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 exam assessment e2e tests failing #9462

Merged
merged 2 commits into from
Oct 13, 2024

Conversation

SimonEntholzer
Copy link
Contributor

@SimonEntholzer SimonEntholzer commented Oct 13, 2024

Checklist

General

Motivation and Context

The exam assessment e2e tests broke due to the logic changes in the student exam creation in #9123, as there is now a race condition, when the student exams are generated automatically. The playwright tests registered users before creating exercises, which lead to the student exams showing up without any exercises to the user.

Description

Simply registering the students after creating the exercises, solves the issue.

Steps for Testing

Prerequisites:
Run the playwright e2e test and make sure no tests fail.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

Before the students did not have any exercises in their exams:
image

After the fix:
image

Summary by CodeRabbit

  • New Features

    • Enhanced the exam assessment process by ensuring students are registered for exams.
    • Introduced feedback mechanisms and verification steps for various exercise types.
    • Improved exam registration flow by ensuring students are registered before test interactions.
  • Bug Fixes

    • Improved handling of exam timings using dayjs for accurate time management.

Copy link

coderabbitai bot commented Oct 13, 2024

Walkthrough

The changes in this pull request enhance the assessment process in the ExamAssessment.spec.ts and ExamDateVerification.spec.ts files by adding a line to register a student for an exam within the respective test cases. This ensures that studentOne is registered after the exam is created, maintaining the integrity of the exam setup. The overall structure and logic of the tests remain intact, with the addition of feedback mechanisms and time management using dayjs. Playwright continues to be utilized for browser interactions.

Changes

File Change Summary
src/test/playwright/e2e/exam/ExamAssessment.spec.ts Added student registration in prepareExam function; maintained existing test structure and logic.
src/test/playwright/e2e/exam/ExamDateVerification.spec.ts Added student registration in two test cases to ensure proper exam flow; overall structure preserved.

Possibly related PRs

Suggested labels

exam

Suggested reviewers

  • JohannesStoehr
  • coolchock
  • sarpsahinalp
  • undernagruzez

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between ab05c2c and 2060c0a.

📒 Files selected for processing (1)
  • src/test/playwright/e2e/exam/ExamDateVerification.spec.ts (2 hunks)
🧰 Additional context used
📓 Learnings (2)
📓 Common learnings
Learnt from: SimonEntholzer
PR: ls1intum/Artemis#8946
File: src/test/playwright/e2e/exam/ExamDateVerification.spec.ts:109-110
Timestamp: 2024-10-08T15:35:48.768Z
Learning: For the pull request `General: Fix and re-enable exam mode e2e tests` (PR #8946), avoid providing "safer alternative" tips as requested by SimonEntholzer.
Learnt from: SimonEntholzer
PR: ls1intum/Artemis#8946
File: src/test/playwright/e2e/exam/ExamDateVerification.spec.ts:109-110
Timestamp: 2024-07-02T20:47:05.487Z
Learning: For the pull request `General: Fix and re-enable exam mode e2e tests` (PR #8946), avoid providing "safer alternative" tips as requested by SimonEntholzer.
src/test/playwright/e2e/exam/ExamDateVerification.spec.ts (2)
Learnt from: SimonEntholzer
PR: ls1intum/Artemis#8946
File: src/test/playwright/e2e/exam/ExamDateVerification.spec.ts:109-110
Timestamp: 2024-10-08T15:35:48.768Z
Learning: For the pull request `General: Fix and re-enable exam mode e2e tests` (PR #8946), avoid providing "safer alternative" tips as requested by SimonEntholzer.
Learnt from: SimonEntholzer
PR: ls1intum/Artemis#8946
File: src/test/playwright/e2e/exam/ExamDateVerification.spec.ts:109-110
Timestamp: 2024-07-02T20:47:05.487Z
Learning: For the pull request `General: Fix and re-enable exam mode e2e tests` (PR #8946), avoid providing "safer alternative" tips as requested by SimonEntholzer.
🔇 Additional comments (3)
src/test/playwright/e2e/exam/ExamDateVerification.spec.ts (3)

73-73: Excellent addition to resolve the race condition.

This line ensures that the student is registered for the exam after the exam and exercise group are created, but before generating individual exams. This change directly addresses the issue mentioned in the PR objectives, where students were unable to see exercises in their exams due to a race condition.


110-110: Consistent application of the fix across test cases.

This change applies the same solution as in the previous test case, ensuring that the student is registered for the exam at the correct point in the setup process. This consistency is crucial for maintaining the integrity of the test suite and addressing the race condition issue across different scenarios.


73-73: Overall, these changes effectively address the race condition issue.

The two identical additions in different test cases provide a consistent solution to the problem of students not seeing exercises in their exams. These changes align perfectly with the PR objectives and should resolve the failing e2e tests.

To ensure the effectiveness of these changes:

Run the following script to verify that these are the only instances where student registration is added, and that they are placed correctly in the test setup process:

This will help confirm that the fix has been applied consistently and correctly across all relevant test cases.

Also applies to: 110-110


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range comments (1)
src/test/playwright/e2e/exam/ExamAssessment.spec.ts (1)

Line range hint 1-478: Consider adding a specific test for the race condition.

While the change effectively addresses the reported issue, it might be beneficial to add a specific test case that verifies the resolution of the race condition. This would ensure that future changes don't inadvertently reintroduce the problem.

Consider adding a test case that:

  1. Creates an exam with multiple exercises
  2. Registers a student
  3. Generates individual exams
  4. Verifies that the student can see all exercises associated with their exam

This would provide an extra layer of confidence in the fix and serve as documentation of the resolved issue.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 330a677 and ab05c2c.

📒 Files selected for processing (1)
  • src/test/playwright/e2e/exam/ExamAssessment.spec.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
src/test/playwright/e2e/exam/ExamAssessment.spec.ts (1)

349-349: LGTM! This change addresses the race condition issue.

The addition of await examAPIRequests.registerStudentForExam(exam, studentOne); at this point in the prepareExam function effectively resolves the race condition mentioned in the PR objectives. By registering the student after creating the exam and exercise, but before generating individual exams, we ensure that the student will have access to all relevant exercises when the exam is generated.

This change aligns perfectly with the PR's goal of modifying the order of operations in the test setup to prevent scenarios where registered students were unable to see exercises associated with their exams.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

2 participants