fix: update test to use getByRole

This commit is contained in:
Lucas Smith
2024-03-08 02:45:22 +00:00
parent 47b06fa290
commit ee35b4a24b
3 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,7 @@
import { test } from '@playwright/test';
import { expect, test } from '@playwright/test';
import { WEBAPP_BASE_URL } from '@documenso/lib/constants/app';
import { getUserByEmail } from '@documenso/lib/server-only/user/get-user-by-email';
import { seedUser } from '@documenso/prisma/seed/users';
import { manualLogin } from './fixtures/authentication';
@ -14,8 +15,11 @@ test('delete user', async ({ page }) => {
redirectPath: '/settings',
});
await page.getByTestId('delete-account-button').click();
await page.getByTestId('delete-account-confirmation-button').click();
await page.getByRole('button', { name: 'Delete Account' }).click();
await page.getByRole('button', { name: 'Confirm Deletion' }).click();
await page.waitForURL(`${WEBAPP_BASE_URL}/signin`);
// Verify that the user no longer exists in the database
await expect(getUserByEmail({ email: user.email })).rejects.toThrow();
});