-
Notifications
You must be signed in to change notification settings - Fork 303
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
: Adds playwright e2e quiz exercise tests for different batch modes
#8645
Development
: Adds playwright e2e quiz exercise tests for different batch modes
#8645
Conversation
WalkthroughThe updates enhance the functionality of quiz exercise participation tests by incorporating new parameters and scenarios, such as scheduled, batched, and individual quizzes. Additionally, the Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant CourseOverviewPage
participant QuizExerciseParticipation
User->>CourseOverviewPage: openRunningExercise(exerciseId)
CourseOverviewPage->>CourseOverviewPage: getOpenRunningExerciseButton(exerciseId)
CourseOverviewPage-->>User: Click Button
User->>QuizExerciseParticipation: Start Quiz
QuizExerciseParticipation->>QuizExerciseParticipation: Initialize quiz parameters
QuizExerciseParticipation-->>User: Participate in Quiz
User->>CourseOverviewPage: practiceExercise()
CourseOverviewPage-->>User: Initiate Exercise Practice
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Demonstrated in testing session, code also LGTM
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.
Demonstrated in testing session.
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.
works as described
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.
demonstrated in the testing session, LGTM
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.
Actionable comments posted: 2
src/test/playwright/support/pageobjects/course/CourseOverviewPage.ts
Outdated
Show resolved
Hide resolved
84f0c7e
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.
Actionable comments posted: 2
src/test/playwright/e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts
Outdated
Show resolved
Hide resolved
src/test/playwright/e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 1
Outside diff range and nitpick comments (5)
src/test/playwright/support/requests/ExerciseAPIRequests.ts (5)
Line range hint
107-107
: Consider using template literals for string concatenation to improve readability and maintain consistency with modern JavaScript practices.- title = 'Programming ' + generateUUID(), + title = `Programming ${generateUUID()}`,Also applies to: 108-108, 132-132, 221-221, 225-225, 265-265, 269-269, 309-309, 317-317, 406-406, 419-419
Line range hint
119-119
: Use strict equality checks (===
) instead of loose equality (==
) to avoid unexpected type coercion.- if (programmingLanguage == ProgrammingLanguage.PYTHON) { + if (programmingLanguage === ProgrammingLanguage.PYTHON) {Also applies to: 121-121, 123-123
Line range hint
183-183
: Avoid using non-null assertions (!
). Instead, handle potential null or undefined values gracefully.- id: testCase.id!, + id: testCase.id ?? throw new Error('Test case ID is missing'),Also applies to: 365-365
Line range hint
324-324
: Avoid usingany
type for variables. Specify a more precise type to enhance type safety and code maintainability.- const quizExercise: any = { + const quizExercise: QuizExercise = {Also applies to: 413-413
Line range hint
326-326
: ReplacehasOwnProperty
with a safer alternative to check property existence.- if (body.hasOwnProperty('course')) { + if (Object.prototype.hasOwnProperty.call(body, 'course')) {
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.
Actionable comments posted: 4
Outside diff range and nitpick comments (2)
src/test/playwright/e2e/course/CourseExercise.spec.ts (1)
Line range hint
30-42
: Avoid using non-null assertions (!
). Consider adding proper null checks or handling potential null values gracefully.- await exerciseAPIRequests.deleteQuizExercise(exercise1.id!); - await exerciseAPIRequests.deleteQuizExercise(exercise2.id!); - await exerciseAPIRequests.deleteQuizExercise(exercise3.id!); + if (exercise1.id && exercise2.id && exercise3.id) { + await exerciseAPIRequests.deleteQuizExercise(exercise1.id); + await exerciseAPIRequests.deleteQuizExercise(exercise2.id); + await exerciseAPIRequests.deleteQuizExercise(exercise3.id); + } else { + console.error('One of the exercises has a null id'); + }src/test/playwright/support/pageobjects/exam/ExamExerciseGroupCreationPage.ts (1)
Line range hint
48-48
: Consider using template literals for string concatenation for better readability and performance.- const response = await this.handleAddGroupWithExercise(exam, 'Exercise ' + generateUUID(), exerciseType, additionalData); + const response = await this.handleAddGroupWithExercise(exam, `Exercise ${generateUUID()}`, exerciseType, additionalData);Also, use strict equality (
===
) for comparisons to avoid unexpected type coercion.- if (exerciseType == ExerciseType.QUIZ) { + if (exerciseType === ExerciseType.QUIZ) {Also applies to: 50-50
src/test/playwright/e2e/exercise/quiz-exercise/QuizExerciseAssessment.spec.ts
Show resolved
Hide resolved
src/test/playwright/e2e/exercise/quiz-exercise/QuizExerciseManagement.spec.ts
Show resolved
Hide resolved
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.
Changes look good to me
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.
Code lgtm
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.
test cases LGTM👍
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.
re-approve
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.
Code changes lgtm
Development
: Adds quiz exercise tests for different batch modesDevelopment
: Adds playwright e2e quiz exercise tests for different batch modes
Checklist
General
Client
Motivation and Context
We want to test quiz exercise participation in different batch modes and time schedules.
Description
Adds E2E tests in Playwright for following types of exercises:
Steps for Testing
Steps for running the tests:
npm install && npm run playwright:setup
npx playwright test e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts -g "Quiz exercise scheduled participation"
npx playwright test e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts -g "Quiz exercise batched participation"
npx playwright test e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts -g "Quiz exercise individual participation"
Testserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Review Progress
Code Review
Manual Tests