Skip to content

Commit

Permalink
test fix signup
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckyShuii committed Aug 21, 2024
1 parent bee7765 commit 5a2fc6a
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions e2e/tests/components/SignUp.test.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
import { test, expect } from "@playwright/test";

test("Test registering existing user", async ({ page }) => {
await page.goto("http://apigateway/access/register")
await page.waitForLoadState("networkidle");

await page.getByPlaceholder('First name').fill('Lucas')
await page.getByPlaceholder('Last name').fill('Boillot')
await page.getByPlaceholder('Email address').fill('[email protected]')
await page.getByTestId('password').fill('123456')
await page.getByTestId('confirmPassword').fill('123456')
await page.getByTestId('conditions').click()
await page.getByTestId('registerButton').click()

await expect(page.locator('.ant-notification-notice-message').first()).toContainText('Error')
});
let r = (Math.random() + 1).toString(36).substring(7);

test("Test registering new user", async ({ page }) => {
await page.goto("http://apigateway/access/register")
await page.waitForLoadState("networkidle");

// Generate a random string so the test always work
let r = (Math.random() + 1).toString(36).substring(7);

await page.getByPlaceholder('First name').fill(`${r}test`)
await page.getByPlaceholder('Last name').fill(`${r}`)
Expand All @@ -32,3 +18,18 @@ test("Test registering new user", async ({ page }) => {

await expect(page.locator('.ant-notification-notice-message').first()).toContainText('Success')
});

test("Test registering existing user", async ({ page }) => {
await page.goto("http://apigateway/access/register")
await page.waitForLoadState("networkidle");

await page.getByPlaceholder('First name').fill('Lucas')
await page.getByPlaceholder('Last name').fill('Boillot')
await page.getByPlaceholder('Email address').fill(`${r}[email protected]`)
await page.getByTestId('password').fill('123456')
await page.getByTestId('confirmPassword').fill('123456')
await page.getByTestId('conditions').click()
await page.getByTestId('registerButton').click()

await expect(page.locator('.ant-notification-notice-message').first()).toContainText('Error')
});

0 comments on commit 5a2fc6a

Please sign in to comment.