Page MenuHomePhabricator
Paste P13064

Outreachy subtask T248221 Update Selenium documentation to work with WebdriverIO v6, Selenium/Explanation/Stack
ActivePublic

Authored by Js636f on Oct 23 2020, 10:54 PM.
# Documentation page: Selenium/Explanation/Stack https://www.mediawiki.org/wiki/Selenium/Explanation/Stack
## Starting chromedriver
My machine was already prepared for testing, so I just started chromedriver in a separate terminal window:
alex@APC:~$ chromedriver --url-base=wd/hub --port=4444
Starting ChromeDriver 86.0.4240.111 (b8c36128a06ebad76af51591bfec980224db5522-refs/branch-heads/4240@{#1290}) on port 4444
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
## Cloning the repository and installing dependencies
Then I cloned the repository mediawiki-selenium-nodejs
$ git clone https://github.com/zeljkofilipin/mediawiki-selenium-nodejs
Then I ran npm install and received a bunch of error messages like this:
fibers@2.0.2 install /home/alex/r/stack/mediawiki-selenium-nodejs/node_modules/fibers
> node build.js || nodejs build.js
make: Entering directory '/home/alex/r/stack/mediawiki-selenium-nodejs/node_modules/fibers/build'
CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:68:2: error: ‘Handle’ does not name a type
68 | Handle<String> NewLatin1String(Isolate* isolate, const char* string) {
| ^~~~~~
...
So, I couldn't run the tests. In particular the second test gave me this output:
alex@APC:~/r/stack/mediawiki-selenium-nodejs$ ./node_modules/.bin/wdio --spec webdriverio/stack/mocha.js
ERROR: Couldn't load "wdio-mocha-framework" framework. You need to install it with `$ npm install wdio-mocha-framework`!
Error: Cannot find module 'wdio-mocha-framework'
Require stack:
...
The source of the problem was fibers package. I found out that using older node.js may help. I changed my node v14.14.0 to v12.19.0 using nvm, tried npm install again, but the result was the same. Then I switched to node v10.22.1, ran npm install again and didn't receive the same error messages (just some warnings, again from fibers) and was able to run the tests from the page.
## WebdriverIO
$ node webdriverio/stack/webdriverio.js
Log in link visible: true
## Mocha
$ ./node_modules/.bin/wdio --spec webdriverio/stack/mocha.js
Log in link visible: true
1 passing (3.50s)
## Assert
$ ./node_modules/.bin/wdio --spec webdriverio/stack/assert.js
1 passing (3.60s)
## Page object
$ ./node_modules/.bin/wdio wdio.conf.js
․․Log in link visible: true
3 passing (10.80s)
As you can see it reports about 3 tests because of this section in the wdio.config.js:
specs: [
'./webdriverio/specs/**/*.js',
'./webdriverio/stack/assert.js',
'./webdriverio/stack/mocha.js'
],
## Conclusion
I think the page https://www.mediawiki.org/wiki/Selenium/Explanation/Stack should be updated.
1. We should mention that Node.js v10.22.1 is recommended. Or we may try to update the example repository. (I tried the latest versions of packages from package.json and deleted package.lock.json, but keep getting aforementioned errors).
2. In the WebdriverIO section we should use this command:
node webdriverio/stack/webdriverio.js
3. We should update Page object section to show actual output:
$ ./node_modules/.bin/wdio wdio.conf.js
․․Log in link visible: true
3 passing (10.80s)