-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix: flaky test Vault Corruption restores a backup that is missing its
meta property successfully
#36777
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: flaky test Vault Corruption restores a backup that is missing its
meta property successfully
#36777
Changes from all commits
923f509
cfc977a
3c0f181
adf6b13
e6bfb5c
e663508
402b139
eafe0dc
5f9b5e5
4d3b473
fd9f06b
dc50376
109f76d
4e42973
7953814
4bc704a
f59964c
f3874d9
e92bdae
ccbb5c6
b710796
1d139e3
480ac88
50950b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ import AccountDetailsModal from '../../page-objects/pages/dialog/account-details | |
import LoginPage from '../../page-objects/pages/login-page'; | ||
|
||
describe('Vault Corruption', function () { | ||
this.timeout(120000); // This test is very long, so we need an unusually high timeout | ||
/** | ||
* Script template to simulate a broken database. | ||
* | ||
|
@@ -127,8 +128,8 @@ describe('Vault Corruption', function () { | |
// the extension has restarted | ||
return title === WINDOW_TITLES.ExtensionInFullScreenView; | ||
}, | ||
// reload and check title as quickly a possible, forever | ||
{ interval: 0, timeout: Infinity }, | ||
// reload and check title as quickly a possible | ||
{ interval: 100, timeout: 10000 }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the ![]() with this fix, the test is less prone to errors, as we are effectively waiting for the correct title, going to the home page, as many times as needed (until reaching 10 seconds): ![]()
|
||
); | ||
await driver.assertElementNotPresent('.loading-logo', { timeout: 10000 }); | ||
} | ||
|
@@ -193,10 +194,7 @@ describe('Vault Corruption', function () { | |
confirm: boolean; | ||
}) { | ||
// click the Recovery/Reset button | ||
const recoveryButton = await driver.findClickableElement( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
'#critical-error-button', | ||
); | ||
await recoveryButton.click(); | ||
await driver.clickElement('#critical-error-button'); | ||
|
||
// Confirm we want to recover/reset. | ||
const prompt = await driver.driver.switchTo().alert(); | ||
|
@@ -206,16 +204,25 @@ describe('Vault Corruption', function () { | |
await prompt.dismiss(); | ||
} | ||
|
||
// the button should be disabled while the recovery process is in progress, | ||
// and enabled if the user dismissed the prompt | ||
const isEnabled = await recoveryButton.isEnabled(); | ||
assert.equal( | ||
isEnabled, | ||
!confirm, | ||
confirm | ||
? 'Recovery button should be disabled when prompt is accepted' | ||
: 'Recovery button should be enabled when prompt is dismissed', | ||
); | ||
if (confirm) { | ||
// delay needed to mitigate a race condition where the tab is closed and re-opened after confirming, causing to window to become stale | ||
await driver.delay(3000); | ||
try { | ||
await driver.switchToWindowWithTitle( | ||
WINDOW_TITLES.ExtensionInFullScreenView, | ||
); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we switch to the Extension page to make sure we are in the correct window, as sometimes the window is closed and re-opened, causing the error |
||
} catch (error) { | ||
// to mitigate a race condition where the tab is closed after confirming (issue #36916) | ||
await driver.openNewPage('about:blank'); | ||
await driver.navigate(); | ||
seaona marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
// the button should be disabled if the user confirmed the prompt, but given this is a transient state that goes very fast | ||
// it can cause a race condition where the element becomes stale, so we check directly that the element is not present as that's a stable state that occurs eventually | ||
await driver.assertElementNotPresent('#critical-error-button'); | ||
} else { | ||
// the button should be enabled if the user dismissed the prompt | ||
await driver.findClickableElement('#critical-error-button'); | ||
} | ||
seaona marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
/** | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
I hit this once: