Skip to content

Commit

Permalink
[playwright] chore: Refactor reg test
Browse files Browse the repository at this point in the history
  • Loading branch information
helloitsdave committed May 19, 2024
1 parent 10a3f7e commit 8200c6b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions playwright/tests/registration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ test.beforeAll(async ({ browser }) => {
await registrationPage.goto();
});

test.afterAll(async () => {
/**
* Delete the user if it was created
*/
if (token) {
const deleteUserResponse = await deleteUser(token);
expect(deleteUserResponse.ok()).toBeTruthy();
}
});

test.describe('User Registration', { tag: ['@PRODUCTION'] }, async () => {
test('Should be able to register new user', async () => {
await expect(registrationPage.accountHeader()).toBeVisible();
Expand All @@ -44,11 +54,6 @@ test.describe('User Registration', { tag: ['@PRODUCTION'] }, async () => {

expect(json.token).toBeTruthy();
});

await test.step('Cleanup: Delete User', async () => {
const deleteUserResponse = await deleteUser(token);
expect(deleteUserResponse.ok()).toBeTruthy();
});
});

test('Should not be able to register with existing username', async () => {
Expand Down

0 comments on commit 8200c6b

Please sign in to comment.