Skip to content

Vods · E2E tests

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

  • SSendou
  • Arrange data setup
  • Act what the user does
  • Assert what is expected

VoDs page

adds video (pov)

Renders/vods/:id/vods/new

Setup
Arrange
  1. Grant user Sendou roles “VIDEO_ADDER”
    await factories.UserFactory.grant(ADMIN_ID, { roles: ["VIDEO_ADDER"] });
SSendou
New vod page
Act
  1. Open the new vod page
    await newVod.goto();
  2. Fill YouTube URL with “https://www.youtube.com/watch?v=o7kWlMZP3lM”
    await newVod.form.fill(
    	"youtubeUrl",
    	"https://www.youtube.com/watch?v=o7kWlMZP3lM",
    );
  3. Fill Video title with “ITZXI Finals - Team Olive vs. Astral [CAMO TENTA PoV]”
    await newVod.form.fill(
    	"title",
    	"ITZXI Finals - Team Olive vs. Astral [CAMO TENTA PoV]",
    );
  4. Set Video date to VIDEO_DATE
    await newVod.form.setDate("date", VIDEO_DATE);
  5. Select “SCRIM” for Type
    await newVod.form.select("type", "SCRIM");
  6. Select pov “Sendou”
    await newVod.selectPov("Sendou");
  7. Match 0 → firstMatch
    const firstMatch = newVod.match(0);
Vod match fields
Act
  1. Set starts at “0:20”
    await firstMatch.setStartsAt("0:20");
  2. Select mode “Tower Control”
    await firstMatch.selectMode("Tower Control");
  3. Select stage “Hammerhead Bridge”
    await firstMatch.selectStage("Hammerhead Bridge");
  4. Select weapon “Zink Mini Splatling”
    await firstMatch.selectWeapon("Zink Mini Splatling");
New vod page
Act
  1. Add match
    await newVod.addMatch();
  2. Match 1 → secondMatch
    const secondMatch = newVod.match(1);
Vod match fields
Act
  1. Set starts at “5:55”
    await secondMatch.setStartsAt("5:55");
  2. Select mode “Rainmaker”
    await secondMatch.selectMode("Rainmaker");
  3. Select stage “Museum d'Alfonsino”
    await secondMatch.selectStage("Museum d'Alfonsino");
  4. Select weapon “Tenta Brella”
    await secondMatch.selectWeapon("Tenta Brella");
New vod page
Act
  1. Save → vod
    const vod = await newVod.save();
Vod page
Assert
  1. published at contains FORMATTED_VIDEO_DATE
    await expect(vod.locators.publishedAt).toContainText(FORMATTED_VIDEO_DATE);
  2. weapon image 4001 is visible
    await expect(vod.weaponImage(ZINK_MINI_SPLATLING)).toBeVisible();
  3. weapon image 6010 is visible
    await expect(vod.weaponImage(TENTA_BRELLA)).toBeVisible();
Act
  1. Open copy timestamps
    await vod.openCopyTimestamps();
