diff --git a/client/src/components/settings/user-token.tsx b/client/src/components/settings/user-token.tsx index d56ee887fdc..de787a5faf5 100644 --- a/client/src/components/settings/user-token.tsx +++ b/client/src/components/settings/user-token.tsx @@ -27,14 +27,11 @@ class UserToken extends Component { const { t } = this.props; return ( -
- - - {t('user-token.title')} - + + + {t('user-token.title')} + +

{t('user-token.delete-p1')}

@@ -49,9 +46,9 @@ class UserToken extends Component { -
-
-
+ + + ); } } diff --git a/e2e/user-token.spec.ts b/e2e/user-token.spec.ts index e97e87ce944..e13d1d0d6df 100644 --- a/e2e/user-token.spec.ts +++ b/e2e/user-token.spec.ts @@ -13,7 +13,9 @@ test.afterAll(() => { test.describe('Initially', () => { test('should not render', async ({ page }) => { await page.goto('/settings'); - await expect(page.getByTestId('user-token')).not.toBeVisible(); + await expect( + page.getByText('User Token', { exact: true }) + ).not.toBeVisible(); }); }); @@ -25,11 +27,20 @@ test.describe('After creating token', () => { await page.getByRole('button', { name: 'Start the course' }).click(); await page.goto('/settings'); - await expect(page.getByTestId('user-token')).toBeVisible(); + // Set `exact` to `true` to only match the panel heading + await expect(page.getByText('User Token', { exact: true })).toBeVisible(); + await expect( + page.getByText( + 'Your user token is used to save your progress on curriculum sections that use a virtual machine. If you suspect it has been compromised, you can delete it without losing any progress. A new one will be created automatically the next time you open a project.' + ) + ).toBeVisible(); await page.getByRole('button', { name: 'Delete my user token' }).click(); - await expect(page.getByTestId('flash-message')).toContainText( + + await expect(page.getByRole('alert')).toContainText( /Your user token has been deleted./ ); - await expect(page.getByTestId('user-token')).not.toBeVisible(); + await expect( + page.getByText('User Token', { exact: true }) + ).not.toBeVisible(); }); });