Skip to content

LFG · E2E tests

0 modules · 0 exports · 1 repository · 4 e2e tests · 2 routes

  • NN-ZAP
  • Arrange data setup
  • Act what the user does
  • Assert what is expected

LFG

adds a new lfg post

Renders//lfg/lfg/new

NN-ZAP
Act
  1. Go to “/”
    await navigate({ page, url: "/" });
Anything adder
Act
  1. Add “lfgPost”
    await new AnythingAdder(page).add("lfgPost");
New LFG post page
Act
  1. Fill Text with “looking for a cool team”
    await newPost.form.fill("postText", "looking for a cool team");
  2. Save
    await newPost.save();
LFG page
Assert
  1. add filter button is visible
    await expect(lfg.locators.addFilterButton).toBeVisible();
  2. post “looking for a cool team” is visible
    await expect(lfg.post("looking for a cool team")).toBeVisible();
Source
test("adds a new lfg post", async ({ page }) => {
	await impersonate(page, NZAP_TEST_ID);
	await navigate({ page, url: "/" });

	await new AnythingAdder(page).add("lfgPost");

	const newPost = new NewLFGPostPage(page);
	await newPost.form.fill("postText", "looking for a cool team");
	await newPost.save();

	const lfg = new LFGPage(page);
	await expect(lfg.locators.addFilterButton).toBeVisible();
	await expect(lfg.post("looking for a cool team")).toBeVisible();
})

creates post with custom languages

Renders/lfg/lfg/new

NN-ZAP
New LFG post page
Act
  1. Open the new LFG post page
    await newPost.goto();
  2. Fill Text with “looking for Japanese/Korean team”
    await newPost.form.fill("postText", "looking for Japanese/Korean team");
  3. Check language “日本語”
    await newPost.checkLanguage("日本語");
  4. Check language “한국어”
    await newPost.checkLanguage("한국어");
  5. Save
    await newPost.save();
LFG page
Assert
  1. language pill “JA / KO” is visible
    await expect(new LFGPage(page).languagePill("JA / KO")).toBeVisible();
Source
test("creates post with custom languages", async ({ page }) => {
	await impersonate(page, NZAP_TEST_ID);

	const newPost = new NewLFGPostPage(page);
	await newPost.goto();

	await newPost.form.fill("postText", "looking for Japanese/Korean team");
	await newPost.checkLanguage("日本語");
	await newPost.checkLanguage("한국어");
	await newPost.save();

	await expect(new LFGPage(page).languagePill("JA / KO")).toBeVisible();
})

edits post languages

Renders/lfg/lfg/new

NN-ZAP
New LFG post page
Act
  1. Open the new LFG post page
    await newPost.goto();
  2. Fill Text with “test post for language editing”
    await newPost.form.fill("postText", "test post for language editing");
  3. Check language “Dansk”
    await newPost.checkLanguage("Dansk");
  4. Save
    await newPost.save();
LFG page
Assert
  1. language pill “DA” is visible
    await expect(lfg.languagePill("DA")).toBeVisible();
  2. post “test post for language editing” is visible
    await expect(lfg.post("test post for language editing")).toBeVisible();
Act
  1. Edit first post → editPost
    const editPost = await lfg.editFirstPost();
New LFG post page
Act
  1. Uncheck language “Dansk”
    await editPost.uncheckLanguage("Dansk");
  2. Check language “Español”
    await editPost.checkLanguage("Español");
  3. Save
    await editPost.save();
LFG page
Assert
  1. add filter button is visible
    await expect(lfg.locators.addFilterButton).toBeVisible();
  2. post “test post for language editing” is visible
    await expect(lfg.post("test post for language editing")).toBeVisible();
  3. language pill “ES” is visible
    await expect(lfg.languagePill("ES")).toBeVisible();
Source
test("edits post languages", async ({ page }) => {
	await impersonate(page, NZAP_TEST_ID);

	const newPost = new NewLFGPostPage(page);
	await newPost.goto();

	await newPost.form.fill("postText", "test post for language editing");
	await newPost.checkLanguage("Dansk");
	await newPost.save();

	const lfg = new LFGPage(page);
	await expect(lfg.languagePill("DA")).toBeVisible();
	await expect(lfg.post("test post for language editing")).toBeVisible();

	const editPost = await lfg.editFirstPost();
	await editPost.uncheckLanguage("Dansk");
	await editPost.checkLanguage("Español");
	await editPost.save();

	await expect(lfg.locators.addFilterButton).toBeVisible();
	await expect(lfg.post("test post for language editing")).toBeVisible();
	await expect(lfg.languagePill("ES")).toBeVisible();
})

filters posts by language

Renders/lfg/lfg/new

NN-ZAP
New LFG post page
Act
  1. Open the new LFG post page
    await newPost.goto();
  2. Fill Text with “Japanese speaking team”
    await newPost.form.fill("postText", "Japanese speaking team");
  3. Check language “日本語”
    await newPost.checkLanguage("日本語");
  4. Save
    await newPost.save();
LFG page
Assert
  1. post “Japanese speaking team” is visible
    await expect(lfg.post("Japanese speaking team")).toBeVisible();
Act
  1. Add language filter
    await lfg.addLanguageFilter();
  2. Select filter language “ja”
    await lfg.selectFilterLanguage("ja");
Assert
  1. post “Japanese speaking team” is visible
    await expect(lfg.post("Japanese speaking team")).toBeVisible();
Act
  1. Select filter language “es”
    await lfg.selectFilterLanguage("es");
Assert
  1. post “Japanese speaking team” is not visible
    await expect(lfg.post("Japanese speaking team")).not.toBeVisible();
Source
test("filters posts by language", async ({ page }) => {
	await impersonate(page, NZAP_TEST_ID);

	const newPost = new NewLFGPostPage(page);
	await newPost.goto();

	await newPost.form.fill("postText", "Japanese speaking team");
	await newPost.checkLanguage("日本語");
	await newPost.save();

	const lfg = new LFGPage(page);
	await expect(lfg.post("Japanese speaking team")).toBeVisible();

	await lfg.addLanguageFilter();
	await lfg.selectFilterLanguage("ja");

	await expect(lfg.post("Japanese speaking team")).toBeVisible();

	await lfg.selectFilterLanguage("es");

	await expect(lfg.post("Japanese speaking team")).not.toBeVisible();
})