feat(e2e): update github workflow to use matrix with playwright tags, cache workflow setup steps

This commit is contained in:
QAComet
2024-04-24 13:45:30 -06:00
parent d181d5db20
commit 1c55ec8d97
2 changed files with 62 additions and 30 deletions
+46 -28
View File
@@ -1,32 +1,50 @@
import { expect, test } from "../../index"
import { expect, test } from "../../index";
test("Logging in without credentials displays an error", async ({ loginPage }) => {
await loginPage.submitLoginButton.click()
const toast = await loginPage.getLatestToast()
await expect(toast.locator).toBeVisible()
await expect(toast.locator).toHaveAttribute("data-type", "error")
})
test.describe(
"Login test suite",
{
tag: "@login",
},
async () => {
test("Logging in without credentials displays an error", async ({
loginPage,
}) => {
await loginPage.submitLoginButton.click();
const toast = await loginPage.getLatestToast();
await expect(toast.locator).toBeVisible();
await expect(toast.locator).toHaveAttribute("data-type", "error");
});
test("Logging in with an erroneous password displays an error", async ({ loginPage }) => {
await loginPage.usernameInput.fill(process.env['TEST_USERNAME'] || "")
await loginPage.passwordInput.fill("NOT_MY_PASSWORD_DNE_ERROR")
await loginPage.submitLoginButton.click()
const toast = await loginPage.getLatestToast()
await expect(toast.locator).toBeVisible()
await expect(toast.locator).toHaveAttribute("data-type", "error")
})
test("Logging in with an erroneous password displays an error", async ({
loginPage,
}) => {
await loginPage.usernameInput.fill(process.env["TEST_USERNAME"] || "");
await loginPage.passwordInput.fill("NOT_MY_PASSWORD_DNE_ERROR");
await loginPage.submitLoginButton.click();
const toast = await loginPage.getLatestToast();
await expect(toast.locator).toBeVisible();
await expect(toast.locator).toHaveAttribute("data-type", "error");
});
test("Logging in without valid credentials displays an error", async ({ loginPage }) => {
await loginPage.submitLoginButton.click()
const toast = await loginPage.getLatestToast()
await expect(toast.locator).toBeVisible()
await expect(toast.locator).toHaveAttribute("data-type", "error")
})
test("Logging in without valid credentials displays an error", async ({
loginPage,
}) => {
await loginPage.submitLoginButton.click();
const toast = await loginPage.getLatestToast();
await expect(toast.locator).toBeVisible();
await expect(toast.locator).toHaveAttribute("data-type", "error");
});
test("Logging in with a valid username and password works as expected", async ({ page, loginPage, dashboardPage }) => {
await loginPage.usernameInput.fill(process.env['TEST_USERNAME'] || "")
await loginPage.passwordInput.fill(process.env['TEST_PASSWORD'] || "")
await loginPage.submitLoginButton.click()
await expect(loginPage.loginForm).not.toBeVisible()
await expect(dashboardPage.container).toBeVisible()
})
test("Logging in with a valid username and password works as expected", async ({
page,
loginPage,
dashboardPage,
}) => {
await loginPage.usernameInput.fill(process.env["TEST_USERNAME"] || "");
await loginPage.passwordInput.fill(process.env["TEST_PASSWORD"] || "");
await loginPage.submitLoginButton.click();
await expect(loginPage.loginForm).not.toBeVisible();
await expect(dashboardPage.container).toBeVisible();
});
}
);