From e796cf5dc5c0cb3270031e3438bf6f787c4dbb52 Mon Sep 17 00:00:00 2001 From: rvdkeere Date: Thu, 23 May 2024 18:07:56 +0200 Subject: [PATCH 1/2] test group leave & join in student flow --- .../src/tests/existing-user-pages.spec.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend/src/tests/existing-user-pages.spec.ts b/frontend/src/tests/existing-user-pages.spec.ts index 5e1d3aba..34f95763 100644 --- a/frontend/src/tests/existing-user-pages.spec.ts +++ b/frontend/src/tests/existing-user-pages.spec.ts @@ -1,7 +1,8 @@ import { test, expect } from '@playwright/test'; import {Token} from "../utils/ApiInterfaces.ts"; +import {join} from "lodash"; -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/); @@ -39,12 +40,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('mathieu.strypsteen@ugent.be'); + const groupMember = page.getByText('robbe.vandekeere@ugent.be'); 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(); + //const noGroup = page.getByText('You don\'t have a group yet'); + //await expect(noGroup).toBeVisible(); + await expect(groupMember).toBeHidden(); + const joinButton = page.getByRole('row', { name: '2 2' }).getByRole('button'); + await expect(joinButton).toBeVisible(); + await joinButton.click(); + //await expect(noGroup).toBeHidden(); + await expect(groupMember).toBeVisible(); + await expect(joinButton).toBeHidden(); //ga naar courses const coursesButton = page.getByRole('link').nth(2); await coursesButton.click(); From 03ed499f1b4a7e90f34c52b37030e26c8d649851 Mon Sep 17 00:00:00 2001 From: rvdkeere Date: Thu, 23 May 2024 19:59:28 +0200 Subject: [PATCH 2/2] student flow changes --- frontend/src/tests/existing-user-pages.spec.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/src/tests/existing-user-pages.spec.ts b/frontend/src/tests/existing-user-pages.spec.ts index 34f95763..bd3e5575 100644 --- a/frontend/src/tests/existing-user-pages.spec.ts +++ b/frontend/src/tests/existing-user-pages.spec.ts @@ -1,6 +1,5 @@ import { test, expect } from '@playwright/test'; import {Token} from "../utils/ApiInterfaces.ts"; -import {join} from "lodash"; test('user flow: student', async ({ page }) => { await page.goto('https://localhost:8080'); @@ -47,14 +46,14 @@ test('user flow: student', async ({ page }) => { const leaveButton = page.getByRole('button').nth(2); await expect(leaveButton).toBeVisible(); await leaveButton.click(); - //const noGroup = page.getByText('You don\'t have a group yet'); - //await expect(noGroup).toBeVisible(); 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(noGroup).toBeHidden(); 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); @@ -70,7 +69,7 @@ test('user flow: student', 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' })