-
Notifications
You must be signed in to change notification settings - Fork 0
2d 3d #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
2d 3d #4
Changes from all commits
41b249a
6038656
c31d841
7a465fe
677804d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||||||||||||||
| import {test} from "./libs/enhanced_test"; | ||||||||||||||||||
| import {userLogin, navigateToAvatarEditor, userLogout} from "./libs/welcomeScreen_helper" | ||||||||||||||||||
| import {expect} from "@playwright/test"; | ||||||||||||||||||
| import {enrollInMoodleCourse} from "./libs/moodle_helpers"; | ||||||||||||||||||
| import {viewPorts} from "./libs/viewPorts"; | ||||||||||||||||||
|
|
||||||||||||||||||
| test.describe.serial(`avatar editor`, () => { | ||||||||||||||||||
|
|
||||||||||||||||||
| test.beforeAll(async ({ request, resetEnvironment, uploadWorld }) => { | ||||||||||||||||||
| await resetEnvironment(); | ||||||||||||||||||
| const uploadedWorld = await uploadWorld('testwelt'); | ||||||||||||||||||
| await enrollInMoodleCourse( | ||||||||||||||||||
| request, | ||||||||||||||||||
| process.env._PLAYWRIGHT_USER_STUDENT_USERNAME!, | ||||||||||||||||||
| process.env._USER_STUDENT_PW!, | ||||||||||||||||||
| uploadedWorld.worldNameInLms | ||||||||||||||||||
| ); | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| viewPorts.forEach(({width, height}) => { | ||||||||||||||||||
|
|
||||||||||||||||||
| test(`user navigates from avatar editor to welcome screen (${width}x${height})`, async ({page}) => { | ||||||||||||||||||
| await page.setViewportSize({width: width, height: height}); | ||||||||||||||||||
| await userLogin(page); | ||||||||||||||||||
| const welcomScreenURL = page.url(); | ||||||||||||||||||
| await navigateToAvatarEditor(page); | ||||||||||||||||||
| await page.getByRole('button', { name: 'Home Icon' }).click(); | ||||||||||||||||||
| await expect(page.url()).toEqual(welcomScreenURL); | ||||||||||||||||||
|
Comment on lines
+25
to
+28
|
||||||||||||||||||
| const welcomScreenURL = page.url(); | |
| await navigateToAvatarEditor(page); | |
| await page.getByRole('button', { name: 'Home Icon' }).click(); | |
| await expect(page.url()).toEqual(welcomScreenURL); | |
| const welcomeScreenURL = page.url(); | |
| await navigateToAvatarEditor(page); | |
| await page.getByRole('button', { name: 'Home Icon' }).click(); | |
| await expect(page.url()).toEqual(welcomeScreenURL); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export const viewPorts: {width: number, height: number}[] = [ | ||
| {width: 844, height: 331}, | ||
| {width: 390, height: 695}, | ||
| {width: 1080, height: 688}, | ||
| {width: 810, height: 918}, | ||
| {width: 1280, height: 612}, | ||
| {width: 1920, height: 918}, | ||
| {width: 2560, height: 1224}, | ||
| {width: 3840, height: 1836}, | ||
| ] |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,30 @@ | ||||||||||
| import {Page} from "@playwright/test"; | ||||||||||
|
|
||||||||||
| export async function userLogin( | ||||||||||
| page: Page, | ||||||||||
| username: string = process.env._PLAYWRIGHT_USER_STUDENT_USERNAME!, | ||||||||||
| password: string = process.env._USER_STUDENT_PW!, | ||||||||||
| ) { | ||||||||||
| await page.goto('/'); | ||||||||||
| await page.getByTestId('userName').click(); | ||||||||||
| await page.getByTestId('userName').fill(username); | ||||||||||
| await page.getByTestId('userName').press('Tab'); | ||||||||||
| await page.getByTestId('password').fill(password); | ||||||||||
| await page.getByTestId('loginButton').click(); | ||||||||||
| } | ||||||||||
|
Comment on lines
+3
to
+14
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wenn öfters benötigt wäre der besser in der enhanced_test.ts untergebracht. der wäre dann so erreichbar und das naming der methode sollte eine klarere differenzierung von den in dieser datei bereits bestehenden methoden haben (generell, unabhängig davon ob du es dort rein packst oder nicht) |
||||||||||
|
|
||||||||||
| export async function userLogout( | ||||||||||
| page: Page | ||||||||||
| ) { | ||||||||||
| await page.getByTestId("logout").click(); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| export async function navigateToLearningWorldMenu(page: Page) { | ||||||||||
| //TODO: Replace with getByTestId-Query when button has testid | ||||||||||
| await page.getByRole('button').filter({ hasText: /^$/ }).nth(1).click(); | ||||||||||
|
Comment on lines
+23
to
+24
|
||||||||||
| //TODO: Replace with getByTestId-Query when button has testid | |
| await page.getByRole('button').filter({ hasText: /^$/ }).nth(1).click(); | |
| // Requires: Add data-testid="learningWorldMenuButton" to the target button in the application code. | |
| await page.getByTestId('learningWorldMenuButton').click(); |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the previous selector, this uses an empty text filter with nth(2) which is brittle. The reliance on button position makes tests fragile to UI changes.
| //TODO: Replace with getByTestId-Query when button has testid | |
| await page.getByRole('button').filter({ hasText: /^$/ }).nth(2).click(); | |
| // TODO: The button for navigating to the Avatar Editor must have data-testid="avatarEditorButton" in the application code. | |
| await page.getByTestId('avatarEditorButton').click(); |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import {test} from "./libs/enhanced_test"; | ||
| import {userLogin, userLogout, navigateToAvatarEditor, navigateToLearningWorldMenu} from "./libs/welcomeScreen_helper" | ||
| import {expect} from "@playwright/test"; | ||
| import {enrollInMoodleCourse} from "./libs/moodle_helpers"; | ||
| import {viewPorts} from "./libs/viewPorts"; | ||
|
|
||
| test.describe.serial(`welcome screen`, () => { | ||
|
|
||
| test.beforeAll(async ({ request, resetEnvironment, uploadWorld }) => { | ||
| await resetEnvironment(); | ||
| const uploadedWorld = await uploadWorld('testwelt'); | ||
| await enrollInMoodleCourse( | ||
| request, | ||
| process.env._PLAYWRIGHT_USER_STUDENT_USERNAME!, | ||
| process.env._USER_STUDENT_PW!, | ||
| uploadedWorld.worldNameInLms | ||
| ); | ||
|
Comment on lines
+11
to
+17
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
| }); | ||
|
|
||
| viewPorts.forEach(({width, height}) => { | ||
|
|
||
| test(`user logs in (${width}x${height})`, async ({page}) => { | ||
| await page.setViewportSize({width: width, height: height}); | ||
| await userLogin(page); | ||
| await expect(page.getByTestId("login-button")).toBeVisible(); | ||
| }) | ||
|
|
||
| test(`user logs out (${width}x${height})`, async ({page}) => { | ||
| await page.setViewportSize({width: width, height: height}); | ||
| await userLogin(page); | ||
| await userLogout(page); | ||
| await expect(page.getByTestId("userName")).toBeVisible() | ||
| await expect(page.getByTestId("password")).toBeVisible() | ||
| }) | ||
|
|
||
| test(`user navigates from welcome screen to learning world menu (${width}x${height})`, async ({page}) => { | ||
| await page.setViewportSize({width: width, height: height}); | ||
| await userLogin(page); | ||
| await navigateToLearningWorldMenu(page); | ||
| await expect(page.url()).toContain("worldmenu"); | ||
| await expect(page.getByRole('button', { name: 'testwelt' })).toBeVisible(); | ||
| }) | ||
|
|
||
| test(`user navigates from welcome screen to avatar-editor (${width}x${height})`, async ({page}) => { | ||
| await page.setViewportSize({width: width, height: height}); | ||
| await userLogin(page); | ||
| await navigateToAvatarEditor(page); | ||
| await expect(page.url()).toContain("avatarEditor"); | ||
| await expect(page.locator("canvas")).toBeVisible(); | ||
| }) | ||
| }) | ||
| }) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnötig hier?!