Commit graph

372 commits

Author SHA1 Message Date
Daimona Eaytoy b84487b6f4 Avoid DB access in non-database tests
Bug: T155147
Change-Id: I812e9695f3db0db7e8b0d1001478adc90d35652b
2023-08-01 20:04:24 +02:00
Jon Robson be398f8a29 Disable flakey test
Noticed this today.

Apparently was reported a long time ago so let's disable this for
now.

Bug: T334634
Change-Id: Id46a8a7d4b9a22ed5d1bd5df5d5f9b03df1f72b0
2023-07-27 09:45:57 -07:00
Daimona Eaytoy 731c0b5703 Avoid accessing the database in SkinUserPageHelperTest
TestUser's are created for real in the test database, but this test
doesn't need that, especially because it's not in the Database group.

Change-Id: I8261b7e8130f0698df4f1684da767f312504c307
2023-07-17 18:11:32 +00:00
Daimona Eaytoy e9e3095a10 Convert MinervaPagePermissions to Authority
Move away from User, and use Authority instead. The only exception is
isBlockedFrom, which still requires a User object, so inject a
UserFactory for that.

Simplify the test accordingly, and also remove implicit assumptions as
to what certain user groups are or aren't allowed to do (e.g., watch
pages).

Also avoid using TestUser as it needs a DB connection.

Change-Id: Idfff8fd00f7b01df1dc6ec509dfc0cbd10ce7ce0
2023-07-17 20:11:23 +02:00
Umherirrender 32c1ebd3cc tests: Make PHPUnit data provider static
Initally used a new sniff with autofix (T333745)

Bug: T332865
Change-Id: Ie3edbdce0d5eae5b09236675469f32719cee558d
2023-05-20 10:58:18 +02:00
Umherirrender b24107fbcf build: Updating eslint-config-wikimedia to 0.25.0
Change-Id: I3280de17d1dbd2da5980ea87cf29f420a99b457b
2023-05-16 00:02:49 +02:00
Umherirrender 69dd6f1c5b build: Convert resources/.eslintrc.js to json file
No javascript code in the file

Follow-Up: If778a8176b8a18cc9a5501f7147cc39fc0a48d45
Change-Id: I556d34a0f9e880cd4a0b97d7ef3e0831e2fef5eb
2023-04-11 19:06:04 +02:00
Vaughn Walters 677ce50b24 selenium: Refactor WebdriverIO tests from sync to async mode
WebdriverIO has dropped support of sync mode, hence changed to async.

Update npm packages: @wdio/*, wdio-mediawiki
because async mode needs at least @wdio v7.9.

Remove npm packages: @wdio/dot-reporter and @wdio/sync.

Bug: T293084
Change-Id: I5babbdadf21e9f951f69de93bfca5213a50965aa
2023-04-08 16:18:28 -05:00
Umherirrender b21e4a98bc Avoid use of deprecated User::idFromName
Use a UserFactory instead of getting an id and the user objects on
second request

Also replace another deprecated User class and use the injected factory

Bug: T325687
Change-Id: Id610ee39e0ef865b97f7ae8506188eea04a86ac5
2022-12-21 22:35:49 +01:00
Željko Filipin da92d66df1 selenium: Skip flaky test
"Wikitext Editor.Closing editor (overlay button)" is breaking CI in core.

Bug: T313775
Change-Id: I3dd3d196a09d7a62faf78d31239e3c8d00141704
2022-12-07 15:47:58 +01:00
Željko Filipin e4abf9c0fb selenium: Delete failing test
"Wikitext Editor (Makes actual saves).Broken redirects" is constantly
breaking CI in core.

I have enabled it in
b9a92ef717
but it isn't as stable as I thought.

Bug: T280652
Change-Id: I667f65a27fd420a3a70f39fb5e1606907e465897
2022-11-30 18:57:21 +01:00
jenkins-bot 16bcb0e716 Merge "selenium: Enable one skipped test, delete one failing test" 2022-11-28 22:07:04 +00:00
Umherirrender 7346ac5494 tests: Replace assertEmpty with assertSame
assertSame avoids use of loose comparisons and
allows to check the expected type

Change-Id: Icd903f3b4397896380e2a087d0e8029920d7be92
2022-11-24 22:51:26 +01:00
Željko Filipin b9a92ef717 selenium: Enable one skipped test, delete one failing test
'Broken redirects' was disabled in 69a100cb45
'should be creatable' was disabled in 5e0dd88af0

'should be creatable' is failing so it is deleted.
'Broken redirects' is passing so it is enabled.

To be sure that the passing test is not flaky, the CI has ran it 100
times, it never failed.

Bug: T280652
Change-Id: I34a863dcbd126c2da8a98624e6ba1fa916eac0cf
2022-11-24 12:31:34 +00:00
Moh'd Khier Abualruz 9c94cb9b52 Special contribute Selenium Test
Fix Beta tests on Minerva, to accept both cases of enabled and disabled contribute special page.

Change-Id: Ic538655d63347a432029e7d637e9251662d560aa
2022-11-15 09:49:31 +01:00
bwang 43d32233d1 Fix a11y logged in test case on beta
Change-Id: I2baa60a512522525163758b454d8826e5f0fa63d
2022-10-21 17:35:40 +00:00
bwang 130ca9c54d Disable headless puppeteer for a11y testing
Change-Id: I33b0fcb1f132ae62824b48511c3a02a3d95e9c55
2022-10-07 14:59:14 -05:00
jenkins-bot 401683288d Merge "Add automated a11y test coverage to Minerva" 2022-10-06 16:37:18 +00:00
bwang a5f9dfd1d4 Add automated a11y test coverage to Minerva
Bug: T319080
Change-Id: I156fd765f02a3deb01722770de68ebbd4f076d5b
2022-09-30 20:26:05 +00:00
Bartosz Dziewoński 69ef22e6bd Remove Minerva talk pages Selenium tests
The feature is being replaced by DiscussionTools. We're not ready to
remove it completely yet, but the tests are preventing us from
enabling it on additional wikis.

Bug: T317467
Change-Id: I8b8206d2810426cf4e09da37d0fcd8dec766ccb3
2022-09-30 00:11:05 +02:00
Fomafix f831849a7d Mockup config variables for TitleUtil.test.js
Use the config parameters from the core file
tests/qunit/resources/mediawiki.Title.test.js

This change allows to run the JavaScript tests on a wiki with a non
English content language.

Change-Id: Ie2b45646117b48904798f9ac64fd8a70d39e49e1
2022-08-18 13:17:48 +00:00
Ed Sanders c19cdec800 Replace bugzilla bug numbers with Phabricator task IDs
Change-Id: I0e8bd586ee0d3d9c3a1d5c14e96e2d0adc64a427
2022-07-18 14:20:11 +01:00
suecarmol 3efc6db04b Group.php: Hard deprecate insertAfter() function
Hard deprecated the Group::insertAfter() function because it is not used in the Mediawiki codebase

Bug: T311894
Change-Id: I209d3fd492713425a2727fd48c5870f983a39f9b
2022-07-07 17:27:24 -05:00
suecarmol 3e1cb1718f Refactor MainMenu building
* Created a buildMenuEntry function
* Replaced all Group::insert() functions with Group::insertEntry()
* Added a trackable parameter to check if a menu entry will be trackable
* Removed the MenuEntry class
* Removed the MenuEntryTest class
* Removed the Group::insert() function
* Changed tests in GroupTest to test Group::insertEntry() function

Bug: T221004
Change-Id: I39bed4e9a9b09f904cb3e5d78ccb3e6e175981a8
2022-06-23 18:29:05 -05:00
Jon Robson 8c57c9c12d Enable special page tabs
For now this should be a NOOP as the existing "special" page tab
is removed, put it paves the way for using tabs on special pages.

Bug: T286466
Change-Id: Ic0b52b298d598c20987b172c81c732a31e409402
2022-05-18 21:41:00 +00:00
Ed Sanders 86caa17713 build: Update linters and linter config
* Update stylelint-config-wikimedia to 0.13.0
* Ensure eslintrc.js and root files are linted
  with server config

Change-Id: I59c49fedd5b0c4c5620f960b78e4f781a6bc5abb
2022-05-18 14:33:23 +01:00
Timo Tijhof 5a65bd5200 tests: Minor clean up of in TitleUtil/UriUtil tests
* Declare variables inline, as per the current code conventions.

* Use built-in assert.true() and assert.false() in a few places.

* Use built-in QUnit.test.each() to remove need for ad-hoc loops and
  inline composing of assertion messages with common prefixes. This
  also creates clearer and more detailed test reports, and more granular
  ability to re-run specific test cases.

* Remove unneeded use of `QUnit.newMwEnvironment()`.

* Simplify restoring of mw.Uri by storing the original reference
  once outside the test, and then re-using that each time.

* Use mw.config.set() for improved familiarity and rely on natural
  restoration instead of the extra 'config' key abstraction which is
  another thing to learn and understand.

Change-Id: I796e034854203d2e0e78e510458f4b34603e9901
2022-05-15 00:46:28 +00:00
Timo Tijhof 9f180f3556 tests: Remove use of QUnit 1.x setup()/teardown()
Bug: T250045
Change-Id: I2bcb6a2b4fe654db26c1feb3a9aa2bd0c3613049
2022-05-15 00:46:13 +00:00
EllenR b94ce6adbd Normalise PHP namespaces used in MinervaNeue
removed commented out code
changed namespace Tests\MediaWiki\Minerva to namespace
MediaWiki\Minerva

Bug: T303104
Change-Id: Ie151dcbfc65b49cb91fea81f8526287ca18d7a7d
2022-05-05 07:07:45 -06:00
Jon Robson 55419f9bcc [Tests] Strengthen the reference drawer test
Assert the drawer is visible before clicking it.

Bug: T266704
Change-Id: Iec1d2a2c0a4b34509f4b73ed87ccc63eeecad671
2022-04-18 23:05:29 +00:00
lens0021 ea8c30b65c phpunit: Implement the new BundleSizeTest::getSkinName()
Bug: T305779
Depends-On: Id77c6124c9b1fd20633cda47bbca89f9b6724a63
Change-Id: Ia82018a31ff6ce2fe80946fd8f8d05a1dddf9523
2022-04-12 00:50:24 +00:00
Jon Robson 996b3fc36b Remove browser tests in Ruby
These are never run. We are not running them manually, so we should
remove them from the codebase.

Change-Id: If54b45dfc72f32c2631a4338096b568aae5d404a
2022-04-05 15:49:35 +00:00
Jon Robson c4f7c60f9f [Tests] Move beforeEach calls into tests
beforeEach failures do not have videos associated. We'd like to see
what's going wrong with these tests.

Change-Id: I1b723bcd7d00f15907647d5c7a4aa1f57578468c
2022-03-17 14:14:10 -07:00
jenkins-bot 366d37efb1 Merge "Revert "[Tests] Check for VisualEditor in editor overlay integration test"" 2022-03-16 22:01:31 +00:00
Jdlrobson 63e744d147 Revert "[Tests] Check for VisualEditor in editor overlay integration test"
This reverts commit 422e3a3b09.

Reason for revert: The Ruby tests don't run. This change should be in
the Node tests.

Change-Id: If59753569b1eb24ffaf2486242ea49e794d388b5
2022-03-16 21:44:55 +00:00
jenkins-bot ddc5252b52 Merge "[Tests] Check for VisualEditor in editor overlay integration test" 2022-03-16 17:22:47 +00:00
Jon Robson 422e3a3b09 [Tests] Check for VisualEditor in editor overlay integration test
The mobile editor can load in two modes - visual editor or wikitext
editor. On the beta cluster depending on user preferences, the
VisualEditor may be loaded.

Since this test is just a smoke test that checks it renders, it's
okay to look for both.

Bug: T301575
Change-Id: I8192fc6e71e064278f62fc41e80652860f319e37
2022-03-15 22:41:51 +00:00
Umherirrender 4831549b14 Replace Title::newFromText by Title::makeTitle
* Prefer Title::makeTitle in unit tests where the title is known,
  this avoids title parsing and can improve the test performance.
* Use Title::makeTitle for the user page like done in User::getUserPage

Change-Id: I3901a6ed208a5ff90b216d01d3c4962cdcb48db1
2022-03-10 22:42:56 +01:00
jenkins-bot 1a2960a3c0 Merge "Tests: expected value goes first in PHPUnit assertions" 2022-03-10 20:55:17 +00:00
DannyS712 3da8d0c734 Tests: expected value goes first in PHPUnit assertions
Change-Id: I5dee074f69a48a6aca218855859a518ca1c051e1
2022-03-04 19:11:34 +00:00
Reedy b6685f9c4a Namespace SkinMinerva
Change-Id: I8f6bddac9f8cd060c551651e711ee987b8bbfbe3
2022-03-04 17:50:20 +00:00
Bartosz Dziewoński ff00b6d9c5 Disable failing talk page tests temporarily
Bug: T302993
Change-Id: I1cbe8367394fdee1c0a88d5dbe2bd00da0b74062
2022-03-03 19:50:09 +01:00
Željko Filipin 436bf80bd8 selenium: Delete tests disabled for more than 1 year
'Redirects' was disabled by Edward Tadros in fbd373b (2021-01-15).

'A newly created topic appears in the list of topics' was disabled by
Jon Robson in d4828b2 (2020-09-24).

Bug: T280652
Change-Id: I63fb62c0c2871ff2713643285cd6e5d878684f83
2022-02-16 15:58:00 +01:00
Umherirrender 791cb1081a selenium: Ensure .waitForDisplayed() before .click()
Avoid time outs
Error in "Opening and closing the reference drawer.Opening a nested
reference"
Error: waitUntil condition timed out after 5000ms
    at Browser.<anonymous>
(/workspace/src/skins/MinervaNeue/node_modules/@wdio/utils/build/shim.js:270:24)
    at iShouldSeeDrawerWithText
(/workspace/src/skins/MinervaNeue/tests/selenium/features/step_definitions/reference_steps.js:25:10)
    at Context.<anonymous>
(/workspace/src/skins/MinervaNeue/tests/selenium/specs/references.js:44:3)
FAILED in chrome - /tests/selenium/specs/references.js

Change-Id: Ia5d493fba4995c1122721b76ae98d6ba60399238
2022-02-03 21:18:02 +01:00
Jon Robson 0b3d21d58d Main page definition come from MediaWiki:Sidebar
Bug: T291568
Depends-On: Ia54d01eb5d8d9c33d067f61c73203f9fec4569a6
Change-Id: Ia9998780dc0a5f51af52d928499b51d5566cf29d
2022-02-02 00:44:56 +00:00
Antoine Musso 0fbb2a34f2 selenium: run tests concurrently
Wikimedia CI now serves MediaWiki over Apache (T285649) which mean we
can do concurrent requests!

Bug: T226869
Change-Id: Ifb155b7a14f5dd7b037578c83c9590f7901feacf
2022-01-05 16:44:12 +00:00
jenkins-bot 3bb487b733 Merge "Minerva uses core page title handling" 2021-12-22 18:06:54 +00:00
bwang bcdfd66fa6 Use watchstar() instead of deprecated jQuery event to update watchstar classes
Depends-on: I88af8585e8fc75f77ebef867d267199aeb2c6592
Change-Id: I859c9d763e77bb06b5109d419fb581258f3bd665
2021-12-21 16:43:57 +00:00
jdlrobson f9a8703a64 Minerva uses core page title handling
Bug: T265892
Change-Id: I2ffdedd64414ffb3c6e441391a75fd6e744847a4
2021-12-20 19:39:42 +00:00
Thiemo Kreuz bb31754073 Use PHPUnit shortcuts where possible
This makes the tests a little easier to read, I would argue.
any() is the default anyway. It doesn't add new information to the
test.

Change-Id: If4655ddea494f1054538a760802b583e17c0108e
2021-12-17 11:29:48 +01:00