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
This aims to disallow using the methods listed below, which are
supported by Chromium 69 but not supported by Internet Explorer 11.
Most of them were introduced in ECMAScript 6, but some are more recent
or experimental.
We keep breaking IE 11 support by using them. Recent examples include:
* mediawiki/core:
Ic85063dfbbcf26a99d343845c9fb801f1888d750
* mediawiki/extensions/MultimediaViewer:
I0954c42a37668b0eb46c3e864a2e13152a6dc68a
* mediawiki/extensions/UploadWizard:
I70d37a8f0abcc96b5e39fa71a93cda6f3421c87c
* VisualEditor/VisualEditor:
Ic1971549da37091c41a847229d18e95aff5c9952
This will unfortunately almost certainly cause false positives, but
hopefully not too many of them. Common false positives can be
disallowed more precisely using 'no-restricted-syntax' rather than
'no-restricted-properties'.
Disallowed methods:
String.prototype:
codePointAt
endsWith
includes
normalize
padEnd (ES 2017)
padStart (ES 2017)
repeat
startsWith
trimEnd (experimental/proposed)
trimLeft (experimental/proposed)
trimRight (experimental/proposed)
trimStart (experimental/proposed)
Array.prototype:
copyWithin
entries
fill
find
findIndex
flat (experimental/proposed)
flatMap (experimental/proposed)
includes (ES 2016)
keys
values
String:
fromCodePoint
raw
Array:
from
of
Object:
assign
entries (ES 2017)
getOwnPropertyDescriptors (ES 2017)
getOwnPropertySymbols
is
values (ES 2017)
I compiled the list based on running the following code in each
browser's console, since there doesn't seem to be an authoritative
list anywhere on the Internet:
console.log( Object.getOwnPropertyNames( String.prototype ) )
console.log( Object.getOwnPropertyNames( Array.prototype ) )
console.log( Object.getOwnPropertyNames( Object.prototype ) )
console.log( Object.getOwnPropertyNames( String ) )
console.log( Object.getOwnPropertyNames( Array ) )
console.log( Object.getOwnPropertyNames( Object ) )
Change-Id: Ic44c79834f99c52863fbc544ad657787f70fb9bb
In addition to two existing modes (headless and visible), this patch
introcues another mode, headless recording.
If DISPLAY environment variable is not set, Chrome will run in it's
built-in headless mode.
If it is set, and the value starts with colon (`:`), Chrome will
run in headless mode using Xvfb and record video of every test using FFmpeg.
If the value does not start with colon, Chrome will be visible.
Bug: T179188
Change-Id: Ic1723c5f2d57a28201caf6ba7056cb73fb74a957
In some cases it's useful adding a fragment to the url, e.g. when
accessing the beta features preference page. This patch adds support
for that on the Page object.
Change-Id: I4b6aa5e7e89e60f05e217fc557bf6786441855e6
"Internal lookups need to be internal, using ./.
This currently works because it executes as part of mediawiki-core, but
may fail when used from the published package, because there will not
be another "wdio-mediawiki" inside this directory." krinkle
Follow-up to a fixme in Ifc49bc5c06eef71da8aff1b1837c32debc2c45dd
Change-Id: I86f321a42eaf4cf706b4e899e4cd460654840284
Many tests use the API during their setup phase, which does not
participate in clearing the job queue, but constantly adds new items.
Consequently the job count keeps mounting. In order to be able to assert
the state of the application once all jobs are processed we need a way
to invoke them.
This is a minimalistic alternative to Idd4924e16925cbf0cb9e42645670c3fd76b72353
Bug: T199446
Change-Id: Ifc49bc5c06eef71da8aff1b1837c32debc2c45dd
Selenium tests run fine when targeting MediaWiki installation in
MediaWiki-Vagrant and in Jenkins, but fail when targeting beta cluster.
Until tests are refactored to run without failure for beta cluster, let's disable
failing tests.
Bug: T185011
Change-Id: I12da893e7d624d4ebe478bccf0706aa07c965796
This test was already flaky and was fixed in
I1fd0c49263e975c6b24e2e1f9a072486a6565dda. However, this caused failures
on several repos. Temporarily disable it until we'll get it to work
properly.
Bug: T199644
Change-Id: I88be83e01eb1789f28f09fc4a0be7ea17f402858
Use page object to create the page we will be asserting on
Special:RecentChanges. Apparently (post send) jobs are not executed on
API calls (that were formerly used for test setup) and consequently
presence of the edit on Special:RecentChanges could not be guaranteed.
Bug: T199446
Change-Id: I1fd0c49263e975c6b24e2e1f9a072486a6565dda
Troubleshooting can happen in parallel without blocking
unrelated work from being merged.
Bug: T198137
Change-Id: Ie84a868a580968ff99ff6879050080c6495fa72a
The AntiSpoof extension disallows this character in usernames, causing
tests to fail on some setups. Its error message claims it is an
"unassigned character" (which is false), but it seems it's
intentionally disallowed and the error message should instead say
"non-script character" or something.
Bug: T198384
Change-Id: Ia8e7b425b6a3cf3742c00178f28c97a19f46bab0
Follow-up on I5c5e9b22af5406f347636b22e68657b2674db6c9 and
I0747c2d361e951f8b3765a3dca548e55edb72216
Change-Id: I35ad793e6d9fe4c3bf58df9b4fcf6471c0a81f70
Extracting this function into a Util module reduces redundancy for
existing and future tests in core and extensions.
Change-Id: I5c5e9b22af5406f347636b22e68657b2674db6c9
Similar to custom location of VisualEditor tests, Wikibase has tests in repo and client folders.
Bug: T180228
Change-Id: I3debe8bed9a760aea374529dbe007aa5a72421aa
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
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
See comment in I3423011c467b0a6426cfa0dad522435618f24bd0
and https://mathiasbynens.be/notes/javascript-unicode#poo-test
Decided on using something more positive than a pile of poo though.
Change-Id: Ic34d0d78044cede71fd1cd8742214c117ed2e99f
This was using the same content for the edit before this
patch, so no edit was actually made, (just a null edit).
Change-Id: I945090647226e82f22b5b10a414a2a0bf9f2bc19
Having randomly generated strings is great, but sometimes
it can help to allow a human to easily see where the string
is actually being generated in code, so add an optional suffix
to the string being generated.
Change-Id: Ibfe45f74b4880a70a76c01223a787dabcd43607e
I have run into this before and we fixed it in the README
but not in this script (I wasn't using this script at the time)
This was changed in the README in change:
I85a9e7dbd9a66418c85585969adb5ac1548f5ef6
Bug: T182421
Change-Id: I6ab92c6a61a57dc313b05321d0789dcbeb776c94
git bash for windows apparently doesn't have killall
by default, so instead get the PID of the chrome driver
we start and kill that specifically.
Change-Id: I8a9a773a7d3dc23807dc3ec12f5b3ef03661c9e3
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
Without this, the tests sometimes fail like this:
> Error: ENOENT: no such file or directory, open './log/should-be-creatable.png'
> at screenshot() - saveScreenshot.js:52:17
> at saveScreenshot("./log/should-be-creatable.png")
This seems to race with the junit plugin, which uses mkdirp to
create it if missing, but the screenshot handling is separate
from that. WebdriverIO's own screenshot handling also does this
so it makes sense for ours to do that, too.
I considered trying to re-use WebdriverIO's save mechanism,
directly but it's not publicly exposed and only used for the
crash scenario, so for now we'll have to keep our own.
Also:
* Add to gitignore.
* Update default to use __dirname instead of './' because the
latter will somtimes be mediawiki/ and sometimes be selenium/
depending on whether you run all tests or some tests.
* Remove trailing slash from default logPath, and instead add the
slash in filePath.
Reason:
- The LOG_DIR used by Jenkins doesn't end in a slash either
(currently not failing because we no longer use that job,
and let quibble run the tests instead, which doesn't set
the LOG_DIR).
- The WDIO docs and example also use screenshotPath without
trailing slash.
- Without this, setting LOG_DIR=/tmp/something results in
filenames like /tmp/somethingexample.png.
Bug: T193088
Change-Id: I6550f9315bae89f96a791f7ae8cc2fbec5ee8dd5
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
It seems relPath() is used for all other paths here. When I was
running a single test from the /tests/selenium, I noticed wdio
was logging to the console that it excluded ./extensions/CirrusSearch,
which doesn't make sense from that directory. The other paths
are fine.
Change-Id: Ic89ae0a91cdb6590b7190ea44969e653e9e2d6ea
I was unable to get the tests passing locally in MediaWiki-Vagrant.
The main slowdown appears to be from MWBot logging-in for each
command anew. Which works fine, but just seems to be quite slow.
Change-Id: I3c0abc79cac48c26d952b0bbe73574aa48b2d70e
Doesn't seem to add anything, except complexity.
This has the benefit of matching more closely the way the README
recommends running individual tests.
Also add a check for 'chromedriver' before running it.
Normally the -e and pipefail would suffice, but because
it runs in the background, the error can be buried,
hard to find, or even not cause exit code to be set
properly. Thus, do a simple 'hash' check that will
print a useful command and exit cleanly.
Before:
> $ something &
> [1] 57922
> -bash: something: command not found
> [1]+ Exit 127 something
> $ echo $?
> 0
After:
> $ hash something
> -bash: hash: something: not found
> (exit: 1) $ echo $?
> 1
Change-Id: Id95f18927b5443defe679a77a82c5cbdd127c716
* Remove redundant user/pass for Jenkins, which is unused now
that Jenkins jobs set it through ENV instead.
See also T188520 and Ibb388741fee9 (integration/config).
* Use simple default operator (||) instead of elaborate
undefined check.
* Document that the inline user/password defaults relate to
MediaWiki vagrant.
* Set 'logPath' for Jenkins based on LOG_PATH env (from mw-set-env.sh),
instead of assuming where it will be relative to mediawiki-core.
* Put new lines between blocks and functions.
* Document --no-sandbox hack from 4ff5652501.
Change-Id: I4c7856d260ded8c94e991a27863b80c9eea2e33e
This makes it possible to use in Quibble. Right now, Quibble
cannot use 'npm run selenium' yet because it sets up its own
chromedriver, which would conflict with selenium.sh.
But, in preparation for Id95f18927b5, we can at least abstract
the test command so that it can easily be changed without having
to update Quibble and without having to worry about it being the
same in all MediaWiki branches.
Bug: T179190
Change-Id: I622ec3bf36746502cae891cc6bec23982b21f876
Both Mocha and Cucumber tests should run. Since WebdriverIO supports only
running one test framework, the only way to do it is to have a generic
configuration file and two framework-specific files (Mocha, Cucumber). Having
Jenkins configuration file complicates things, and there is no need for
it.
Bug: T179190
Change-Id: I710066f7b5479dcad27aa57cd61007c1c2d88931
Just running `npm run selenium` in CI does not work. If WebdriverIO fails, the
job still passes since the last command to run is `killall chromedriver`.
Reusing the script from CI that starts and stops Chromedriver should fix the
problem.
Bug: T179190
Change-Id: If29227263d23a3e4f26e2329dfa13c49f976cf8e
When running webdriver.io in a Jessie Docker container, the sandboxing
fails:
Failed to move to new namespace: PID namespaces supported, Network
namespace supported, but failed: errno = Operation not permitted
Detect whether we are in a Docker container by checking /.dockerenv and
if present append --no-sandbox to Chrome options.
Change-Id: Ie5c276d12553e4473c01b3407e0f7622e0a678e0
The default is 10000 (10 seconds). It was increased by mistake. 20000 is the value needed for mochaOpts timeout. There is no reason to have the double value for waitforTimeout.
Bug: T179190
Change-Id: I14f72367a36815d155cedc57757481f6294fdc51
No changes are made to the configuration file. It has just been
regenerated with the latest WebdriverIO version. Minor whitespace
cleanup has been made to the file after it has been generated so it
conforms to our ESLint configuration.
This is the first step in updating configuration so videos of failed
tests are recorded.
Bug: T179188
Change-Id: Id0db3743ae7d828357b1527770bb7dcd2e02f99b
Chrome 59 introduced an headless mode, in this mode it does not need any
DISPLAY (Xorg, Xvfb...). That achieved by passing to chrome:
--headless
Use headless when DISPLAY is not available. One can switch to headless
by simply unsetting the environment variable: unset(DISPLAY).
Bug: T167507
Signed-off-by: Antoine Musso <hashar@free.fr>
Change-Id: Id5424eafb20112fd74d472b8cef02cb15cafff89