Skip to content

Instantly share code, notes, and snippets.

View wswebcreation's full-sized avatar
🤣
SaaS (Selles as a Service)

Wim Selles wswebcreation

🤣
SaaS (Selles as a Service)
View GitHub Profile
/**
* This is an example class for how the handle alerts with WebdriverIO.
* You can use it in the following way (this is with Jasmine, but other frameworks can also be used)
*
* @example
* import Screen from '../Screen';
* import NativeAlert from '../NativeAlert';
*
* describe('Check buttons', () => {
* it('should be able to open the alert and close it with all 3 buttons', () => {
@wswebcreation
wswebcreation / wdio.conf.js
Created July 26, 2018 12:21
Simple setup to provide feature files through the command line, 1, multiple or all. Use this with webdriver.io
/**
* This is an example conf with webdriver.io + cucumberjs to run 1 or multiple feature through the command line.
* I use `yargs` to get command line arguments, but there is maybe a better / easier way.
*
* Feel free to use it for all kinds of purposes, a star is much appreciated ;-)
*
* Grtz,
* Wim | wswebreation
*/
@wswebcreation
wswebcreation / getNativeText.js
Created July 18, 2018 07:36
Get text from native iOS/Android elements with webdriver.io and Appium
/**
* This a method to get text from a native iOS/Android app component.
* It can be used when you are using webdriver.io
*
* In the app I need to automate I found out that:
* - iOS will have the complete text (of all the childeren) in the parent component.
* - on Android a component can have mutiple childrens, that's why you get an array of text back
*
* Feel free to use it for all kinds of purposes, a star is much appreciated ;-)
*
@wswebcreation
wswebcreation / 1.issue.md
Created July 12, 2018 05:16
`An unknown server-side error occurred while processing the command` while sending text to an iOS simulator

Issue:

Typing text into an input text element on an iOS simulator with webdriver.io and Appium is causing an error like this

An unknown server-side error occurred while processing the command. Original error: An unknown server-side error occurred while processing the command.

The result is a failing test.

The command

The command is very simple, just this $('~test-Stel hier je vraag.').setValue('Ben je er?')

@wswebcreation
wswebcreation / start.android.emulator.js
Last active March 7, 2024 13:41
Start your Android emulator from the command line with a simple questions form
/**
* With this helper you can start emulators from the command line with some easy questions.
* It will automatically list all AVD's that you've configuered on your machine.
*
* NOTE 1: MAKE SURE YOU'VE ADDED inquirer WITH `npm install inquirer --D` TO YOUR DEV DEPENDENCIES
* NOTE 2: MAKE SURE YOU'VE SETUP UP YOUR ENVIRONMENT CORRECTLY WITH ALL THE ENVIRONMENT VARIABLES NEEDED
* FOR MAKING ANDROID WORK ON YOUR MACHINE
* NOTE 3: MAKE USE YOU HAVE SET YOUR `HOME`, THAT SHOULD BE SOMETHING LIKE `/Users/wswebcreation`
* NOTE 4: MAKE SURE YOU'VE SET THE `ANDROID_EMULATOR_PATH` TO THE CORRECT PATH ON YOUR MACHINE
* WHERE ALL THE EMULATORS ARE LISTED, WITHOUT THE `HOME` PATH IN IT
@wswebcreation
wswebcreation / webdriverio.appium.native.swipe.js
Last active February 15, 2023 12:00
This gist holds some methods I use to do swiping on iOS and Android
/**
* Here you'll find some swipe methods for a native iOS or Android app
* which can be used when you are using webdriver.io
*
* I work a lot based on percentages, so it is working on all screens and all devices
* and I hope you understand how to use it based on the docs.
*
* Feel free to use it for all kinds of purposes, a star is much appreciated ;-)
*
* Grtz,
@wswebcreation
wswebcreation / table.hashes.js
Last active July 4, 2023 06:54
The difference in `table.hashes()` and `table.rowsHash()` in CucumberJS
import { Given } from 'cucumber';
/**
* Transform a cucumberjs data table to an Array
*
* @example
* <pre>
* // insert from featurefile
* Given a table hashes step
* | Vegetable | Rating |
@wswebcreation
wswebcreation / find.element.js
Last active June 3, 2018 15:03
Find an element that can't be find in the UI-tree with Appium + webdriver.io by using an other component
let SEND_BUTTON_COORDINATES;
const SELECTORS = {
INPUT: '~test-Message input',
ADD_BUTTON: '~test-Add',
SEND_BUTTON: '~test-Send',
};
export class ChatInput {
/**
* Get the chat input
@wswebcreation
wswebcreation / after.scenario.js
Created May 18, 2018 12:09
Setup for attaching the difference to the Cucumber report file. This can be used with Protractor + CucumberJS + protractor-image-comparison
import { After, Status } from 'cucumber';
import { resolve } from 'path';
const fs = require('fs');
const diffFolder = resolve(process.cwd(), '.tmp/report/screenshots/image-comparison/diff/');
const screenshotFolder = resolve(process.cwd(), '.tmp/screenshots/');
/**
* The After hook that checks the scenario status and creates a
* screemshot if needed
@wswebcreation
wswebcreation / onliners.response.json
Last active December 9, 2017 18:50
This JSON is part of the demo app of wswebcreation and is used in the Chat view. These oneliners are used as responses in the chat
[
"May the force be with you.",
"Bond. James bond.",
"I’ll be back",
"Houston, we have a problem.",
"You talking to me?",
"Here’s Johnny!",
"Go ahead, make my day.",
"Say hello to my little friend!",
"Yippee-ki-yay, Motherf*cker!",