add test to upload file
This commit is contained in:
parent
5fad3555e1
commit
a38440bb19
5 changed files with 14 additions and 7 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",
|
"test:e2e": "npm run db-seed && playwright test --workers 1 --headed",
|
||||||
"db-seed": "NODE_ENV=development prisma db seed",
|
"db-seed": "NODE_ENV=development prisma db seed",
|
||||||
"start": "next start"
|
"start": "next start"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import { test, expect } from "@playwright/test";
|
import { test, expect } from "@playwright/test";
|
||||||
|
|
||||||
test.describe.configure({ mode: "serial" });
|
|
||||||
|
|
||||||
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
|
||||||
|
|
@ -22,7 +20,7 @@ test("can upload video", async ({ page }) => {
|
||||||
await page.getByText("New video").click();
|
await page.getByText("New video").click();
|
||||||
await page
|
await page
|
||||||
.getByText("Drop files to Attach, or browse")
|
.getByText("Drop files to Attach, or browse")
|
||||||
.setInputFiles("tests/.auth/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,
|
||||||
|
|
@ -30,7 +28,5 @@ test("can upload video", async ({ page }) => {
|
||||||
|
|
||||||
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]+/);
|
||||||
timeout: 30000,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
@ -31,3 +31,14 @@ test("should be able to rename video", async ({ page }) => {
|
||||||
await page.locator("div > span.text-lg.font-medium").textContent()
|
await page.locator("div > span.text-lg.font-medium").textContent()
|
||||||
).toBe(randomTitle);
|
).toBe(randomTitle);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("should be able to share video", async ({ page }) => {
|
||||||
|
await page.goto("http://localhost:3000/videos");
|
||||||
|
await page.locator("div.grid > a:nth-child(1)").click();
|
||||||
|
await expect(page).toHaveURL(/http:\/\/localhost:3000\/share\/[A-Za-z0-9]+/);
|
||||||
|
|
||||||
|
await page.getByText("Share").click();
|
||||||
|
await page.locator('button[role="switch"]').click();
|
||||||
|
|
||||||
|
await page.waitForTimeout(5000);
|
||||||
|
});
|
||||||
BIN
tests/assets/example_video.webm
Normal file
BIN
tests/assets/example_video.webm
Normal file
Binary file not shown.
Loading…
Reference in a new issue