Skip to content

Commit

Permalink
Playwright 1st test
Browse files Browse the repository at this point in the history
  • Loading branch information
hsc-nue committed Sep 29, 2023
1 parent 800f56b commit 267dbeb
Show file tree
Hide file tree
Showing 6 changed files with 1,980 additions and 957 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
env:
PLAYWRIGHT_USER: ${{ secrets.PLAYWRIGHT_USER }}
PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }}
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
26 changes: 26 additions & 0 deletions dist/e2e/test-1.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const test_1 = require("@playwright/test");
require("dotenv").config();
test_1.test.beforeEach(({ page }) => __awaiter(void 0, void 0, void 0, function* () {
yield page.goto("https://kind-pear-cowboy-boots.cyclic.app/login");
yield page.locator('input[name="email"]').click();
yield page.locator('input[name="email"]').fill(process.env.PLAYWRIGHT_USER);
yield page.locator('input[name="email"]').press("Tab");
yield page
.locator('input[name="password"]')
.fill(process.env.PLAYWRIGHT_PASSWORD);
yield page.getByRole("button", { name: "Login" }).click();
}));
(0, test_1.test)("test", ({ page }) => __awaiter(void 0, void 0, void 0, function* () {
yield (0, test_1.expect)(page.getByRole("heading", { name: "HSC rental score management" })).toBeVisible();
}));
18 changes: 0 additions & 18 deletions e2e/example.spec.ts

This file was deleted.

31 changes: 31 additions & 0 deletions e2e/test-login-page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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");

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/HSC Leihnoten Verwaltung/);
});

test('Password forgotten link', async ({ page }) => {
await page.goto("https://kind-pear-cowboy-boots.cyclic.app/login");

await page.getByRole('link', { name: 'Passwort vergessen' }).click();

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!);
console.log("process.env.PLAYWRIGHT_USER!", 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();
});

Loading

0 comments on commit 267dbeb

Please sign in to comment.