This commit adds missing async defintions in a couple of
methods for our wdio page tests. It's better to define the
functions so that its clear that its async.
Bug: T358092
Change-Id: I9006deb9a9a0bb524ab61a16c6f41621482f21bf
Mostly this has a bunch of whitespace changes from the
template-curly-spacing and brace-style rules being set
to align with other spacing rules.
Change-Id: I4609c52a4ef426ad1f35fb4bfe447bb08323a8e8
Otherwise, the Selenium tests will fail on test2wiki because it defaults to VisualEditor.
Bug: T303739
Change-Id: I96e6c019968d9b4dcc890e4e73208bee7672f6d4
Only creating account via the web interface does not work on the beta
cluster, because of CAPTCHA.
Bug: T323824
Change-Id: I7e9c6169f1c72450b4b620a8712629af7637f06b
Tests were disabled for a long time because of 66e9dab5f5
so nobody noticed they were failing.
Bug: T303737
Change-Id: I57d0cd39a582beb7720488f2ae2cb5b69d38714f
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
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
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
Api.edit is asynchronous and is wrapped in a browser.call but
should be returned.
Follows-up 341320457c.
Bug: T220479
Change-Id: Id0e3549e93a967165bdc1bb758ddef8d59ccc300
This also removes the helper method waitForScriptsToBeReady() and uses the more
general waitForModuleState() method directly.
Bug: T220479
Change-Id: I6be81ad68720449ef03b6a60b4b329040f236c72
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
Return DOM element(s) to specs instead of creating another level of
inflection and to be more in line with other implementations.
Follow-up for I916516d5055c3ce9be071a75e5c3af2b3547d4ba
Bug: T191600
Change-Id: I03b0cd4af7adca23dd34173710b995629f833a1a
Add Special:RecentChanges page object with method to retrieve
displayed titles, test page last edited is shown there.
Will be used to test more advanced title/link formatters downstream.
Bug: T191600
Change-Id: I916516d5055c3ce9be071a75e5c3af2b3547d4ba
This is new package will be reusable by other repositories for
their browser tests, without having to reference the internal
selenium/pageobjects/ directory from MediaWiki core.
In addition to not requiring direct imports, it will also avoid
problems in the future by allowing the package to be versioned
and iterated upon without forcing an atomic global upgrade
(or broken master builds), everytime we change something.
See wdio-mediawiki/README for details.
Within MediaWiki core itself, the package is used using the
'file' specifier in its package.json, so that we always test
and develop using its working copy, which makes drafting and
testing changes easier.
Also misc changes to make wdio.conf easier to understand.
Bug: T193088
Change-Id: I547a7899e7a97693a93567dd763784e637433d55
This is functionally a no-op, purely refactoring (mostly style).
* Consistently require packages at the top of a file.
(e.g. MWBot in edit.page.js).
* Remove unused .call(this) from mwbot interaction closures,
which didn't use 'this'.
* Use Node.js regular Promise chaining with then(), instead of
complex bluebird.coroutine generator function yields, which
are intended to emulate async-await, but the syntax is quite
error-prone for inexperienced developers and hard to debug.
Once we require Node 7+ for the selenium tests, we can use
async-await here natively, but until then, might as well use
regular then() syntax, which we already use elsewhere in the
tests, and is also what MWBot documentation uses.
* Also applied some minor whitespace changes for consistency
among these files and other MediaWiki JS. E.g. no empty line
before the first statement of a function. Add a new line between
different methods, and between the end of a class and the
export statement.
* Remove 'use strict' from test files. The patterns that would expose
the bad non-strict behaviour are mostly already forbidden by ESLint,
and the run-time optimisation to disable non-strict can't be noticed
in tests (more useful in prod where e.g. the same process would run
a function 1 million times). Main reason here is to keep things
simple for new-comers and reduce boilerplate, given that these tests
will mainly be worked on by browser-JS developers, not Node.js devs,
and we don't currently use strict mode in our front-end code, either.
* Remove unused bluebird dependency.
Bug: T193088
Change-Id: I59f9211299e8e884c28c7733bcee3b7b28542610
This reverts commit 6ca3e221d1.
This is breaking CI for the Minerva skin and Echo as Echo changes how
this interaction works. When the browser test tries to locate the
div.usermessage it has moved so fails.
This test needs to be rewritten to take this into account.
On a side note, given usermessage is generated by all skins (and not
in core) there is a big argument to be made that this shouldn't be in
core but in the individual skins. MinervaNeue the mobile skin notably
does not use this class so this test would always fail on a mediawiki
instance which only uses the Minerva skin.
Bug: T185928
Change-Id: I43b6cf328aaf4a4fded0bb9746716c4cc9d8f364
The number of issues with the new interface is unacceptable and we
will not be able to fix them reasonably quickly. See subtasks of
T180538 for the list of issues, raised both by the Wikimedia community
and by WMF employees.
I should have pushed back harder against the merging of this half-baked
change with the promise that we'll fix it later. I convinced myself
that the regressions were not so noticeable and that the issues that
were pointed out will in fact be fixed by someone. Predictably,
however, regressions were bad and the only person fixing the issues
was me.
I am not going to work nights to make this page decent again within a
reasonable timeframe; I'm not sure if I'd even be able to since many
issues are problems with the design rather than the implementation. No
one else seems to be working on improving it, therefore I am reverting
the change.
On the bright side, this work has resulted in a number of improvements
to HTMLForm and Preferences code, which are not being reverted here:
<https://gerrit.wikimedia.org/r/#/q/topic:T117781>.
If anyone reattempts this, I recommend gating the new interface behind
a configuration variable and URL parameter, like we did with
$wgOOUIEditPage in the past, and testing thoroughly in production
before enabling it for everyone.
* Revert "Special:Preferences: Use OOjs UI"
This reverts commit 486e566cfe.
* Revert "Preferences: Show preview of edit fonts in edit font selector"
This reverts commit 6634ff729d.
* Revert "Follow-Up Iae63b6994: Add missing editfont dependency"
This reverts commit ce42fdf151.
* Revert "Preferences: Improve visual appearance by “unboxing” sections"
This reverts commit c9415bb005.
* Revert "Remove box-shadow from preference panels for ooui-apex"
This reverts commit a934b82ca2.
* Revert "Preferences: Don't show the watchlist token; just link to ResetTokens"
This reverts commit e8c9102fc7.
* Revert "mw.special.preferences: Make the "Basic information" section more compact"
This reverts commit d48b7260f3.
* Revert "mw.special.preferences: Widen the dropdown of the "Time zone" field"
This reverts commit afd5f1417e.
Bug: T117781
Bug: T180538
Change-Id: I44b5daea1828f71881b5bd35218f5ecb7ab7f36e