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
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