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 #8420

Merged
merged 11 commits into from
Apr 17, 2024

Conversation

muradium
Copy link
Contributor

@muradium muradium commented Apr 17, 2024

Checklist

General

Client

Motivation and Context

Exam test run tests have flaky assertions and fail sometimes. Exam assessment complaint tests fail in CI build due to .

Description

This PR fixes flaky assertions and improves isolation of some test exam tests.
It also fixes exam complaint tests by changing complaint message assertions.

Steps for Testing

  • Code Review: Ensure that tests pass for valid reasons, functionality is adequately tested, and check the code quality.
  • Run the tests (optional): Tests are checked by automatic run in CI environment. You can optionally run them locally and check if they pass.

Steps for running the tests:

  1. Navigate to src/tests/playwright
  2. Configure Playwright using playwright.env file based on your local setup. Current configuration should work for default Artemis setup.
  3. Setup playwright by running npm install && npm run playwright:setup && npx playwright test e2e/exercise/quiz-exercise/QuizExerciseManagement.spec.ts
  4. Run exam test run tests with npx playwright test e2e/exam/ExamTestRun.spec.ts && npx playwright test e2e/exam/test-exam/TestExamTestRun.spec.ts
  5. Run exam assessment tests with npx playwright test e2e/exam/ExamAssessment.spec.ts

Testserver States

Note

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







Review Progress

Code Review

  • [] Code Review 1
  • [] Code Review 2

Manual Tests

  • Test 1
  • Test 2

Summary by CodeRabbit

  • Tests
    • Enhanced end-to-end test coverage for exam functionalities, including creating, modifying, and deleting test runs.
    • Improved visibility checks and assertions in existing tests for more reliable outcomes.
  • Refactor
    • Streamlined methods in assessment and exam management page objects for better readability and efficiency in test scripts.
  • New Features
    • Introduced new tests to assess changes in test run working times and the ability to conduct and delete test runs effectively.

@muradium muradium requested a review from a team as a code owner April 17, 2024 10:13
Copy link

coderabbitai bot commented Apr 17, 2024

Walkthrough

This update involves refactoring and enhancing test suites for better reliability and maintainability. Changes include renaming tests for consistency, updating assertion methods for improved visibility checks, and adding new tests to cover more functionalities like test run creation, modification, and deletion. Overall, the changes aim to streamline testing processes and improve code quality.

Changes

File Path Change Summary
.../e2e/exam/ExamTestRun.spec.ts Removed declaration, renamed and refactored tests, added new tests for managing test runs.
.../e2e/exam/test-exam/TestExamTestRun.spec.ts Similar changes as above including API requests in new tests.
.../support/pageobjects/assessment/... Refactored methods to use expect directly for assertions in assessment-related page objects.
.../support/pageobjects/exam/ExamManagementPage.ts Added visibility check before verifying text content.

Possibly related issues

  • Enable StudentExamIntegrationTests #8291: The addition of new tests and refactoring in the exam modules could align with the objectives to enable and enhance integration tests for student exams.

    • Reasoning: The PR includes significant updates to testing functionalities related to exams, which might contribute to the comprehensive testing coverage mentioned in the issue.
  • Exam: Divide the Testing Process into Steps #6621: The refactoring and addition of new tests might indirectly support the structured approach to testing during exam programming exercises.

    • Reasoning: Although the PR does not explicitly address the dummy test replacement, the enhancements in testing methodologies could support more reliable and structured testing processes as outlined in the issue.

Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4d7b40e and f79282d.
Files selected for processing (5)
  • src/test/playwright/e2e/exam/ExamTestRun.spec.ts (5 hunks)
  • src/test/playwright/e2e/exam/test-exam/TestExamTestRun.spec.ts (5 hunks)
  • src/test/playwright/support/pageobjects/assessment/ExerciseAssessmentDashboardPage.ts (2 hunks)
  • src/test/playwright/support/pageobjects/assessment/StudentAssessmentPage.ts (2 hunks)
  • src/test/playwright/support/pageobjects/exam/ExamManagementPage.ts (1 hunks)
Additional comments not posted (11)
src/test/playwright/support/pageobjects/assessment/StudentAssessmentPage.ts (1)

40-40: Refactoring to use direct assertions with expect enhances readability and reliability.

src/test/playwright/support/pageobjects/assessment/ExerciseAssessmentDashboardPage.ts (1)

39-39: Refactoring to use direct assertions with expect enhances readability and reliability.

src/test/playwright/support/pageobjects/exam/ExamManagementPage.ts (1)

100-100: Adding a visibility check before text verification improves the reliability of the test by ensuring the element is present.

src/test/playwright/e2e/exam/test-exam/TestExamTestRun.spec.ts (4)

52-76: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [42-63]

Renaming and refactoring in the test case 'Creates a test run' improves clarity and consistency.


52-76: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [67-90]

The new test case 'Changes test run working time' is well-structured and follows best practices for test design.


84-98: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [93-116]

The new test case 'Conducts a test run' is comprehensive and covers multiple aspects of the test run process.


120-133: The new test case 'Deletes a test run' correctly implements the deletion process and checks for visibility changes.

src/test/playwright/e2e/exam/ExamTestRun.spec.ts (4)

59-79: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [49-69]

Renaming and refactoring in the test case 'Creates a test run' improves clarity and consistency.


59-79: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [73-98]

The new test case 'Changes test run working time' is well-structured and follows best practices for test design.


92-108: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [101-126]

The new test case 'Conducts a test run' is comprehensive and covers multiple aspects of the test run process.


130-144: The new test case 'Deletes a test run' correctly implements the deletion process and checks for visibility changes.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@github-actions github-actions bot added the tests label Apr 17, 2024
@muradium muradium changed the title Test/playwright/fix flaky exam test run General: Fix flaky E2E tests - exam test run and complaints Apr 17, 2024
@krusche krusche changed the title General: Fix flaky E2E tests - exam test run and complaints Development: Fix flaky e2e tests Apr 17, 2024
@krusche krusche added this to the 7.0.1 milestone Apr 17, 2024
@krusche krusche merged commit 0875959 into develop Apr 17, 2024
32 of 36 checks passed
@krusche krusche deleted the test/playwright/fix-flaky-exam-test-run branch April 17, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants