owncloud / web

:dragon_face: Next generation frontend for ownCloud Infinite Scale
https://owncloud.dev/clients/web/
GNU Affero General Public License v3.0
421 stars 157 forks source link

SSE doesn't close up properly when e2e tests fails #11016

Closed amrita-shrestha closed 1 month ago

amrita-shrestha commented 1 month ago

Describe the bug

When e2e tests fail, everything should be closed without any console error. However, the closing SSE faces a problem when e2e tests fail. Need proper investigation as to whether it is our scenario that affects SSE closing or if SSE itself has some problem.

1) Scenario: system language change (attempt 1, retried) # tests/e2e/cucumber/features/smoke/languageChange.feature:11
   ✔ Before # tests/e2e/cucumber/environment/index.ts:44
   ✔ Given "Admin" creates following users using API # tests/e2e/cucumber/steps/api.ts:7
       | id    |
       | Alice |
       | Brian |
   ✔ And "Brian" logs in # tests/e2e/cucumber/steps/ui/session.ts:45
   ✔ And "Brian" creates the following folder in personal space using API # tests/e2e/cucumber/steps/api.ts:64
       | name          |
       | check_message |
   ✔ And "Brian" shares the following resource using API # tests/e2e/cucumber/steps/api.ts:84
       | resource      | recipient | type | role     |
       | check_message | Alice     | user | Can edit |
   ✔ And "Brian" logs out # tests/e2e/cucumber/steps/ui/session.ts:58
   ✔ And "Alice" logs in # tests/e2e/cucumber/steps/ui/session.ts:45
   ✔ And "Alice" opens the user menu # tests/e2e/cucumber/steps/ui/accountMenu.ts:27
   ✔ And "Alice" changes the language to "Deutsch - German" # tests/e2e/cucumber/steps/ui/accountMenu.ts:52
   ✖ Then "Alice" should see the following account page title "Konto" # tests/e2e/cucumber/steps/ui/accountMenu.ts:63
       Error: expect(received).toEqual(expected) // deep equality

       Expected: "Konto"
       Received: "Account"
           at Proxy.<anonymous> (/var/www/owncloud/web/node_modules/.pnpm/playwright@1.39.0/node_modules/playwright/lib/matchers/expect.js:173:37)
           at World.<anonymous> (/var/www/owncloud/web/tests/e2e/cucumber/steps/ui/accountMenu.ts:69:23)
   - When "Alice" logs out # tests/e2e/cucumber/steps/ui/session.ts:58
   - And "Alice" logs in # tests/e2e/cucumber/steps/ui/session.ts:45
   - Then "Alice" should see the following notifications # tests/e2e/cucumber/steps/ui/notifications.ts:6
       | message                                          |
       | Brian Murphy hat check_message mit Ihnen geteilt |
   - And "Alice" logs out # tests/e2e/cucumber/steps/ui/session.ts:58
   ✔ After # tests/e2e/cucumber/environment/index.ts:112

