Skip to content

Instantly share code, notes, and snippets.

View samuelr-daysmart's full-sized avatar
🏎️

samuel r samuelr-daysmart

🏎️
  • DaySmart
  • Hyderabad
  • 08:37 (UTC +05:30)
View GitHub Profile
@mgrybyk
mgrybyk / compiled_proxy.js
Last active February 4, 2022 01:15
WebdriverIO - new async api
// proxy.ts after compilation
async function p$(selector) {
return pElementFactory.call(this, selector)
}
async function shadow$(selector) {
return pElementFactory.call(this, selector)
}
async function p$$(selector) {
return [pElementFactory.call(this, selector, 0), pElementFactory.call(this, selector, 1)]
@Xotabu4
Xotabu4 / index.d.ts
Last active February 4, 2022 01:07
Adding waits, scroll, and retries into webdriverio clicks
/** Add custom browser and Element commands here */
export {};
declare global {
namespace WebdriverIO {
// interface Browser {
// browserCustomCommand: (arg: any) => Promise<void>
// }
// interface MultiRemoteBrowser {
// browserCustomCommand: (arg: any) => Promise<void>
@mgrybyk
mgrybyk / datepicker.js
Last active February 4, 2022 01:06
WebdriverIO snippets
const lang = 'en'
describe('element ui date picker', () => {
it('set current date +60 days', () => {
browser.url('https://element.eleme.io/#/en-US/component/date-picker')
const datePickerInput = $('.el-date-editor>input')
expect(datePickerInput).toBeClickable()
const datePicker = new DatePickerElement(datePickerInput)
@Xotabu4
Xotabu4 / config.ts
Last active February 4, 2022 01:05
Describing how add automatic waits, scrolling and retries for wdio click function
import { declareClickCommand } from './customCommands';
export const baseConfig: WebdriverIO.Config = {
bail: 0,
automationProtocol: 'webdriver',
hostname: 'localhost',
protocol: 'http',
port: 4444,
path: '/wd/hub',
baseUrl: '',
@kembek
kembek / wdio.conf.ts
Last active February 4, 2022 01:04
E2E test configurations
// tslint:disable
/// <reference path="./node_modules/@wdio/sync/webdriverio.d.ts" />
/// <reference path="./node_modules/@wdio/sync/webdriverio-core.d.ts" />
const merge = require('lodash/merge');
const { TimelineService } = require('wdio-timeline-reporter/timeline-service');
interface JasmineNodeOpts {
defaultTimeoutInterval?: number;
requires?: string[];
expectationResultHandler?: (passed: any, assertion: any) => void;
@chrisflatley
chrisflatley / AppiumWebdriverService.ts
Created October 17, 2019 12:53
Example of using appium, webdriverio with Typescript
import { Injectable } from '@nestjs/common';
import { remote, BrowserObject } from 'webdriverio';
import { blockStatement, numberTypeAnnotation } from '@babel/types';
import { notDeepStrictEqual } from 'assert';
import { SplitChunksPlugin } from 'webpack';
function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@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,
@ItamarGronich
ItamarGronich / custom-commands.js
Last active February 4, 2022 01:20
Webdriver test localhost with browserstack
module.exports = (browser, capabilities, specs) => {
if (!browser && browser !== null && typeof browser === 'object') {
throw new TypeError("browserElement must be the WebdriverIo browser object.")
}
const
onDesktop = capabilities.browserName !== 'iPad',
onMobile = !onDesktop;
exports.config = {
// =====================
// Server Configurations
// =====================
// Host address of the running Selenium server. This information is usually obsolete as
// WebdriverIO automatically connects to localhost. Also if you are using one of the
// supported cloud services like Sauce Labs, Browserstack or Testing Bot you also don't
// need to define host and port information because WebdriverIO can figure that our
// according to your user and key information. However if you are using a private Selenium
// backend you should define the host address, port, and path here.