Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky e2e test: incorrect-locale has been failing constantly in "after each" hook #9543

Closed
tatilepizs opened this issue Oct 14, 2024 · 4 comments · Fixed by #9611
Closed
Assignees
Labels
Flaky Indicates a flaky or unreliable test Testing Affects how the code is tested Type: Technical issue Improve something that users won't notice
Milestone

Comments

@tatilepizs
Copy link
Contributor

tatilepizs commented Oct 14, 2024

Describe the issue
E2e test /tests/e2e/default/translations/incorrect-locale.wdio-spec.js has been failing constantly in the "after each" hook due to timing

------------------------------------------------------------------
[chrome 90.0.4430.72 linux #0-5] Running: chrome (v90.0.4430.72) on linux
[chrome 90.0.4430.72 linux #0-5] Session ID: 62d09db66cd013a39458898546df0548
[chrome 90.0.4430.72 linux #0-5]
[chrome 90.0.4430.72 linux #0-5] » /tests/e2e/default/translations/incorrect-locale.wdio-spec.js
[chrome 90.0.4430.72 linux #0-5] Testing Incorrect locale
[chrome 90.0.4430.72 linux #0-5]    ✖ should work with incorrect locale
[chrome 90.0.4430.72 linux #0-5]    ✖ "after each" hook for Testing Incorrect locale
[chrome 90.0.4430.72 linux #0-5]
[chrome 90.0.4430.72 linux #0-5] 1 failing (5m 5.1s)
[chrome 90.0.4430.72 linux #0-5]
[chrome 90.0.4430.72 linux #0-5] 1) Testing Incorrect locale should work with incorrect locale
[chrome 90.0.4430.72 linux #0-5] Timeout of 120000ms exceeded. The execution in the test "Testing Incorrect locale should work with incorrect locale" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts). (/home/runner/work/cht-core/cht-core/tests/e2e/default/translations/incorrect-locale.wdio-spec.js)
[chrome 90.0.4430.72 linux #0-5] Error: Timeout of 120000ms exceeded. The execution in the test "Testing Incorrect locale should work with incorrect locale" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts). (/home/runner/work/cht-core/cht-core/tests/e2e/default/translations/incorrect-locale.wdio-spec.js)
[chrome 90.0.4430.72 linux #0-5]     at createTimeoutError (/home/runner/work/cht-core/cht-core/node_modules/mocha/lib/errors.js:498:15)
[chrome 90.0.4430.72 linux #0-5]     at Test.Runnable._timeoutError (/home/runner/work/cht-core/cht-core/node_modules/mocha/lib/runnable.js:429:10)
[chrome 90.0.4430.72 linux #0-5]     at Timeout.<anonymous> (/home/runner/work/cht-core/cht-core/node_modules/mocha/lib/runnable.js:244:24)
[chrome 90.0.4430.72 linux #0-5]     at listOnTimeout (node:internal/timers:573:17)
[chrome 90.0.4430.72 linux #0-5]     at processTimers (node:internal/timers:514:7)
[chrome 90.0.4430.72 linux #0-5]
[chrome 90.0.4430.72 linux #0-5] 2) Testing Incorrect locale "after each" hook for Testing Incorrect locale
[chrome 90.0.4430.72 linux #0-5] Timeout
[chrome 90.0.4430.72 linux #0-5] Error: Timeout
[chrome 90.0.4430.72 linux #0-5]     at listOnTimeout (node:internal/timers:573:17)
[chrome 90.0.4430.72 linux #0-5]     at processTimers (node:internal/timers:514:7)
------------------------------------------------------------------

This is an example run

Here is the artifact in case it is helpful -> incorrect-locale-ci-webdriver-default-core-minimum-browser.zip

@tatilepizs tatilepizs added Type: Technical issue Improve something that users won't notice Testing Affects how the code is tested Flaky Indicates a flaky or unreliable test labels Oct 14, 2024
@garethbowen
Copy link
Contributor

@tatilepizs Could you please include the log as a text snippet rather than a screenshot so we can find this issue when doing a text search?

@tatilepizs
Copy link
Contributor Author

Sure, I updated the description.

@dianabarsan
Copy link
Member

I think the failure is both in the test and in the hook.
Looking at the reported screenshots, it looks like the language actually never changes:

Image

@ralfudx
Copy link
Contributor

ralfudx commented Nov 6, 2024

The way the test was written, only a few components on the page will have translations as seen in the createLanguage function at the top of the spec file:

'n.month': '{MONTHS, plural, =1{1 luna} other{# luni}}',
'n.week': '{WEEKS, plural, =1{1 saptamana} other{# saptamani}}',
'reports.none.n.months':
  '{MONTHS, plural, =1{No reports in the last month.} other{No reports in the last # months.}}',
'task.days.left': '{DAYS, plural, =1{1 day left} other{# days left}',
'tasks.none.n.weeks': '{WEEKS, plural, =1{No tasks in the next week.} other{No tasks in the next # weeks.}}',
'Reports': 'HilReports',
'view.all': 'View all'

So the expected screenshot when the test runs successfully will look like this:
Image

Also, the validations for the language translations are only for the Tasks filter and the HilReports filter.

From my investigations I noticed intermittent failures happening in the afterEach hook majorly because of a timeout which seems to happen in the revertSettings.

Timeout of 120000ms exceeded. The execution in the test "Testing Incorrect locale should work with incorrect locale" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts). (/home/runner/work/cht-core/cht-core/tests/e2e/default/translations/incorrect-locale.wdio-spec.js)

Moving this function from the afterEach block to the main test block seemed to make the test more stable and we can accommodate this fix for now because we have only one test in the spec file - /tests/e2e/default/translations/incorrect-locale.wdio-spec.js

After executing the test about 20 times here, there was no related failure - the only failure on Attempt#5 & Attempt#20 happened because of this error - A previous test did not call revertSettings in the createLanguage function and isn't one of the previous functions in the afterEach block.

@ralfudx ralfudx moved this from Todo to In Progress in Product Team Activities Nov 8, 2024
ralfudx added a commit that referenced this issue Nov 11, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Product Team Activities Nov 11, 2024
@garethbowen garethbowen added this to the 4.15.0 milestone Nov 11, 2024
sugat009 pushed a commit that referenced this issue Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Flaky Indicates a flaky or unreliable test Testing Affects how the code is tested Type: Technical issue Improve something that users won't notice
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants