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: Add e2e playwright tests for programming exercise team participation #8559

Merged

Conversation

muradium
Copy link
Contributor

@muradium muradium commented May 8, 2024

Checklist

General

Client

Motivation and Context

We want to test programming exercise participations by teams.

Description

Adds E2E tests in Playwright about programming exercise team participations.

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. Run npm install && npm run playwright:setup && npx playwright test e2e/exercise/programming/ProgrammingExerciseParticipation.spec.ts
  4. Confirm that "Programming exercise team participation" tests pass

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

  • New Features

    • Introduced a new functionality for checking exam results, including detailed assessments and feedback across various exercise types.
    • Added methods to fetch grade summaries and handle text exercise submissions with flexibility in request types.
  • Enhancements

    • Enhanced various methods to improve element location techniques and parameter flexibility, enhancing the interaction with exercise and exam components.
  • Documentation

    • Updated documentation to reflect new features and enhancements in exam and exercise management.
  • Refactor

    • Modified several methods to use more efficient element locating strategies and added optional parameters to existing methods for better customization.

@muradium muradium requested a review from a team as a code owner May 8, 2024 14:59
@github-actions github-actions bot added the tests label May 8, 2024
Copy link

coderabbitai bot commented May 8, 2024

Walkthrough

The recent updates focus on refining the Playwright testing framework for programming exercises. These changes include enhancing test setup and execution, improving element targeting for better interaction with UI components, introducing new methods and page objects, adding constants for new features, and updating API requests to support programming exercise configurations effectively.

Changes

Files Changes
.../ProgrammingExerciseAssessment.spec.ts
.../ProgrammingExerciseParticipation.spec.ts
Updated import statements and method calls for test enhancements.
.../support/commands.ts
.../support/fixtures.ts
.../support/pageobjects/...
Replaced selector with locator, added new methods, and page objects for improved UI interaction.
.../support/constants.ts
.../support/requests/ExerciseAPIRequests.ts
Added constants and updated API methods for new programming exercise features.

Possibly related issues


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.

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: 8

Out of diff range and nitpick comments (5)
src/test/playwright/support/pageobjects/exercises/programming/RepositoryPage.ts (1)

17-18: Clarify the reason for reversing the commits array.

It would be helpful to add a comment explaining why the commits array is reversed, as this might not be immediately obvious to other developers or maintainers.

src/test/playwright/support/pageobjects/exercises/programming/ProgrammingExerciseOverviewPage.ts (1)

44-50: Add documentation for the methods getCloneRepositoryButton and getExerciseDetails.

It would be beneficial to add JSDoc comments for the methods getCloneRepositoryButton and getExerciseDetails to improve code readability and maintainability.

src/test/playwright/e2e/exercise/programming/ProgrammingExerciseParticipation.spec.ts (3)

8-8: Consider adding a brief comment explaining the purpose of the imported entities for better code readability.


Line range hint 54-77: The conditional logic to skip C tests based on the database type is a good practice to ensure compatibility. However, consider externalizing such environment-specific configurations to a separate configuration file or environment variables to enhance maintainability and scalability.


261-261: Add a detailed comment explaining the purpose and usage of the pushGitSubmissionFiles function to improve code readability and maintainability.

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

Out of diff range and nitpick comments (3)
src/test/playwright/e2e/exercise/programming/ProgrammingExerciseParticipation.spec.ts (3)

8-8: Consider adding a brief comment explaining the purpose of the imported entities for better code readability.


Line range hint 54-77: The conditional logic to skip C tests based on the database type (Postgres) is a good practice to ensure compatibility. However, consider externalizing such environment-specific configurations to a separate configuration file or utility function to enhance modularity and maintainability.


262-262: The function pushGitSubmissionFiles is crucial for setting up the test environment. Consider adding more detailed comments explaining each step of the process, which would be beneficial for new contributors or during debugging sessions.

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: 2

Out of diff range and nitpick comments (3)
src/test/playwright/e2e/exercise/programming/ProgrammingExerciseParticipation.spec.ts (3)

8-8: Consider adding a brief comment describing the purpose of the imported entities for better code readability.


[!TIP]
Codebase Verification

The verification process has revealed that the PLAYWRIGHT_DB_TYPE environment variable is set differently across various Docker configuration files used for CI environments. Specifically, it is set to 'MySQL' in the configurations for MySQL setups and to 'Postgres' in the configuration for Postgres setup. This indicates that the environment variable is not consistently set to 'Postgres' across all environments, which aligns with the conditional logic in the test script to skip C tests when using Postgres.

Given this information, the review comment is accurate in highlighting the potential for unintentional skipping of C tests due to the variability in the setting of PLAYWRIGHT_DB_TYPE across different environments.

Final Response:

The verification has confirmed that the PLAYWRIGHT_DB_TYPE environment variable is set differently in various CI configurations:

  • docker/playwright-E2E-tests-mysql-localci.yml and docker/playwright-E2E-tests-mysql.yml set it to 'MySQL'.
  • docker/playwright-E2E-tests-postgres.yml sets it to 'Postgres'.

This variability can indeed lead to the unintentional skipping of C tests in environments not using Postgres, as the test script checks for this variable to decide whether to skip. It is recommended to ensure consistency in the environment settings or adjust the test script to handle different environments appropriately.

  • File locations:
    • docker/playwright-E2E-tests-mysql-localci.yml
    • docker/playwright-E2E-tests-mysql.yml
    • docker/playwright-E2E-tests-postgres.yml
Analysis chain

Line range hint 54-77: Ensure that the environment variable PLAYWRIGHT_DB_TYPE is consistently set across different environments to avoid skipping C tests unintentionally.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the PLAYWRIGHT_DB_TYPE environment variable is set to 'Postgres' in all CI environments.

# Test: Search for environment variable settings in CI configuration files. Expect: 'Postgres' should be set for PLAYWRIGHT_DB_TYPE.
rg --type yaml --type json 'PLAYWRIGHT_DB_TYPE: Postgres'

Length of output: 59



Script:

#!/bin/bash
# Description: Broaden the search to find any instances of the PLAYWRIGHT_DB_TYPE environment variable being set, regardless of its value.

# Search across all file types for the environment variable setting.
rg 'PLAYWRIGHT_DB_TYPE' --files-with-matches

Length of output: 255



Script:

#!/bin/bash
# Description: Extract the lines setting the PLAYWRIGHT_DB_TYPE environment variable in identified Docker configuration files.

# Extract relevant lines from each configuration file.
cat docker/playwright-E2E-tests-mysql-localci.yml
cat docker/playwright-E2E-tests-postgres.yml
cat docker/playwright-E2E-tests-mysql.yml
grep 'PLAYWRIGHT_DB_TYPE' docker/playwright-E2E-tests-mysql-localci.yml
grep 'PLAYWRIGHT_DB_TYPE' docker/playwright-E2E-tests-postgres.yml
grep 'PLAYWRIGHT_DB_TYPE' docker/playwright-E2E-tests-mysql.yml

Length of output: 6366


262-262: The function pushGitSubmissionFiles lacks documentation for the deleteFiles parameter. Adding a comment explaining its purpose would enhance code clarity.

BBesrour
BBesrour previously approved these changes May 9, 2024
Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

code lgtm!
Test passed on CI: Bamboo tests

Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

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

I have left some comments where I think that changes might be needed.

Besides the comments I think it would be good if the comments of coderabbit would be either resolved, or commented on if there is something unclear about them.
Not all suggestions might be useful, if a comment doesn't make sense it would still be beneficial to resolve that conversation.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 14, 2024
BBesrour
BBesrour previously approved these changes May 23, 2024
Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

re-approve

rstief
rstief previously approved these changes May 23, 2024
Copy link
Contributor

@rstief rstief left a 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, works as expected.

Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

re-approve

BBesrour
BBesrour previously approved these changes May 23, 2024
Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

re-approve
(last one was a misclick :'))

coolchock
coolchock previously approved these changes May 23, 2024
Copy link
Contributor

@coolchock coolchock left a 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, looks good

coderabbitai[bot]
coderabbitai bot previously approved these changes May 24, 2024
Copy link
Contributor

@undernagruzez undernagruzez left a comment

Choose a reason for hiding this comment

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

approve

Copy link
Contributor

@rstief rstief left a comment

Choose a reason for hiding this comment

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

Reapprove after merge

Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

re-approve

@krusche krusche changed the title Development: Add e2e tests for programming exercise team participation Development: Add e2e playwright tests for programming exercise team participation May 25, 2024
@krusche krusche added this to the 7.1.0 milestone May 25, 2024
@krusche krusche merged commit e6d058f into develop May 25, 2024
27 of 32 checks passed
@krusche krusche deleted the feature/playwright/programming-exercise-team-participation branch May 25, 2024 20:17
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.

None yet

7 participants