-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
86 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [ main, master ] | ||
branches: [main, master] | ||
pull_request: | ||
branches: [ main, master ] | ||
branches: [main, master] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
env: | ||
PLAYWRIGHT_BASE_URL: ${{ secrets.PLAYWRIGHT_BASE_URL }} | ||
PLAYWRIGHT_ENABLE_WEBSERVER: ${{ vars.PLAYWRIGHT_ENABLE_WEBSERVER }} | ||
PLAYWRIGHT_USER: ${{ secrets.PLAYWRIGHT_USER }} | ||
PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }} | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
env: | ||
PLAYWRIGHT_BASE_URL: ${{ secrets.PLAYWRIGHT_BASE_URL }} | ||
PLAYWRIGHT_ENABLE_WEBSERVER: ${{ vars.PLAYWRIGHT_ENABLE_WEBSERVER }} | ||
PLAYWRIGHT_USER: ${{ secrets.PLAYWRIGHT_USER }} | ||
PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }} | ||
PLAYWRIGHT_ADMIN_USER: ${{ secrets.PLAYWRIGHT_ADMIN_USER }} | ||
PLAYWRIGHT_ADMIN_PASSWORD: ${{ secrets.PLAYWRIGHT_ADMIN_PASSWORD }} | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { test, expect } from "@playwright/test"; | ||
require("dotenv").config(); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
// login | ||
await page.goto(`/login`); | ||
await page.locator('input[name="email"]').click(); | ||
await page | ||
.locator('input[name="email"]') | ||
.fill(process.env.PLAYWRIGHT_ADMIN_USER!); | ||
await page.locator('input[name="email"]').press("Tab"); | ||
await page | ||
.locator('input[name="password"]') | ||
.fill(process.env.PLAYWRIGHT_ADMIN_PASSWORD!); | ||
await page.getByRole("button", { name: "Login" }).click(); | ||
await expect( | ||
page.getByRole("link", { name: "Ausleihen anzeigen" }) | ||
).toBeVisible(); | ||
}); | ||
|
||
test("Show checkouts", async ({ page }) => { | ||
await page.getByRole("link", { name: "Ausleihen anzeigen" }).click(); | ||
await expect(page.getByRole("heading", { name: "Ausleihen" })).toBeVisible(); | ||
await page.getByRole("combobox").selectOption("ORFF-COM"); | ||
await page.getByRole("button", { name: "Suchen" }).click(); | ||
|
||
await expect( | ||
page.getByRole("cell", { | ||
name: "ORFF-COM-1f3e2bf1-7dbb-43c7-9b9e-b8b4f7f0306f", | ||
}) | ||
).toBeVisible(); | ||
|
||
// filter by extId | ||
await expect( | ||
page.getByRole("cell", { name: "Filtern.." }).first() | ||
).toBeVisible(); | ||
await page.locator("#searchScoreExtIdInput").click(); | ||
await page.locator("#searchScoreExtIdInput").pressSequentially("9"); // fill will not create keypress event and thus will not reduce the list | ||
// extId '115' should become hidden | ||
await expect( | ||
page.getByRole("cell", { | ||
name: "ORFF-COM-1f3e2bf1-7dbb-43c7-9b9e-b8b4f7f0306f", | ||
}) | ||
).toBeHidden(); | ||
await page.keyboard.press("Backspace"); | ||
|
||
// filter by last name | ||
await expect( | ||
page.getByRole("cell", { name: "Filtern.." }).nth(1) | ||
).toBeVisible(); | ||
await page.locator("#searchUserInput").click(); | ||
await page.locator("#searchUserInput").pressSequentially("Be"); // fill will not create keypress event and thus will not reduce the list | ||
// extId '115' should become hidden | ||
await expect( | ||
page.getByRole("cell", { | ||
name: "ORFF-COM-1f3e2bf1-7dbb-43c7-9b9e-b8b4f7f0306f", | ||
}) | ||
).toBeHidden(); | ||
await page.keyboard.press("Backspace"); | ||
await page.keyboard.press("Backspace"); | ||
}); |