-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
fix: Fixed flaky test related to change language spec #27590
base: develop
Are you sure you want to change the base?
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
… flaky-test-change-language-27390
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also get rid of the driver.refresh()
from here
Thanks @seaona for the feedback. The test scenario involves refreshing the page to ensure that the language change is retained. Hence the refresh is required. However the current title of the test scenario is misleading and does not clearly represent this purpose. I can update the title to better reflect the scenario or do you want me to remove the scenario. Also I see in the CI its failing due to the reason about the |
oh I see. So the test is currently failing on ci at the refresh point, for the same reason that it was failing on navigate. If this refresh is part of the test, I think we'll need to await until at least one word has changed to the new language, before refreshing. This can mitigate the race condition below Let me know if this makes sense! |
I think we both agree on the CI failures, but we are considering different approaches to fix them.
|
Despite changing the language and checking You can observe this in the video -- language-loading.mp4 |
@seaona, Thank you. I see it clearly now with the video you have posted. I appreciate your patience in explaining this to me. I will add a wait for the text to be fully loaded before performing the refresh. |
@seaona, I have pushed the changes you suggested. Please take a look at your convenience. Locally, everything has been working fine, and I will rerun the tests again the CI to verify. |
… flaky-test-change-language-27390
Builds ready [df9b75e]
Page Load Metrics (1678 ± 54 ms)
Bundle size diffs
|
await driver.assertElementNotPresent('.loading-overlay__spinner'); | ||
|
||
await driver.findVisibleElement(selectors.labelSpanish); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @hjetpoluru my suggestion is to add this conditions before doing the refresh
. Otherwise we'd still can run into the race condition when refreshing. Let me know if this makes sense 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! I thought it was needed after the refresh and before clicking on the dropdown again, cause the overlay appears.
@seaona reading this comment, I feel it would be better to include it both before(just wait for overlay) and after(overlay is gone and the label is visible). Please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await changeLanguage(driver, languageIndex);
await driver.assertElementNotPresent('.loading-overlay__spinner');
// Validate the label changes to Spanish
const isLanguageLabelChanged = await driver.isElementPresent(
selectors.labelSpanish,
);
assert.equal(isLanguageLabelChanged, true, 'Language did not change');
await driver.refresh();
await driver.assertElementNotPresent('.loading-overlay__spinner');
await driver.findVisibleElement(selectors.labelSpanish);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think it's okay. I would keep the labelSpanish before the refresh too, since this needs to happen, to ensure we don't refresh before fetching the language change.
We do have a validation that the language changed below, so I think we can remove the labelSpanish after the refresh (mainly doing the same thing)
await changeLanguage(driver, languageIndex);
await driver.assertElementNotPresent('.loading-overlay__spinner');
await driver.waitForSelector(selectors.labelSpanish);
// Validate the label changes to Spanish
const isLanguageLabelChanged = await driver.isElementPresent(
selectors.labelSpanish,
);
assert.equal(isLanguageLabelChanged, true, 'Language did not change');
await driver.refresh();
await driver.assertElementNotPresent('.loading-overlay__spinner');
let me know if this makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @seaona for guiding me through this change. That makes sense and I will make the change and push up.
… flaky-test-change-language-27390
Quality Gate passedIssues Measures |
After getting the latest develop updates, the test failed on this scenario, which is the intended change. Hence, I am converting this PR as draft for further investigation. Thanks @seaona and @HowardBraham for reviewing this PR and if there is any suggestion please do let me know. |
Description
The test was initially written to change the language in the settings. Due to the dropdown not closing properly, the line await driver.navigate() was used to refresh the page. However, with recent changes in navigation, this step now appears to cause a driver/browser error.
To resolve this issue, instead of refreshing the page it is more logical to close the settings page by clicking the close button after changing the language. Upon @chloeYue suggestion by replacing the line
await driver.navigate()
withawait driver.clickElementAndWaitToDisappear('.settings-page__header__title-container__close-button')
solves the flaky test.Related issues
Fixes:
#27390
Manual testing steps
Run the change language spec locally or in codespace using below commands against chrome browser:
yarn
yarn build:test:webpack
ENABLE_MV3=false yarn test:e2e:single test/e2e/tests/settings/change-language.spec.ts --browser=chrome
Pre-merge author checklist
Pre-merge reviewer checklist