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
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
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
The current tests in core rely on selectors provided by Vector, but with some
small modifications the tests can work equally well with and without Vector.
Bug: T248484
Change-Id: I5bc0c80b796252b1a920f6549ef4a462a9b13b87
This does the same for the other specs, as previously done to the
page.js spec in 058d5b7cd8.
* rollkback: From 6 api logins to 4 api logins.
Before (2x3): admin for edit, admin for createaccount, vandal for edit.
After (2x2): admin for edit + createaccount, vandal for edit.
* recentchanges spec: No difference, but updated pattern for consistency
so that if it is extended in the future, it will be natural to re-use
the bot object instead of creating a new one.
* watchlist spec: From 3 api logins to 1 api login.
Before: admin for createaccount, admin for edit, admin for edit.
After: admin (re-used)
* user spec: From 2 to 1 api login.
Also:
* Remove the now-unused Api.edit() and Api.delete() anti-pattern
methods, as these are nothing but one-line shortcuts to the
already one-line invocation of bot.edit() and bot.delete(),
except that they bypassed the current bot object, causing
inefficient repeat logins in way that was non-obvious.
Migration is simple and won't be required until other repos
upgrade to the next wdio-mediawiki version (not yet released).
* Make 'bot' a mandatory parameter for the createAccount, block,
and unblock convenience wrapper methods.
* Move the vandalizePage() method from HistoryPage to rollback spec,
as it had no connection with that page object or the action=history
interface, and document why it can't (yet) re-use its bot object.
Bug: T234002
Change-Id: Id6e995916566f7dd7b618892295198b897fbee2e
The one-var rule only applies to 'var' where it matters that we
don't let the engine implicitly hoist variables leading to
confusing code that may be unsafe to refactor in a straight-forward
manner.
This doesn't apply to ES6 const and let. While I updated the
rule in 1955a8aa5 to allow ES6, I did not enforce it. Fixed now.
When assigning a value, each assignment should be its own
statement (disallow awkward comma separated assignments).
When not assigning a value, and the lines are next to each other,
they should be in one statement. This makes sense for this small
directory and might make sense to propose for the wikimedia preset
at some point.
Note that the rule I added was not required to make the build
pass. The changes I made are allowed by default by the wikimedia
preset for es6+. The rule I added disallows the previous way.
Change-Id: I26cda095a8a4589084e36273038877f2dd1fc50b
Remove uses of setLocalStorage (incompatible with chromedriver >= 75)
and also requires slightly fewer requests since BlankPage.open()
doesn't need to be invoked.
Bug: T234002
Change-Id: I4cfb4fe17a3c99bfcb7ff39ac6db60f5c5e8a687
This test previously took 4 minutes to run locally and ended up
running the MWBot.login process 9 times.
After this, the specs/page tests only log-in once.
Bug: T234002
Change-Id: I374620a01f49d4da559070d0982bdbe4c1269e2e
This test was consistently reaching the RunJobs timeout of
10 tries and then giving up. This happens in CI, where it wasted
about ~ 5 seconds, and locally where it takes about 30s for mw.
Like so:
> RunJobs through requests to the main page (run 1).
> RunJobs detected 12 more queued job(s).
> RunJobs through requests to the main page (run 2).
> RunJobs detected 12 more queued job(s).
Etc, until it reaches run 10 and gives up. This also suggests
the whole thing isn't wokring, but that's a separate matter.
First and foremost, RecentChange objects are saved from a PRESEND
deferred update, which means it does not require a job queue wait
in order to appear on Special:RecentChanges.
This was added in e908d347ef (T199446) "to keep the number of
unrun jobs low". The idea being that this test makes an edit via
the API, which means it creates jobs without running them. On
the other hand, there's also lots of test steps that view pages
but don't create jobs, which would make this optimisation premature.
If and when we do encounter a test failing due to a job backlog,
I'm confident we can find a better solution at that time.
Bug: T234002
Bug: T225730
Bug: T199446
Change-Id: I9ef8c5b65d4b636572569912f04f48ed40aa0564
* Options no longer needed or no longer exist in wdio v5:
- coloredLogs: Now always on. The underlying 'chalk' library can still
be influenced via the FORCE_COLOR environment variable.
- screenshotPath: Removed. Was already disabled in our config.
- deprecationWarnings: Meh.
- 'sync: true' – On by default when `@wdio/sync` is installed.
The wdio v5 config generator doesn't recommend setting manually.
* The selenium.sh script was removed. It existed to start and stop
chromedriver for local use by developers. This is now done by
the wdio-chromedriver-service. In WMF CI, Quibble starts its own
chromedriver (as optimisation, reused across gated repos),
which is why the 'selenium-test' entry points remains and skips
this.
* The wdio-mediawiki package now requires wdio v5 and Node 10.
This doesn't affect extension repos because versions are pinned.
Upgrade may happen at the earliest convenience.
* Several WDIO methods changed names or signature. Full list at:
<https://github.com/webdriverio/webdriverio/blob/v5.13.2/CHANGELOG.md#v500-2018-12-20>
Highlights:
- browser.element() is now browser.findElement() with "$()" as alias.
- browser.localStorage replaced by browser.setLocalStorage.
- browser.deleteCookie() requires `name` param. To delete all at once,
there is a new method browser.deleteAllCookies().
- Commands that return data no longer wrapped in `{ value: … }`.
Values are now returned directly.
- Custom config keys are now under browser.config instead of browser.options.
Renamed our username/password keys to be mw-prefixed, to avoid clashes
and reduce confusion with similar config keys.
- browser.click(selector) and browser.getText(selector) no longer exist.
Use $(selector).click() or .getText() instead.
* Fix "no such alert" warning from specs/page.js by removing the apparently
redundant code.
Bug: T234002
Bug: T213268
Change-Id: I908997569ca8457997af30cb29e98ac41fae3b64
When using local storage, any page has to be open. UserLoginPage is usually used.
BlankPage should be slightly faster to load. It also makes it more clear than
any page would do the job.
Change-Id: I50b23993065ad6b093a6cc951d00b0bf7a3d5e68
Sometimes the element doesn't appear. This is breaking during gate-and-submit,
so skipping until it can be fixed properly.
Bug: T219440
Change-Id: I7286eb5499e34146acf5da3180b665436569a18c
This test is proving flakey (seen in Minerva and MobileFrontend)
Let's skip this until we've worked out the problem.
Bug: T220479
Change-Id: I3629d4109d8e0c5c4da0c7fb0b82cf59290c0db9
This also removes the helper method waitForScriptsToBeReady() and uses the more
general waitForModuleState() method directly.
Bug: T220479
Change-Id: I6be81ad68720449ef03b6a60b4b329040f236c72
Wait for an actual state to be reached, whether a JavaScript
expression to become true, or a certain state in the DOM.
Using pauses is an anti-pattern and inherently unstable.
Bug: T219440
Change-Id: Ibb2bd335f12442ab8ec2973031454cb58733211d
The test is broken only when and targeting beta cluster, because an
extension adds text to page. Instead of checking the entire body of
the page, test just checks if expected string is there.
Bug: T217544
Change-Id: Ibd67790c1df2cd8556b9c71d872d52cfc18f5ebd
This change is necessary to make the rollback confirmation work even
when the list of items which can be rolled back is updated via
JavaScript (this is possible on RecentChanges, for example).
Bug: T218354
Change-Id: Idafe1380b283cf0056ff1efdffa04aca92cf1217
This change prepares a form for the RollbackAction to allow rollbacks to
be triggered via POST while also ensuring users are always prompted with
a request to confirm the rollback if the rollback confirmation prompt is
enabled.
Bug: T215303
Change-Id: Iaf7e095b3bb34072eea6bcac76ba29358b14cc09
The basic functionality of being able to preview an edit is currently
not covered by a test, as far as I can see.
The assertion for a wpTextbox2 that should *not* be there is a result of
the issue documented at T209012, where the EditPage::isConflict flag was
accidentially set. This assertion makes sure accidential conflicts can't
happen again, no matter which extension might cause it.
Bug: T210758
Change-Id: Iae723430b3a88079ad3499429e65c29817eca67e
Many tests use the API during their setup phase, which does not
participate in clearing the job queue, but constantly adds new items.
Consequently the job count keeps mounting. In order to be able to assert
the state of the application once all jobs are processed we need a way
to invoke them.
This is a minimalistic alternative to Idd4924e16925cbf0cb9e42645670c3fd76b72353
Bug: T199446
Change-Id: Ifc49bc5c06eef71da8aff1b1837c32debc2c45dd
Selenium tests run fine when targeting MediaWiki installation in
MediaWiki-Vagrant and in Jenkins, but fail when targeting beta cluster.
Until tests are refactored to run without failure for beta cluster, let's disable
failing tests.
Bug: T185011
Change-Id: I12da893e7d624d4ebe478bccf0706aa07c965796
This test was already flaky and was fixed in
I1fd0c49263e975c6b24e2e1f9a072486a6565dda. However, this caused failures
on several repos. Temporarily disable it until we'll get it to work
properly.
Bug: T199644
Change-Id: I88be83e01eb1789f28f09fc4a0be7ea17f402858
Use page object to create the page we will be asserting on
Special:RecentChanges. Apparently (post send) jobs are not executed on
API calls (that were formerly used for test setup) and consequently
presence of the edit on Special:RecentChanges could not be guaranteed.
Bug: T199446
Change-Id: I1fd0c49263e975c6b24e2e1f9a072486a6565dda
Troubleshooting can happen in parallel without blocking
unrelated work from being merged.
Bug: T198137
Change-Id: Ie84a868a580968ff99ff6879050080c6495fa72a