Commit graph

54 commits

Author SHA1 Message Date
Bartosz Dziewoński
46c3a0674a tests/selenium: Fix inputting DeletePage reason
Bug: T369872
Change-Id: Ief05bb819f7b9365e9509e89ec416b8619cf6461
2024-07-12 13:46:26 +00:00
Ed Sanders
2af1c3c901 build: Update eslint-config-wikimedia to 0.28.1 and autofix
Also remove temporary explicit dependency on eslint-plugin-vue
introduced in Ibd616750f046a.

Change-Id: Ic6330fcb116e99d5827b4877e094e3073e2b7b72
2024-06-11 19:03:53 +01:00
jenkins-bot
3185e5376a Merge "Add missing await in edit page." 2024-02-26 14:37:42 +00:00
Peter Hedenskog
7a548c1e01 Add missing await in edit page.
There are a couple of missing awaits when we call async functions.

Bug: T358094
Change-Id: I235732996f08a440d7fe04e9d19ce8f0d6aeda0f
2024-02-26 15:47:48 +03:00
Peter Hedenskog
4a42035c11 Add missing async.
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
2024-02-21 12:29:07 +01:00
James D. Forrester
c2aa05102d build: Upgrade eslint-config-wikimedia from 0.25.0 to 0.26.0 and make pass
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
2023-11-22 13:25:32 -05:00
Func
a6d3e64ae2 openForEditing: Wait until CodeMirror is fully disabled
Bug: T324879
Change-Id: I2a86a37fe2853890742bea2e7180f7d6c5f9304c
2023-01-17 06:00:09 +00:00
Func
6e3bf95a8e openForEditing: await openTitle
Bug: T324879
Change-Id: I4d8b88be43a8c7fbe391b75dc9043e55523f796b
2023-01-12 03:19:13 +08:00
Bartosz Dziewoński
43cc41d22c Disable CodeMirror while running Selenium tests
Bug: T324879
Change-Id: I81c0bd2cf036538d7727df008d7406b80caeddc9
2023-01-05 00:17:38 +01:00
jenkins-bot
89f360ca23 Merge "Always go to the source editor when editing." 2022-12-07 22:58:41 +00:00
dwalden
53b2a054f7 Always go to the source editor when editing.
Otherwise, the Selenium tests will fail on test2wiki because it defaults to VisualEditor.

Bug: T303739
Change-Id: I96e6c019968d9b4dcc890e4e73208bee7672f6d4
2022-12-01 07:44:04 +00:00
Željko Filipin
f4a4b07500 selenium: Run most tests targeting the beta cluster
Only creating account via the web interface does not work on the beta
cluster, because of CAPTCHA.

Bug: T323824
Change-Id: I7e9c6169f1c72450b4b620a8712629af7637f06b
2022-11-30 15:13:08 +00:00
Zfilipin
fc8264ce14 selenium: Fix failing tests
Tests were disabled for a long time because of 66e9dab5f5
so nobody noticed they were failing.

Bug: T303737
Change-Id: I57d0cd39a582beb7720488f2ae2cb5b69d38714f
2022-11-28 17:25:50 +00:00
Željko Filipin
31a826bf38 selenium: Delete PreferencesPage
The page is not used in tests.

Bug: T303737
Change-Id: I08d94efb739009b6736ffc0baa17f7122bd22289
2022-11-26 09:42:20 +00:00
WMDE-Fisch
ab4b1b2b6d [selenium] Remove leftovers from rollback tests
Leftover from Ieaccf37ad016f2e811aeb98d2bd2f061c9b13fbf

Bug: T280652
Change-Id: I87c8440d970bf0ae33160fb2031abb9e07dcc76f
2022-01-27 16:23:16 +01:00
DannyS712
676d8a6488 Selenium: provide CreateAccountPage in wdio-mediawiki
So that it can be used by extensions too. Use case:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/GrowthExperiments/+/702893

Change-Id: Ie1c71484526718b91c43ae881b0230ac4f1cef61
2021-07-08 03:50:24 +00:00
Petr Pchelko
ff4e6f59dc Add selenium tests for page protection
Change-Id: I31349f747dc1fa22c3bfbb3fe02386686aeb2cf1
2021-06-07 11:35:02 -07:00
jenkins-bot
5a844e9b08 Merge "selenium: Tests pass if Vector skin is not installed" 2021-03-09 20:22:46 +00:00
Željko Filipin
4cf24376b7 selenium: Tests pass if Vector skin is not installed
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
2021-03-09 15:02:03 +00:00
Gergő Tisza
d1bf6a036d Suppress VisualEditor welcome dialog in undo Selenium test
Bug: T276783
Change-Id: I1a67a1e8dc8c46e86aaadb0dccc9ec8d21f737c1
2021-03-09 14:51:34 +01:00
Ed Sanders
4fc3f3af24 build: Update eslint-config-wikimedia to 0.17.0
Fix remaining instances of variable shadowing.

Change-Id: I2a3840446f1fe138410249cc35be5ddf262d8e46
2020-08-20 12:45:09 +01:00
Ed Sanders
8b720e9bd6 eslint: Update to eslint-config-wikimedia 0.16.0
* valid-jsdoc replaced with jsdoc plugin
* New /selenium config

