webdriverio / appium-boilerplate

Boilerplate project to run WebdriverIO tests with Appium to test native applications on iOS and Android
MIT License
451 stars 260 forks source link

No connected devices found #109

Closed EINBOX closed 3 years ago

EINBOX commented 3 years ago

Hello, I am trying to automate android browser applications through emulator, I ha configured capabilities, appium server started but it is throwing error like.. No connected devices found Can you throw some light here to fix this issues?

wswebcreation commented 3 years ago

Hi @EINBOX

Sorry for the late response, I was on vacation. Can you share your config and a screenshot of how you configured your Emulator in Android Studio?

RollerIn commented 3 years ago

Thank you, which I have fixed the issue. Need some help , am planning to automate react native web on mobile browser , is this WebdriverIO is good to proceed? is there any solution to keep wdio to wait till react web app loads completely?

in my case, I was able to launch application on browser but before performing any action or before capturing browesr title itself , application getting closed

please assist me to fix this issue.

wswebcreation commented 3 years ago

Hi @RollerIn

Thanks for the update. This sounds like an asynchronous issue. Can you provide an example of your packages and testcode?

RollerIn commented 3 years ago

Package.json

{
  "name": "wriotest",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "npx wdio run wdio.only.back.conf.js",
    "androidBrowser": "wdio ./config/androidBrowser.config.js --timeout 50000",
    "androidBrowserlocal": "wdio ./config/browser.local.config.js --timeout 50000",
    "dummyloacl": "wdio ./config/dummylocal.js --timeout 50000",
    "report": "allure generate --clean && allure open",
    "report:generate": "allure generate",
    "report:open": "allure open"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "@wdio/runner": "^7.9.1",
    "allure-commandline": "^2.13.8",
    "react-device-detect": "^1.17.0",
    "wd": "^1.14.0",
    "wdio-video-reporter": "^3.1.2",
    "webdriverio": "^7.9.1"
  },
  "devDependencies": {
    "@babel/cli": "^7.14.8",
    "@babel/core": "^7.15.0",
    "@babel/preset-env": "^7.15.0",
    "@babel/register": "^7.14.5",
    "@wdio/allure-reporter": "^7.9.1",
    "@wdio/appium-service": "^7.8.0",
    "@wdio/cli": "^7.9.1",
    "@wdio/dot-reporter": "^7.9.0",
    "@wdio/local-runner": "^7.9.1",
    "@wdio/mocha-framework": "^7.9.1",
    "@wdio/spec-reporter": "^7.9.0",
    "appium": "^1.21.0",
    "chai": "^4.3.4",
    "chromedriver": "^92.0.1",
    "wdio-chromedriver-service": "^7.2.0"
  }
}

fontsize.js

