diff --git a/cypress/e2e/open-wallet.cy.ts b/cypress/e2e/open-wallet.cy.ts index 1eddcbe75c..4d1713d613 100644 --- a/cypress/e2e/open-wallet.cy.ts +++ b/cypress/e2e/open-wallet.cy.ts @@ -35,6 +35,7 @@ describe('Open wallet', () => { cy.findByPlaceholderText('Enter your keyphrase here').type(mnemonic, { delay: 1 }) cy.findByRole('button', { name: /Import my wallet/ }).click() cy.findByText(/Invalid keyphrase/).should('not.exist') + cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true }) cy.findByRole('button', { name: /Open/ }).click() cy.url().should('include', 'oasis1qqca0gplrfn63ljg9c833te7em36lkz0cv8djffh') }) @@ -42,6 +43,7 @@ describe('Open wallet', () => { it('Should open multiple accounts from mnemonic', () => { cy.findByPlaceholderText('Enter your keyphrase here').type(mnemonic, { delay: 1 }) cy.findByRole('button', { name: /Import my wallet/ }).click() + cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true }) cy.findAllByTestId('account-choice').should('have.length', 4) cy.findAllByRole('checkbox', { name: /oasis1/, checked: false }) .should('have.length', 3) @@ -58,6 +60,7 @@ describe('Open wallet', () => { cy.findByPlaceholderText('Enter your keyphrase here').type(mnemonic, { delay: 1 }) cy.findByRole('button', { name: /Import my wallet/ }).click() + cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true }) cy.findAllByTestId('account-choice').should('have.length', 4) cy.findAllByRole('checkbox', { name: /oasis1/, checked: false }) .should('have.length', 3) @@ -72,6 +75,7 @@ describe('Open wallet', () => { const privateKey = 'X0jlpvskP1q8E6rHxWRJr7yTvpCuOPEKBGW8gtuVTxfnViTI0s2fBizgMxNzo75Q7w7MxdJXtOLeqDoFUGxxMg==' beforeEach(() => { cy.visit('/open-wallet/private-key') + cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true }) }) it('Should reject invalid keys', () => { @@ -100,6 +104,7 @@ describe('Open wallet', () => { cy.findByRole('link', { name: /Open wallet/ }).click() cy.findByRole('link', { name: /Private key/ }).click() cy.url().should('include', '/open-wallet/private-key') + cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true }) cy.findByPlaceholderText('Enter your private key here').type(privateKey, { delay: 1 }) cy.findByRole('button', { name: /Import my wallet/ }).click() cy.url().should('include', '/account/oasis1qz0k5q8vjqvu4s4nwxyj406ylnflkc4vrcjghuwk') diff --git a/cypress/e2e/scenario-account-switcher.cy.ts b/cypress/e2e/scenario-account-switcher.cy.ts index 5d1ca3118b..61544d6af2 100644 --- a/cypress/e2e/scenario-account-switcher.cy.ts +++ b/cypress/e2e/scenario-account-switcher.cy.ts @@ -10,6 +10,7 @@ describe('Scenario : multiple accounts', () => { { delay: 0 }, ) cy.findByRole('button', { name: /Import my wallet/ }).click() + cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true }) cy.findByRole('button', { name: /Open/ }).click() cy.url().should('include', '/account/oasis1qq5t7f2gecsjsdxmp5zxtwgck6pzpjmkvc657z6l') @@ -18,6 +19,7 @@ describe('Scenario : multiple accounts', () => { // Open account 2 through private cy.findByRole('link', { name: /Open wallet/ }).click() cy.findByRole('link', { name: /Private key/ }).click() + cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true }) cy.findByPlaceholderText('Enter your private key here').type( 'X0jlpvskP1q8E6rHxWRJr7yTvpCuOPEKBGW8gtuVTxfnViTI0s2fBizgMxNzo75Q7w7MxdJXtOLeqDoFUGxxMg==', { delay: 0 }, diff --git a/cypress/e2e/scenario-transaction.cy.ts b/cypress/e2e/scenario-transaction.cy.ts index 0bf46a3438..620ee11594 100644 --- a/cypress/e2e/scenario-transaction.cy.ts +++ b/cypress/e2e/scenario-transaction.cy.ts @@ -31,6 +31,7 @@ describe('Scenario : from mnemonic', () => { { delay: 1 }, ) cy.findByRole('button', { name: /Import my wallet/ }).click() + cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true }) cy.findByRole('button', { name: /Open/ }).click() cy.url().should('include', '/account/oasis1qq5t7f2gecsjsdxmp5zxtwgck6pzpjmkvc657z6l') }) @@ -86,6 +87,7 @@ describe('Scenario : from private key', () => { cy.visit('/') cy.findByRole('link', { name: /Open wallet/ }).click() cy.findByRole('link', { name: /Private key/ }).click() + cy.findByRole('checkbox', { name: /Create a profile/ }).uncheck({ force: true }) cy.findByPlaceholderText('Enter your private key here').type( 'X0jlpvskP1q8E6rHxWRJr7yTvpCuOPEKBGW8gtuVTxfnViTI0s2fBizgMxNzo75Q7w7MxdJXtOLeqDoFUGxxMg==', { delay: 1 }, diff --git a/playwright/tests/extension.spec.ts b/playwright/tests/extension.spec.ts index d5843bb0ef..5610b74812 100644 --- a/playwright/tests/extension.spec.ts +++ b/playwright/tests/extension.spec.ts @@ -57,7 +57,6 @@ test.describe('The extension popup should load', () => { await fillPrivateKeyWithoutPassword(page, { privateKey: privateKey, privateKeyAddress: privateKeyAddress, - persistenceCheckboxChecked: false, persistenceCheckboxDisabled: false, }) await expect(page.getByTestId('account-selector')).toBeVisible() diff --git a/playwright/tests/fiat.spec.ts b/playwright/tests/fiat.spec.ts index 67bbd9c215..25a431fb70 100644 --- a/playwright/tests/fiat.spec.ts +++ b/playwright/tests/fiat.spec.ts @@ -13,7 +13,6 @@ async function setup(page: Page) { await fillPrivateKeyWithoutPassword(page, { privateKey: privateKey, privateKeyAddress: privateKeyAddress, - persistenceCheckboxChecked: false, persistenceCheckboxDisabled: false, }) await expect(page.getByTestId('account-selector')).toBeVisible() diff --git a/playwright/tests/paraTimes.spec.ts b/playwright/tests/paraTimes.spec.ts index aef21603d3..c2d94c5263 100644 --- a/playwright/tests/paraTimes.spec.ts +++ b/playwright/tests/paraTimes.spec.ts @@ -15,7 +15,6 @@ test.describe('ParaTimes', () => { await fillPrivateKeyWithoutPassword(page, { privateKey: privateKey, privateKeyAddress: privateKeyAddress, - persistenceCheckboxChecked: false, persistenceCheckboxDisabled: false, }) await page.getByTestId('nav-paratime').click() diff --git a/playwright/tests/persist.spec.ts b/playwright/tests/persist.spec.ts index bcc27371b0..f953c7a849 100644 --- a/playwright/tests/persist.spec.ts +++ b/playwright/tests/persist.spec.ts @@ -31,6 +31,7 @@ test.describe('Persist', () => { await page.goto('/open-wallet/mnemonic') await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic) await page.getByRole('button', { name: /Import my wallet/ }).click() + await page.getByText('Create a profile').uncheck() await expect(page.getByText('One account selected')).toBeVisible({ timeout: 10_000 }) const uncheckedAccounts = page.getByRole('checkbox', { name: /oasis1/, checked: false }) await expect(uncheckedAccounts).toHaveCount(3) @@ -38,7 +39,6 @@ test.describe('Persist', () => { const persistence = await page.getByText('Create a profile') await expect(persistence).toBeEnabled() - await expect(persistence).not.toBeChecked() await persistence.check() await page.getByRole('button', { name: /Open/ }).click() }) @@ -82,7 +82,6 @@ test.describe('Persist', () => { const persistence = await page.getByText('Create a profile') await expect(persistence).toBeEnabled() - await expect(persistence).not.toBeChecked() await persistence.check() await page.getByPlaceholder('Enter your private key here').fill(privateKey) @@ -126,8 +125,7 @@ test.describe('Persist', () => { await fillPrivateKeyWithoutPassword(page, { privateKey: privateKey2, privateKeyAddress: privateKey2Address, - persistenceCheckboxChecked: true, - persistenceCheckboxDisabled: true, + persistenceCheckboxDisabled: 'disabled-checked', }) await page.goto('/') await page.getByPlaceholder('Enter your password', { exact: true }).fill(password) @@ -164,6 +162,7 @@ test.describe('Persist', () => { await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic) await page.getByRole('button', { name: /Import my wallet/ }).click() + await page.getByText('Create a profile').uncheck() await expect(page.getByText('One account selected')).toBeVisible({ timeout: 10_000 }) await page.getByText('Create a profile').check() @@ -195,8 +194,7 @@ test.describe('Persist', () => { await fillPrivateKeyWithoutPassword(page, { privateKey: privateKey2, privateKeyAddress: privateKey2Address, - persistenceCheckboxChecked: false, - persistenceCheckboxDisabled: true, + persistenceCheckboxDisabled: 'disabled-unchecked', }) await page.goto('/') await page.getByPlaceholder('Enter your password', { exact: true }).fill(password) @@ -237,7 +235,6 @@ test.describe('Persist', () => { await page.getByRole('button', { name: /Open wallet/ }).click() await page.getByRole('button', { name: /Private key/ }).click() await fillPrivateKeyWithoutPassword(page, { - persistenceCheckboxChecked: false, persistenceCheckboxDisabled: false, }) } diff --git a/playwright/tests/preventSavingInputsToDisk/chromium.spec.ts b/playwright/tests/preventSavingInputsToDisk/chromium.spec.ts index 64787609fc..8912fd9dc4 100644 --- a/playwright/tests/preventSavingInputsToDisk/chromium.spec.ts +++ b/playwright/tests/preventSavingInputsToDisk/chromium.spec.ts @@ -26,6 +26,7 @@ test('Chromium expect mnemonic, privateKey, and password to NOT leak with preven await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic) await page.getByRole('button', { name: /Import my wallet/ }).click() await expect(page.getByText('One account selected')).toBeVisible({ timeout: 10_000 }) + await page.getByText('Create a profile').uncheck() await page.getByRole('button', { name: /Open/ }).click() await expect(page.getByText('Loading account')).toBeHidden() diff --git a/playwright/tests/refreshing-balance.spec.ts b/playwright/tests/refreshing-balance.spec.ts index 1b758afa59..2446f4f83d 100644 --- a/playwright/tests/refreshing-balance.spec.ts +++ b/playwright/tests/refreshing-balance.spec.ts @@ -12,7 +12,6 @@ test.beforeEach(async ({ page }) => { await fillPrivateKeyWithoutPassword(page, { privateKey: privateKey, privateKeyAddress: privateKeyAddress, - persistenceCheckboxChecked: false, persistenceCheckboxDisabled: false, }) await expect(page.getByTestId('account-selector')).toBeVisible() diff --git a/playwright/tests/syncTabs.spec.ts b/playwright/tests/syncTabs.spec.ts index 2e09f49d18..95f14d4bb3 100644 --- a/playwright/tests/syncTabs.spec.ts +++ b/playwright/tests/syncTabs.spec.ts @@ -29,7 +29,6 @@ test.describe('syncTabs', () => { test('unpersisted', async ({ page, context }) => { await page.goto('/open-wallet/private-key') await fillPrivateKeyWithoutPassword(page, { - persistenceCheckboxChecked: false, persistenceCheckboxDisabled: false, }) await expect(page.getByTestId('account-selector')).toBeVisible() @@ -62,8 +61,7 @@ test.describe('syncTabs', () => { await expect(tab2.getByRole('button', { name: /^Unlock$/ })).toBeHidden() await tab2.goto('/open-wallet/private-key') await fillPrivateKeyWithoutPassword(tab2, { - persistenceCheckboxChecked: false, - persistenceCheckboxDisabled: true, + persistenceCheckboxDisabled: 'disabled-unchecked', }) await expect(tab2.getByTestId('account-selector')).toBeVisible() await expect(page.getByTestId('account-selector')).toBeVisible() @@ -96,7 +94,6 @@ test.describe('syncTabs', () => { test('unpersisted', async ({ page, context }) => { await page.goto('/open-wallet/private-key') await fillPrivateKeyWithoutPassword(page, { - persistenceCheckboxChecked: false, persistenceCheckboxDisabled: false, }) const tab2 = await context.newPage() @@ -120,8 +117,7 @@ test.describe('syncTabs', () => { const tab2 = await context.newPage() await tab2.goto('/open-wallet/private-key') await fillPrivateKeyWithoutPassword(tab2, { - persistenceCheckboxChecked: false, - persistenceCheckboxDisabled: true, + persistenceCheckboxDisabled: 'disabled-unchecked', }) await testSyncingNetwork(page, tab2) }) @@ -202,7 +198,6 @@ test.describe('syncTabs', () => { test('unpersisted', async ({ page, context }) => { await page.goto('/open-wallet/private-key') await fillPrivateKeyWithoutPassword(page, { - persistenceCheckboxChecked: false, persistenceCheckboxDisabled: false, }) const tab2 = await context.newPage() @@ -226,8 +221,7 @@ test.describe('syncTabs', () => { const tab2 = await context.newPage() await tab2.goto('/open-wallet/private-key') await fillPrivateKeyWithoutPassword(tab2, { - persistenceCheckboxChecked: false, - persistenceCheckboxDisabled: true, + persistenceCheckboxDisabled: 'disabled-unchecked', }) await testSelectedAccountNotSync(page, tab2) }) @@ -270,6 +264,7 @@ test.describe('syncTabs', () => { await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic) await page.getByRole('button', { name: /Import my wallet/ }).click() + await page.getByText('Create a profile').uncheck() await expect(page.getByText('One account selected')).toBeVisible({ timeout: 10_000 }) await page.getByRole('checkbox', { name: /oasis1/, checked: true }).uncheck() for (let i = 0; i < 11; i++) { diff --git a/playwright/tests/toolbar.spec.ts b/playwright/tests/toolbar.spec.ts index 1397f66304..d3f99d233d 100644 --- a/playwright/tests/toolbar.spec.ts +++ b/playwright/tests/toolbar.spec.ts @@ -110,6 +110,7 @@ test.describe('My Accounts tab', () => { await page.goto('/open-wallet/mnemonic') await page.getByPlaceholder('Enter your keyphrase here').fill(mnemonic) await page.getByRole('button', { name: /Import my wallet/ }).click() + await page.getByText('Create a profile').uncheck() const uncheckedAccounts = page.getByRole('checkbox', { name: /oasis1/, checked: false }) await expect(uncheckedAccounts).toHaveCount(3) for (const account of await uncheckedAccounts.elementHandles()) await account.click() diff --git a/playwright/tests/validators.spec.ts b/playwright/tests/validators.spec.ts index 40c892ffd5..3247a49373 100644 --- a/playwright/tests/validators.spec.ts +++ b/playwright/tests/validators.spec.ts @@ -21,7 +21,6 @@ test.beforeEach(async ({ page }) => { await fillPrivateKeyWithoutPassword(page, { privateKey: privateKey, privateKeyAddress: privateKeyAddress, - persistenceCheckboxChecked: false, persistenceCheckboxDisabled: false, }) await expect(page.getByTestId('account-selector')).toBeVisible() diff --git a/playwright/utils/fillPrivateKey.ts b/playwright/utils/fillPrivateKey.ts index b06a9179f8..16e1ac3ada 100644 --- a/playwright/utils/fillPrivateKey.ts +++ b/playwright/utils/fillPrivateKey.ts @@ -6,8 +6,7 @@ export async function fillPrivateKeyWithoutPassword( params: { privateKey?: string privateKeyAddress?: string - persistenceCheckboxDisabled: boolean - persistenceCheckboxChecked: boolean + persistenceCheckboxDisabled: false | 'disabled-checked' | 'disabled-unchecked' ticker?: string }, ) { @@ -15,15 +14,15 @@ export async function fillPrivateKeyWithoutPassword( await expect(page).toHaveURL(new RegExp('/open-wallet/private-key')) const persistence = await page.getByText('Create a profile') - if (params.persistenceCheckboxDisabled) { + if (params.persistenceCheckboxDisabled === 'disabled-checked') { await expect(persistence).toBeDisabled() - } else { - await expect(persistence).toBeEnabled() - } - if (params.persistenceCheckboxChecked) { await expect(persistence).toBeChecked() - } else { + } else if (params.persistenceCheckboxDisabled === 'disabled-unchecked') { + await expect(persistence).toBeDisabled() await expect(persistence).not.toBeChecked() + } else { + await expect(persistence).toBeEnabled() + await persistence.uncheck() } await page.getByPlaceholder('Enter your private key here').fill(params.privateKey ?? privateKey) @@ -44,7 +43,6 @@ export async function fillPrivateKeyAndPassword( const persistence = await page.getByText('Create a profile') await expect(persistence).toBeEnabled() - await expect(persistence).not.toBeChecked() await persistence.check() await page.getByPlaceholder('Enter your private key here').fill(params.privateKey ?? privateKey)