WebdriverIO has dropped support of sync mode due to breaking changes in Chromium, hence all tests have been changed to async.
Bug: T293071
Change-Id: I15347b789f11de84b764e13a3981545ed6759881
Wikimedia CI now serves MediaWiki over Apache (T286649) which mean we
can now do concurrent requests!
Change-Id: I5513535ac43138df1215a4896267aaa689bb2f56
For 99% of JS classes, there is no constructor description and instead
the class/constructor are defined together followed by both `@class`
and `@constructor` in the same block. These are interpreted as the
description belonging to the class and prominently displayed in the
documentation.
For the very rare cases where a constructor has its own description,
this must follow the tag rather than preceed it. This makes sense
when thinking about it in terms of how classes are usually defined
(above the constructor, and thus the space above `@constructor`
already belongs to `@class`).
This has the unfortunate side-effect, however, that when a constructor
is documented on its own, that any text above `@constructor` is
ignored, as happened with mw.Api.
But, as so often with strict documentation warnings, it helped uncover
a mistake. The text here is quite useful and not really specific to
the constructor and more broadly useful for the module as a whole,
as such I moved it to the class block.
Also:
* Clean up the code by bringing the class and constructor definition
back together.
* Fix warning about invalid internal reference:
> Warning: /resources/src/mediawiki.api/index.js:3: {@link https://…}
The `@see` tag is only valid when referring to another index entity.
There were three other uses of `@see` with a URL in core, but only in
`@ignore`-ed code, which this commit fixes at the same time.
Follows-up a28b76abe9.
* Use local `var` declarion for `promises`, since "one-var" style
is no longer current.
Change-Id: I2d4f8b99c2896d4e1af50956c9faa8b36344884e
Flaky selenium tests are a problem (https://w.wiki/3XMD).
Ideally we'd have better shared practices around writing tests that
reduce flakiness, but there will probably always be some element of
instability due to the nature of these tests.
We should fix flaky tests where there are clear fixes to do so, but it
would also be nice to not have to re-run a 20 minute build when a 5
second test, when retried, passes.
https://webdriver.io/docs/retry indicates that you can specify a number
of times to retry a spec file, so that's what is added here.
Change-Id: I29a4943e7ddaf755b242756543d9402177a0f6e5
All other debugging information (screenshots, webdriverio, mwbot) is
already removed.
Bug: T284335
Change-Id: I27eb5053c35b4d7813315f3001c07d469fe9cbd2
dotenv is used only in core. It's usage was introduced into
wdio-defaults.conf.js by mistake in 8a4fab5, while moving functionality
from wdio.conf.js.
This patch moves dotenv usage back to wdio.conf.js, where it should be.
Bug: T283613
Change-Id: I6ec96248cd0b829ef44e574b7e6dc98cf363ee3a
Remove `special` from `recentchanges.js` and `watchlist.js`.
The entire `spec` folder has only four files. The two mentioned and
`page.js` and `user.js`. If that was a folder with a lot of files, it
would make sense to use `special`. Now it just makes file names long.
Additionally, files in `pageobjects` folder are already using simpler
names, `recentchanges.page.js` and `watchlist.page.js`, without
`special`.
Bug: T210726
Change-Id: I156f436e2de345586a25174c630ad60259504115
Unil 2020-06-15 we were using Xvfb+ffmpeg to record videos.
In eed975d we have switched to wdio-video-reporter npm package.
It has never worked very well. It does not really record videos.
It creates screenshots and creates videos from them.
It does not record modal popups. Sometimes, it doesn't create a video
for a test at all.
I think it's time to switch back to Xvfb+ffmpeg. It has worked well. The
reason we moved to wdio-video-reporter was that it worked on all
platforms. That's not really important any more, since Xvfb+ffmpeg works
in a Fresh container.
Bug: T253113
Change-Id: I221775208576b6496f682ceefd6e6334db488bd4
So far, each repository had it's own wdio.conf.js file. That lead to a
lot of duplicated code. This patch moves core's wdio.conf.js file to
wdio-mediawiki package. The file can be used by core, extensions and
skins. Each repository can override settings, if needed.
Bug: T281484
Change-Id: Icd098a2adf8f6183aad5fb6b33196c67fd809e15
The jobs are running a subset of tests. (Tests containing string
`@daily` in the name.) To find the tests we are using
`--mochaOpts.grep` WebdriverIO command line option. The filter is
executed after the tests have already started. Since some test files
have no tests with string `@daily`, they are skipped. That results in
JUnit reporter creating a couple of empty XML files. Jenkins thinks
empty files are failures and fails the build.
This commit creates a suite of files that have tests with string
`@daily` and runs only those files.
Bug: T281505
Change-Id: Id844da81feac49f2a2b6820e98ead98d7e932e9f
JUnit reporter configuration changed since WebdriverIO v6. Before this
patch, the reporter was creating files in format
wdio-*-junit-reporter.log while Jenkins expects files in format
WDIO.xunit*.xml.
Bug: T214686
Change-Id: Iba68a48e3b3f512c5004446b21cdfde6558e8b15
When debugging, it's useful to have screenshots from multiple test runs.
At the moment, file name is created only with test suite name and test
name. When a new test (suite) is executed, screenshots from the previous
one are overwritten.
This patch adds date and time in a slightly modified ISO 8601 format.
(Colons and dots are replaced with dashes.)
Example old file name:
Special%3ARecentChanges-shows-page-creation.png
Example new file name:
Special%3ARecentChanges-shows-page-creation-2021-04-27T12-58-01-822Z.png
Bug: T280970
Change-Id: I90fbcdaf5cb22ea455fd55e718e8db3b3c1dfaea
Two tasks (T214686 and T280970) need a timestamp in file name.
It's currently implemented as a simple constant, but it's duplicated
in two files, tests/selenium/wdio.conf.js and
tests/selenium/wdio-mediawiki/index.js.
To reduce duplication, this patch creates a simple function in
wdio-mediawiki.
Bug: T281372
Change-Id: Id2a9a340e7e3be253238463b9bd25483647e227c
Rollback with confirmation
- should offer rollback options for admin users (Kosta Harlan, 2 years ago, 2fb62de)
- should offer a way to cancel rollbacks (Adam Roses Wight, 2 years ago, 89a00d2)
- should perform rollbacks after confirming intention (Jon Robson, 2 years ago, ddf7a50)
- should verify rollbacks via GET requests are confirmed on a follow-up page (Timo Tijhof, 2 years ago, c3e379d)
Rollback without confirmation
- should perform rollback via POST request without asking the user to confirm (Sam Reed, 2 years ago, 8631daa)
- should perform rollback via GET request without asking the user to confirm (Kosta Harlan, 2 years ago, f0162af)
User
- should be able to change preferences (Kunal Mehta, 3 years ago, 4b0cde2)
Bug: T280652
Change-Id: Ieaccf37ad016f2e811aeb98d2bd2f061c9b13fbf
Tests in rollback.js are disabled due to flakiness. After enabling them
a few of them fail with `browser.getText is not a function`.
It is caused by WebdriverIO API change. `browser.getText()` was replaced
with `$().getText()`. The problem was not noticed during the WebdriverIO
upgrade since the tests were disabled.
Bug: T280639
Change-Id: I4b21bbc1ad9ddbc8b04b444b21ee67b2621f54e7
I've removed `test` argument from afterTest hook by mistake in 2320f00.
It's needed by `filePath()`.
Linters didn't catch this and tests didn't fail, so this mistake went
unnoticed.
Bug: T280355
Change-Id: I1bc142d8282b7a7266233c69d0b27f8700c8f473
There is code in wdio.conf.js to only take screenshots of failed tests.
For a while now, `test.passed` is returning `undefined`, so screenshots
are taken for both passing and failing tests. The change probably
happened when we upgraded webdriverio to v5 or v6, but nobody noticed
it.
I actually like the current behavior. We take videos for both passing
and failing tests, so it makes sense to take screenshots too. Both
screenshots and videos are small files.
(The biggest screenshot is 539 KB, the biggest video is 21 KB.)
Bug: T280355
Change-Id: I8a73afcda19d6dc1cad75256835448488aff37d5
A typical output when running Selenium tests contains a lot of
`Screenshot location...` messages. They are not useful and should be
removed.
Bug: T280343
Change-Id: I462a3764f4a26c4231ff48797c4834ba80a4079d
By default, Mocha will abort the test suite if it takes more than 60
seconds. That is usually plenty when you're just running tests, but it's
usually not enough when you're debugging. At the moment, you have to
manually increase `mochaOpts` `timeout` in `wdio.conf.js`.
This patch checks if DEBUG is set, and if so, increases `timeout` from
60 seconds to 60 minutes.
This patch simplifies debugging. Instead of having to manually edit
`wdio.conf.js`, increasing `timeout` is done by:
DEBUG=true npm run selenium-test
Debugging is documented at
https://www.mediawiki.org/wiki/Selenium/How-to/Debug_with_browser.debug()#mochaOpts
Bug: T278827
Change-Id: Ied8e7eab34d9472b841b803ada6541dd12f85976
A year ago (in 0257160) Kosta Harlan changed the tests to use class name
instead of ID to find page elements. That made the tests pass even when
Vector skin is not installed. Apparently something changed since and
core now uses ID instead of class name.
Bug: T276900
Change-Id: Iac4295627547f70e81eeab61d0c64208d7be1d1d
Since WebdriverIO v5, Puppeteer is available as a Chromedriver
alternative.
Puppeteer and Chromedriver behave almost the same, but there were a few
minor failures that needed to be fixed.
Puppeteer is bundled with WebdriverIO. Chromedriver needs to be installed
(and started/stopped) separately. Getting rid of Chromedriver simplifies
our documentation, among other things.
The commit updates tests/selenium/wdio.conf.js to use Puppeteer.
It also fixes a few minor problems in tests/selenium/specs/page.js
introduced by the change.
Bug: T269566
Change-Id: I143c44304461980a2be98eb60741184fa7671343
There may be a race condition when running against a multithreaded
server, in which the Special:RecentChanges request arrives before the
deferred job has updated history. The API call ensures that the
recentchanges table has been updated, within a 5-second grace period.
Bug: T225218
Change-Id: I0882a5624c62b94f8c6e6056ea3396d9e2904d48