Commit graph

161 commits

Author SHA1 Message Date
James D. Forrester eb4e17f15d build: Enable phpcs rule 'PSR2.Classes.PropertyDeclaration.ScopeMissing' and make pass
Change-Id: I96b295bba43185085631722e10a5e5cfa7ecf27f
2015-10-29 13:06:43 +01:00
James D. Forrester 7f7e6b8159 build: Enable phpcs rule 'PSR2.Methods.MethodDeclaration.StaticBeforeVisibility' and make pass
Change-Id: Iff0709c3a30f8c39d54bab2361e109c96aea6aa0
2015-10-29 13:06:43 +01:00
James D. Forrester cd8c77df29 build: Enable phpcs rule 'MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment' and make pass
Change-Id: Ied1a479e6f5aa82d03e449ec10d655a921cd37e4
2015-10-29 13:06:14 +01:00
James D. Forrester 18969bf227 build: Enable phpcs rule 'Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma' and make pass
Change-Id: I5493cb692525ab6c0d560aebbe131f40b6016232
2015-10-29 12:57:02 +01:00
James D. Forrester becbea0941 build: Enable phpcs rule 'Squiz.WhiteSpace.LanguageConstructSpacing.Incorrect' and make pass
Change-Id: I9379c18263474ed13921791b920c7b06e58a84ad
2015-10-29 12:56:33 +01:00
Stephane Bisson ba2d072255 Browser tests: using mw_selenium 1.5 because 1.6 is broken
mw_selenium errors out with undefined method `last_session_ids='
when run in jenkins.

Bug: T114368
Change-Id: Ie4d1b15be3b12694d9adba8747f1457f43ead57c
2015-10-23 11:53:34 -04:00
jenkins-bot 14a5bc371d Merge "Add browser test for notifications in Echo" 2015-10-13 17:29:02 +00:00
Moriel Schottlender 8b2c6355cc Add browser test for notifications in Echo
This browser test checks that mentions go to alerts and talk page
messages go to messages popup. This also upgrades the MW-Selenium
version in Echo tests to 1.6.1.

Depends on MW-Selenium version 1.6.1 (See T114061)

Bug: T113081
Change-Id: I40a17500cdfb838420c04dc0b9268ba56515cc2c
2015-10-04 22:23:51 -07:00
Siebrand Mazeland 33126b69aa Update formatting
In preparation of Code Sniffer based updates.

Change-Id: Id5d43332b44a37665d57dc24ef8c432bc65b2f6a
2015-10-03 23:28:54 -04:00
Željko Filipin 8afe4c1c15 Fixed Metrics/LineLength RuboCop offense
Bug: T114095
Change-Id: I598e4782e97c7b571f92a802c816db6567169d1d
2015-09-29 14:59:05 +02:00
Moriel Schottlender 3ea86361a4 Rewrite browser tests for Echo
The new oouified echo popup makes the tests invalid; this commit
rewrites those tests.

Also by doing this commit we are upgrading to Selenium 1.4.

Change-Id: I26215558768d55be449276c55b4b745c3a458ecb
2015-09-25 15:50:59 -07:00
Alangi Derick ba4789760c IP addresses should link to Special:Contributions instead of user page for revert
This changes the revert notification (special page version) to link
to the contributions page for anonymous (logged out) editors.
It still links to the user page for logged in editors.

Bug: T55564
Change-Id: Ib1f17fb88237b96cda63dd30ed488a8ffd84750e
2015-09-20 15:53:10 -04:00
Moriel Schottlender 1ac72cc01a Split alerts and messages in Echo
Split the notifications into 'alert' and 'message' badget with two
different flyouts. Also clean up styling and module behavior.

** Depends on ooui change Id4bbe14ba0bf6c for footers in popups.
** Depends on ooui change Ie93e4d6ed5637c for fixing a bug in
   inverted icons.

** MobileFrontend must also be updated to support the new modules
   in this patch  I168f485d6e54cb4067

In this change:
* Split notifcations into alert and messages and display those in
  two different badges.
* Create two separate flyout/popups for each category with their
  notifications.
* Create a view-model to control notification state and emit events
  for both the popup and the badge to intercept and react to.
* Clean up module load and distribution:
  * Create an ext.echo.ui module for javascript-ui support and ooui
    widgets.
  * Create an ext.echo.nojs module that unifies all base classes that
    are needed for both nojs and js support, that the js version
    builds upon.
  * Create a separate ext.echo.logger module as a singleton that can
    be called to perform all logging.
* Clean up style uses
  * Move the special page LESS file into nojs module so all styles
    load properly even in nojs mode.
  * Transfer some of the styling from JS to LESS for consistency.
  * Make the 'read more' button load already with the styles it
    needs to look like a button, since its behavior is similar in
    nojs and js vesions, but before its classes were applied only
    by the js, making it inconsistent and also making its appearance
    'jump' from a link to a button.
* Delete and clean up all old and unused files.
* Moved 'Help.png' icon from modules/overlay to modules/icons for
  later use.

Bug: T108190
Change-Id: I55f440ed9f64c46817f620328a6bb522d44c9ca9
2015-09-02 15:36:37 -07:00
Kunal Mehta 92da0124d0 Only require event type to construct a formatter
Push the $wgEchoNotifications dependency to
NotificationFormatter::factory(), and only catch exceptions we're
actually expecting (NotificationFormatter::format()).

And clean up the logging to use structured logging while we're at it.

Change-Id: I7e18c318c5c81b6a38e55f27ef8f604654f10858
2015-08-10 11:27:52 -07:00
addshore a9be7abfbe Remove use of deprecated TestUser->user
Change-Id: I9b3e048f01551cffb6848410fa9515201cbb2d1f
2015-08-07 17:04:59 +01:00
Kunal Mehta 5e2da7627b Refactor and unify icon URL logic
The logic to get the URL for an icon was duplicated in the
EmailFormatter and BasicFormatter. It is now in the abstract
NotificationFormatter, which EmailFormatter and BasicFormatter now
use.

Changes in logic:
* Throw an exception if an invalid notification type is provided instead
of a PHP notice
* icons using 'url' may have different ltr/rtl icons
* Throw exception if icon is supposed to have different icons for
ltr/rtl, but doesn't, instead of debug logging

The new function is static so it can be used in EmailFormatter as it
does not inherit from NotificationFormatter.

Bug: T60726
Change-Id: Ia3c01c35f58eed8cc2c039249ab1ec1a80a8abbb
2015-08-06 04:17:14 +00:00
Kunal Mehta 3a1883f3db Add test case to demonstrate T68512 is fixed
Change-Id: Icadf33455aa09147e7f42809a9c36794ec7abd82
2015-07-06 17:31:08 -07:00
Kunal Mehta c1c91a0c1d Update tests/phpunit for new directory structure
Change-Id: Ic2d5659bb1db89cb62d3703ce59f3e58ba909886
2015-06-15 11:36:02 -07:00
Matthew Flaschen a6412a6d27 Fix typo in scenario name
Change-Id: I90cf03197c715dc7c786479056f95137245ef939
2015-06-11 23:02:12 -04:00
Kunal Mehta add1eb8266 Remove unused EchoDiscussionParser::getNotifiedUsersForComment()
Change-Id: I63c51835f54735c04f8356cf8ce161210895c378
2015-06-09 23:38:16 -04:00
Kunal Mehta 70d95fbad0 Use mw.Api.postWithToken to automatically re-try badtoken errors
Bug: T101664
Change-Id: I93188099e24102b47384c08113e8dbd26dac8df1
2015-06-07 18:11:48 -07:00
Erik Bernhardson a17ae46897 Test with $wgDiff = false when wikidiff2 is installed
Change-Id: I404b26589d0e8788c458f72c1d608af859e98a6f
2015-05-20 22:26:26 -07:00
Erik Bernhardson fb028f7a8c Run DiscussionParserTest with $wgDiff = false to match prod
Change-Id: Ie2f64bdb5c614a71412d935ea1b8e9ce7dc2a9a4
2015-05-20 22:18:07 -07:00
Roan Kattouw 518101e495 Actually pass jscs
Removed exemptions from .jscsrc and fixed the code to make jscs still
pass.

Kept the dangling underscores exemption because leading underscores
are (for now) used as a naming convention for private functions in
this repo.

Change-Id: I18964f8469f52c294276527d92cb6bf9f48c2576
2015-05-04 19:28:01 +00:00
jenkins-bot df9de05c68 Merge "Start tests for the built-in notification types" 2015-05-01 20:51:50 +00:00
Matthias Mullie da07893647 Display red badge based on time of notifications vs last time panel was opened
I tried to stick as close to the existing code as possible.

Special:Notifications is slightly different from the overlay,
however. I made it add .mw-echo-unread class for consistency,
but that JS doesn't record seen time (it only loads older
entries), not does the CSS fadeout apply there (it marks
everything as read as soon as it's displayed, so different
behavior from overlay)

PS: I'm not sure about browser compat for the fadeout. But
even if some obscure browsers don't support this, meh. It's
not an "important" feature that can't be missed.

Bug: T94634
Change-Id: Ibb201823fb52ef8a3d5eaa39b0b724ede8d271d1
2015-05-01 11:39:45 -07:00
jenkins-bot 472779eb59 Merge "Title::newFromText requires string argument." 2015-04-04 04:10:01 +00:00
Erik Bernhardson 70639162f3 Allow multiple target pages per event
Bug: T85064
Change-Id: I338f3d73efb98a3bb66ef64fdeeb66e752a453c2
2015-03-31 07:56:52 +00:00
Erik Bernhardson a8c0fff41a Title::newFromText requires string argument.
Change-Id: Ieb062879e7e8e43796b7c3aa7829b5e6b00644ad
2015-03-23 15:47:45 -07:00
jenkins-bot 7be4aad14c Merge "Hygiene: Remove unused method on EchoTargetPageMapper" 2015-03-20 12:26:23 +00:00
Erik Bernhardson e9f1e67487 Hygiene: Remove unused method on EchoTargetPageMapper
Change-Id: Ic2517bf095421ced125c653716fbf44c7934a1e9
2015-03-16 08:48:22 -07:00
Cmcmahon 4631bc8d94 QA: insert one-second sleep for Chrome workaround
As of about 4 March, Chrome has begun failing to wait for javascript
event listeners on pages. The only workaround we've found is to
pause for a bit before clicking any element that brings up a WMF
"overlay"

This is the failure see at
https://integration.wikimedia.org/ci/view/BrowserTests/view/-All/job/browsertests-Echo-en.wikipedia.beta.wmflabs.org-linux-chrome-sauce/399/testReport/

Change-Id: I984f394a55423f17feae85236e18d16dd00239bc
2015-03-09 18:43:24 -04:00
Cmcmahon 68c8a7a65a QA: rubocop fixes broke the tests in the builds
regenerated rubocop config so those checks also stay green

Change-Id: Ib8a88c88c02d1638e758d62eb86f2ac59feefe5d
2015-02-23 09:44:41 -07:00
jenkins-bot f0cd4d5076 Merge "QA: update for rubocop offenses" 2015-02-20 17:02:37 +00:00
Cmcmahon 7d607dbfb6 QA: update for rubocop offenses
Do not name methods starting with "get"

Change-Id: If4adf0c775b031d6a462e00aed8b588077169413
2015-02-20 10:00:01 -07:00
jenkins-bot 5f93e4defe Merge "QA: more rubocop updates" 2015-02-20 16:57:10 +00:00
Cmcmahon 60a0e05c7c QA: more rubocop updates
No change to function at all

Change-Id: I150aed4379c75f716633cc4904cb9d8f388c9d45
2015-02-20 09:54:06 -07:00
jenkins-bot 1ae16a6358 Merge "QA: update for rubocop offenses" 2015-02-20 16:52:11 +00:00
Cmcmahon fcd695a076 QA: update for rubocop offenses
No change to function, just cleaning up

Change-Id: I1b0b4fe8e4f785cbeebc2d1415a45f831dc75f5c
2015-02-20 09:49:38 -07:00
Erik Bernhardson 91abb657c8 More gracefully handle unavailability of ParserFunctions in phpunit
Change-Id: I375c13e937892062b061940b2b9ac5bdd832ac9d
2015-02-17 14:53:51 -08:00
Matthias Mullie 0dee3d3587 Pass title along to signature parser
* Parser generates signature to compare against
* Signature can be overwritten per wiki, in NS_MEDIAWIKI
* Such overwritten default can be different depending on
  page the signature is on[1]
* Our comparison signature generation was page-agnostic
  (always from Title::newMainPage)
* Signatures didn't match up on own talk pages, where
  default signature is different

Also added 2 new tests cases & improved tests by also
setting the page

1: https://en.wikipedia.org/w/index.php?title=MediaWiki%3ASignature&diff=176507985&oldid=176229132

Bug: T78424
Change-Id: Ice151d4d16236a5d1556ef62805b61310c7beb85
2015-02-17 10:24:12 -08:00
Cmcmahon 46f2d7c46d QA: robustify Notification no-javascript test
Identify the first heading better

Change-Id: Idb029c43b20915022f4d566a7795c3e0ec55cea2
2015-02-09 13:48:02 -07:00
jenkins-bot 6f4d2b68fb Merge "Add tests for generateEventsForRevision" 2015-02-06 13:49:16 +00:00
Matthias Mullie 682eff7022 Add tests for generateEventsForRevision
Change-Id: I54d6904c613d6f58beaa4d8202a07f1bf5850e7e
2015-02-06 14:37:58 +01:00
jenkins-bot d3bfc5a5b9 Merge "Improve signature detection" 2015-02-06 01:21:27 +00:00
Matthias Mullie 58e1c765d6 Improve signature detection
Previously, there were a couple of hacks in play.
It was also not picking up ~~~ (signature without timestamp)
And it relied an a nasty regular expression which, although
based on Parser, may some day get out of date.
And it relied heavily on a specific signature format, which
isn't guaranteed (it's an i18n msg)

This patch changes the approach: it will use a very simple
regex to match links, and will send those through Parser to
generate the signature anew. My reasoning is that that should
be exactly the same as what Echo just received (should've
also gone through parser)

Biggest discomfort of this approach is that it's much stricter.
It should still match whatever it generated from a ~~~ or ~~~~,
but no longer the e.g. not-real signatures we were doing in
our tests. Also had to update our tests, because signatures
change depending on anon. So I had to generate all the users.
And fix some of the signature formats used in the tests.

Bug: T75426
Bug: T87852
Bug: T75366
Bug: T78424
Change-Id: Ibeff36397129fdd5d376f3668a23a45f9a014525
2015-02-05 20:45:19 +01:00
jenkins-bot 028388aa6c Merge "Bug: Fails signature detection with extra long signature" 2015-01-31 01:13:43 +00:00
Kunal Mehta 3e94bfac8b Start tests for the built-in notification types
* Only covers EchoHooks::onUserRights right now, more
  patches to follow

Change-Id: Ie93eff0a9a75a4a9816c81d57b7530149a14bb7a
2015-01-30 18:09:04 +00:00
Erik Bernhardson bf5ff9b8ea Rework broken echo test to make less assumptions
Change-Id: Id73794e3555ef18e5dde0c40b8f9ab8eba53eb96
2015-01-29 16:45:05 -08:00
Antoine Musso 7f5b0c1793 Fix EchoTitleLocalCacheTest::testGet corner case
EchoTitleLocalCache title cache resolution ends up querying the database
to resolve title id to Title object.

In some corner case, we might only have one page in the database (UTPage
as provided by MediaWikiTestCase), thus the id 2 would not resolve to a
Title breaking the test.

Use insertPage() to ensure we have a second page.

Bug: T78592
Change-Id: Ia9dbb256f566e489e1c81d89b6a6077831e07fc3
2015-01-09 13:54:08 +01:00