2) Scenario: anonymous user language change (attempt 1, retried) # tests/e2e/cucumber/features/smoke/languageChange.feature:32
   ✔ Before # tests/e2e/cucumber/environment/index.ts:44
   ✔ Given "Admin" creates following users using API # tests/e2e/cucumber/steps/api.ts:7
       | id    |
       | Alice |
       | Brian |
   ✔ When "Alice" logs in # tests/e2e/cucumber/steps/ui/session.ts:45
   ✔ And "Alice" creates the following folder in personal space using API # tests/e2e/cucumber/steps/api.ts:64
       | name         |
       | folderPublic |
   ✔ And "Alice" uploads the following local file into personal space using API # tests/e2e/cucumber/steps/api.ts:152
       | localFile                | to        |
       | filesForUpload/lorem.txt | lorem.txt |
   ✔ And "Alice" opens the "files" app # tests/e2e/cucumber/steps/ui/application.ts:15
   ✔ And "Alice" creates a public link of following resource using the sidebar panel # tests/e2e/cucumber/steps/ui/links.ts:6
       | resource     | password |
       | folderPublic | %public% |
   ✔ And "Alice" logs out # tests/e2e/cucumber/steps/ui/session.ts:58
   ✔ When "Anonymous" opens the public link "Link" # tests/e2e/cucumber/steps/ui/public.ts:8
   ✔ And "Anonymous" unlocks the public link with password "%public%" # tests/e2e/cucumber/steps/ui/public.ts:29
   ✔ And "Anonymous" opens the user menu # tests/e2e/cucumber/steps/ui/accountMenu.ts:27
   ✔ And "Anonymous" changes the language to "Deutsch - German" # tests/e2e/cucumber/steps/ui/accountMenu.ts:52
   ✖ Then "Anonymous" should see the following account page title "Konto" # tests/e2e/cucumber/steps/ui/accountMenu.ts:63
       Error: expect(received).toEqual(expected) // deep equality

       Expected: "Konto"
       Received: "Account"
           at Proxy.<anonymous> (/var/www/owncloud/web/node_modules/.pnpm/playwright@1.39.0/node_modules/playwright/lib/matchers/expect.js:173:37)
           at World.<anonymous> (/var/www/owncloud/web/tests/e2e/cucumber/steps/ui/accountMenu.ts:69:23)
   ✔ After # tests/e2e/cucumber/environment/index.ts:112

29 scenarios (2 failed, 27 passed)
519 steps (2 failed, 4 skipped, 513 passed)
7m10.308s (executing steps: 7m09.555s)
TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11442:53)
    at Fetch.emit (node:events:514:28)
    at Fetch.emit (node:domain:489:12)
    at Fetch.terminate (node:internal/deps/undici/undici:10695:14)
    at Object.onError (node:internal/deps/undici/undici:11537:36)
    at Request.onError (node:internal/deps/undici/undici:8310:31)
    at errorRequest (node:internal/deps/undici/undici:10378:17)
    at TLSSocket.onSocketClose (node:internal/deps/undici/undici:9811:9)
    at TLSSocket.emit (node:events:526:35)
    at TLSSocket.emit (node:domain:489:12) {
  [cause]: BodyTimeoutError: Body Timeout Error
      at Timeout.onParserTimeout [as callback] (node:internal/deps/undici/undici:9752:32)
      at Timeout.onTimeout [as _onTimeout] (node:internal/deps/undici/undici:8047:17)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7) {
    code: 'UND_ERR_BODY_TIMEOUT'
  }
}
Closing SSE...
TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11442:53)
    at Fetch.emit (node:events:514:28)
    at Fetch.emit (node:domain:489:12)
    at Fetch.terminate (node:internal/deps/undici/undici:10695:14)
    at Object.onError (node:internal/deps/undici/undici:11537:36)
    at Request.onError (node:internal/deps/undici/undici:8310:31)
    at errorRequest (node:internal/deps/undici/undici:10378:17)
    at TLSSocket.onSocketClose (node:internal/deps/undici/undici:9811:9)
    at TLSSocket.emit (node:events:526:35)
    at TLSSocket.emit (node:domain:489:12) {
  [cause]: BodyTimeoutError: Body Timeout Error
      at Timeout.onParserTimeout [as callback] (node:internal/deps/undici/undici:9752:32)
      at Timeout.onTimeout [as _onTimeout] (node:internal/deps/undici/undici:8047:17)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7) {
    code: 'UND_ERR_BODY_TIMEOUT'
  }
}
Closing SSE...
TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11442:53)
    at Fetch.emit (node:events:514:28)
    at Fetch.emit (node:domain:489:12)
    at Fetch.terminate (node:internal/deps/undici/undici:10695:14)
    at Object.onError (node:internal/deps/undici/undici:11537:36)
    at Request.onError (node:internal/deps/undici/undici:8310:31)
    at errorRequest (node:internal/deps/undici/undici:10378:17)
    at TLSSocket.onSocketClose (node:internal/deps/undici/undici:9811:9)
    at TLSSocket.emit (node:events:526:35)
    at TLSSocket.emit (node:domain:489:12) {
  [cause]: BodyTimeoutError: Body Timeout Error
      at Timeout.onParserTimeout [as callback] (node:internal/deps/undici/undici:9752:32)
      at Timeout.onTimeout [as _onTimeout] (node:internal/deps/undici/undici:8047:17)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7) {
    code: 'UND_ERR_BODY_TIMEOUT'
  }
}
TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11442:53)
    at Fetch.emit (node:events:514:28)
    at Fetch.emit (node:domain:489:12)
    at Fetch.terminate (node:internal/deps/undici/undici:10695:14)
    at Object.onError (node:internal/deps/undici/undici:11537:36)
    at Request.onError (node:internal/deps/undici/undici:8310:31)
    at errorRequest (node:internal/deps/undici/undici:10378:17)
    at TLSSocket.onSocketClose (node:internal/deps/undici/undici:9811:9)
    at TLSSocket.emit (node:events:526:35)
    at TLSSocket.emit (node:domain:489:12) {
  [cause]: BodyTimeoutError: Body Timeout Error
      at Timeout.onParserTimeout [as callback] (node:internal/deps/undici/undici:9752:32)
      at Timeout.onTimeout [as _onTimeout] (node:internal/deps/undici/undici:8047:17)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7) {
    code: 'UND_ERR_BODY_TIMEOUT'
  }
}
Closing SSE...
Closing SSE...
TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11442:53)
    at Fetch.emit (node:events:514:28)
    at Fetch.emit (node:domain:489:12)
    at Fetch.terminate (node:internal/deps/undici/undici:10695:14)
    at Object.onError (node:internal/deps/undici/undici:11537:36)
    at Request.onError (node:internal/deps/undici/undici:8310:31)
    at errorRequest (node:internal/deps/undici/undici:10378:17)
    at TLSSocket.onSocketClose (node:internal/deps/undici/undici:9811:9)
    at TLSSocket.emit (node:events:526:35)
    at TLSSocket.emit (node:domain:489:12) {
  [cause]: BodyTimeoutError: Body Timeout Error
      at Timeout.onParserTimeout [as callback] (node:internal/deps/undici/undici:9752:32)
      at Timeout.onTimeout [as _onTimeout] (node:internal/deps/undici/undici:8047:17)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7) {
    code: 'UND_ERR_BODY_TIMEOUT'
  }
}
TypeError: terminated
    at Fetch.onAborted (node:internal/deps/undici/undici:11442:53)
    at Fetch.emit (node:events:514:28)
    at Fetch.emit (node:domain:489:12)
    at Fetch.terminate (node:internal/deps/undici/undici:10695:14)
    at Object.onError (node:internal/deps/undici/undici:11537:36)
    at Request.onError (node:internal/deps/undici/undici:8310:31)
    at errorRequest (node:internal/deps/undici/undici:10378:17)
    at TLSSocket.onSocketClose (node:internal/deps/undici/undici:9811:9)
    at TLSSocket.emit (node:events:526:35)
    at TLSSocket.emit (node:domain:489:12) {
  [cause]: BodyTimeoutError: Body Timeout Error
      at Timeout.onParserTimeout [as callback] (node:internal/deps/undici/undici:9752:32)
      at Timeout.onTimeout [as _onTimeout] (node:internal/deps/undici/undici:8047:17)
      at listOnTimeout (node:internal/timers:569:17)
      at processTimers (node:internal/timers:512:7) {
    code: 'UND_ERR_BODY_TIMEOUT'
  }
}
Closing SSE...
Closing SSE...
 ELIFECYCLE  Command failed with exit code 1.

Build:

AlexAndBear commented 1 month ago

I don't know the problem in detail but SSE will try to re-establish the connection

saw-jan commented 1 month ago

we have a method in the hooks to close the sse connections opened from test code. it works when test passes but doesn't when the test fails.

saw-jan commented 1 month ago

Can happen even if the tests pass: https://drone.owncloud.com/owncloud/web/45049/4/8

Screenshot from 2024-06-19 17-09-22