-
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(e2e): Convert cy to pw test suite settings/safety-checks.test.ts (…
- Loading branch information
Showing
2 changed files
with
72 additions
and
75 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
packages/suite-desktop-core/e2e/tests/settings/safety-checks.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { test, expect } from '../../support/fixtures'; | ||
|
||
test.describe('Safety Checks Settings', { tag: ['@group=settings'] }, () => { | ||
test.use({ emulatorStartConf: { wipe: true } }); | ||
test.beforeEach(async ({ onboardingPage, settingsPage }) => { | ||
await onboardingPage.completeOnboarding(); | ||
await settingsPage.navigateTo(); | ||
await settingsPage.deviceTabButton.click(); | ||
}); | ||
|
||
test('There is button in device settings, that opens safety checks modal.', async ({ | ||
window: page, | ||
}) => { | ||
await page.getByTestId('@settings/device/safety-checks-button').click(); | ||
await expect(page.getByTestId('@safety-checks-apply')).toBeVisible(); | ||
}); | ||
|
||
test('Only one level is selected at a time', async ({ window: page }) => { | ||
// Open the safety checks modal. | ||
await page.getByTestId('@settings/device/safety-checks-button').click(); | ||
|
||
// There should be two radio buttons, one checked and one not. | ||
await expect(page.locator('[data-testid*="@radio-button"]')).toHaveCount(2); | ||
await expect( | ||
page.locator('[data-testid*="@radio-button"][data-checked="true"]'), | ||
).toHaveCount(1); | ||
await expect( | ||
page.locator('[data-testid*="@radio-button"][data-checked="false"]'), | ||
).toHaveCount(1); | ||
|
||
await page.locator('[data-testid*="@radio-button"][data-checked="false"]').click(); | ||
// After switching the value, there should still be one checked and one unchecked. | ||
await expect( | ||
page.locator('[data-testid*="@radio-button"][data-checked="true"]'), | ||
).toHaveCount(1); | ||
await expect( | ||
page.locator('[data-testid*="@radio-button"][data-checked="false"]'), | ||
).toHaveCount(1); | ||
}); | ||
|
||
test('Apply button is enabled only when value is changed', async ({ window: page }) => { | ||
// Open the safety checks modal. | ||
await page.getByTestId('@settings/device/safety-checks-button').click(); | ||
|
||
await expect(page.getByTestId('@safety-checks-apply')).toBeDisabled(); | ||
await page.locator('[data-testid*="@radio-button"][data-checked="false"]').click(); | ||
await expect(page.getByTestId('@safety-checks-apply')).not.toBeDisabled(); | ||
}); | ||
|
||
test('Device safety_check setting is changed after pressing the apply button', async ({ | ||
window: page, | ||
trezorUserEnvLink, | ||
}) => { | ||
await page.getByTestId('@settings/device/safety-checks-button').click(); | ||
// Don't assume the device is set to any particular value. | ||
// Just switch to the one that is not currently checked. | ||
await page.locator('[data-testid*="@radio-button"][data-checked="false"]').click(); | ||
const targetValue = await page | ||
.locator('[data-testid*="@radio-button"][data-checked="true"]') | ||
.getAttribute('data-testid'); | ||
if (!targetValue) { | ||
throw new Error('Target value not found'); | ||
} | ||
// Changing safety_checks to targetValue | ||
await page.getByTestId('@safety-checks-apply').click(); | ||
await expect(page.getByTestId('@prompts/confirm-on-device')).toBeVisible(); | ||
await trezorUserEnvLink.pressYes(); | ||
|
||
await page.getByTestId('@settings/device/safety-checks-button').click(); | ||
await expect(page.getByTestId(targetValue)).toHaveAttribute('data-checked', 'true'); | ||
}); | ||
}); |
75 changes: 0 additions & 75 deletions
75
packages/suite-web/e2e/tests/settings/safety-checks.test.ts
This file was deleted.
Oops, something went wrong.