Conversation
| const uploadedWorld = await uploadWorld('testwelt'); | ||
| await enrollInMoodleCourse( | ||
| request, | ||
| process.env._PLAYWRIGHT_USER_STUDENT_USERNAME!, | ||
| process.env._USER_STUDENT_PW!, | ||
| uploadedWorld.worldNameInLms | ||
| ); |
| const uploadedWorld = await uploadWorld('testwelt'); | ||
| await enrollInMoodleCourse( | ||
| request, | ||
| process.env._PLAYWRIGHT_USER_STUDENT_USERNAME!, | ||
| process.env._USER_STUDENT_PW!, | ||
| uploadedWorld.worldNameInLms | ||
| ); |
| 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(); | ||
| } |
There was a problem hiding this comment.
wenn öfters benötigt wäre der besser in der enhanced_test.ts untergebracht. der wäre dann so erreichbar
test(`user navigates from avatar editor to welcome screen (${width}x${height})`, async ({page, userlogin}) => {..}
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)
There was a problem hiding this comment.
Pull Request Overview
This PR restructures the test suite by refactoring login functionality and creating comprehensive test coverage for the welcome screen and avatar editor across multiple viewport sizes. The changes extract reusable helper functions and replace a basic login test with more comprehensive screen navigation tests.
- Refactored login functionality into reusable helper functions
- Added comprehensive welcome screen tests covering login, logout, and navigation scenarios
- Implemented avatar editor tests for navigation and category selection
- Introduced viewport testing across multiple screen sizes
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| game/tests/welcomeScreen.spec.ts | New comprehensive test suite for welcome screen functionality across multiple viewports |
| game/tests/login.spec.ts | Removed basic login test (functionality moved to helper) |
| game/tests/libs/welcomeScreen_helper.ts | New helper functions for user login, logout, and navigation operations |
| game/tests/libs/viewPorts.ts | New configuration file defining viewport dimensions for responsive testing |
| game/tests/avatarEditor.spec.ts | New test suite for avatar editor functionality and navigation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| //TODO: Replace with getByTestId-Query when button has testid | ||
| await page.getByRole('button').filter({ hasText: /^$/ }).nth(1).click(); |
There was a problem hiding this comment.
The selector uses an empty text filter with nth(1) which is fragile and could break if button order changes. Consider using a more specific selector or add test IDs to the buttons as suggested in the TODO comment.
| //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(); |
| //TODO: Replace with getByTestId-Query when button has testid | ||
| await page.getByRole('button').filter({ hasText: /^$/ }).nth(2).click(); |
There was a problem hiding this comment.
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(); |
| const welcomScreenURL = page.url(); | ||
| await navigateToAvatarEditor(page); | ||
| await page.getByRole('button', { name: 'Home Icon' }).click(); | ||
| await expect(page.url()).toEqual(welcomScreenURL); |
There was a problem hiding this comment.
Corrected spelling of 'welcomScreenURL' to 'welcomeScreenURL'.
| 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); |
No description provided.