-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,22 +5,37 @@ import { User } from "@shared/entities/users/user.entity"; | |
let testManager: E2eTestManager; | ||
let page: Page; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
testManager = await E2eTestManager.load(page); | ||
}); | ||
test.describe.configure({ mode: "serial" }); | ||
|
||
test.beforeEach(async () => { | ||
await testManager.clearDatabase(); | ||
}); | ||
test.describe("Auth", () => { | ||
test.beforeAll(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
testManager = await E2eTestManager.load(page); | ||
}); | ||
|
||
test.afterEach(async () => { | ||
//await testManager.clearDatabase(); | ||
}); | ||
test.beforeEach(async () => { | ||
await testManager.clearDatabase(); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await testManager.logout(); | ||
await testManager.close(); | ||
test.afterEach(async () => { | ||
// await testManager.clearDatabase(); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
//await testManager.logout(); | ||
await testManager.close(); | ||
}); | ||
|
||
test("an user signs in successfully", async () => { | ||
const user: Pick<User, "email" | "password" | "partnerName"> = { | ||
email: "[email protected]", | ||
password: "12345678", | ||
partnerName: "admin", | ||
}; | ||
await testManager.mocks().createUser(user); | ||
await testManager.login(user as User); | ||
await expect(page.getByText(`Email: ${user.email}`)).toBeVisible(); | ||
}); | ||
}); | ||
|
||
// test("an user signs up successfully", async ({ page }) => { | ||
|
@@ -49,42 +64,3 @@ test.afterAll(async () => { | |
// user.email, | ||
// ); | ||
// }); | ||
|
||
test("an user signs in successfully", async ({ page }) => { | ||
const user: Pick<User, "email" | "password" | "partnerName"> = { | ||
email: "[email protected]", | ||
password: "12345678", | ||
partnerName: "admin", | ||
}; | ||
|
||
await testManager.mocks().createUser(user); | ||
await page.goto("/auth/signin"); | ||
await page.getByLabel("Email").fill(user.email); | ||
await page.locator('input[type="password"]').fill(user.password); | ||
await page.getByRole("button", { name: /log in/i }).click(); | ||
}); | ||
|
||
test("test", async ({ page }) => { | ||
await page.goto("http://localhost:3000/"); | ||
await page.getByRole("link", { name: "Sign in" }).click(); | ||
await page.getByPlaceholder("Enter your email").click(); | ||
await page.getByPlaceholder("Enter your email").fill("[email protected]"); | ||
await page.getByPlaceholder("*******").click(); | ||
await page.getByPlaceholder("*******").fill("12345678"); | ||
await page.getByRole("button", { name: "Log in" }).click(); | ||
}); | ||
// test("test", async ({ page }) => { | ||
// const user: Pick<User, "email" | "password" | "partnerName"> = { | ||
// email: "[email protected]", | ||
// password: "12345678", | ||
// partnerName: "admin", | ||
// }; | ||
// await page.goto("http://localhost:3000/"); | ||
// await page.getByRole("link", { name: "Sign in" }).click(); | ||
// await page.getByPlaceholder("Enter your email").click(); | ||
// await page.getByPlaceholder("Enter your email").fill(user.email); | ||
// await page.getByPlaceholder("*******").click(); | ||
// await page.getByPlaceholder("*******").fill(user.password); | ||
// await page.getByRole("button", { name: "Log in" }).click(); | ||
// await expect(page.getByText(`Email: ${user.email}`)).toBeVisible(); | ||
// }); |