Commit graph

314 commits

Author SHA1 Message Date
jenkins-bot 7862759c53 Merge "Re-enable test coverage reporting, add @covers tags" 2018-06-28 17:02:18 +00:00
Kosta Harlan da2da90b48 Re-enable test coverage reporting, add @covers tags
Bug: T195136
Change-Id: I9203232e79f162aedb982b713f708cebfe9d1ae0
2018-06-28 08:32:57 -04:00
jenkins-bot 855497c3ba Merge "Avoid counting where not necessary" 2018-06-26 13:54:59 +00:00
Thiemo Kreuz cb282251a8 Avoid counting where not necessary
Change-Id: I0abbdced4474dabbdecd3bbfae194e79b7c29db1
2018-06-26 07:10:38 +00:00
Željko Filipin 6aa871293e Use new page objects from mediawiki/core in Selenium tests
Bug: T171848
Change-Id: Ib6a08c6a34ef6a4bef8a81f49fed8aae67dc67dc
2018-06-22 15:23:23 +00:00
jenkins-bot e129533772 Merge "selenium: Make it possible to run tests from Echo folder" 2018-06-22 14:34:36 +00:00
Željko Filipin 53d849b3c9 selenium: Make it possible to run tests from Echo folder
Until now, Echo tests had to be run from mediawiki/core folder.

Add an independant 'npm run selenium-test' entry point
for local development. It comes with a minimal wdio.conf.js file that contains
only non-default settings, and runs only specs from this extension.
This also makes it so that screenshots are saved to this repo's
log directory instead of core's.

Bug: T171848
Change-Id: I1396f8d856c6cb1ad9818abf4ba09a4fcefdcfdc
2018-06-22 14:17:05 +00:00
Thiemo Kreuz d04b3f2710 Make use of PHP's …::class feature
Change-Id: Ifbb70f7b9d54e2e2bb713c8a13668344ac880a72
2018-06-19 18:11:23 +00:00
Thiemo Kreuz 6aa6824f96 Update some PHPDoc tags for improved type safety
Change-Id: I7573ab01e88c86c25180bc56b3874505aa00a047
2018-06-17 19:04:54 +02:00
Umherirrender 43820a6390 Move NotificationsTest to tests/phpunit
Under this folder the test is run automatically on CI or
phpunit.php --testsuite extensions

Change-Id: I5e466c04fc5c827883882f798ba0e41d6990e423
2018-06-06 19:30:35 +00:00
jenkins-bot bb453d23e3 Merge "NotifUser: Redo caching strategy for multi-DC compatibility" 2018-06-02 17:10:20 +00:00
Roan Kattouw d90e2d1066 NotifUser: Redo caching strategy for multi-DC compatibility
To use WANObjectCache correctly in a multi-DC-safe way, we need to use
getWithSetCallback() to read data, and call delete() when it changes.
NotifUser's caching of notification counts and timestamps relied
heavily on set() calls, and so wasn't multi-DC-safe.

Changes in this commit:
* Rather than caching counts/timestamps in separate cache keys, and
  using separate cache keys for each section (alert/message/all), put
  all this data in an array and store that in a single cache key.
  This reduces the number of cache keys per user per wiki from 6 to 1.
* Similarly, use a single global cache key per user. The global check
  key for the last updated timestamp is retained, so we now have
  2 global cache keys per user (down from 7)
* Remove preloading using getMulti(), no longer needed
* Move computation of counts and timestamps into separate compute
  functions (one for local, one for global), and wrap them with
  a getter that uses getWithSetCallback().
* Use TS_MW strings instead of MWTimestamp objects internally, to
  simplify comparisons and max() operations.
* Make existing getters wrap around this new getter. They now ignore
  their $cached and $dbSource parameters, and we should deprecate/change
  these function signatures.
* In resetNotificationCounts(), just delete the cache keys. In global
  mode, also recompute the notification counts and put them in the
  echo_unread_wikis table. We could also set() the data into the cache
  at this point, but don't, because you're not supposed to mix set() and
  getWithSetCallback() calls and I don't want to find out what happens
  if you do.

Bug: T164860
Change-Id: I4f86aab11d50d20280a33e0504ba8ad0c6c01842
2018-05-30 17:49:48 -07:00
Roan Kattouw 6cdebeb6ab tests: Delete the rspec tests
They keep failing intermittently in CI.

Change-Id: I4370eb0169b9dbd3a6578a94700c85d3b53ef933
2018-05-29 16:56:09 -07:00
Roan Kattouw 36d250da85 rspec: Use environment variables for user+password
Change-Id: I20273f1be7d11614879144a495c7853b6459e8b2
2018-04-30 15:46:01 -07:00
Roan Kattouw 2988b0ac04 rspec: Update wiki password for Jenkins
Apparently this changed. We should really use the env vars for this.

Change-Id: I4c4147ff6cc64d276588a16842bf436cb45e575a
2018-04-30 15:35:29 -07:00
Kunal Mehta 23a06fa5d4 tests: Remove expectations for methods that don't exist
These trigger warnings in PHPUnit 6.

Change-Id: I01ddd139f1226c1a905763cd98cb4ddb5242f4bf
2018-04-12 16:21:09 -07:00
Aryeh Gregor 86b4ed5c56 Remove call to doLogin(), which does nothing
I805520e5 is removing all callers from core.

Change-Id: I56025a9c64406f44cb157a17e308da358de0da47
2018-04-11 17:11:27 +03:00
Max Semenik 6f6e5062fe Don't ping from user talk links in summary
As discussed at T189034

Change-Id: I86f36ab55c0e03ba3bbd2ea1ee94ce3056d91e30
2018-03-08 14:36:58 -08:00
Max Semenik 9874e2d024 Allow to avoid pinging from summaries by prefixing with :
Bug: T189067
Change-Id: I0596c575a42754d2b86fd2164e15b5f46b9bca9d
2018-03-07 20:56:48 +00:00
Željko Filipin 67f0bb4763 Update README file for Selenium tests
Bug: T187862
Change-Id: I43e0a91966b07377dbbc487c5b3980c34cf53ad3
2018-02-27 13:57:52 +01:00
jenkins-bot d814e9c4bf Merge "Ping users mentioned in edit summaries" 2018-02-23 18:44:46 +00:00
Max Semenik 467b13fe89 Ping users mentioned in edit summaries
Disabled by default for now.

Bug: T32750
Change-Id: I8012b82b6e27cc2612fb2302d0c9feb3f3623d62
2018-02-22 12:37:35 -08:00
addshore 1bb986c407 Use overrideMwServices in DiscussionParserTest
Bug: T135023
Change-Id: Ibcef80224c998239f57a9353fa97ba6129fc53b1
2018-02-01 16:14:59 +00:00
jenkins-bot 1ea8a2dc55 Merge "Add @covers tags" 2018-01-24 01:29:07 +00:00
Kunal Mehta 59a125fc38 Add @covers tags
Change-Id: Ib8cf432b58470c9218519639379c83254acef1c8
2018-01-23 16:44:45 -08:00
Phantom42 ac6622711b Fix multiple PHP class declarations in one file in tests
All files containing more than one PHP class were split into
multiple files.

extension.json was updated to match new class locations.

phpcs `OneObjectStructurePerFile.MultipleFound` rule was
re-enabled.

Bug: T177809
Change-Id: I6fc2ec9cc35e6bac5a7c44d94b0f1b1b40e6dba5
2018-01-22 16:27:07 +02:00
WMDE-Fisch 9635657ab4 When running Selenium tests, use wd/hub
Now it works on Mac, Windows and Linux.

Change-Id: Idf984c89f541a44ad522ff4d765dc58ada407797
2018-01-18 15:02:42 +01:00
Max Semenik 62703e4dc8 Don't use deprecated DatabaseMysql
Bug: T120333
Change-Id: I3150bcd9aeefa154fc064bcc8078419521e6340c
2018-01-16 10:58:52 -08:00
Željko Filipin 58e9dda85c ESLint parserOptions is reduntand when es6 env is used
Bug: T171848
Change-Id: I27ad1fc514d7420f18601990beaf1411cd6d8687
2018-01-11 14:03:09 +01:00
Željko Filipin 30511cccdc Selenium test: alerts and notices are visible after logging in
The first Selenium test in Node.js using WebdriverIO.

Bug: T171848
Change-Id: Ie6bdc0f164e24c35db8a922df57428ec4d5452d3
2018-01-05 15:16:22 +00:00
Amir Sarabadani 30a5b88ea1 Use ExtensionRegistry instead of class_exists
Bug: T183096
Change-Id: I963704cdcfdbc97727f435eb16998c16c692ed01
2017-12-29 00:12:30 +01:00
Umherirrender 08cb7a470a Change doc type from DatabaseBase to IDatabase
Change-Id: I853b7cef85fdd77c28a947a8f3601f84ba17359a
2017-12-22 23:20:13 +01:00
jenkins-bot 611fdde4d9 Merge "Remove Ruby browser tests" 2017-12-22 11:54:46 +00:00
daniel 774610c0d4 Check for IDatabase (not DatabaseBase) in tests
Change-Id: Ia94fcae2a1dd28761b4e2f40fa1491f8401ad491
2017-12-21 19:52:10 +00:00
Matthew Flaschen 47c45866de Remove Ruby browser tests
The continuous integration infrastructure for these is being removed
(or never existed), and our team decided not to invest the time to
convert them to node.js.

Bug: T171848
Change-Id: I0faeecb2635f24c40c83aa689b670e69aa381431
2017-12-20 12:29:01 +01:00
David Barratt 6593a0a427 Prevent loading or saving of zeros in the database.
When intval() fails, the function returns a zero. We should remove
the failures from the blacklist.

Bug: T178512
Change-Id: I89ad680a287da16c2fbd6aa4d53a725142429144
2017-11-17 12:34:54 -05:00
Ed Sanders 892ba8e5fe build: Update eslint and other linters
Change-Id: I68b74742bea0c3d4c8e359fd7850beaa6bbc4190
2017-10-17 13:53:08 +01:00
Roan Kattouw 98370e8c83 ContainmentSet: Use strict comparison for array_search()
Otherwise, if $list->getValues() contains the number 0,
any non-numerical string will match, because 'foo'==0 is true.

This, in combination with a broken maintenance script that had
inserted 0s into some users' blacklist, broke all notifications
for those users.

Bug: T177825
Change-Id: If8700b4d0de0fdba876eb9d5cc4997e185dfeb3c
2017-10-14 16:31:13 -07:00
Umherirrender eba147a1b4 Always return false on EchoUserNotificationGateway::markRead
Also rename some variables.
$res indicate a ResultSet, not a bool

Change-Id: I4f0276cbe01a0391b4bd2616e111067b40363fea
2017-10-06 22:22:33 +00:00
libraryupgrader 7a23ddf4b0 build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I7b19fab3b1100c4973600ec95ee24160e141c5ac
2017-09-24 09:49:43 +00:00
Brad Jorsch 1f9eedf40f Remove reference to deprecated IDatabase->nextSequenceValue()
The method was deprecated and made unnecessary in Ib308190c.

Change-Id: I47aca6a7c77821119f52e639d0e74a1e6302532a
2017-09-06 13:05:14 -04:00
Željko Filipin ffaf7586dd Rake test target now runs RuboCop, RSpec and Cucumber/Selenium tests.
Bug: T164479
Change-Id: I73a075f1aa8ce3d6321f5b1eeb62fe27d1d021f0
2017-09-04 16:02:48 +00:00
Kunal Mehta 9095d5bcb5 Use namespaced ScopedCallback
The non-namespaced version is deprecated since 1.28

Change-Id: Iac0b120ccda77065a480e9461e7fcbd19d55f1db
2017-08-21 14:05:11 -07:00
MusikAnimal fdd1fe6d22 Duplicate new table from core, patch 349457
With 349457, anytime a revision is created, a corresponding record
is created in the new ip_changes table. This may cause tests to fail
if they don't drop the ip_changes table between individual tests.

https://gerrit.wikimedia.org/r/#/c/349457/

Change-Id: I48f0b64f19f9582b40540fa1b42a39d281979625
2017-08-11 15:51:03 -04:00
Kunal Mehta aaf061c725 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.ExtraParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I8401abf121a7413fa191d7bc535e0ddd6cf8c3f7
2017-06-22 14:13:28 +00:00
Kunal Mehta 5d2cde1022 Implement per-user notification blacklists
- Disabled by default, is a gated preference by wg variable
- User specifies blocks in Echo preferences
- Uses a TextArea with username separated by new lines as input
- Still allows notifications to come through on a user's talk page
- Cache the blacklist and whitelist

Requested at
<https://meta.wikimedia.org/wiki/2016_Community_Wishlist_Survey/Categories/Miscellaneous#Allow_users_to_restrict_who_can_send_them_notifications>.

Bug: T150419
Change-Id: Ibf548da4aa600bdc7848cba1947436e56ac48a4a
2017-05-24 16:09:04 -05:00
Brad Jorsch d7a77b0aba Fix usage of $db->nextSequenceValue()
The return value from the method is only suitable for passing to
$db->insert(). To get the inserted ID, you need to call $db->insertId()
even if $db->nextSequenceValue() returned non-null.

Bug: T164900
Change-Id: I466fd372804927b3ad72125c7a69d253bd7a24f8
2017-05-10 17:46:07 -04:00
Ed Sanders 571223a206 build: Update eslint to 0.4.0 and make pass
Change-Id: I30dd0e1ee56dbcbb7c60608a401179e2d37557ff
2017-05-04 20:57:37 +00:00
jenkins-bot a9d4fb257b Merge "Echo should notify user about mention on wikitext page" 2017-05-03 16:22:44 +00:00
jenkins-bot a3fd1af768 Merge "Echo should notify a new user with welcome message" 2017-04-26 16:11:02 +00:00