Skip to content
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

Development: Fix flaky e2e tests #9326

Merged
merged 15 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,17 @@ test.describe('Test Exam - student exams', () => {

await studentExamManagement.checkExamStudent(studentOne.username);
await studentExamManagement.checkExamStudent(studentTwo.username);
await studentExamManagement.checkExamStudent(studentThree.username);

await expect(studentExamManagement.getStudentExamRows()).toHaveCount(2);
await expect(studentExamManagement.getStudentExamRows()).toHaveCount(3);

await studentExamManagement.checkStudentExamProperty(studentOne.username, 'Started', 'Yes');
await studentExamManagement.checkStudentExamProperty(studentTwo.username, 'Started', 'Yes');
await studentExamManagement.checkStudentExamProperty(studentThree.username, 'Started', 'No');

await studentExamManagement.checkStudentExamProperty(studentOne.username, 'Submitted', 'Yes');
await studentExamManagement.checkStudentExamProperty(studentTwo.username, 'Submitted', 'No');
await studentExamManagement.checkStudentExamProperty(studentThree.username, 'Submitted', 'No');

await studentExamManagement.checkStudentExamProperty(studentTwo.username, 'Used working time', '0s');
});
Expand Down Expand Up @@ -115,6 +118,7 @@ test.describe('Test Exam - student exams', () => {
) {
if (!toStart) {
await examParticipation.openExam(student, course, exam);
await examParticipation.almostStartExam();
} else {
await examParticipation.openExam(student, course, exam);
await examParticipation.startExam();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ test.describe('Modeling Exercise Assessment', () => {
// });

test('Tutor can assess a submission', async ({ login, courseManagement, courseAssessment, exerciseAssessment, modelingExerciseAssessment }) => {
await login(tutor, '/course-management');
await courseManagement.openSubmissionsForExerciseAndCourse(course.id!, modelingExercise.id!);
await courseManagement.checkIfStudentSubmissionExists(studentOne.username);
SimonEntholzer marked this conversation as resolved.
Show resolved Hide resolved
await login(tutor, '/course-management');
await courseManagement.openAssessmentDashboardOfCourse(course.id!);
await courseAssessment.clickExerciseDashboardButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ test.describe('Programming Exercise Management', () => {
});

test('Create an exercise team', async ({ login, page, navigationBar, courseManagement, courseManagementExercises, exerciseTeams, programmingExerciseOverview }) => {
await login(instructor, '/');
await login(instructor);
await navigationBar.openCourseManagement();
await courseManagement.openExercisesOfCourse(course.id!);
await courseManagementExercises.openExerciseTeams(exercise.id!);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ export class CourseManagementPage {
await this.page.waitForURL('**/assessment-dashboard**');
}

async openSubmissionsForExerciseAndCourse(courseID: number, exerciseID: number) {
await this.getCourse(courseID).locator('#course-card-open-exercises').click();
await this.page.waitForURL('**/exercises**');
await this.page.click(`[href="/course-management/${courseID}/modeling-exercises/${exerciseID}/scores"]`);
await this.page.waitForURL('**/scores');
}
SimonEntholzer marked this conversation as resolved.
Show resolved Hide resolved

async checkIfStudentSubmissionExists(studentName: string) {
await expect(this.page.locator('.datatable-body-row', { hasText: studentName })).toBeVisible();
}
SimonEntholzer marked this conversation as resolved.
Show resolved Hide resolved

/*
* Helper methods to get information about the course
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export class ExamParticipationPage extends ExamParticipationActions {
await this.examStartEnd.startExam(true);
}

async almostStartExam() {
await this.examStartEnd.onlyClickConfirmationCheckmark();
}
SimonEntholzer marked this conversation as resolved.
Show resolved Hide resolved

async handInEarly() {
await this.examNavigation.handInEarly();
const response = await this.examStartEnd.finishExam();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export class ExamStartEndPage {
}
}

async onlyClickConfirmationCheckmark() {
await this.setConfirmCheckmark();
}

async finishExam(timeout?: number) {
await this.setConfirmCheckmark(timeout);
await this.enterFirstnameLastname();
Expand Down
Loading