describe('My Login application', async () =>{
    beforeEach(async () => {
        await browser.url('./');
        await browser.setTimeout({ 'script': 20000 })
        const title1=$('.-chapter-title')
        await browser.waitUntil(function() {
            return title1.waitForExist();
        },50000, 'title is no html')
        console.log('html value:'+title1.getHTML())
        const form = await $('iframe').waitForExist()
const loader=$('.loader-container.hide')
        await browser.waitUntil(function() {
            return  loader.getHTML();
        },500, 'loader is no html').then(() => done())
        console.log('loader value:'+loader.getHTML())
 }
    });
describe('React app loader', function() {
        it('Moving pages', function() {
            browser.keys("ArrowLeft" )
            browser.keys("Enter" )
            browser.keys("Enter" )
            browser.debug
            const selector = '.us-container"';
            //browser.waitForExist();
            console.log('container:'+selector.toString())
            browser.pause(9999999);
        });
    });
wswebcreation commented 3 years ago

@RollerIn

I've edited your code a bit

describe('My Login application', async () =>{
    beforeEach(async () => {
        await browser.url('./');
        await browser.setTimeout({ 'script': 20000 })
        // Selecting an element is also async
        const title1=await $('.-chapter-title')
        // Why not use the waitforexists are mentioned in the docs, see https://webdriver.io/docs/api/element/waitForExist/
        // This might be one of the reasons the script already fails
        await  title1.waitForExist({ timeout: 5000 });
        // getHTML is also a promise, so you need to await it
        console.log('html value:'+await title1.getHTML())
        const form = await $('iframe').waitForExist()
        // Selecting an element is also async
        const loader=await $('.loader-container.hide')
       // What are you doing here?
        await browser.waitUntil(function() {
            return  loader.getHTML();
        },500, 'loader is no html').then(() => done())
        // getHTML is also a promise, so you need to await it
        console.log('loader value:'+await loader.getHTML())
      });

    // I've removed the second describe, because it will not use the before each which you created above
        it('Moving pages', async  function() {
            // Keys are promises, so you should await them all
            await browser.keys("ArrowLeft" )
            await browser.keys("Enter" )
            await rowser.keys("Enter" )
            // What are you doing here?
            browser.debug
            const selector = '.us-container"';
            //browser.waitForExist();
            console.log('container:'+selector.toString())
            // This is also a promise
            await browser.pause(9999999);
        });
    });
RollerIn commented 3 years ago

Thank you for the quick reply, let me try this way

RollerIn commented 3 years ago

same issue ,even after the updates…app is launching but closing it 1) My Login application "before each" hook for My Login application [emulator-5554 Android 10 #0-0] Timeout of 10000ms exceeded. The execution in the test "My Login application "before each" hook for "Moving pages"" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts).

Actually I tried by increasing time out on config level , package level and on spec level…but did not work

wswebcreation commented 3 years ago

Can you provide a sample repo with your complete setup so I can test it?

RollerIn commented 3 years ago

Sure, but uploading repo to GITHUB is not allowed here…am not sure how I can share it here only my code , package, config details I can share as content here

RollerIn commented 3 years ago

WDIO.config

/**
 * WebdriverIO config file to run tests on native mobile apps.
 * Config file helps us configure all the settings and setup environments
 * to run our tests.
 */

const host = '127.0.0.1';   // default appium host
const port = 4730;          // default appium port
path: '/wd/hub',
``
const waitforTimeout = 30 * 60000;
const commandTimeout = 30 * 60000;
//var mochaTimeout = process.env.DEBUG ? 99999999 : 60000;
/**
 * WebdriverIO config file to run tests on native mobile apps.
 * Config file helps us configure all the settings and setup environments
 * to run our tests.
 */

exports.config = {
    // WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
    // on a remote machine).
    runner: 'local',
    sync: true,
    debug: false,

    specs: [
        './test/specs/fontsize.js'
    ],

    // Patterns to exclude.
    exclude: [
        // 'path/to/excluded/files'
    ],
    // ============
    // Capabilities
    // ============
    // will define on mobile level

    // ===================
    // Test Configurations
    // ===================
    // Define all options that are relevant for the WebdriverIO instance here
    //
    // Level of logging verbosity: trace | debug | info | warn | error | silent
    logLevel: 'silent',

    reporters: ['allure','spec'],
    reporterOptions: {
        allure: {
            outputDir: 'allure-results'
        }
    },

    host: host,
    port: port,

    maxInstances: 1,
    // Default request retries count
    connectionRetryCount: 3,

    baseUrl: 'https://web-azurewebsites.net/',

    services: ['appium'],
    appium: {
        waitStartTime: 6000,
        waitforTimeout: waitforTimeout,
        command: 'appium',
        logFileName: 'appium.log',
        args: {
            relaxedSecurity: true,
            address: host,
            port: port,
            commandTimeout: commandTimeout,
            sessionOverride: true,
            debugLogSpacing: true
        }
    },

    /**
     * test configurations
     */
    logLevel: 'silent',
    coloredLogs: true,
    framework: 'mocha',          // cucumber framework specified
    //bail: 0,
    // Saves a screenshot to a given path if a command fails.
    screenshotPath: './errorShots/',
    /**
     * hooks
     */
    onPrepare: function () {
        console.log('<<< BROWSER TESTS STARTED >>>');
    },

   before: function (capabilities, specs) {
        browser.url(this.baseUrl);
        console.log('<<< BROWSER TESTS STARTED >>>'+this.baseUrl);
    },

    afterStep: function (test, scenario, { error, result, duration, passed, retries }) {
        if (error) {
            browser.saveScreenshot('./reports/screenshots/Fail_'+
            moment().format('DD-MMM-YYYY-HH-MM-SS') + '.png')
           // browser.takeScreenshot();
        }
    },

    afterScenario: function (scenario) {
        browser.screenshot();
    },

    onComplete: function() {
        const reportError = new Error('Could not generate Allure report')
        const generation = allure(['generate', 'allure-results', '--clean'])
        return new Promise((resolve, reject) => {
            const generationTimeout = setTimeout(
                () => reject(reportError),
                5000)

            generation.on('exit', function(exitCode) {
                clearTimeout(generationTimeout)

                if (exitCode !== 0) {
                    return reject(reportError)
                }

                console.log('Allure report successfully generated')
                resolve()
            })
        })
    },
    //onComplete: function () {

        //console.log('<<< TESTING FINISHED >>>');
   // }

};
=======================
android.info
class AndroidInfo {
    static deviceName() {
        return 'Pixel_3a'; // pass the udid or devicename
    }

    static platFormVersion() {
        return '10'; // pass the platform version
    }

    static appName() {
        return ''; // pass the apk name
    }
}

module.exports = AndroidInfo;
===================
androidBrowser.config
/**
 * WebdriverIO config file to run tests on native mobile apps.
 * Config file helps us configure all the settings and setup environments
 * to run our tests.
 */
const {config} = require('./wdio.conf');
const AndroidInfo = require("./android.info");

const waitforTimeout = 30 * 60000;
const commandTimeout = 30 * 60000;
/**
 * WebdriverIO config file to run tests on native mobile apps.
 * Config file helps us configure all the settings and setup environments
 * to run our tests.
 */

config.capabilities = [
    {
        platformName: 'Android',
        browserName: 'chrome',
        maxInstances: 1,
        automationName: 'uiautomator2',
        deviceName: AndroidInfo.deviceName(),
        platformVersion: AndroidInfo.platFormVersion(),
        deviceOrientation:'portriat',
        avd: AndroidInfo.deviceName(),
        //waitforTimeout: waitforTimeout,
        commandTimeout: commandTimeout,
        newCommandTimeout: 30 * 60000
    }
];
exports.config = config;

======================

package.json
{
  "name": "wriotest",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "npx wdio run wdio.only.back.conf.js",
    "androidBrowser": "wdio ./config/androidBrowser.config.js --timeout 50000",
    "androidBrowserlocal": " wdio ./config/browser.local.config.js --timeout 50000",
    "dummyloacl": "wdio ./config/dummylocal.js --timeout 50000",
    "report": "allure generate --clean && allure open",
    "report:generate": "allure generate",
    "report:open": "allure open"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": "",
  "dependencies": {
    "@wdio/runner": "^7.9.1",
    "allure-commandline": "^2.13.8",
    "react-device-detect": "^1.17.0",
    "wd": "^1.14.0",
    "wdio-video-reporter": "^3.1.2",
    "webdriverio": "^7.9.1"
  },
  "devDependencies": {
    "@babel/cli": "^7.14.8",
    "@babel/core": "^7.15.0",
    "@babel/preset-env": "^7.15.0",
    "@babel/register": "^7.14.5",
    "@wdio/allure-reporter": "^7.9.1",
    "@wdio/appium-service": "^7.8.0",
    "@wdio/cli": "^7.9.1",
    "@wdio/dot-reporter": "^7.9.0",
    "@wdio/local-runner": "^7.9.1",
    "@wdio/mocha-framework": "^7.9.1",
    "@wdio/spec-reporter": "^7.9.0",
    "appium": "^1.21.0",
    "chai": "^4.3.4",
    "chromedriver": "^92.0.1",
    "wdio-chromedriver-service": "^7.2.0"
  }
}
fontsize.js test
describe('My Login application', async () =>{
    beforeEach(async () => {
        await browser.url('./');

        await browser.setTimeout({ 'script': 50000 })
        const title1=await $('.r-chapter-title')
        await  title1.waitForExist({ timeout: 9000 });
        console.log('html value:'+await title1.getHTML())
        const form = await $('iframe').waitForExist()

        console.log('html value:'+await title1.getHTML())

        console.log('iframe:'+form)
        await browser.setTimeout({ 'script': 20000 })

        //await browser.setTimeout({ 'pageLoad': 25000 })
        console.log('am hereby logged in:')
        console.log('ArrowLeft value:')
        browser.keys("Arrow Left" )
        console.log('enter value:')
        browser.keys("Enter" )

    });

        it('Moving pages', function() {
            browser.keys("ArrowLeft" )
            browser.keys("Enter" )
            browser.keys("Enter" )
            browser.debug
            const selector = '.r-container"';
            //browser.waitForExist();
            console.log('container:'+selector.toString())
            browser.pause(9999999);
        });
});

Note: I have change web URL, because of sensitive info

RollerIn commented 3 years ago

One more observation, in case increasing waiting time , the app be be blank image

wswebcreation commented 3 years ago

@RollerIn

Can you make a sample project in GitHub, I'm seeing a few things that are not correct in this setup but I'd like to see the complete picture

EINBOX commented 3 years ago

I have created sample projects , please check it here … https://github.com/EINBOX/WDIOTest

wswebcreation commented 3 years ago

Hi @EINBOX

I think you made it a private repo, I can't access it

EINBOX commented 3 years ago

HI wswebcreation , You can access now, sorry I have not checked the access info

wswebcreation commented 3 years ago

I've created a PR so you can see the diffs. There were a few issues in your script. Please check them to see if you understand them. It should work now.

This is the logs I have now

yarn androidBrowser
yarn run v1.22.10
warning ../../../../../package.json: No license field
$ wdio ./config/androidBrowser.config.js --timeout 50000

Execution of 1 workers started at 2021-08-17T08:48:04.055Z

2021-08-17T08:48:04.057Z DEBUG @wdio/utils:initialiseServices: initialise service "appium" as NPM package
2021-08-17T08:48:04.068Z INFO @wdio/cli:launcher: Run onPrepare hook
<<< BROWSER TESTS STARTED >>>
2021-08-17T08:48:04.069Z DEBUG @wdio/appium-service: Will spawn Appium process: appium --base-path / --relaxed-security --address 127.0.0.1 --port 4730 --command-timeout 1800000 --session-override --debug-log-spacing
2021-08-17T08:48:04.647Z DEBUG @wdio/appium-service: Appium started with ID: 38048
2021-08-17T08:48:04.647Z DEBUG @wdio/cli:utils: Finished to run "onPrepare" hook in 579ms
2021-08-17T08:48:04.648Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2021-08-17T08:48:04.648Z DEBUG @wdio/cli:utils: Finished to run "onWorkerStart" hook in 0ms
2021-08-17T08:48:04.649Z INFO @wdio/local-runner: Start worker 0-0 with arg: ./config/androidBrowser.config.js,--timeout,50000
[0-0] 2021-08-17T08:48:05.049Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2021-08-17T08:48:05.089Z DEBUG @wdio/config:utils: Found '@babel/register' package, auto-compiling files with Babel
[0-0] 2021-08-17T08:48:05.115Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2021-08-17T08:48:05.118Z DEBUG @wdio/utils:initialiseServices: initialise service "appium" as NPM package
[0-0] RUNNING in chrome - /test/specs/movepages.js
[0-0] 2021-08-17T08:48:05.332Z DEBUG @wdio/local-runner:utils: init remote session
[0-0] 2021-08-17T08:48:05.334Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2021-08-17T08:48:05.376Z INFO webdriver: [POST] http://localhost:4730/session
[0-0] 2021-08-17T08:48:05.376Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       platformName: 'Android',
[0-0]       browserName: 'chrome',
[0-0]       automationName: 'uiautomator2',
[0-0]       deviceName: 'Pixel_3_11.0',
[0-0]       platformVersion: '11',
[0-0]       deviceOrientation: 'portriat',
[0-0]       avd: 'Pixel_3_11.0',
[0-0]       commandTimeout: 1800000,
[0-0]       newCommandTimeout: 1800000
[0-0]     },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     platformName: 'Android',
[0-0]     browserName: 'chrome',
[0-0]     automationName: 'uiautomator2',
[0-0]     deviceName: 'Pixel_3_11.0',
[0-0]     platformVersion: '11',
[0-0]     deviceOrientation: 'portriat',
[0-0]     avd: 'Pixel_3_11.0',
[0-0]     commandTimeout: 1800000,
[0-0]     newCommandTimeout: 1800000
[0-0]   }
[0-0] }
[0-0] 2021-08-17T08:48:12.372Z INFO webdriver: COMMAND navigateTo("https://web.azurewebsites.net/")
[0-0] 2021-08-17T08:48:12.372Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/url
[0-0] 2021-08-17T08:48:12.372Z INFO webdriver: DATA { url: 'https://web.azurewebsites.net/' }
[0-0] 2021-08-17T08:48:13.459Z INFO webdriver: COMMAND setTimeouts(undefined, undefined, 50000)
[0-0] 2021-08-17T08:48:13.460Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/timeouts
[0-0] 2021-08-17T08:48:13.460Z INFO webdriver: DATA { script: 50000 }
[0-0] 2021-08-17T08:48:13.472Z INFO webdriver: COMMAND findElement("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:13.472Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/element
[0-0] 2021-08-17T08:48:13.472Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:13.593Z INFO webdriver: RESULT {
[0-0]   error: 'no such element',
[0-0]   message: 'no such element: Unable to locate element: {"method":"css selector","selector":".r-chapter-title"}\n' +
[0-0]     '  (Session info: chrome=83.0.4103.106)',
[0-0]   stacktrace: '0   chromedriver_mac64_v83.0.4103.39    0x0000000105cfce99 chromedriver_mac64_v83.0.4103.39 + 4808345\n' +
[0-0]     '1   chromedriver_mac64_v83.0.4103.39    0x0000000105c975f3 chromedriver_mac64_v83.0.4103.39 + 4392435\n' +
[0-0]     '2   chromedriver_mac64_v83.0.4103.39    0x000000010592329d chromedriver_mac64_v83.0.4103.39 + 770717\n' +
[0-0]     '3   chromedriver_mac64_v83.0.4103.39    0x000000010588cc51 chromedriver_mac64_v83.0.4103.39 + 154705\n' +
[0-0]     '4   chromedriver_mac64_v83.0.4103.39    0x00000001058b79f7 chromedriver_mac64_v83.0.4103.39 + 330231\n' +
[0-0]     '5   chromedriver_mac64_v83.0.4103.39    0x00000001058a8fdd chromedriver_mac64_v83.0.4103.39 + 270301\n' +
[0-0]     '6   chromedriver_mac64_v83.0.4103.39    0x00000001058b5ad8 chromedriver_mac64_v83.0.4103.39 + 322264\n' +
[0-0]     '7   chromedriver_mac64_v83.0.4103.39    0x00000001058a92a3 chromedriver_mac64_v83.0.4103.39 + 271011\n' +
[0-0]     '8   chromedriver_mac64_v83.0.4103.39    0x00000001058828dd chromedriver_mac64_v83.0.4103.39 + 112861\n' +
[0-0]     '9   chromedriver_mac64_v83.0.4103.39    0x0000000105883875 chromedriver_mac64_v83.0.4103.39 + 116853\n' +
[0-0]     '10  chromedriver_mac64_v83.0.4103.39    0x0000000105cbf47f chromedriver_mac64_v83.0.4103.39 + 4555903\n' +
[0-0]     '11  chromedriver_mac64_v83.0.4103.39    0x0000000105ccc77a chromedriver_mac64_v83.0.4103.39 + 4609914\n' +
[0-0]     '12  chromedriver_mac64_v83.0.4103.39    0x0000000105ccc509 chromedriver_mac64_v83.0.4103.39 + 4609289\n' +
[0-0]     '13  chromedriver_mac64_v83.0.4103.39    0x0000000105ca3319 chromedriver_mac64_v83.0.4103.39 + 4440857\n' +
[0-0]     '14  chromedriver_mac64_v83.0.4103.39    0x0000000105cccd03 chromedriver_mac64_v83.0.4103.39 + 4611331\n' +
[0-0]     '15  chromedriver_mac64_v83.0.4103.39    0x0000000105cb5083 chromedriver_mac64_v83.0.4103.39 + 4513923\n' +
[0-0]     '16  chromedriver_mac64_v83.0.4103.39    0x0000000105ce3454 chromedriver_mac64_v83.0.4103.39 + 4703316\n' +
[0-0]     '17  chromedriver_mac64_v83.0.4103.39    0x0000000105d02f57 chromedriver_mac64_v83.0.4103.39 + 4833111\n' +
[0-0]     '18  libsystem_pthread.dylib             0x00007fff203bf8fc _pthread_start + 224\n' +
[0-0]     '19  libsystem_pthread.dylib             0x00007fff203bb443 thread_start + 15\n'
[0-0] }
[0-0] 2021-08-17T08:48:13.609Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:13.610Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:13.610Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:13.661Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:14.114Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:14.115Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:14.115Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:14.135Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:14.615Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:14.615Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:14.615Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:14.635Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:15.111Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:15.111Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:15.111Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:15.129Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:15.615Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:15.615Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:15.615Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:15.640Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:16.112Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:16.112Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:16.112Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:16.130Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:16.613Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:16.614Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:16.614Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:16.652Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:17.112Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:17.114Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:17.114Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:17.186Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:17.614Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:17.614Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:17.614Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:17.632Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:18.113Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:18.113Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:18.113Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:18.133Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:18.613Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:18.613Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:18.613Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:18.631Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:19.114Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:19.114Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:19.114Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:19.130Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:19.615Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:19.615Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:19.616Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:19.644Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:20.112Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:20.112Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:20.112Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:20.129Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:20.612Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:20.612Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:20.612Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:20.628Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:21.112Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:21.112Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:21.112Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:21.139Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:21.613Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:21.613Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:21.613Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:21.642Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:22.112Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:22.112Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:22.112Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:22.138Z INFO webdriver: RESULT []
[0-0] 2021-08-17T08:48:22.436Z INFO webdriver: COMMAND deleteSession()
[0-0] 2021-08-17T08:48:22.436Z INFO webdriver: [DELETE] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8
[0-0] 2021-08-17T08:48:22.611Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:22.612Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:22.613Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:22.680Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:22.680Z WARN webdriver: Request failed with status 404 due to A session is either terminated or not started
[0-0] 2021-08-17T08:48:22.681Z INFO webdriver: Retrying 1/3
[0-0] 2021-08-17T08:48:22.681Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:22.681Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:22.691Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:22.691Z WARN webdriver: Request failed with status 404 due to A session is either terminated or not started
[0-0] 2021-08-17T08:48:22.691Z INFO webdriver: Retrying 2/3
[0-0] 2021-08-17T08:48:22.692Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:22.692Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:22.699Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:22.699Z WARN webdriver: Request failed with status 404 due to A session is either terminated or not started
[0-0] 2021-08-17T08:48:22.699Z INFO webdriver: Retrying 3/3
[0-0] 2021-08-17T08:48:22.699Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:22.699Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:22.716Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:22.717Z ERROR webdriver: Request failed with status 404 due to invalid session id: A session is either terminated or not started
[0-0] 2021-08-17T08:48:23.112Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:23.112Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:23.112Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:23.140Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:23.140Z INFO webdriver: Retrying 1/3
[0-0] 2021-08-17T08:48:23.140Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:23.141Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:23.140Z WARN webdriver: Request failed with status 404 due to A session is either terminated or not started
[0-0] 2021-08-17T08:48:23.159Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:23.160Z INFO webdriver: Retrying 2/3
[0-0] 2021-08-17T08:48:23.160Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:23.160Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:23.160Z WARN webdriver: Request failed with status 404 due to A session is either terminated or not started
[0-0] 2021-08-17T08:48:23.178Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:23.178Z INFO webdriver: Retrying 3/3
[0-0] 2021-08-17T08:48:23.178Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:23.178Z WARN webdriver: Request failed with status 404 due to A session is either terminated or not started
[0-0] 2021-08-17T08:48:23.178Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:23.210Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:23.210Z ERROR webdriver: Request failed with status 404 due to invalid session id: A session is either terminated or not started
[0-0] 2021-08-17T08:48:23.612Z INFO webdriver: COMMAND findElements("css selector", ".r-chapter-title")
[0-0] 2021-08-17T08:48:23.614Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:23.615Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:23.632Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:23.633Z INFO webdriver: Retrying 1/3
[0-0] 2021-08-17T08:48:23.633Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:23.633Z WARN webdriver: Request failed with status 404 due to A session is either terminated or not started
[0-0] 2021-08-17T08:48:23.633Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:23.646Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:23.647Z INFO webdriver: Retrying 2/3
[0-0] 2021-08-17T08:48:23.647Z WARN webdriver: Request failed with status 404 due to A session is either terminated or not started
[0-0] 2021-08-17T08:48:23.647Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:23.647Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:23.654Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:23.655Z INFO webdriver: Retrying 3/3
[0-0] 2021-08-17T08:48:23.655Z INFO webdriver: [POST] http://localhost:4730/session/105624f4-6876-4b0a-92f4-aa18d7dbc2d8/elements
[0-0] 2021-08-17T08:48:23.655Z WARN webdriver: Request failed with status 404 due to A session is either terminated or not started
[0-0] 2021-08-17T08:48:23.655Z INFO webdriver: DATA { using: 'css selector', value: '.r-chapter-title' }
[0-0] 2021-08-17T08:48:23.666Z DEBUG webdriver: request failed due to response error: invalid session id
[0-0] 2021-08-17T08:48:23.667Z ERROR webdriver: Request failed with status 404 due to invalid session id: A session is either terminated or not started
2021-08-17T08:48:24.056Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
[0-0] FAILED in chrome - /test/specs/movepages.js
2021-08-17T08:48:24.058Z INFO @wdio/cli:launcher: Run onComplete hook
2021-08-17T08:48:24.058Z DEBUG @wdio/appium-service: Appium (pid: 38048) killed
2021-08-17T08:48:24.058Z DEBUG @wdio/cli:utils: Finished to run "onComplete" hook in 0ms
2021-08-17T08:48:24.073Z ERROR @wdio/cli:utils: Error in onCompleteHook: ReferenceError: allure is not defined
    at Object.onComplete (/Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/config/wdio.conf.js:111:28)
    at /Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/node_modules/@wdio/cli/build/utils.js:84:19
    at Array.map (<anonymous>)
    at Object.runOnCompleteHook (/Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/node_modules/@wdio/cli/build/utils.js:82:39)
    at Launcher.run (/Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/node_modules/@wdio/cli/build/launcher.js:94:53)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

 "spec" Reporter:
------------------------------------------------------------------
[emulator-5554 Android 11 #0-0] Running: emulator-5554 on Android 11 executing chrome
[emulator-5554 Android 11 #0-0] Session ID: 105624f4-6876-4b0a-92f4-aa18d7dbc2d8
[emulator-5554 Android 11 #0-0]
[emulator-5554 Android 11 #0-0] » /test/specs/movepages.js
[emulator-5554 Android 11 #0-0] My Login application
[emulator-5554 Android 11 #0-0]    ? Moving pages
[emulator-5554 Android 11 #0-0]    ✖ "before each" hook for My Login application
[emulator-5554 Android 11 #0-0]
[emulator-5554 Android 11 #0-0] 1 failing (11.5s)
[emulator-5554 Android 11 #0-0]
[emulator-5554 Android 11 #0-0] 1) My Login application "before each" hook for My Login application
[emulator-5554 Android 11 #0-0] Timeout of 10000ms exceeded. The execution in the test "My Login application "before each" hook for "Moving pages"" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts). (/Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/test/specs/movepages.js)
[emulator-5554 Android 11 #0-0] Error: Timeout of 10000ms exceeded. The execution in the test "My Login application "before each" hook for "Moving pages"" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts). (/Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/test/specs/movepages.js)
[emulator-5554 Android 11 #0-0]     at createTimeoutError (/Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/node_modules/mocha/lib/errors.js:498:15)
[emulator-5554 Android 11 #0-0]     at Hook.Runnable._timeoutError (/Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/node_modules/mocha/lib/runnable.js:431:10)
[emulator-5554 Android 11 #0-0]     at Timeout.<anonymous> (/Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/node_modules/mocha/lib/runnable.js:246:24)
[emulator-5554 Android 11 #0-0]     at listOnTimeout (internal/timers.js:554:17)
[emulator-5554 Android 11 #0-0]     at processTimers (internal/timers.js:497:7)

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:20 

2021-08-17T08:48:24.081Z INFO @wdio/local-runner: Shutting down spawned worker
2021-08-17T08:48:24.336Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2021-08-17T08:48:24.336Z INFO @wdio/local-runner: shutting down
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

you can see the error Timeout of 10000ms exceeded. The execution in the test "My Login application "before each" hook for "Moving pages"" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts). (/Users/wimselles/Sauce/Git/customers/opensource/WDIOTest/test/specs/movepages.js) but this is related to the fact that the beforeEach hook couldn't find any element

For further assistance please use the Gitter channel. I'll stop responding to this ticket now because it works with the current changes

RollerIn commented 3 years ago

Thank you,@wswebcreation for your support in between ,I have created a method for login that worked fine , till this method but after this am calling "move pages" method here actually react web will load , while loading am getting same error "Timeout of 10000ms exceeded." as per my observation problem is keeping WDIO in waiting status till hole pages loads completely or each page/element renders completely since it is a react native web application

here am attaching source what I can see on web image

Thanks