Skip to content

Commit

Permalink
test(e2e): update default instance invidious
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-r committed Feb 20, 2024
1 parent f35c976 commit 7b65731
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion e2e/favorites.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { navigateTo, selectedInstance } from "./utils";

test("save card in favorites", async ({ page }) => {
await page.goto("localhost:3000");
await selectedInstance(page, "invidious.fdn.fr");
await selectedInstance(page, "invidious.projectsegfau.lt");

// Go to Trending page
await page.getByRole("button", { name: "Trending" }).click();
Expand Down
2 changes: 1 addition & 1 deletion e2e/player.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test.describe.serial("player", () => {
test.skip("play video", async ({ page }) => {
await page.goto("localhost:3000");

await selectedInstance(page, "invidious.fdn.fr");
await selectedInstance(page, "invidious.projectsegfau.lt");

await page.reload();

Expand Down
2 changes: 1 addition & 1 deletion e2e/playlists.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "./utils";

const createPlaylist = async (page, title: string) => {
await selectedInstance(page, "invidious.fdn.fr");
await selectedInstance(page, "invidious.projectsegfau.lt");
await navigateTo(page, "Playlists", "Playlists");

// Open modal to create playlist
Expand Down
9 changes: 7 additions & 2 deletions e2e/search.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { expect, test } from "@playwright/test";

import { listVisibility, search, selectSearchType, selectedInstance } from "./utils";
import {
listVisibility,
search,
selectSearchType,
selectedInstance,
} from "./utils";

test.describe.serial("search", () => {
test("search an artist", async ({ page }) => {
await page.goto("localhost:3000");

await selectedInstance(page, "invidious.fdn.fr");
await selectedInstance(page, "invidious.projectsegfau.lt");

await search(page, "Eminem");
await search(page, "Dubstep");
Expand Down
10 changes: 6 additions & 4 deletions e2e/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export const selectSearchType = async (
// page.getByRole("listbox").getByRole("option", { selected: true }),
// ).toContainText(currentType);
// await page.getByRole("listbox").getByRole("option", { name: type }).click();
await expect(page.locator('[role="option"][value="video"][aria-selected="true"]')).toContainText(currentType);
await expect(
page.locator('[role="option"][value="video"][aria-selected="true"]'),
).toContainText(currentType);
await page.locator(`[role="option"][value=${type}]`).click();
};

Expand All @@ -73,13 +75,13 @@ export const selectedInstance = async (page: Page, instanceUri: string) => {
page.getByRole("list", { name: "Invidious instances list" }),
).toBeVisible();
await expect(
page.getByRole("listitem", { name: "invidious.fdn.fr" }),
page.getByRole("listitem", { name: "invidious.projectsegfau.lt" }),
).toBeVisible();
await page
.getByRole("listitem", { name: "invidious.fdn.fr" })
.getByRole("listitem", { name: "invidious.projectsegfau.lt" })
.getByTestId("use")
.click();
await expect(
page.getByRole("listitem", { name: "invidious.fdn.fr" }),
page.getByRole("listitem", { name: "invidious.projectsegfau.lt" }),
).toHaveAttribute("aria-current", "true");
};

0 comments on commit 7b65731

Please sign in to comment.