Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

E2e tests #390

Merged
merged 3 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions frontend/src/tests/existing-user-pages.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
import {Token} from "../utils/ApiInterfaces.ts";

test('fake login works', async ({ page }) => {
test('user flow: student', async ({ page }) => {
await page.goto('https://localhost:8080');
await page.waitForLoadState('networkidle');
await expect(page).toHaveTitle(/Delphi/);
Expand Down Expand Up @@ -39,12 +39,22 @@ test('fake login works', async ({ page }) => {
//klik op flashcards
const flashcardsButton = page.getByRole('link', { name: 'Flash Cards' })
await flashcardsButton.click();
const confirmButton = page.getByRole('button', { name: 'Confirm' })
await expect(confirmButton).toBeVisible();
const groupMember = page.getByText('[email protected]');
const groupMember = page.getByText('[email protected]');
await expect(groupMember).toBeVisible();
const submissionReq = page.getByText('submission.zip');
await expect(submissionReq).toBeVisible();
const leaveButton = page.getByRole('button').nth(2);
await expect(leaveButton).toBeVisible();
await leaveButton.click();
await expect(groupMember).toBeHidden();
//selecteer groep
const joinButton = page.getByRole('row', { name: '2 2' }).getByRole('button');
await expect(joinButton).toBeVisible();
await joinButton.click();
await expect(groupMember).toBeVisible();
const otherMember = page.getByRole('cell', { name: 'Ruben', exact: true });
await expect(otherMember).toBeVisible();
await expect(joinButton).toBeHidden();
//ga naar courses
const coursesButton = page.getByRole('link').nth(2);
await coursesButton.click();
Expand All @@ -59,7 +69,7 @@ test('fake login works', async ({ page }) => {
//ga naar settings en log uit
await settingsButton.click();
const logoutButton = page.locator('div').filter({ hasText: /^Logout:$/ }).getByRole('link')
await logoutButton.click(); // deze button zou wel iets eenvoudiger mogen zijn
await logoutButton.click();
await page.waitForLoadState('networkidle');
await expect(page).toHaveTitle(/Delphi/);
const loginButton = page.getByRole('link', { name: 'Log in' })
Expand Down