forked from ls1intum/Artemis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Development: Add e2e tests for programming exercise teams (ls1intum#8532
- Loading branch information
Showing
8 changed files
with
174 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
src/test/playwright/support/pageobjects/exercises/ExerciseTeamsPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { Page } from 'playwright'; | ||
import { expect } from '@playwright/test'; | ||
|
||
/** | ||
* Page object for the exercise teams page. | ||
*/ | ||
export class ExerciseTeamsPage { | ||
private readonly page: Page; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
} | ||
|
||
/** | ||
* Clicks the "Create team" button. | ||
*/ | ||
async createTeam() { | ||
await this.page.locator('button', { hasText: 'Create team' }).click(); | ||
} | ||
|
||
/** | ||
* Enters the team name. | ||
* @param teamName - the team name. | ||
*/ | ||
async enterTeamName(teamName: string) { | ||
await this.page.locator('#teamName').fill(teamName); | ||
} | ||
|
||
/** | ||
* Enters the team short name. | ||
* @param teamShortName - the team short name. | ||
*/ | ||
async enterTeamShortName(teamShortName: string) { | ||
await this.page.locator('#teamShortName').fill(teamShortName); | ||
} | ||
|
||
/** | ||
* Sets the team owner/tutor. | ||
* @param username - the tutor username. | ||
*/ | ||
async setTeamTutor(username: string) { | ||
const tutorSearchInput = this.page.locator('#owner-search-input'); | ||
await tutorSearchInput.fill(username); | ||
await this.page.getByRole('listbox').waitFor({ state: 'visible' }); | ||
await tutorSearchInput.press('Enter'); | ||
} | ||
|
||
/** | ||
* Adds a student to the team. | ||
* @param username - the student username. | ||
*/ | ||
async addStudentToTeam(username: string) { | ||
const studentSearchInput = this.page.locator('#student-search-input'); | ||
await studentSearchInput.fill(username); | ||
await this.page.getByRole('listbox').waitFor({ state: 'visible' }); | ||
await studentSearchInput.press('Enter'); | ||
} | ||
|
||
/** | ||
* Checks if the team is on the list of teams. | ||
* @param teamShortName - the team short name. | ||
*/ | ||
async checkTeamOnList(teamShortName: string) { | ||
await expect(this.page.getByRole('table').getByRole('row').getByText(teamShortName)).toBeVisible(); | ||
} | ||
|
||
/** | ||
* Retrieves the Locator to ignore team size recommendation checkbox. | ||
*/ | ||
getIgnoreTeamSizeRecommendationCheckbox() { | ||
return this.page.locator('#ignoreTeamSizeRecommendation'); | ||
} | ||
|
||
/** | ||
* Retrieves the Locator for the save button. | ||
*/ | ||
getSaveButton() { | ||
return this.page.locator('button', { hasText: 'Save' }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters