Skip to content

Commit

Permalink
corpus as fixture param
Browse files Browse the repository at this point in the history
  • Loading branch information
ctot-nondef committed Feb 6, 2024
1 parent aecc941 commit d005a43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions e2e/fixtures/corpsum.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@ export const login = base.extend<NonNullable<unknown>, { account: Account }>({
},
});

export const search = login.extend<NonNullable<unknown>, { term: string }>({
export const search = login.extend<NonNullable<unknown>, { term: string, corpus: string }>({
term: ["", { scope: "worker" }],
page: async ({ page, term }, use) => {
corpus: ["", { scope: "worker" }],
page: async ({ page, term, corpus }, use) => {
await page.getByRole("combobox").first().click();
const corpusPromise = page.waitForResponse(
"https://noskecrystal5corpsum.acdh-dev.oeaw.ac.at/run.cgi/corp_info?corpname=amc_4.2&subcorpora=1&format=json",
`https://noskecrystal5corpsum.acdh-dev.oeaw.ac.at/run.cgi/corp_info?corpname=${corpus}&subcorpora=1&format=json`,
);
await page.getByRole("option", { name: "amc_4.2" }).click();
await page.getByRole("option", { name: corpus }).click();
await corpusPromise;
await page.getByPlaceholder("Your search term").fill(term);
const wordformFreqsPromise = page.waitForResponse(
`https://noskecrystal5corpsum.acdh-dev.oeaw.ac.at/run.cgi/freqml?usecorp=amc_4.2&corpname=amc_4.2&default_attr=lemma&attrs=word&refs==doc.id&attr_allpos=all&viewmode=kwic&cup_hl=q&structs=s,+g&fromp=1&pagesize=20&kwicleftctx=100%23&kwicrightctx=100%23&json=%7B%22concordance_query%22:%7B%22iquery%22:%22${term}%22,%22queryselector%22:%22iqueryrow%22%7D%7D`,
`https://noskecrystal5corpsum.acdh-dev.oeaw.ac.at/run.cgi/freqml?usecorp=${corpus}&corpname=${corpus}&default_attr=lemma&attrs=word&refs==doc.id&attr_allpos=all&viewmode=kwic&cup_hl=q&structs=s,+g&fromp=1&pagesize=20&kwicleftctx=100%23&kwicrightctx=100%23&json=%7B%22concordance_query%22:%7B%22iquery%22:%22${term}%22,%22queryselector%22:%22iqueryrow%22%7D%7D`,
);
await page.getByPlaceholder("Your search term").press("Enter");
await wordformFreqsPromise;
Expand Down
2 changes: 1 addition & 1 deletion e2e/pages/results.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect } from "@playwright/test";
import { search as test } from "../fixtures/corpsum.fixtures";

const account = { username: process.env.TEST_USER!, password: process.env.TEST_PASSWORD! };
test.use({ account, term: "haus" });
test.use({ account, term: "haus", corpus: "amc_4.2" });

test.describe("Search Result Display", () => {
test("should be able to display result information on selected searches", async ({ page }) => {
Expand Down

0 comments on commit d005a43

Please sign in to comment.