From 876232a1c3630ad5b48cabaa8331f551b98917b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20S=C3=BCdkamp?= Date: Fri, 29 Sep 2023 10:35:27 +0200 Subject: [PATCH] test --- e2e/example.spec.ts | 18 ------------------ e2e/test-1.spec.ts | 22 ---------------------- e2e/test-2.spec.ts | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 40 deletions(-) delete mode 100644 e2e/example.spec.ts delete mode 100644 e2e/test-1.spec.ts diff --git a/e2e/example.spec.ts b/e2e/example.spec.ts deleted file mode 100644 index 54a906a..0000000 --- a/e2e/example.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { test, expect } from '@playwright/test'; - -test('has title', async ({ page }) => { - await page.goto('https://playwright.dev/'); - - // Expect a title "to contain" a substring. - await expect(page).toHaveTitle(/Playwright/); -}); - -test('get started link', async ({ page }) => { - await page.goto('https://playwright.dev/'); - - // Click the get started link. - await page.getByRole('link', { name: 'Get started' }).click(); - - // Expects page to have a heading with the name of Installation. - await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); -}); diff --git a/e2e/test-1.spec.ts b/e2e/test-1.spec.ts deleted file mode 100644 index 73ce275..0000000 --- a/e2e/test-1.spec.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { test, expect } from "@playwright/test"; -require("dotenv").config(); - -test.beforeEach(async ({ page }) => { - await page.goto("https://kind-pear-cowboy-boots.cyclic.app/login"); - await page.locator('input[name="email"]').click(); - await page.locator('input[name="email"]').fill(process.env.PLAYWRIGHT_USER!); - await page.locator('input[name="email"]').press("Tab"); - await page - .locator('input[name="password"]') - .fill(process.env.PLAYWRIGHT_PASSWORD!); - await page.getByRole("button", { name: "Login" }).click(); -}); - -test("home content", async ({ page }) => { - await expect( - page.getByRole("heading", { name: "HSC Leihnoten Verwaltung" }) - ).toBeDefined(); - expect(page.getByRole('link', { name: 'Ausleihen anzeigen' })).toBeDefined(); - expect(page.getByRole('link', { name: 'QRCode für Login anzeigen' })).toBeDefined(); - // await expect(page.getByRole('link', { name: 'QRCode für Login anzeigen' })).toBeVisible(); -}); diff --git a/e2e/test-2.spec.ts b/e2e/test-2.spec.ts index 243888f..5d4e904 100644 --- a/e2e/test-2.spec.ts +++ b/e2e/test-2.spec.ts @@ -1,4 +1,5 @@ import { test, expect } from '@playwright/test'; +require("dotenv").config(); test('has title', async ({ page }) => { await page.goto("https://kind-pear-cowboy-boots.cyclic.app/login"); @@ -14,3 +15,16 @@ test('Password forgotten link', async ({ page }) => { await expect(page.getByRole('heading', { name: 'Passwort vergessen' })).toBeVisible(); }); + +test('Login link', async ({ page }) => { + await page.goto("https://kind-pear-cowboy-boots.cyclic.app/login"); + await page.locator('input[name="email"]').click(); + await page.locator('input[name="email"]').fill(process.env.PLAYWRIGHT_USER!); + await page.locator('input[name="email"]').press("Tab"); + await page + .locator('input[name="password"]') + .fill(process.env.PLAYWRIGHT_PASSWORD!); + await page.getByRole("button", { name: "Login" }).click(); + await expect(page.getByRole('link', { name: 'QRCode für Login anzeigen' })).toBeVisible(); +}); + \ No newline at end of file