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

@ -115,7 +115,7 @@ export const DeleteAccountDialog = ({ className, user }: DeleteAccountDialogProp
data-testid="delete-account-confirmation-button"
disabled={hasTwoFactorAuthentication}
>
{isDeletingAccount ? 'Deleting account...' : 'Delete Account'}
{isDeletingAccount ? 'Deleting account...' : 'Confirm Deletion'}
</Button>
</DialogFooter>
</DialogContent>

View File

@ -20,7 +20,7 @@
"prisma:migrate-dev": "npm run with:env -- npm run prisma:migrate-dev -w @documenso/prisma",
"prisma:migrate-deploy": "npm run with:env -- npm run prisma:migrate-deploy -w @documenso/prisma",
"prisma:seed": "npm run with:env -- npm run prisma:seed -w @documenso/prisma",
"prisma:studio": "npm run with:env -- npx prisma studio --schema packages/prisma/schema.prisma",
"prisma:studio": "npm run with:env -- npm run prisma:studio -w @documenso/prisma",
"with:env": "dotenv -e .env -e .env.local --",
"reset:hard": "npm run clean && npm i && npm run prisma:generate",
"precommit": "npm install && git add package.json package-lock.json"

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();
});