From 4074489901c6c30bb27dd59a992cba6217c5e287 Mon Sep 17 00:00:00 2001 From: wafflesvsfrankie <92288602+burtonemily@users.noreply.github.com> Date: Mon, 10 Feb 2025 10:26:25 +1100 Subject: [PATCH] Adds in tests for warning modals when trying to exit during onboarding process --- tests/automation/onboarding.spec.ts | 55 +++++++++++++++++++++++++++++ tests/automation/types/testing.ts | 3 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 tests/automation/onboarding.spec.ts diff --git a/tests/automation/onboarding.spec.ts b/tests/automation/onboarding.spec.ts new file mode 100644 index 0000000..cee341b --- /dev/null +++ b/tests/automation/onboarding.spec.ts @@ -0,0 +1,55 @@ +import { englishStrippedStr } from '../locale/localizedString'; +import { test_Alice_1W_no_network } from './setup/sessionTest'; +import { + checkModalStrings, + clickOnTestIdWithText, + typeIntoInput, + waitForTestIdWithText, +} from './utilities/utils'; + +test_Alice_1W_no_network( + 'Warning modal new account', + async ({ aliceWindow1 }) => { + // Create User + await clickOnTestIdWithText(aliceWindow1, 'create-account-button'); + // Need to implement a back button on Desktop + await clickOnTestIdWithText(aliceWindow1, 'back-button'); + // Expect modal to appear with warning message + await checkModalStrings( + aliceWindow1, + englishStrippedStr('warning').toString(), + englishStrippedStr('onboardingBackAccountCreation').toString(), + ); + await clickOnTestIdWithText( + aliceWindow1, + 'session-confirm-ok-button', + englishStrippedStr('quit').toString(), + ); + // Should reload page and take you back to create account page + await waitForTestIdWithText(aliceWindow1, 'create-account-button'); + }, +); + +test_Alice_1W_no_network( + 'Warning modal restore account', + async ({ aliceWindow1 }) => { + const seedPhrase = + 'eldest fazed hybrid buzzer nasty domestic digit pager unusual purged makeup assorted domestic'; + // Restore user + await clickOnTestIdWithText(aliceWindow1, 'existing-account-button'); + // Input recovery phrase + await typeIntoInput(aliceWindow1, 'recovery-phrase-input', seedPhrase); + // Click continue to go to loading page + await clickOnTestIdWithText(aliceWindow1, 'continue-button'); + // Need to implement a back button on Desktop + await clickOnTestIdWithText(aliceWindow1, 'back-button'); + // Expect modal to appear with warning message + await checkModalStrings( + aliceWindow1, + englishStrippedStr('warning').toString(), + englishStrippedStr('onboardingBackLoadAccount').toString(), + ); + // Should reload page and take you back to create account page + await waitForTestIdWithText(aliceWindow1, 'create-account-button'); + }, +); diff --git a/tests/automation/types/testing.ts b/tests/automation/types/testing.ts index 8666838..e0b8c48 100644 --- a/tests/automation/types/testing.ts +++ b/tests/automation/types/testing.ts @@ -178,4 +178,5 @@ export type DataTestId = | 'contact' | 'modal-heading' | 'call-notification-answered-a-call' - | 'call-notification-started-call'; + | 'call-notification-started-call' + | 'back-button';