-
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
10 changed files
with
129 additions
and
112 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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
NEXTAUTH_URL=http://localhost:$PORT | ||
NEXTAUTH_SECRET=WAzjpS46vFxp17TsRDU3FXo+TF0vrfy6uhCXwGMBUE8= | ||
NEXT_PUBLIC_API_URL=https://dev.blue-carbon-cost-tool.dev-vizzuality.com/api | ||
#NEXT_PUBLIC_API_URL=https://dev.blue-carbon-cost-tool.dev-vizzuality.com/api | ||
NEXT_PUBLIC_API_URL=http://localhost:4000 |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
NEXTAUTH_URL=http://localhost:$PORT | ||
NEXTAUTH_SECRET=WAzjpS46vFxp17TsRDU3FXo+TF0vrfy6uhCXwGMBUE8= | ||
NEXT_PUBLIC_API_URL=https://dev.blue-carbon-cost-tool.dev-vizzuality.com/api | ||
NEXT_PUBLIC_API_URL=http://localhost:4000 |
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 |
---|---|---|
@@ -1,48 +1,51 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
import { defineConfig, devices } from "@playwright/test"; | ||
|
||
const API_URL = 'http://localhost:4000'; | ||
const APP_URL = 'http://localhost:3000'; | ||
// | ||
const API_URL = "http://localhost:4000"; | ||
const APP_URL = "http://localhost:3000"; | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ | ||
/* Run your local dev server before starting the tests */ | ||
webServer: [ | ||
{ | ||
command: 'pnpm --filter api run build && NODE_ENV=test pnpm --filter api run start:prod', | ||
url: API_URL, | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
{ | ||
command: 'NODE_ENV=test pnpm --filter client run build && NODE_ENV=test pnpm --filter client run start', | ||
url: APP_URL, | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
], | ||
testDir: './tests', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: false, | ||
workers: 1, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: process.env.CI ? 'list' : 'html', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL: APP_URL, | ||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
/* Run your local dev server before starting the tests */ | ||
webServer: [ | ||
{ | ||
command: | ||
"pnpm --filter api run build && NODE_ENV=test pnpm --filter api run start:prod", | ||
url: API_URL, | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
], | ||
{ | ||
command: | ||
"NODE_ENV=test pnpm --filter client run build && NODE_ENV=test pnpm --filter client run start", | ||
url: APP_URL, | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
], | ||
testDir: "./tests", | ||
/* Run tests in files in parallel */ | ||
fullyParallel: false, | ||
workers: 1, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: process.env.CI ? "list" : "html", | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
baseURL: APP_URL, | ||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: "on-first-retry", | ||
}, | ||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { ...devices["Desktop Chrome"] }, | ||
}, | ||
], | ||
}); |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
import { E2eTestManager } from '@shared/lib/e2e-test-manager'; | ||
import { User } from '@shared/entities/users/user.entity'; | ||
import { test, expect, Page } from "@playwright/test"; | ||
import { E2eTestManager } from "@shared/lib/e2e-test-manager"; | ||
import { User } from "@shared/entities/users/user.entity"; | ||
|
||
let testManager: E2eTestManager; | ||
let page: Page; | ||
|
@@ -15,48 +15,76 @@ test.beforeEach(async () => { | |
}); | ||
|
||
test.afterEach(async () => { | ||
await testManager.clearDatabase(); | ||
//await testManager.clearDatabase(); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await testManager.logout(); | ||
await testManager.close(); | ||
}); | ||
|
||
// test('an user signs up successfully', async ({ page }) => { | ||
// const user: Pick<User, 'email' | 'password'> = { | ||
// email: '[email protected]', | ||
// password: 'password', | ||
// test("an user signs up successfully", async ({ page }) => { | ||
// const user: Pick<User, "email" | "password"> = { | ||
// email: "[email protected]", | ||
// password: "password", | ||
// }; | ||
// | ||
// await page.goto('/auth/signup'); | ||
// await page.goto("/auth/signup"); | ||
// | ||
// await page.getByLabel('Email').fill(user.email); | ||
// await page.getByLabel("Email").fill(user.email); | ||
// await page.locator('input[type="password"]').fill(user.password); | ||
// await page.getByRole('checkbox').check(); | ||
// await page.getByRole("checkbox").check(); | ||
// | ||
// await page.getByRole('button', { name: /sign up/i }).click(); | ||
// await page.getByRole("button", { name: /sign up/i }).click(); | ||
// | ||
// await page.waitForURL('/auth/signin'); | ||
// await page.waitForURL("/auth/signin"); | ||
// | ||
// await page.getByLabel('Email').fill(user.email); | ||
// 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(); | ||
// await page.getByRole("button", { name: /log in/i }).click(); | ||
// | ||
// await page.waitForURL('/profile'); | ||
// await page.waitForURL("/profile"); | ||
// await expect(await page.locator('input[type="email"]')).toHaveValue( | ||
// user.email | ||
// user.email, | ||
// ); | ||
// }); | ||
|
||
test('an user signs in successfully', async ({ page }) => { | ||
const user: Pick<User, 'email' | 'password' | 'partnerName'> = { | ||
email: '[email protected]', | ||
password: '12345678', | ||
partnerName: 'partner-test' | ||
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 testManager.login(user as User) | ||
await expect(page.getByText(`Email: ${user.email}`)).toBeVisible(); | ||
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(); | ||
// }); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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