Page MenuHomePhabricator

ERROR @wdio/runner: Error: Unable to load spec files quite likely because they rely on `browser` object that is not fully initialised.
Closed, InvalidPublic

Description

quibble-vendor-mysql-php72-selenium-docker fails for 724375 with:

[0-1] RUNNING in chrome - /tests/selenium/specs/user_page.js
[0-1] 2021-09-29T14:42:46.862Z ERROR @wdio/runner: Error: Unable to load spec files quite likely because they rely on `browser` object that is not fully initialised.
`browser` object has only `capabilities` and some flags like `isMobile`.
Helper files that use other `browser` commands have to be moved to `before` hook.
Spec file(s): /workspace/src/extensions/MobileFrontend/tests/selenium/specs/user_page.js
Error: TypeError: Cannot read property 'username' of undefined
    at Object.<anonymous> (/workspace/src/extensions/MobileFrontend/tests/selenium/features/step_definitions/user_page_steps.js:6:34)
...
    at Object.<anonymous> (/workspace/src/extensions/MobileFrontend/tests/selenium/specs/user_page.js:12:6)
...

tests/selenium/specs/user_page.js:12 is

} = require( '../features/step_definitions/user_page_steps' ),

tests/selenium/features/step_definitions/user_page_steps.js:6 is

const USERNAME = browser.options.username;

The error message is:

Error: TypeError: Cannot read property 'username' of undefined

Full terminal output.

1> @ selenium-test /workspace/src/extensions/MobileFrontend
2> wdio tests/selenium/wdio.conf.js
3
4
5Execution of 2 spec files started at 2021-09-29T14:42:36.899Z
6
7[0-0] RUNNING in chrome - /tests/selenium/specs/switch_views.js
8[0-0] PASSED in chrome - /tests/selenium/specs/switch_views.js
9[0-1] RUNNING in chrome - /tests/selenium/specs/user_page.js
10[0-1] 2021-09-29T14:42:46.862Z ERROR @wdio/runner: Error: Unable to load spec files quite likely because they rely on `browser` object that is not fully initialised.
11`browser` object has only `capabilities` and some flags like `isMobile`.
12Helper files that use other `browser` commands have to be moved to `before` hook.
13Spec file(s): /workspace/src/extensions/MobileFrontend/tests/selenium/specs/user_page.js
14Error: TypeError: Cannot read property 'username' of undefined
15 at Object.<anonymous> (/workspace/src/extensions/MobileFrontend/tests/selenium/features/step_definitions/user_page_steps.js:6:34)
16 at Module._compile (internal/modules/cjs/loader.js:778:30)
17 at Module._compile (/workspace/src/extensions/MobileFrontend/node_modules/pirates/lib/index.js:99:24)
18 at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
19 at Object.newLoader [as .js] (/workspace/src/extensions/MobileFrontend/node_modules/pirates/lib/index.js:104:7)
20 at Module.load (internal/modules/cjs/loader.js:653:32)
21 at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
22 at Function.Module._load (internal/modules/cjs/loader.js:585:3)
23 at Module.require (internal/modules/cjs/loader.js:692:17)
24 at require (internal/modules/cjs/helpers.js:25:18)
25 at Object.<anonymous> (/workspace/src/extensions/MobileFrontend/tests/selenium/specs/user_page.js:12:6)
26 at Module._compile (internal/modules/cjs/loader.js:778:30)
27 at Module._compile (/workspace/src/extensions/MobileFrontend/node_modules/pirates/lib/index.js:99:24)
28 at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
29 at Object.newLoader [as .js] (/workspace/src/extensions/MobileFrontend/node_modules/pirates/lib/index.js:104:7)
30 at Module.load (internal/modules/cjs/loader.js:653:32)
31 at MochaAdapter._loadFiles (/workspace/src/extensions/MobileFrontend/node_modules/@wdio/mocha-framework/build/index.js:85:35)
32 at process._tickCallback (internal/process/next_tick.js:68:7)
33[0-1] Error: Unable to load spec files quite likely because they rely on `browser` object that is not fully initialised.
34`browser` object has only `capabilities` and some flags like `isMobile`.
35Helper files that use other `browser` commands have to be moved to `before` hook.
36Spec file(s): /workspace/src/extensions/MobileFrontend/tests/selenium/specs/user_page.js
37Error: TypeError: Cannot read property 'username' of undefined
38 at Object.<anonymous> (/workspace/src/extensions/MobileFrontend/tests/selenium/features/step_definitions/user_page_steps.js:6:34)
39 at Module._compile (internal/modules/cjs/loader.js:778:30)
40 at Module._compile (/workspace/src/extensions/MobileFrontend/node_modules/pirates/lib/index.js:99:24)
41 at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
42 at Object.newLoader [as .js] (/workspace/src/extensions/MobileFrontend/node_modules/pirates/lib/index.js:104:7)
43 at Module.load (internal/modules/cjs/loader.js:653:32)
44 at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
45 at Function.Module._load (internal/modules/cjs/loader.js:585:3)
46 at Module.require (internal/modules/cjs/loader.js:692:17)
47 at require (internal/modules/cjs/helpers.js:25:18)
48 at Object.<anonymous> (/workspace/src/extensions/MobileFrontend/tests/selenium/specs/user_page.js:12:6)
49 at Module._compile (internal/modules/cjs/loader.js:778:30)
50 at Module._compile (/workspace/src/extensions/MobileFrontend/node_modules/pirates/lib/index.js:99:24)
51 at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
52 at Object.newLoader [as .js] (/workspace/src/extensions/MobileFrontend/node_modules/pirates/lib/index.js:104:7)
53 at Module.load (internal/modules/cjs/loader.js:653:32)
54[0-1] FAILED in chrome - /tests/selenium/specs/user_page.js
55
56 "dot" Reporter:
57.
58
59Spec Files: 1 passed, 1 failed, 2 total (100% completed) in 00:00:10
60
61npm ERR! code ELIFECYCLE
62npm ERR! errno 1
63npm ERR! @ selenium-test: `wdio tests/selenium/wdio.conf.js`
64npm ERR! Exit status 1
65npm ERR!
66npm ERR! Failed at the @ selenium-test script.
67npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
68
69npm ERR! A complete log of this run can be found in:
70npm ERR! /cache/npm/_logs/2021-09-29T14_42_47_302Z-debug.log

Event Timeline

zeljkofilipin changed the task status from Open to In Progress.Sep 29 2021, 3:26 PM
zeljkofilipin claimed this task.
zeljkofilipin triaged this task as Medium priority.
zeljkofilipin moved this task from Backlog 🪒 to Deep work 🌊 on the User-zeljkofilipin board.
zeljkofilipin changed the task status from In Progress to Open.Oct 4 2021, 2:08 PM
zeljkofilipin removed zeljkofilipin as the assignee of this task.
zeljkofilipin moved this task from Deep work 🌊 to Q2 👔 on the User-zeljkofilipin board.
zeljkofilipin raised the priority of this task from Medium to Needs Triage.Oct 7 2021, 3:05 PM
zeljkofilipin added a project: Browser-Tests.
zeljkofilipin moved this task from Q2 👔 to Backlog 🪒 on the User-zeljkofilipin board.

MobileFrontend doesn't have WebdriverIO tests since 859535.