Skip to content

Instantly share code, notes, and snippets.

View maggiesavovska's full-sized avatar

Maggie Jones Savovska maggiesavovska

View GitHub Profile
@maggiesavovska
maggiesavovska / screenshot.es6
Created October 4, 2017 16:32
screenshot and image diff
/**
* @description
* Takes a screenshot of page.
* Stores screenshot url to be embedded in reporter
* Runs image diff
* @param {Object} options
* @param {Object} options.test - test object
* @param {String} [options.filename = 'screenshot'] - keyword for screenshot filename
* @param {String} options.filepath - path to folder where screenshots are stored
* @param {Bool} options.element - provide element selector if only element should be captured
@maggiesavovska
maggiesavovska / wdio-jquery-browser-patch-keys.js
Created June 22, 2017 17:21
Webdriverio compatible in browser patch for keys
// courtesy of Thamu Gurung @thamu_gurung_twitter
browser.execute(() => {
return $(elementSelector).trigger({ type: 'mousedown', which: 39 });
});
/* The Key codes
rightArrow - 39
leftArrow - 37
down - 40
enter - 13
@maggiesavovska
maggiesavovska / wdioscreenshot-outputchrome58macos.txt
Created June 9, 2017 20:22
Output from test on mac os 10.12 Chrome 58 on sauce labs using wdio-screenshot saveDocumentScreenshot
0|undefine | [15:20:09] COMMAND POST "/wd/hub/session/91f1f1ab6cef413dbd27d3874dc1954d/execute"
0|undefine | [15:20:09] DATA {"script":"return (function scrollbars(enabled) {\n if (enabled) {\n document.documentElement.style.overflow = '';\n } else {\n document.documentElement.style.overflow = 'hidden';\n }\n}).apply(null, arguments)","args":[false]}
0|undefine | [15:20:09] RESULT null
0|undefine | [15:20:09] COMMAND POST "/wd/hub/session/91f1f1ab6cef413dbd27d3874dc1954d/execute"
0|undefine | [15:20:09] DATA {"script":"return (function triggerResize() {\n var evt = window.document.createEvent('UIEvents');\n evt.initUIEvent('resize', true, false, window, 0);\n window.dispatchEvent(evt);\n}).apply(null, arguments)","args":[]}
0|undefine | [15:20:09] COMMAND POST "/wd/hub/session/91f1f1ab6cef413dbd27d3874dc1954d/execute"
0|undefine | [15:20:09] DATA {"script":"return (function scrollbars(enabled) {\n if (enabled) {\n document.documentElement.style.overflow = '';\n } else {\n
@maggiesavovska
maggiesavovska / runMocha.js
Created June 8, 2017 19:40
run mocha programatically
"use strict"
var argv = require('minimist')(process.argv.slice(2));
var utils = require('../lib/modules/utils/utility.es6');
var jsonReporter = require('../reportGenerator/reporter/reporter.js');
require('source-map-support').install();
var Mocha = require('mocha');
var path = require('path');
@maggiesavovska
maggiesavovska / gist:b16da0b662af5ac599261e82ebd35e09
Last active June 8, 2017 19:28
webdriverio - integrating with crossbrowsertesting.com
1) Include the following in your webdriverio config
NOTE: max_duration is specific to crossbrowsertesting.com.
cbt will time out any test after 10 minutes unless you pass a "max_duration"
value in your capabilities.
desiredCapabilities: {max_duration:[[amount in seconds]]}
const cbtConfig = {
host: "hub.crossbrowsertesting.com",
port: 80,
user: [[INSERT YOUR USER NAME HERE]],
@maggiesavovska
maggiesavovska / appiummac.md
Created May 31, 2017 20:29
Setting Up Appium on Mac
  1. Set up for Appium:
@maggiesavovska
maggiesavovska / actionsApi.txt
Last active March 26, 2018 18:42
Summary of sendKeys() and moveTo() Issues
Bunch of stuff broken? Don't fear..the Actions API is on it's way and it will probably be a good thing! Chin up!
OVERVIEW:
The purpose of this document is to explain the new actions API and what it has to do with certain commands
such as moveto and keys being depricated in webdriverio (due to them being deprecated in certain browser drivers).
MAIN ISSUE:
1. The issue is that these new drivers suppress these commands on purpose because they are deprecated,
but the drivers have not yet implemented the new WC3 standard called "actions API".
"The user-facing API for emulating complex user gestures. Use this class rather than using the Keyboard or Mouse directly."
@maggiesavovska
maggiesavovska / child.js
Created March 7, 2017 19:15
pm2 launchBus() child process sending message after exit
process.send({
type : 'process:msg',
data : {id:process.pid}
});
process.disconnect();
process.exit();
@maggiesavovska
maggiesavovska / recursivefs.js
Last active January 14, 2017 16:25
node.js recursive function to read all files in directory (searches through all directories to find files)
//******************************************************/
//Include all files going one directory deep
//* @param {String} d - directory name of directory where search is occurring
//* @param {Array || String} exclude - array of file names {STRING} to skip
//******************************************************/
function fileSearch(d, exclude){
var exclude = exclude || [];
@maggiesavovska
maggiesavovska / Dockerfile
Last active October 10, 2016 19:51
getting started with docker
FROM node:argon
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install