Assert
  1. timestamps has value [ "0:00 Intro", "0:20 Zink Mini Splatling / TC Hammerhead Bridge", "5:55 Tent…
    await expect(vod.locators.timestamps).toHaveValue(
    	[
    		"0:00 Intro",
    		"0:20 Zink Mini Splatling / TC Hammerhead Bridge",
    		"5:55 Tenta Brella / RM Museum d'Alfonsino",
    	].join("\n"),
    );
Source
test("adds video (pov)", async ({ page, factories }) => {
	await factories.UserFactory.grant(ADMIN_ID, { roles: ["VIDEO_ADDER"] });

	await impersonate(page);

	const newVod = new NewVodPage(page);
	await newVod.goto();

	await newVod.form.fill(
		"youtubeUrl",
		"https://www.youtube.com/watch?v=o7kWlMZP3lM",
	);
	await newVod.form.fill(
		"title",
		"ITZXI Finals - Team Olive vs. Astral [CAMO TENTA PoV]",
	);
	await newVod.form.setDate("date", VIDEO_DATE);
	await newVod.form.select("type", "SCRIM");

	await newVod.selectPov("Sendou");

	const firstMatch = newVod.match(0);
	await firstMatch.setStartsAt("0:20");
	await firstMatch.selectMode("Tower Control");
	await firstMatch.selectStage("Hammerhead Bridge");
	await firstMatch.selectWeapon("Zink Mini Splatling");

	await newVod.addMatch();

	const secondMatch = newVod.match(1);
	await secondMatch.setStartsAt("5:55");
	await secondMatch.selectMode("Rainmaker");
	await secondMatch.selectStage("Museum d'Alfonsino");
	await secondMatch.selectWeapon("Tenta Brella");

	const vod = await newVod.save();

	await expect(vod.locators.publishedAt).toContainText(FORMATTED_VIDEO_DATE);
	await expect(vod.weaponImage(ZINK_MINI_SPLATLING)).toBeVisible();
	await expect(vod.weaponImage(TENTA_BRELLA)).toBeVisible();

	await vod.openCopyTimestamps();
	await expect(vod.locators.timestamps).toHaveValue(
		[
			"0:00 Intro",
			"0:20 Zink Mini Splatling / TC Hammerhead Bridge",
			"5:55 Tenta Brella / RM Museum d'Alfonsino",
		].join("\n"),
	);
})

adds video (cast)

Renders/vods/:id/vods/new

Setup
Arrange
  1. Grant user Sendou roles “VIDEO_ADDER”
    await factories.UserFactory.grant(ADMIN_ID, { roles: ["VIDEO_ADDER"] });
SSendou
New vod page
Act
  1. Open the new vod page
    await newVod.goto();
  2. Fill YouTube URL with “https://www.youtube.com/watch?v=QFk1Gf91SwI”
    await newVod.form.fill(
    	"youtubeUrl",
    	"https://www.youtube.com/watch?v=QFk1Gf91SwI",
    );
  3. Fill Video title with “BIG ! vs Starburst - Splatoon 3 Grand Finals - The Big House 10”
    await newVod.form.fill(
    	"title",
    	"BIG ! vs Starburst - Splatoon 3 Grand Finals - The Big House 10",
    );
  4. Set Video date to VIDEO_DATE
    await newVod.form.setDate("date", VIDEO_DATE);
  5. Select “CAST” for Type
    await newVod.form.select("type", "CAST");
  6. Match 0 → match
    const match = newVod.match(0);
Vod match fields
Act
  1. Set starts at “0:25”
    await match.setStartsAt("0:25");
  2. Select mode “Clam Blitz”
    await match.selectMode("Clam Blitz");
  3. Select stage “MakoMart”
    await match.selectStage("MakoMart");
  4. Repeat for (let i = 0; i < 4; i++)
    for (let i = 0; i < 4; i++) {
    	await match.selectTeamWeapon(1, i, "Luna Blaster");
    }
    1. Select team weapon 1, i, “Luna Blaster”
      await match.selectTeamWeapon(1, i, "Luna Blaster");
  5. Repeat for (let i = 0; i < 4; i++)
    for (let i = 0; i < 4; i++) {
    	await match.selectTeamWeapon(2, i, "Tenta Brella");
    }
    1. Select team weapon 2, i, “Tenta Brella”
      await match.selectTeamWeapon(2, i, "Tenta Brella");
New vod page
Act
  1. Save → vod
    const vod = await newVod.save();
Assert
  1. Repeat for (let i = 0; i < 8; i++)
    for (let i = 0; i < 8; i++) {
    	await expect(
    		vod.weaponImage(i < 4 ? LUNA_BLASTER : TENTA_BRELLA, i),
    	).toBeVisible();
    }
    1. weapon image i < 4 ? LUNA_BLASTER : TENTA_BRELLA, i is visible
      await expect(
      	vod.weaponImage(i < 4 ? LUNA_BLASTER : TENTA_BRELLA, i),
      ).toBeVisible();
Source
test("adds video (cast)", async ({ page, factories }) => {
	await factories.UserFactory.grant(ADMIN_ID, { roles: ["VIDEO_ADDER"] });

	await impersonate(page);

	const newVod = new NewVodPage(page);
	await newVod.goto();

	await newVod.form.fill(
		"youtubeUrl",
		"https://www.youtube.com/watch?v=QFk1Gf91SwI",
	);
	await newVod.form.fill(
		"title",
		"BIG ! vs Starburst - Splatoon 3 Grand Finals - The Big House 10",
	);
	await newVod.form.setDate("date", VIDEO_DATE);
	await newVod.form.select("type", "CAST");

	const match = newVod.match(0);
	await match.setStartsAt("0:25");
	await match.selectMode("Clam Blitz");
	await match.selectStage("MakoMart");

	for (let i = 0; i < 4; i++) {
		await match.selectTeamWeapon(1, i, "Luna Blaster");
	}
	for (let i = 0; i < 4; i++) {
		await match.selectTeamWeapon(2, i, "Tenta Brella");
	}

	const vod = await newVod.save();

	for (let i = 0; i < 8; i++) {
		await expect(
			vod.weaponImage(i < 4 ? LUNA_BLASTER : TENTA_BRELLA, i),
		).toBeVisible();
	}
})

edits and deletes vod

Renders/u/:identifier/u/:identifier/vods/vods/vods/:id/vods/new

Setup
Arrange
  1. Create vod submitter Sendou pov type “USER” user Sendou matches starts at “0:00” stage id 0 mode “SZ” weapons 6010 → existingVod
    const existingVod = await factories.VodFactory.create({
    	submitterUserId: ADMIN_ID,
    	pov: { type: "USER", userId: ADMIN_ID },
    	matches: [
    		{
    			startsAt: "0:00",
    			stageId: SCORCH_GORGE,
    			mode: "SZ",
    			weapons: [TENTA_BRELLA],
    		},
    	],
    });
  2. Grant user Sendou roles “VIDEO_ADDER”
    await factories.UserFactory.grant(ADMIN_ID, { roles: ["VIDEO_ADDER"] });
SSendou
Vod page
Act
  1. Open the vod page existingVod.id
    await vod.goto(existingVod.id);
  2. Open edit → editVod
    const editVod = await vod.openEdit();
New vod page
Act
  1. Select weapon “Luna Blaster”
    await editVod.match(0).selectWeapon("Luna Blaster");
  2. Save
    await editVod.save();
Assert
  1. the page URL is vodVideoPage(existingVod.id)
    await expect(page).toHaveURL(vodVideoPage(existingVod.id));
Vod page
Assert
  1. weapon image 200 is visible
    await expect(vod.weaponImage(LUNA_BLASTER)).toBeVisible();
Act
  1. Delete
    await vod.delete();
Assert
  1. the page URL is /\/u\/.+\/vods/
    await expect(page).toHaveURL(/\/u\/.+\/vods/);
Vods page
Act
  1. Open the vods page
    await vods.goto();
Assert
  1. no vods text is visible
    await expect(vods.locators.noVodsText).toBeVisible();
Source
test("edits and deletes vod", async ({ page, factories }) => {
	const existingVod = await factories.VodFactory.create({
		submitterUserId: ADMIN_ID,
		pov: { type: "USER", userId: ADMIN_ID },
		matches: [
			{
				startsAt: "0:00",
				stageId: SCORCH_GORGE,
				mode: "SZ",
				weapons: [TENTA_BRELLA],
			},
		],
	});

	await factories.UserFactory.grant(ADMIN_ID, { roles: ["VIDEO_ADDER"] });

	await impersonate(page);

	const vod = new VodPage(page);
	await vod.goto(existingVod.id);

	const editVod = await vod.openEdit();
	await editVod.match(0).selectWeapon("Luna Blaster");
	await editVod.save();

	await expect(page).toHaveURL(vodVideoPage(existingVod.id));
	await expect(vod.weaponImage(LUNA_BLASTER)).toBeVisible();

	await vod.delete();

	await expect(page).toHaveURL(/\/u\/.+\/vods/);

	const vods = new VodsPage(page);
	await vods.goto();

	await expect(vods.locators.noVodsText).toBeVisible();
})

operates vod filters

Renders/vods

Setup
Arrange
  1. Create vod submitter Sendou pov type “USER” user N-ZAP matches starts at “0:00” stage id 0 mode “SZ” weapons 6010
    await factories.VodFactory.create({
    	submitterUserId: ADMIN_ID,
    	pov: { type: "USER", userId: NZAP_TEST_ID },
    	matches: [
    		{
    			startsAt: "0:00",
    			stageId: SCORCH_GORGE,
    			mode: "SZ",
    			weapons: [TENTA_BRELLA],
    		},
    	],
    });
SSendou
Vods page
Act
  1. Open the vods page
    await vods.goto();
  2. Pov link “N-ZAP” → nzapPovLink
    const nzapPovLink = vods.povLink("N-ZAP");
Assert
  1. nzapPovLink is visible
    await expect(nzapPovLink).toBeVisible();
Act
  1. Filter by weapon “Carbon Roller”
    await vods.filterByWeapon("Carbon Roller");
Assert
  1. nzapPovLink is not visible
    await isNotVisible(nzapPovLink);
  2. no vods text is visible
    await expect(vods.locators.noVodsText).toBeVisible();
Source
test("operates vod filters", async ({ page, factories }) => {
	await factories.VodFactory.create({
		submitterUserId: ADMIN_ID,
		pov: { type: "USER", userId: NZAP_TEST_ID },
		matches: [
			{
				startsAt: "0:00",
				stageId: SCORCH_GORGE,
				mode: "SZ",
				weapons: [TENTA_BRELLA],
			},
		],
	});

	await impersonate(page);

	const vods = new VodsPage(page);
	await vods.goto();

	const nzapPovLink = vods.povLink("N-ZAP");
	await expect(nzapPovLink).toBeVisible();

	await vods.filterByWeapon("Carbon Roller");

	await isNotVisible(nzapPovLink);
	await expect(vods.locators.noVodsText).toBeVisible();
})