MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
12.01k stars 4.91k forks source link

Fix "Test Snap Cronjob can trigger a cronjob to open a di..." flaky tests #28154

Open hjetpoluru opened 1 week ago

hjetpoluru commented 1 week ago

CI failure reported on Oct 31 (Test Snap Cronjob can trigger a cronjob to open a di...)

Build - Flask Browser - Chrome Test Path - /test/e2e/snaps/test-snap-cronjob.spec.js Test Scenario - Test Snap Cronjob can trigger a cronjob to open a dialog every minute

Error: No window found by background script with title: MetaMask Dialog
    at ServerMochaToBackground.receivedMessage (test/e2e/background-socket/server-mocha-to-background.ts:2:2485)
    at ws.onmessage (test/e2e/background-socket/server-mocha-to-background.ts:2:1916)
    at callListener (node_modules/ws/lib/event-target.js:290:14)
    at WebSocket.onMessage (node_modules/ws/lib/event-target.js:209:9)
    at WebSocket.emit (node:events:519:28)
    at WebSocket.emit (node:domain:488:12)
    at Receiver.receiverOnMessage (node_modules/ws/lib/websocket.js:1220:20)
    at Receiver.emit (node:events:519:28)
    at Receiver.emit (node:domain:488:12)
    at Receiver.dataMessage (node_modules/ws/lib/receiver.js:596:14)
    at Receiver.getData (node_modules/ws/lib/receiver.js:496:10)
    at Receiver.startLoop (node_modules/ws/lib/receiver.js:167:16)
    at Receiver._write (node_modules/ws/lib/receiver.js:94:10)
    at writeOrBuffer (node:internal/streams/writable:570:12)
    at _write (node:internal/streams/writable:499:10)
    at Writable.write (node:internal/streams/writable:508:10)
    at Socket.socketOnData (node_modules/ws/lib/websocket.js:1355:35)
    at Socket.emit (node:events:519:28)
    at Socket.emit (node:domain:488:12)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:191:23)

https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/108186/workflows/1dc73b8c-a92d-4e87-a378-39d8db2563e2/jobs/4046081/tests#failed-test-0

Build - Flask Browser - Firefox Test Path - /test/e2e/snaps/test-snap-cronjob.spec.js Test Scenario - Test Snap Cronjob can trigger a cronjob to open a dialog every minute

ElementNotInteractableError: Element <button id="connectcronjobs" class="btn btn-primary" type="submit"> could not be scrolled into view
  (Ran on CircleCI Node 9 of 24, Job test-e2e-firefox)
    at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:524:15)
    at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:601:13)
    at Executor.execute (node_modules/selenium-webdriver/lib/http.js:529:28)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async thenableWebDriverProxy.execute (node_modules/selenium-webdriver/lib/webdriver.js:745:17)
    at async element.click (test/e2e/webdriver/driver.js:79:7)
    at async Driver.clickElement (test/e2e/webdriver/driver.js:579:9)
    at async /home/circleci/project/test/e2e/snaps/test-snap-cronjob.spec.js:34:9
    at async withFixtures (test/e2e/helpers.js:217:5)
    at async Context.<anonymous> (test/e2e/snaps/test-snap-cronjob.spec.js:13:5)

image

image

hjetpoluru commented 5 days ago

The flakiness initially reported in the ticket, has been fixed in the PR #27684.

But when this PR https://github.com/MetaMask/metamask-extension/pull/28153 was unable to be merged, a discussion took place in the slack channel and this flaky test appeared with another reason details in the CI link.

According to the log, the failure occurs in the Chrome browser when the delay await driver.delayFirefox(1000); is executed, which should not have been executed. Hence further analysis of the flaky test needs to be done.