Change-Id: I471eebac0312cb25c539c3f6a3ecfc7cfd4ed8d6
2020-06-02 21:32:56 +01:00
Kosta Harlan
0257160852 [selenium] Make tests skin agnostic
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
2020-03-25 16:21:18 +01:00
Timo Tijhof
22d149c3f7 selenium: Fix more inefficient MWBot use and simplify wdio-mediawiki Api
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
2019-10-04 18:16:28 +01:00
Timo Tijhof
46586a243c selenium: Replace ES5 one-var assignments with const/let per line
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
2019-10-01 02:18:19 +00:00
Kosta Harlan
640b0b4943 Selenium: Hide VE welcome and beta dialogs
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
2019-09-30 21:57:23 +02:00
Timo Tijhof
776321bf1a selenium: Remove deprecated legacy methods
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
2019-09-29 02:31:51 +00:00
Timo Tijhof
1955a8aa56 selenium: Upgrade from webdriver v4 to v5
* 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
2019-09-29 02:59:44 +01:00
Ed Sanders
689d07b81d build: Update eslint-config-wikimedia to 0.13.0
Change-Id: I7df5840bc97f8bbcd8cfc875c2b48b3061ef2c9e
2019-07-05 13:32:26 -07:00
jdlrobson
b781ccb2c2 selenium: Asynchronous methods should be returned to browser.call()
Api.edit is asynchronous and is wrapped in a browser.call but
should be returned.

Follows-up 341320457c.

Bug: T220479
Change-Id: Id0e3549e93a967165bdc1bb758ddef8d59ccc300
2019-05-09 12:15:12 +00:00
tzhelyazkova
3990e0bbc7 Improve rollback tests setup by extracting repeating logic to HistoryPage object
This also removes the helper method waitForScriptsToBeReady() and uses the more
general waitForModuleState() method directly.

Bug: T220479
Change-Id: I6be81ad68720449ef03b6a60b4b329040f236c72
2019-04-30 18:17:00 +02:00
Tim Eulitz
0a84032711 Implement non-JS RollbackAction with form
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
2019-03-21 12:16:44 +01:00
Tim Eulitz
341320457c Show confirmation prompt on rollback links
Bug: T215020
Change-Id: Ic831888e30808a20a04397912498fe2ca04f80ba
2019-03-21 10:13:22 +00:00
Thiemo Kreuz
3b03ea9bdc Add browser test for preview functionality to MediaWiki core
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
2018-12-07 16:27:45 +01:00
Pablo Grass
32c36f0e73 selenium: undo page
Add basic undo page object and test showing a previous edit can be
undone.

Bug: T201901
Change-Id: Idc1b3889abc6e655032bc1576f1b9d591abd6c8d
2018-08-14 16:27:31 +02:00
jenkins-bot
22ff706ce0 Merge "Add browser test for basic watchlist functionality" 2018-06-25 09:49:02 +00:00
Jakob Warkotsch
b25d303007 Add browser test for basic watchlist functionality
Will be used to test more advanced title/link formatters downstream.

Bug: T191601
Change-Id: I0747c2d361e951f8b3765a3dca548e55edb72216
2018-06-19 16:24:48 +02:00
Pablo Grass
97b6792142 selenium: RecentChanges page object
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
2018-06-19 15:31:07 +02:00
Pablo Grass
948990f05d selenium: add RecentChanges test to page spec
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
2018-06-13 16:23:20 +02:00
Timo Tijhof
16a4d9da7b selenium: Initial version of wdio-mediawiki package
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
2018-05-09 14:43:30 +00:00
Timo Tijhof
2729bf4653 selenium: Minor clean-up in preparation for packaging
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
2018-05-08 14:42:59 +00:00
jenkins-bot
33fa8c095c Merge "Selenium: Replace nodemw with mwbot" 2018-03-21 15:17:06 +00:00
Željko Filipin
9c5fa5567b Selenium: Replace nodemw with mwbot
Bug: T181284
Change-Id: I012a5cc6a7f30a8652cbad87293eb119fa2e405f
Depends-On: Ic69be92c2b0b7a08a9b8cc417a40ebb38f249ea3
2018-03-21 13:34:37 +01:00
Željko Filipin
771c5a7814 Selenium: Upgrade WebdriverIO to 4.12.0
Bug: T180144
Change-Id: I8d34e2240fe76798c99315a54ea5bab63b2409e9
Depends-On: Ic69be92c2b0b7a08a9b8cc417a40ebb38f249ea3
2018-03-21 12:20:42 +00:00
Jdlrobson
33ba3cfebb Revert "selenium: add new message banner test to user spec"
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
2018-01-29 20:41:21 +00:00
addshore
6ca3e221d1 selenium: add new message banner test to user spec
Change-Id: I92dc612d215d1d3eb8dff02c2ff4d57da0105d69
2018-01-24 14:06:01 -08:00
addshore
9c7d876341 selenium, add restoration test to page spec
Change-Id: Ied06915f982e693b00edab14b8c29c978a5d6dff
2018-01-20 10:45:16 +00:00
addshore
52c7dc56df selenium: add deletion test to page spec
Change-Id: Ia17b52958778a09378eeb10c9f24ebe9229bd9f5
2018-01-20 10:41:41 +00:00
Željko Filipin
6e1b37c966 Page title is not used in Selenium tests
Bug: T182421
Change-Id: I0de9bf27f1227e7b29c5aaa28451823e80fa8ff1
2018-01-17 13:15:56 +01:00
Bartosz Dziewoński
808e45d13d Revert "Special:Preferences: Use OOjs UI" and follow-ups
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
2017-12-02 22:32:08 +01:00