browserstack / webdriverio-browserstack

Selenium examples for WebDriverIO and BrowserStack Automate
https://www.browserstack.com
68 stars 91 forks source link

Cannot integrate webdriver-io boilerplate project with Browserstack #18

Open sergiybuch opened 5 years ago

sergiybuch commented 5 years ago

Hi, I am trying to integrate Browserstack with https://github.com/webdriverio/appium-boilerplate/. I have created new conf.js file

`exports.config = { services: ['browserstack'], user: process.env.BROWSERSTACK_USERNAME || 'xxxxxxxxxxxxxxxxxxxxxxxx', key: process.env.BROWSERSTACK_ACCESS_KEY || '000000000000000000000', browserstackLocal: true, updateJob: false, specs: [ './tests/specs/app*.spec.js', ], exclude: [],

capabilities: [{
    name: 'single_appium_test',
    build: 'webdriver-browserstack',
    device: 'Samsung Galaxy S7',
    browserName: 'android',
    app: process.env.BROWSERSTACK_APP_ID || 'bs://xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    appPackage: 'com.wdiodemoapp',
    appActivity: 'com.wdiodemoapp.MainActivity',
    'browserstack.debug': true
}],
logLevel: 'verbose',
coloredLogs: true,
screenshotPath: './errorShots/',
baseUrl: '',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,

framework: 'mocha',
mochaOpts: {
    ui: 'bdd',
    timeout: 20000
}

}; When I am running tests I am getting errors in console: > appium-boilerplate@5.0.0 android.browserstack C:\Source\appium-boilerplate-master

wdio ./config/wdio.android.browserstack.conf.js

2019-03-13T15:21:42.248Z DEBUG wdio-config: @wdio/sync found, running tests synchronous 2019-03-13T15:21:42.880Z DEBUG wdio-cli:run: Run suite with config ./config/wdio.android.browserstack.conf.js and params { _: [ './config/wdio.android.browserstack.conf.js' ], '$0': 'node_modules\@wdio\cli\bin\wdio.js' }

Test Suites: 0 passed, 6 total (0% completed) Time: 🕓 0.09s

Test Suites: 0 passed, 6 total (0% completed) Time: 🕗 0.13s

RUNNING 0-3 in android - \tests\specs\app.swipe.spec.js RUNNING 0-4 in android - \tests\specs\app.webview.spec.js RUNNING 0-5 in android - \tests\specs\app.webview.xpath.spec.js

Stdout: 2019-03-13T15:21:43.043Z INFO wdio-local-runner: Start worker 0-5 with arg: ./config/wdio.android.browserstack.conf.js 2019-03-13T15:21:43.204Z DEBUG wdio-local-runner: Runner 0-1 finished with exit code 1 2019-03-13T15:21:43.214Z DEBUG wdio-local-runner: Runner 0-0 finished with exit code 1 2019-03-13T15:21:43.230Z DEBUG wdio-local-runner: Runner 0-2 finished with exit code 1 2019-03-13T15:21:43.246Z DEBUG wdio-local-runner: Runner 0-3 finished with exit code 1

Stderr: [0-0] C:\Source\appium-boilerplate-master\node_modules\loglevel\lib\loglevel.js:186 throw "log.setLevel() called with invalid level: " + level; ^ log.setLevel() called with invalid level: verbose [0-1] C:\Source\appium-boilerplate-master\node_modules\loglevel\lib\loglevel.js:186 throw "log.setLevel() called with invalid level: " + level; ^ log.setLevel() called with invalid level: verbose [0-2] C:\Source\appium-boilerplate-master\node_modules\loglevel\lib\loglevel.js:186 throw "log.setLevel() called with invalid level: " + level; ^ log.setLevel() called with invalid level: verbose [0-2] C:\Source\appium-boilerplate-master\node_modules\loglevel\lib\loglevel.js:186 throw "log.setLevel() called with invalid level: " + level; ^ log.setLevel() called with invalid level: verbose [0-3] C:\Source\appium-boilerplate-master\node_modules\loglevel\lib\loglevel.js:186 throw "log.setLevel() called with invalid level: " + level; ^ log.setLevel() called with invalid level: verbose [0-4] C:\Source\appium-boilerplate-master\node_modules\loglevel\lib\loglevel.js:186 throw "log.setLevel() called with invalid level: " + level; ^ log.setLevel() called with invalid level: verbose [0-5] C:\Source\appium-boilerplate-master\node_modules\loglevel\lib\loglevel.js:186 throw "log.setLevel() called with invalid level: " + level; ^ log.setLevel() called with invalid level: verbose

Test Suites: 0 passed, 6 failed, 6 total (100% completed) Time: 🕕 0.37s

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! appium-boilerplate@5.0.0 android.browserstack: wdio ./config/wdio.android.browserstack.conf.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the appium-boilerplate@5.0.0 android.browserstack script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2019-03-13T15_21_43_294Z-debug.log `

logs-debug.txt

How can i make these tests run in Browserstack?

sergiybuch commented 5 years ago

I made some changes in my package.json and now I am getting this error: ` [13:31:06] COMMAND POST "/wd/hub/session" [13:31:06] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"name":"single_appiumtest","build":"webdriver-browserstack","de vice":"Samsung Galaxy S7","browserName":"android","app":"bs://f8f8e513f30233679fe79d32e8d8ace28a67d987","browserstack.debug":true,"":"2 more keys: [\"browserstack.local\",\"requestOrigins\"]"}} [13:31:38] INFO SET SESSION ID f576aaeddb11b947251f7d9e2e5125152e4b784d [13:31:38] RESULT {"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"device":"samsung galaxy s7","browserstack.debug":"true","browserstack.local":"true","r equestOrigins":{"ur ... (1188 more bytes) StatusCodeError: 404 - {"status":404,"message":"Not Found"} at new StatusCodeError (C:\Source\appium-boilerplate-master\node_modules\request-promise-core\lib\errors.js:32:15) at Request.plumbing.callback (C:\Source\appium-boilerplate-master\node_modules\request-promise-core\lib\plumbing.js:104:33) at Request.RP$callback [as _callback] (C:\Source\appium-boilerplate-master\node_modules\request-promise-core\lib\plumbing.js:46:31) at Request.self.callback (C:\Source\appium-boilerplate-master\node_modules\request\request.js:185:22) at Request.emit (events.js:189:13) at Request.EventEmitter.emit (domain.js:441:20) at Request. (C:\Source\appium-boilerplate-master\node_modules\request\request.js:1161:10) at Request.emit (events.js:189:13) at Request.EventEmitter.emit (domain.js:441:20) at IncomingMessage. (C:\Source\appium-boilerplate-master\node_modules\request\request.js:1083:12) at Object.onceWrapper (events.js:277:13) at IncomingMessage.emit (events.js:194:15) at IncomingMessage.EventEmitter.emit (domain.js:441:20) at endReadableNT (_stream_readable.js:1103:12) at process._tickCallback (internal/process/next_tick.js:63:19) ERROR: Unexpected identifier android.f8f8e513f30233679fe79d32e8d8ace28a67d987 [13:31:39] COMMAND DELETE "/wd/hub/session/f576aaeddb11b947251f7d9e2e5125152e4b784d" C:\Source\appium-boilerplate-master\tests\specs\app.login.spec.js:1 (function (exports, require, module, filename, dirname) { import TabBar from '../screenobjects/components/tab.bar'; ^^^^^^

`

sergiybuch commented 5 years ago

Looks like Browserstack does not work with projects that has page objects structure.

Biswajeet11 commented 5 years ago

Are you still able to integrate webdriverio with browserstack? @sergiybuch