group tests using .describe
This commit is contained in:
parent
d3723a3e75
commit
141c3e385c
4 changed files with 92 additions and 75 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"postinstall": "prisma generate",
|
"postinstall": "prisma generate",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"test:e2e": "npm run db-seed && playwright test --workers 1 --headed",
|
"test:e2e": "npm run db-seed && playwright test --headed",
|
||||||
"db-seed": "NODE_ENV=development prisma db seed",
|
"db-seed": "NODE_ENV=development prisma db seed",
|
||||||
"start": "next start"
|
"start": "next start"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { test, expect } from "@playwright/test";
|
import { test, expect } from "@playwright/test";
|
||||||
|
|
||||||
|
test.describe("landing", () => {
|
||||||
test("should show logged in state on landing page", async ({ page }) => {
|
test("should show logged in state on landing page", async ({ page }) => {
|
||||||
await page.goto("http://localhost:3000/");
|
await page.goto("http://localhost:3000/");
|
||||||
await expect(
|
await expect(
|
||||||
|
|
@ -8,3 +9,4 @@ test("should show logged in state on landing page", async ({ page }) => {
|
||||||
)
|
)
|
||||||
).toContainText("Logged in as E2E Account");
|
).toContainText("Logged in as E2E Account");
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
import { test, expect } from "@playwright/test";
|
import { test, expect } from "@playwright/test";
|
||||||
|
|
||||||
|
test.describe("videos", () => {
|
||||||
test("should be able to view videos", async ({ page }) => {
|
test("should be able to view videos", async ({ page }) => {
|
||||||
await page.goto("http://localhost:3000/");
|
await page.goto("http://localhost:3000/");
|
||||||
await page
|
await page
|
||||||
.getByRole("link", { name: "Go to Videos → The entire videos collection" })
|
.getByRole("link", {
|
||||||
|
name: "Go to Videos → The entire videos collection",
|
||||||
|
})
|
||||||
.click();
|
.click();
|
||||||
await expect(page).toHaveURL("http://localhost:3000/videos");
|
await expect(page).toHaveURL("http://localhost:3000/videos");
|
||||||
});
|
});
|
||||||
|
|
@ -22,11 +25,17 @@ test("can upload video", async ({ page }) => {
|
||||||
.getByText("Drop files to Attach, or browse")
|
.getByText("Drop files to Attach, or browse")
|
||||||
.setInputFiles("tests/assets/example_video.webm");
|
.setInputFiles("tests/assets/example_video.webm");
|
||||||
await page.getByRole("button", { name: "Upload" }).click();
|
await page.getByRole("button", { name: "Upload" }).click();
|
||||||
await expect(page).toHaveURL(/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/, {
|
await expect(page).toHaveURL(
|
||||||
|
/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/,
|
||||||
|
{
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
await page.click('[href="/videos"]');
|
await page.click('[href="/videos"]');
|
||||||
await page.getByText("example_video.webm").click();
|
await page.getByText("example_video.webm").click();
|
||||||
await expect(page).toHaveURL(/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/);
|
await expect(page).toHaveURL(
|
||||||
|
/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
import { expect, test } from "@playwright/test";
|
import { expect, test } from "@playwright/test";
|
||||||
|
|
||||||
|
test.describe("video", () => {
|
||||||
test("should be able to view video", async ({ page }) => {
|
test("should be able to view video", async ({ page }) => {
|
||||||
await page.goto("http://localhost:3000/videos");
|
await page.goto("http://localhost:3000/videos");
|
||||||
await page.locator("div.grid > a:nth-child(1)").click();
|
await page.locator("div.grid > a:nth-child(1)").click();
|
||||||
await expect(page).toHaveURL(/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/);
|
await expect(page).toHaveURL(
|
||||||
|
/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/
|
||||||
|
);
|
||||||
|
|
||||||
const video = page.locator("video");
|
const video = page.locator("video");
|
||||||
expect(video).toBeTruthy();
|
expect(video).toBeTruthy();
|
||||||
|
|
@ -20,7 +23,9 @@ test("should be able to rename video", async ({ page }) => {
|
||||||
|
|
||||||
await page.goto("http://localhost:3000/videos");
|
await page.goto("http://localhost:3000/videos");
|
||||||
await page.locator("div.grid > a:nth-child(1)").click();
|
await page.locator("div.grid > a:nth-child(1)").click();
|
||||||
await expect(page).toHaveURL(/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/);
|
await expect(page).toHaveURL(
|
||||||
|
/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/
|
||||||
|
);
|
||||||
|
|
||||||
await page.locator("button > svg").click();
|
await page.locator("button > svg").click();
|
||||||
await page.getByText("Rename").click();
|
await page.getByText("Rename").click();
|
||||||
|
|
@ -35,10 +40,11 @@ test("should be able to rename video", async ({ page }) => {
|
||||||
test("should be able to share video", async ({ page }) => {
|
test("should be able to share video", async ({ page }) => {
|
||||||
await page.goto("http://localhost:3000/videos");
|
await page.goto("http://localhost:3000/videos");
|
||||||
await page.locator("div.grid > a:nth-child(1)").click();
|
await page.locator("div.grid > a:nth-child(1)").click();
|
||||||
await expect(page).toHaveURL(/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/);
|
await expect(page).toHaveURL(
|
||||||
|
/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/
|
||||||
|
);
|
||||||
|
|
||||||
await page.getByText("Share").click();
|
await page.getByText("Share").click();
|
||||||
await page.locator('div.mt-6 > button[role="switch"]').click();
|
await page.locator('div.mt-6 > button[role="switch"]').click();
|
||||||
|
});
|
||||||
await page.waitForTimeout(5000);
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue