Page MenuHomePhabricator

Add capability to provoke generic save error to browser tests
Closed, ResolvedPublic

Description

For several other tasks, browser tests must be able to provoke the generic error screen on save. One way to do that is to delete the target item; browser tests that want to use the “retry” button would additionally have to undelete the item before that. But other options might also work – faking network traffic, for example (or potentially disabling it via setNetworkConnection).

Event Timeline

It turns out that webdriver+chrome can do this natively with:

browser.setNetworkConditions( { latency: 0, throughput: 0, offline: true } )

See https://webdriver.io/docs/api/chromium.html#setnetworkconditions

I'm not sure that this needs to be wrapped in a helper function on its own. If it does - where would that helper function live?

(also, it says "Non official and undocumented Chromium command" might break in some point in the future, but might also just keep working fine and it creates most "realistic" scenario)

I'm not sure that this needs to be wrapped in a helper function on its own. If it does - where would that helper function live?

Since we’ll likely only need it for the save tests, I’d put it in specs/canSave.js.

Change 592257 had a related patch set uploaded (by Michael Große; owner: Michael Große):
[mediawiki/extensions/Wikibase@master] bridge: Add capability to provoke generic save error to browser tests

https://gerrit.wikimedia.org/r/592257

Hmm, I see a canSave.js patch landed. Was about to add such a test to the (new) errorHandling test, using network outage as the reason for the initial loading to fail (retry does hardly make sense on an invalid entity id [the only pre-existing case]). I'd be happy with no util at all, or it moving into the page objects (or any other centrally reachable place), but an individual spec will almost always leave something to be desired…

Hmm, I see a canSave.js patch landed. Was about to add such a test to the (new) errorHandling test, using network outage as the reason for the initial loading to fail (retry does hardly make sense on an invalid entity id [the only pre-existing case]). I'd be happy with no util at all, or it moving into the page objects (or any other centrally reachable place), but an individual spec will almost always leave something to be desired…

Makes sense. Since there now might be multiple places after all where we might need it, I opted for a separate NetworkUtils.js file, though I'm not sure whether it will ever acquire more functions than those two.

not sure whether it will ever acquire more functions than those two.

At least it will have an intuitive, easy to discover file name then.

I can totally see this functionality in wdio-mediawiki as well (it also has a Util already). Maybe we can suggest it there and keep our own clone for now - getting the best of the boyscout rule and rapid iterations.

Change 592257 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] bridge: Add capability to provoke generic save error to browser tests

https://gerrit.wikimedia.org/r/592257