From 1272172674511dacb6b8edcf08a20a3819fdd357 Mon Sep 17 00:00:00 2001 From: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:24:37 -0700 Subject: [PATCH] fix(client): add padding to the user token section (#55101) --- client/src/components/settings/user-token.tsx | 19 ++++++++----------- e2e/user-token.spec.ts | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 15 deletions(-) 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(); }); });