11import { remote } from 'webdriverio' ;
2- import { pluginE2EHarness } from '@appium/plugin-test-support' ;
3- import path from 'path' ;
2+ import { resolve } from 'path' ;
43var chai = require ( 'chai' ) ,
54 chaiAsPromised = require ( 'chai-as-promised' ) ;
65
@@ -9,18 +8,12 @@ chai.use(chaiAsPromised);
98should = chai . should ( ) ;
109let expect = chai . expect ;
1110
12- const APPIUM_HOST = 'localhost' ;
13- const FAKE_ARGS = { timeout : 10000 , intervalBetweenAttempts : 1000 } ;
14- const FAKE_PLUGIN_ARGS = { 'element-wait' : FAKE_ARGS } ;
11+ const APPIUM_HOST = '127.0.0.1' ;
12+ const DEFAULT_TIMEOUT_VALUE = { timeout : 10000 , intervalBetweenAttempts : 500 } ;
1513
16- const THIS_PLUGIN_DIR = path . join ( __dirname , '..' , '..' ) ;
17- const APPIUM_HOME = path . join ( THIS_PLUGIN_DIR , 'local_appium_home' ) ;
18- const FAKE_DRIVER_DIR =
19- process . env . PLATFORM === 'android' ? 'appium-uiautomator2-driver' : 'appium-xcuitest-driver' ;
20- const TEST_HOST = 'localhost' ;
21- const TEST_PORT = 4723 ;
14+ const androidApp = resolve ( './build/VodQA.apk' ) ;
15+ const iosApp = resolve ( './build/vodqa.zip' ) ;
2216
23- let server ;
2417const WDIO_PARAMS = {
2518 connectionRetryCount : 220000 ,
2619 hostname : APPIUM_HOST ,
@@ -31,37 +24,22 @@ const androidCaps = {
3124 platformName : 'Android' ,
3225 'appium:uiautomator2ServerInstallTimeout' : '120000' ,
3326 'appium:automationName' : 'UIAutomator2' ,
34- 'appium:app' :
35- 'https://github.com/AppiumTestDistribution/appium-demo/blob/main/VodQA.apk?raw=true' ,
27+ 'appium:app' : androidApp ,
3628} ;
3729
3830const iOSCaps = {
3931 platformName : 'iOS' ,
4032 'appium:automationName' : 'XCUITest' ,
41- 'appium:deviceName' : 'iPhone 14 Pro ' ,
33+ 'appium:deviceName' : 'iPhone 12 ' ,
4234 'appium:platformVersion' : '16.2' ,
43- 'appium:app' :
44- 'https://github.com/AppiumTestDistribution/appium-demo/blob/main/vodqa.zip?raw=true' ,
35+ 'appium:app' : iosApp ,
36+ 'appium:usePrebuiltWDA' : true ,
37+ 'appium:wdaLaunchTimeout' : 120000
4538} ;
4639
4740describe ( 'Set Timeout' , ( ) => {
4841 describe ( 'with CLI args' , ( ) => {
4942 let driver ;
50- pluginE2EHarness ( {
51- before,
52- after,
53- server,
54- serverArgs : { basePath : '/wd/hub' , plugin : FAKE_PLUGIN_ARGS } ,
55- port : TEST_PORT ,
56- host : TEST_HOST ,
57- appiumHome : APPIUM_HOME ,
58- driverName : process . env . PLATFORM === 'android' ? 'uiautomator2' : 'xcuitest' ,
59- driverSource : 'npm' ,
60- driverSpec : FAKE_DRIVER_DIR ,
61- pluginName : 'element-wait' ,
62- pluginSource : 'local' ,
63- pluginSpec : '.' ,
64- } ) ;
6543 beforeEach ( async ( ) => {
6644 driver = await remote ( {
6745 ...WDIO_PARAMS ,
@@ -70,7 +48,9 @@ describe('Set Timeout', () => {
7048 } ) ;
7149 it ( 'Should be able to set and get waitPlugin timeout' , async ( ) => {
7250 await driver . $ ( '~login' ) . click ( ) ;
73- expect ( await driver . executeScript ( 'plugin: getWaitTimeout' , [ ] ) ) . to . deep . include ( FAKE_ARGS ) ;
51+ expect ( await driver . executeScript ( 'plugin: getWaitTimeout' , [ ] ) ) . to . deep . include (
52+ DEFAULT_TIMEOUT_VALUE
53+ ) ;
7454 await driver . executeScript ( 'plugin: setWaitTimeout' , [
7555 {
7656 timeout : 1111 ,
@@ -85,7 +65,6 @@ describe('Set Timeout', () => {
8565
8666 afterEach ( async ( ) => {
8767 await driver . deleteSession ( ) ;
88- if ( server ) await server . close ( ) ;
8968 } ) ;
9069 } ) ;
9170} ) ;
0 commit comments