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
Run the script explictly via sh, the default is cmd.exe on Windows.
Also ported from bash to sh per Jforrester's request.
Change-Id: I96b66c6ae01a1761619955be2e8a3dbc64edff18
This package was serving two purposes:
* Install chromedriver automatically.
* Start chromedriver automatically when using the
'npm run selenium' entry point (e.g. for local development).
For the CI entry points (selenium-test, selenium-daily) the
chromedriver is skipped. For those, we expect the CI runner to
have started a chromedriver server already, which allows the
server to continue running between different the test suites
of different extensions etc.
By letting WDIO start the chromedriver for local development,
we had the benefit of 'npm run selenium' directly being an alias
to the 'wdio' command. This made it easy to pass additional
arguments like --spec or --mochaOpts for running specific tests
only and overall makes things easier to reason about from a
developer perspective with fewer (required) layers of
indirection you see and need to understand when debugging.
But, this has also caused problems. Specifically, it means
developers have to use the same version of Chrome locally
as we specify in package.json which isn't very flexible. While
we could try to keep this up-to-date roughly, that too isn't
an option because the secure environments we recommend for local
use (Quibble and Fresh-node) both use a Debian distro with
typically older versions of Chromium than your local auto-updating
Google Chrome.
For now, let's go back to moving the responsibility of installing
chromedriver together with the responsibility to install Chrome
itself.
== Changes ==
For CI, nothing changes (it already installs both).
For developers using Quibble, Vagrant or Fresh nothing changes
(already installs both).
For developers who make their own secure environment, they will
need to make sure chromedriver is installed, just as we required
between 2017 and Aug 2019 before my commit 1955a8aa56.
== How ==
wdio-chromedriver cannot start a foreign install because the
protocol can change between versions, so unfortunately together
with not using chromedriver from npm, we also can't use
the wdio-chromedriver autostart mechanism. Instead, I'm bringing
back Antoine's shell script that did this prior to ebda397c54.
But, with a few tweaks so that it forwards shell arguments,
this way developers continue to enjoy the benefit of 1955a8aa56,
which is that 'npm run selenium -- --spec foo.js' works.
Bug: T234610
Change-Id: I03ca94315d0611d2b6abccc12cf9076d41b2c00e
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
Simplify the README to only mention the bare minimum about
how to use WDIO itself. The rest is deferred to the various wiki
pages, which are more up to date.
Also removes selenium.sh file, which is no longer used as of 1955a8aa56,
I forgot to re-remove it during one of the rebases.
It is now supported to pass arguments to 'npm run selenium' as well.
Previously, arguments were only supported for 'npm run selenium-test',
which required manual starting of a chromedriver.
Bug: T214708
Change-Id: I5951af9146ac5fdce8d6506d703620049d6efe74
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
These are from 2018, prior to introducing wdio-mediawiki in
commit 16a4d9da7b. Some extensions referenced these pageobjects
files through escalating "../../" references.
None of these are seen in Codesearch anymore, as well as no
references to these deprecated methods by other means.
Change-Id: Idbc373f13f9767cecd6404922b5c9773d796dda5
* 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
I removed these in e78484109a because they seemed redundant
given that the library used by wdio-sauce-service already reads
these when present. However, our current version of this package
clobbers this unconditionally with config.user/config.key, thus
not letting it reach that default.
Also add sauceConnect:true which means developers can run
localhost tests against sauce labs if they so choose.
Change-Id: I8d31a23374b2b9b6cd6f1405c7a2f1001da08f1a
Also, remove the redundant unprefixed `user` and `key` options.
These would be cleaner to set through `sauceConnectOpts`
as `sauceConnectOpts { username: …, accesskey: … }`, but even
that isn't needed because wdio-sauce-service already reads these
same environment variables directly. No further config needed.
Also remove the duplication of default variables we don't have
any particular preference for yet so that enjoy improvements to
these when upgrading.
Change-Id: I0d4802f83509b0b49f775560b508d9929ae9979e
This functionality was previously copy+pasted for most other methods,
and is also useful externally, to make API requests that are not covered
by other methods in Api.js.
createAccount() needs a different type of token, so for now we leave it
alone. (Perhaps the token type could become a parameter of bot() later?)
Change-Id: Ica24213a1f0d651bfc3fbffe24b63251a4841658
The initial version of this package (added in change I547a7899e7, commit
16a4d9da7b) was 0.1.0, not 1.0.0.
Change-Id: I39511be15ea8ec27692f8547f375349bb6384a6b
So that we can use different framework and let developers easily upgrade
webdriver.io, selenium tests for extensions and skins must now be run
directly at the root of the extension or skin:
cd extensions/Foobar
npm install
npm run-script selenium-test
All repositories had the entry point introduced and Quibble 0.0.34
supports that new scheme. Thus Wikimedia CI runs extensions / skins
tests twice: once via mediawiki/core and once via the 'selenium-test'
script.
Remove the glob specs for extensions / skins from wdio.conf.
Bug: T199116
Change-Id: If19db4e45b56989e2c15240a9ed0e8a55a940fb9
a1e51bf943 unpublished 3 RunJobs methods
They do not appear to be used according to wmf codesearch
and, given their limited usefulness, are unlikely to be used elsewhere.
Change-Id: Iaefe6f71320c2c3ab86468bf827b6e8d2e80095d
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 reverts commit c3878c08b5.
Now that we're running on node10, this will fail until we fix
things.
Bug: T213268
Bug: T222406
Change-Id: I5935fc5d5bc23978e50275d3c99ac870b3b82f49
This is so that we can migrate to node 10 in CI. It should only land
for an hour or so, and is to be reverted as soon as we get CI up to
node 10 and working, lest our suites of selenium tests become
subject to bitrot.
Bug: T222406
Change-Id: I9473e0213c070a0e963913fd81062c6bbf9ec2f2
These test must be run from the extension's repo, because they use a custom
script to modify LocalSettings.php.
Bug: T190829
Change-Id: I920c7faa3ce91f1560f383575aa6a6adfcadd9c7
Api.edit is asynchronous and is wrapped in a browser.call but
should be returned.
Follows-up 341320457c.
Bug: T220479
Change-Id: Id0e3549e93a967165bdc1bb758ddef8d59ccc300
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
To match the Minerva repo per I3a48ecb768a, currently
requires duplication of logic here because Quibble ignores
per-repo settings (tracked as T199116).
Bug: T222517
Change-Id: I857458c4fd9185dea03566183f40216252c533cd
This also removes the helper method waitForScriptsToBeReady() and uses the more
general waitForModuleState() method directly.
Bug: T220479
Change-Id: I6be81ad68720449ef03b6a60b4b329040f236c72