Page tree
Skip to end of metadata
Go to start of metadata

Note:

As the latest version of webdriver.io client is W3C compliant, we recommend using Appium-OSS mode of execution in order to run these tests.

Native App Test

Open myTest.js file and write:

iOS test example
describe('Eribank test', () => {
    it('Login test', async () => {
         const username = await $('//*[@name="usernameTextField"]');  //find element
         const password = await $('//*[@name="passwordTextField"]');
         const loginButton = await $('//*[@name="loginButton"]');
         await username.setValue('company');  //send key
         await password.setValue('company');
         await loginButton.click();  //click
    })
})
Android test example
describe('Eribank test', () => {
    it('Login test', async () => {
         const username = await $('//*[@text="Username"]');  //find element
         const password = await $('//*[@text="Password"]');
         const loginButton = await $('//*[@text="Login"]');
         await username.setValue('company');  //send key
         await password.setValue('company');
         await loginButton.click();  //click
    })
})

For more advanced capabilities Continuous Testing offers, check here.

wdio.config.js example
exports.config = {
    runner: 'local',
    hostname: '<cloud-ip>',
    protocol: 'https',
    port: 443,
    path: '/wd/hub',

    specs: [
        './*.js'
    ],
	capabilities: [{
	    'experitest:accessKey':	'<AccessKey>', 				// Or userName, password and projectName if needed
	     platformName: '<platform>', 						// 'ios' for iOS tests, 'android' for Android tests             
		'appium:udid': '<Device-Udid>',          			// Optional
		'appium:app': 'cloud:com.experitest.ExperiBank',
        'appium:bundleId': 'com.experitest.ExperiBank', 	// for iOS
		'appium:appPackage': 'com.experitest.ExperiBank', 	// for Android
		'appium:appiumVersion': '1.22.2',
	    'experitest:testName': 'Appium WebdriverIO native test',  //Optional
	}],
    mochaOpts: {
        ui: 'bdd',
        timeout: 180000
    },
}

Web test

Open myTest.js file and write:

Web test example
const assert = require('assert')
describe('webdriver.io page', () => {
    it('should have the right title', async () => {
        await browser.url('https://digital.ai/continuous-testing')
        const title = await browser.getTitle()
        assert.strictEqual(title, 'Digital.ai Continuous Testing | Scalable App & Device Testing Tool')
    })
})

For more advanced capabilities Continuous Testing offers, check here.

wdio.config.js example
exports.config = {
    runner: 'local',
    hostname: '<cloud-ip>',
    protocol: 'https',
    port: 443,
    path: '/wd/hub',

    specs: [
        './*.js'
    ],
	capabilities: [{
		'experitest:accessKey':	'<AccessKey>', 					// Or userName, password and projectName if needed
		platformName: '<platform>', 							// 'ios' for iOS tests, 'android' for Android tests
		'appium:udid': '<Device-Udid>',            				// Optional
		browserName: 'Chrome',	
		'appium:appiumVersion': '1.22.2',
		'experitest:testName': 'Appium WebdriverIO webtest',  	// Optional
	}],

    mochaOpts: {
        ui: 'bdd',
        timeout: 180000
    },
}

Webdriverio Run


 Window run

To run your tests, execute:

bash
npx wdio run .\wdio.conf.js
 Mac run

To run your tests, execute:

bash
npx wdio run ./wdio.conf.js



  • No labels