As shown in https://integration.wikimedia.org/ci/job/quibble-with-gated-extensions-selenium-php83/11543/console and pasted below, the ReviseTone.cy.ts tests can fail with a badtoken error.
16:41:46 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
16:41:46
16:41:46 Running: ReviseTone.cy.ts (6 of 9)
16:41:48
16:41:48
16:41:48 Revise Tone
16:41:52 On desktop
16:41:58 β Shows the Revise Tone Edit Check (8895ms)
16:41:58 - Closes the Editor when declining Edits and suggests a new task
16:41:58 - Shows the Revise Tone Edit Check and tags edits
16:41:58 On mobile
16:42:00 1) "before each" hook for "Shows the Revise Tone Edit Check"
16:42:00 cy:command β visit /index.php -> 301: http://127.0.0.1:9413/index.php?title=Main_Page
16:42:00 cy:command β window
16:42:00 cy:command β assert expected **<window>** to have property **mw**
16:42:00 cy:command β window
16:42:00 cy:command β its .mw.Api
16:42:00 cy:command β assert expected **[Function]** to exist
16:42:00 cy:command β window
16:42:00 cy:xhr β POST http://127.0.0.1:9413/api.php
16:42:00 Status: 200
16:42:00 cy:xhr β POST http://127.0.0.1:9413/api.php
16:42:00 Status: 200
16:42:00 cy:command β visit /index.php -> 301: http://127.0.0.1:9413/index.php?title=Main_Page
16:42:00 cy:command β window
16:42:00 cy:command β its .mw.Api
16:42:00 cy:command β assert expected **[Function]** to exist
16:42:00 cy:command β window
16:42:00 cy:xhr β POST http://127.0.0.1:9413/api.php
16:42:00 Status: 200
16:42:00 cy:xhr β GET http://127.0.0.1:9413/api.php?action=query&format=json&meta=tokens&type=csrf
16:42:00 Status: 200
16:42:00 cy:xhr β POST http://127.0.0.1:9413/api.php
16:42:00 Status: 200
16:42:00 cy:command β then function(){}
16:42:00
16:42:00
16:42:00
16:42:00
16:42:00 1 passing (11s)
16:42:00 2 pending
16:42:00 1 failing
16:42:00
16:42:00 1) Revise Tone
16:42:00 On mobile
16:42:00 "before each" hook for "Shows the Revise Tone Edit Check":
16:42:00 Error: badtoken
16:42:00
16:42:00 Because this error occurred during a `before each` hook we are skipping the remaining tests in the current suite: `Revise Tone`
16:42:00 at $Cy.fail (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:146049:13)
16:42:00 at onError (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:152519:22)
16:42:00 at tryCatcher (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:1777:23)
16:42:00 at Promise._settlePromiseFromHandler (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:1489:31)
16:42:00 at Promise._settlePromise (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:1546:18)
16:42:00 at Promise._settlePromise0 (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:1591:10)
16:42:00 at Promise._settlePromises (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:1667:18)
16:42:00 at _drainQueueStep (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:2377:12)
16:42:00 at _drainQueue (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:2370:9)
16:42:00 at Async._drainQueues (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:2386:5)
16:42:00 at Async.drainQueues (http://127.0.0.1:9413/__cypress/runner/cypress_runner.js:2256:14)
16:42:00
16:42:00
16:42:00
16:42:01
16:42:01 (Results)
16:42:01
16:42:01 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
16:42:01 β Tests: 6 β
16:42:01 β Passing: 1 β
16:42:01 β Failing: 1 β
16:42:01 β Pending: 2 β
16:42:01 β Skipped: 2 β
16:42:01 β Screenshots: 1 β
16:42:01 β Video: true β
16:42:01 β Duration: 11 seconds β
16:42:01 β Spec Ran: ReviseTone.cy.ts β
16:42:01 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
16:42:01
16:42:01
16:42:01 (Screenshots)
16:42:01
16:42:01 - /workspace/log/GrowthExperiments/ReviseTone.cy.ts/Revise Tone -- Shows the Revis (1280x720)
16:42:01 e Tone Edit Check -- before each hook (failed).png
16:42:01
16:42:01
16:42:01 (Video)
16:42:01
16:42:01 - Video output: /workspace/log/GrowthExperiments/ReviseTone.cy.ts.mp4
16:42:01
16:42:01
....
16:42:22 (Run Finished)
16:42:22
16:42:22
16:42:22 Spec Tests Passing Failing Pending Skipped
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
16:42:22 β β AddALink.cy.ts 00:27 1 1 - - - β
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
16:42:22 β β AddImage.cy.ts 00:22 2 2 - - - β
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
16:42:22 β β CommunityConfiguration.cy.ts 00:01 1 1 - - - β
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
16:42:22 β β Homepage.cy.ts 62ms 1 - - 1 - β
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
16:42:22 β β MentorDashboard.cy.ts 00:11 1 1 - - - β
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
16:42:22 β β ReviseTone.cy.ts 00:11 6 1 1 2 2 β
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
16:42:22 β β TemplateBasedTask.cy.ts 88ms 1 - - 1 - β
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
16:42:22 β β ViewGrowthExperimentsEvents.cy.ts 00:03 1 1 - - - β
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
16:42:22 β β Impact/Impact.cy.ts 00:05 1 1 - - - β
16:42:22 ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
16:42:22 β 1 of 9 failed (11%) 01:23 15 8 1 4 2Suggested path forward:
- if account creation fails, then the account creation method checks if it got a badtoken error, waits 1 second, and then tries again (including a new token)
- explore if it is feasible to create a test account in the beginning of the cypress test suite and then reuse for several tests where appropriate.
Notes
- This should also resolve T411370: Flaky Cypress test: Add Image Structured Task: mobile: user can close the image suggestion UI: Error: badtoken
- I wonder if it is related to whatever caused T397780: Increased badtoken errors during account creation?