-
Notifications
You must be signed in to change notification settings - Fork 301
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 e2e playwright tests that navigate to a course page
#8764
Conversation
WalkthroughThe recent updates focus on refining the login URLs in various test suites to include specific exercise IDs. This enhancement ensures precise navigation for students to particular exercises within their courses, improving the accuracy and reliability of the test scenarios for text, quiz, modeling, and programming exercises. Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant Student
participant System
Student->>System: Login with `/courses/{course.id}/exercises/{exercise.id}`
System-->>Student: Authenticate and Redirect to Exercise Page
Student->>System: Start Exercise
System-->>Student: Display Exercise Interface
Student->>System: Submit Exercise
System-->>Student: Confirm Submission
Recent review detailsConfiguration used: .coderabbit.yaml Files selected for processing (3)
Additional context usedBiome
Additional comments not posted (3)
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 (
|
General
: Fix E2E tests that navigate to an exerciseGeneral
: Fix E2E tests that navigate to a course page
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 comments (4)
src/test/playwright/e2e/exercise/modeling/ModelingExerciseParticipation.spec.ts (2)
Line range hint
20-24
: Remove non-null assertions.- await courseOverview.startExercise(modelingExercise.id!); - await courseOverview.openRunningExercise(modelingExercise.id!); - await modelingExerciseEditor.addComponentToModel(modelingExercise.id!, 1, 310, 320); - await modelingExerciseEditor.addComponentToModel(modelingExercise.id!, 2, 730, 500); - await modelingExerciseEditor.addComponentToModel(modelingExercise.id!, 3, 1000, 100); + await courseOverview.startExercise(modelingExercise.id); + await courseOverview.openRunningExercise(modelingExercise.id); + await modelingExerciseEditor.addComponentToModel(modelingExercise.id, 1, 310, 320); + await modelingExerciseEditor.addComponentToModel(modelingExercise.id, 2, 730, 500); + await modelingExerciseEditor.addComponentToModel(modelingExercise.id, 3, 1000, 100);Non-null assertions should be avoided unless absolutely necessary as they can lead to runtime errors if the values are null.
Tools
Biome
[error] 20-20: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 21-21: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 22-22: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
Line range hint
1-2
: Use type-only imports for TypeScript entities.- import { Course } from 'app/entities/course.model'; - import { ModelingExercise } from 'app/entities/modeling-exercise.model'; + import type { Course } from 'app/entities/course.model'; + import type { ModelingExercise } from 'app/entities/modeling-exercise.model';This change ensures that these imports are used for type checking only and not included in the JavaScript output, optimizing the bundle size.
Tools
Biome
[error] 20-20: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 21-21: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 22-22: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
src/test/playwright/e2e/exercise/ExerciseImport.spec.ts (1)
Line range hint
45-48
: Remove non-null assertions.- await courseManagementExercises.clickImportExercise(textExercise.id!); - await expect(page.locator('#field_title')).toHaveValue(textExercise.title!); - await expect(page.locator('#field_points')).toHaveValue(`${textExercise.maxPoints!}`); - await textExerciseCreation.setReleaseDate(dayjs()); - await textExerciseCreation.setDueDate(dayjs().add(1, 'days')); - await textExerciseCreation.setAssessmentDueDate(dayjs().add(2, 'days')); - await login(studentOne, `/courses/${secondCourse.id}/exercises/${exercise.id}`); + await courseManagementExercises.clickImportExercise(textExercise.id); + await expect(page.locator('#field_title')).toHaveValue(textExercise.title); + await expect(page.locator('#field_points')).toHaveValue(`${textExercise.maxPoints}`); + await textExerciseCreation.setReleaseDate(dayjs()); + await textExerciseCreation.setDueDate(dayjs().add(1, 'days')); + await textExerciseCreation.setAssessmentDueDate(dayjs().add(2, 'days')); + await login(studentOne, `/courses/${secondCourse.id}/exercises/${exercise.id}`);Non-null assertions should be avoided unless absolutely necessary as they can lead to runtime errors if the values are null.
Also applies to: 57-58, 62-62, 75-78, 84-88, 98-102, 111-113
Tools
Biome
[error] 57-57: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 58-58: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
src/test/playwright/e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts (1)
Line range hint
29-29
: Use template literals instead of string concatenation.- await login(studentOne, '/courses/' + course.id); + await login(studentOne, `/courses/${course.id}`);Using template literals improves readability and consistency in the code.
Tools
Biome
[error] 35-35: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 36-36: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 37-37: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 42-42: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 43-43: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 44-44: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 45-45: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 46-46: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
[error] 47-47: Forbidden non-null assertion. (lint/style/noNonNullAssertion)
src/test/playwright/e2e/exercise/quiz-exercise/QuizExerciseParticipation.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.
code changes and explanation make sense, the tests pass
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 and the corresponding e2e tests pass
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.
Corresponding e2e tests pass
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.
shown in 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.
Tested in a testing session
General
: Fix E2E tests that navigate to a course pageDevelopment
: Fix e2e playwright tests that navigate to a course page
Checklist
General
Client
Motivation and Context
After changes to course exercises page, directly accessing a course page does not open the first exercise. E2E tests relying on that fail.
Description
This PR fixes the failing tests by navigating to exercise page instead of the course page.
Steps for Testing
Steps for running the tests:
npm install && npm run playwright:setup
npx playwright test e2e/exercise/modeling/ModelingExerciseParticipation.spec.ts
npx playwright test e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts
npx playwright test e2e/exercise/ExerciseImport.spec.ts
Testserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Review Progress
Code Review
Manual Tests
Summary by CodeRabbit
Import exercises
test suite.