Skip to content

Instantly share code, notes, and snippets.

@TuHuynhVan
TuHuynhVan / Readme.md
Created May 18, 2017 17:20 — forked from christian-bromann/Readme.md
Run Chrome headless

Run Chrome headless

The good old PhantomJS times are over. The project is not maintained anymore and it is recommended to switch over to Chrome headless. Just run a local Selenium standalone server:

$ java -jar Sites/selenium-server-standalone-3.4.0.jar
@TuHuynhVan
TuHuynhVan / appiummac.md
Created June 2, 2017 11:16 — forked from maggiesavovska/appiummac.md
Setting Up Appium on Mac
  1. Set up for Appium:
@TuHuynhVan
TuHuynhVan / wdio-jquery-browser-patch-keys.js
Created June 22, 2017 17:27 — forked from maggiesavovska/wdio-jquery-browser-patch-keys.js
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
@TuHuynhVan
TuHuynhVan / mocha-guide-to-testing.js
Created July 27, 2017 04:02 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@TuHuynhVan
TuHuynhVan / actionsApi.txt
Created August 11, 2017 11:58 — forked from maggiesavovska/actionsApi.txt
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."
/**
* Created by Tu Huynh on 8/17/2017.
*/
let resemble = require('node-resemble-js')
, fs = require('fs')
, jimp = require("jimp")
, shell = require('shelljs');
class ImageProcessing {
let cpr = require('../../utils/ImageProcessing');
class MobileVisualTest {
static visualTest(deviceUdid, deviceName, screenName) {
let folders = {
diffFolderPath: 'screenshots/diff/',
referenceFolderPath: 'screenshots/reference/',
screenFolderPath: 'screenshots/screen/'
}
let CheckingCommentFlow = require("../../test_flows/mobile/CheckingComment")
...
it("Test name", () => {
let deviceUdid = browser.desiredCapabilities.udid
, deviceName = browser.desiredCapabilities.deviceName
, testingScreenName = "CommentTab"
, checkingCommentFlow = new CheckingCommentFlow(dataObject);
@TuHuynhVan
TuHuynhVan / e2e-shadowdom.md
Created August 24, 2017 08:14 — forked from ChadKillingsworth/e2e-shadowdom.md
Selenium Testing with Shadow DOM

End-to-end Testing with Shadow DOM

As the web component specs continue to be developed, there has been little information on how to test them. In particular the /deep/ combinator has been deprecated in Shadow DOM 1.0. This is particularly painful since most end-to-end testing frameworks rely on elements being discoverable by XPath or calls to querySelector. Elements in Shadow DOM are selectable by neither.

WebDriver.io

Webdriver.io has the standard actions by selectors, but also allows browser executable scripts to return an element

@TuHuynhVan
TuHuynhVan / better-nodejs-require-paths.md
Created October 10, 2017 12:42 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions