Commit graph

21 commits

Author SHA1 Message Date
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
Bartosz Dziewoński
486e566cfe Special:Preferences: Use OOjs UI
* Change the form to OOUI mode. Tweak some formatting to look better
  with this mode. Change various random links to be OOUI buttons.
* Rewrite custom tabs to use OO.ui.IndexLayout instead.
* Update styles and JS enhancements for OOUI widgets.
* Rename ResourceLoader modules so that old skin-specific styles
  (from $wgResourceModuleSkinStyles) no longer apply. They tend
  to make no sense with the OOUI styling.

Bug: T117781
Change-Id: Ie9396f0146f5020e52710c41e55ec86151ae0095
2017-11-13 20:51:09 +01:00
Željko Filipin
d1439a3e67 Selenium tests should log in before creating pages
MediaWiki Vagrant by default allows creating pages to anonymous users,
but other environments, like Beta Cluster, require user to log in
before creating pages.

Bug: T176315
Change-Id: I34eeaf3cc22a64be6580aa483b28885137ba60b6
2017-10-03 11:46:01 +02:00
Željko Filipin
853cba1deb Create users and pages for Selenium tests using action API
This will make tests slightly more robust.

Bug: T164721
Bug: T167502
Change-Id: I9b2fea77b28af4f7f521490a0105e7d04730bc87
2017-07-07 04:59:14 +00:00
Željko Filipin
7aee98758a Selenium tests in Node.js using WebdriverIO
Introduce the WebdriverIO browser testing framework driven by Node.js.
The overall intents are:
* have MediaWiki core to provide a platform to run tests that is shared
  between core and the extensions.
* phase out ruby driven browser tests eventually.

Code is namespaced in sub directory /tests/selenium
The 'pages' sub directory provides helper representing a MediaWiki page
such as Special:Login and human friendly helpers to interact with the
elements.

Add Grunt task webdriver:test.

Provide a npm script to easily spawn/dispose chromedriver and run above
grunt task.

wdio.conf.js provides all the configuration. It defaults to point to a
MediaWiki-Vagrant installation on http://127.0.0.1:8080. Can be
overriden with environment settings as needed.

glob patterns (specs) are made absolute paths from MediaWiki root path
that let us run the tests either from the root path (eg the npm
wrapper or from the tests/selenium directory when invoking wdio
directly. wdio assumes they are relative to the current working
directory, hence the normalization.

wdio.conf.jenkins.js extends the configuration and is used solely for
Jenkins.  The switch is done from the Gruntfile.js whenever JENKINS_HOME
is set.  Specially we want junit reports to be generated.

Provide a more specific eslint configuration.

References:

* MALU https://phabricator.wikimedia.org/source/malu/
* T151442 Research WebdriverIO
* T151443 Research Nightwatch.js

Bug: T139740
Signed-off-by: Antoine Musso <hashar@free.fr>
Change-Id: Ibe7a004a120e82af637ab3e31b725de743134c99
2017-03-14 12:20:32 +01:00