Page MenuHomePhabricator

AbuseFilter 1.36 selenium test failures
Closed, ResolvedPublic

Description

Seen on an unrelated patch.. https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CirrusSearch/+/756579 - https://integration.wikimedia.org/ci/job/quibble-composer-mysql-php73-selenium-docker/13195/console

17:31:00 [Chrome 90.0.4430.212 linux #0-1] Spec: /workspace/src/extensions/AbuseFilter/tests/selenium/specs/importingFilters.js
17:31:00 [Chrome 90.0.4430.212 linux #0-1] Running: Chrome (v90.0.4430.212) on linux
17:31:00 [Chrome 90.0.4430.212 linux #0-1] Session ID: cc913888-72df-4378-b287-275f662c8f56
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1] When importing a filter
17:31:00 [Chrome 90.0.4430.212 linux #0-1]    ✓ the interface should be visible
17:31:00 [Chrome 90.0.4430.212 linux #0-1]    ✓ it should redirect to ViewEdit after submission
17:31:00 [Chrome 90.0.4430.212 linux #0-1]    ✖ bad data results in an error
17:31:00 [Chrome 90.0.4430.212 linux #0-1]    ✖ valid data shows the editing interface
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1]     Data on the editing interface is correct
17:31:00 [Chrome 90.0.4430.212 linux #0-1]        ✖ filter specs are copied
17:31:00 [Chrome 90.0.4430.212 linux #0-1]        ✖ filter flags are copied
17:31:00 [Chrome 90.0.4430.212 linux #0-1]        ✖ filter actions are copied
17:31:00 [Chrome 90.0.4430.212 linux #0-1]        ✖ the imported data can be saved
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1] 2 passing (50.9s)
17:31:00 [Chrome 90.0.4430.212 linux #0-1] 6 failing
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1] 1) When importing a filter bad data results in an error
17:31:00 [Chrome 90.0.4430.212 linux #0-1] The expression evaluated to a falsy value:
17:31:00 
17:31:00   assert( ViewEditPage.error.isDisplayed() )
17:31:00 
17:31:00 [Chrome 90.0.4430.212 linux #0-1] AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1]   assert( ViewEditPage.error.isDisplayed() )
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1]     at Context.<anonymous> (/workspace/src/extensions/AbuseFilter/tests/selenium/specs/importingFilters.js:59:3)
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1] 2) When importing a filter valid data shows the editing interface
17:31:00 [Chrome 90.0.4430.212 linux #0-1] The expression evaluated to a falsy value:
17:31:00 
17:31:00   assert( ViewEditPage.name.isDisplayed() )
17:31:00 
17:31:00 [Chrome 90.0.4430.212 linux #0-1] AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1]   assert( ViewEditPage.name.isDisplayed() )
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1]     at Context.<anonymous> (/workspace/src/extensions/AbuseFilter/tests/selenium/specs/importingFilters.js:65:3)
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1] 3) Data on the editing interface is correct filter specs are copied
17:31:00 [Chrome 90.0.4430.212 linux #0-1] Can't call getValue on element with selector "input[name="wpFilterDescription"]" because element wasn't found
17:31:00 [Chrome 90.0.4430.212 linux #0-1] Error: Can't call getValue on element with selector "input[name="wpFilterDescription"]" because element wasn't found
17:31:00 [Chrome 90.0.4430.212 linux #0-1]     at Context.<anonymous> (/workspace/src/extensions/AbuseFilter/tests/selenium/specs/importingFilters.js:70:42)
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1] 4) Data on the editing interface is correct filter flags are copied
17:31:00 [Chrome 90.0.4430.212 linux #0-1] Can't call isSelected on element with selector "input[name="wpFilterEnabled"]" because element wasn't found
17:31:00 [Chrome 90.0.4430.212 linux #0-1] Error: Can't call isSelected on element with selector "input[name="wpFilterEnabled"]" because element wasn't found
17:31:00 [Chrome 90.0.4430.212 linux #0-1]     at Context.<anonymous> (/workspace/src/extensions/AbuseFilter/tests/selenium/specs/importingFilters.js:75:45)
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1] 5) Data on the editing interface is correct filter actions are copied
17:31:00 [Chrome 90.0.4430.212 linux #0-1] Can't call isSelected on element with selector "input[name="wpFilterActionWarn"]" because element wasn't found
17:31:00 [Chrome 90.0.4430.212 linux #0-1] Error: Can't call isSelected on element with selector "input[name="wpFilterActionWarn"]" because element wasn't found
17:31:00 [Chrome 90.0.4430.212 linux #0-1]     at Context.<anonymous> (/workspace/src/extensions/AbuseFilter/tests/selenium/specs/importingFilters.js:80:50)
17:31:00 [Chrome 90.0.4430.212 linux #0-1]
17:31:00 [Chrome 90.0.4430.212 linux #0-1] 6) Data on the editing interface is correct the imported data can be saved
17:31:00 [Chrome 90.0.4430.212 linux #0-1] element ("#mw-abusefilter-editing-form input[type="submit"]") still not clickable after 10000ms
17:31:00 [Chrome 90.0.4430.212 linux #0-1] Error: element ("#mw-abusefilter-editing-form input[type="submit"]") still not clickable after 10000ms
17:31:00 [Chrome 90.0.4430.212 linux #0-1]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
17:31:00 [Chrome 90.0.4430.212 linux #0-1]     at ViewEditPage.submit (/workspace/src/extensions/AbuseFilter/tests/selenium/pageobjects/viewedit.page.js:27:21)
17:31:00 [Chrome 90.0.4430.212 linux #0-1]     at Context.<anonymous> (/workspace/src/extensions/AbuseFilter/tests/selenium/specs/importingFilters.js:85:17)

Event Timeline

I'm not sure what's going on -- for starters, there haven't been changes to AF in REL1_36 that crossed that code path, nor to core's HTMLForm.php file. However, this code was almost certainly working when 1.36 was cut. Second, the assertion before the first failing one ensures that the current page is Special:AbuseFilter/new, and this is confirmed by the image linked above. The view picker code in 1.36 is essentially the same as today, and if the subpage is "new" it instantiates an AbuseFilterViewEdit object, not AbuseFilterViewImport, which is in the above stacktrace. The code in question is also pretty simple, and I don't see how it could confuse "new" and "import". As such, the only possible explanation is that the special page is being instantiated with the wrong subpage (by SpecialPageFactory). My guess would be something messing up with Titles and leaking some state. I seem to recall a similar issue in the past (for unrelated code, I believe), where the Title wasn't correct after form submission.

Reedy triaged this task as High priority.Jan 24 2022, 11:23 PM

Marked as high because this blocks any REL1_36 (extension) patches to AbuseFilter or anything that depends on AF.

And REL1_36 is to be supported until the end of May 2022.

The old framework calls:

await (0, _utils.executeHooksWithArgs)(this.config.after, [runtimeError || result, this.capabilities, this.specs]);

the new:

await utils_1.executeHooksWithArgs('after', this._config.after, [runtimeError || result, this._capabilities, this._specs]);

There is an new argument before the function is passed and the signature no longer match the called function.

That seems to be https://github.com/webdriverio/webdriverio/commit/6bf7b203b2a74012eca129e92ce581753756c62f

Libup only updates @wdio/mocha-framework, but the new version needs a new version of @wdio/sync to match the new argument on executeHooksWithArgs

I'm not sure what's going on -- for starters, there haven't been changes to AF in REL1_36 that crossed that code path, nor to core's HTMLForm.php file. However, this code was almost certainly working when 1.36 was cut. Second, the assertion before the first failing one ensures that the current page is Special:AbuseFilter/new, and this is confirmed by the image linked above. The view picker code in 1.36 is essentially the same as today, and if the subpage is "new" it instantiates an AbuseFilterViewEdit object, not AbuseFilterViewImport, which is in the above stacktrace. The code in question is also pretty simple, and I don't see how it could confuse "new" and "import". As such, the only possible explanation is that the special page is being instantiated with the wrong subpage (by SpecialPageFactory). My guess would be something messing up with Titles and leaking some state. I seem to recall a similar issue in the past (for unrelated code, I believe), where the Title wasn't correct after form submission.

The selenium test is inputing into the import form and submit it. The form redirects to /new and that fails

I have backport the fix for T285464 and it passed.

Reedy assigned this task to Umherirrender.