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: Run e2e tests on bamboo #9964

Closed
wants to merge 27 commits into from

Conversation

SimonEntholzer
Copy link
Contributor

@SimonEntholzer SimonEntholzer commented Dec 7, 2024

The sole purpose of this PR is to run the e2e tests of the branch of PR #9796 on bamboo. For some reason, bamboo does not find the branch.
With the identical changes, this branch, #9964, does trigger the e2e tests on bamboo.

Summary by CodeRabbit

  • New Features

    • Updated documentation for clearer setup instructions for Playwright tests.
    • Introduced new shell scripts for automating the setup and execution of Artemis and Playwright on macOS and Linux.
    • Added scripts for user creation and Playwright setup.
  • Bug Fixes

    • Improved timeout settings for tests.
  • Documentation

    • Added a README file detailing the setup and execution process for Playwright with Artemis.
  • Chores

    • Updated installation commands and environment variable templates for better usability.

Copy link

coderabbitai bot commented Dec 7, 2024

Walkthrough

The pull request introduces several changes primarily focused on enhancing the documentation and setup processes for running Playwright tests in conjunction with the Artemis application. Key updates include clearer instructions in docs/dev/playwright.rst, the addition of new shell scripts to automate Docker setup and user creation, and modifications to environment variables. The package.json file has been updated to include a new script for local Playwright setup. Overall, these changes aim to streamline the setup and execution of Playwright tests for developers.

Changes

File Path Change Summary
docs/dev/playwright.rst Enhanced setup instructions, added timeout settings, updated user configuration guidance, modified installation command.
src/test/playwright/package.json Added new script "playwright:setup-local" for local Playwright setup with dependencies.
src/test/playwright/playwright.env Updated username and password templates, removed CREATE_USERS variable.
supporting_scripts/playwright/README.md New documentation outlining setup steps for Playwright with Artemis.
supporting_scripts/playwright/runArtemisInDocker_linux.sh New script for automating Artemis setup in Docker on Linux.
supporting_scripts/playwright/runArtemisInDocker_macOS.sh New script for automating Artemis setup in Docker on macOS.
supporting_scripts/playwright/setupUsers.sh New script for setting up users in a virtual environment.
supporting_scripts/playwright/startPlaywright.sh New script for automating Playwright setup and execution.

Possibly related PRs

Suggested labels

ready to merge, docker

Suggested reviewers

  • az108
  • BBesrour
  • EneaGore
  • marlon-luca-bu

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

🧹 Outside diff range and nitpick comments (12)
supporting_scripts/playwright/startPlaywright.sh (1)

11-13: Improve error handling for npm commands

The script suppresses errors from playwright:setup-local without logging. Consider adding error logging and conditional handling.

-npm install
+if ! npm install; then
+    echo "Error: Failed to install npm dependencies"
+    exit 1
+fi

-npm run playwright:setup-local || true
+if ! npm run playwright:setup-local; then
+    echo "Warning: Playwright local setup failed, continuing anyway..."
+fi
supporting_scripts/playwright/setupUsers.sh (1)

15-18: Add error handling for pip install and user creation

The script should handle potential failures in pip installation and user creation more gracefully.

-cd  course-scripts/quick-course-setup
+if [ ! -d "course-scripts/quick-course-setup" ]; then
+    echo "Error: Setup directory not found"
+    exit 1
+fi
+cd course-scripts/quick-course-setup

-python3 -m pip install -r requirements.txt
-python3 create_users.py
+if ! python3 -m pip install -r requirements.txt; then
+    echo "Error: Failed to install requirements"
+    exit 1
+fi
+
+if ! python3 create_users.py; then
+    echo "Error: Failed to create users"
+    exit 1
+fi
src/test/playwright/playwright.env (1)

1-2: Consider more secure password generation

The current password template is predictable and follows the same pattern as the username. Consider implementing a more secure password generation strategy.

Suggestions:

  1. Use environment variables for password configuration
  2. Implement a secure password generation function in the user creation script
  3. Store passwords in a secure credential store

Would you like me to provide an example implementation of any of these approaches?

supporting_scripts/playwright/runArtemisInDocker_linux.sh (1)

5-9: Use relative paths more robustly

The script uses hard-coded relative paths which could break if the script is run from a different location.

-cd ../..
+# Get the directory where the script is located
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd "$SCRIPT_DIR/../.."
 
-echo "Copied configuration"
+echo "Changed to repository root: $(pwd)"
src/test/playwright/package.json (1)

23-23: Consider enhancing the local setup script

The setup script could be more robust by adding verification and cleanup options.

-    "playwright:setup-local": "npx playwright install --with-deps chromium",
+    "playwright:setup-local": "npx playwright install --with-deps chromium && npx playwright test --list",
+    "playwright:clean": "rm -rf test-results/ playwright-report/",

This change:

  1. Verifies the installation by listing available tests
  2. Adds a cleanup script for test artifacts
docs/dev/playwright.rst (4)

15-16: Maintain consistent path reference style

The path reference style should be consistent. Consider using backticks for both path references:

-For a quick test setup with only three steps, you can use the scripts provided in `supportingScripts/playwright`.
+For a quick test setup with only three steps, you can use the scripts provided in `supporting_scripts/playwright`.

55-56: Document the purpose of timeout variables

The newly added timeout variables FAST_TEST_TIMEOUT_SECONDS and SLOW_TEST_TIMEOUT_SECONDS need documentation explaining:

  • Their purpose and use cases
  • When to use fast vs slow timeouts
  • Guidelines for adjusting these values

Would you like me to help draft the documentation for these timeout variables?


64-71: Enhance user creation script documentation

The setupUsers.sh section should include:

  • The exact location of the script
  • What the script does (number of users created, roles assigned)
  • Prerequisites for running the script
  • Expected output or success indicators

Would you like me to help expand this section with more detailed documentation?


78-84: Enhance installation troubleshooting documentation

Please expand the installation section to include:

  • Specific package managers and commands for different OS
  • Common installation issues and their solutions
  • Verification steps to confirm successful installation

Would you like me to help draft the troubleshooting documentation?

supporting_scripts/playwright/README.md (3)

14-14: Fix grammatical error

-After this step, you are be able to access Artemis locally as you usually would be.
+After this step, you will be able to access Artemis locally as you usually would.
🧰 Tools
🪛 LanguageTool

[grammar] ~14-~14: Consider using either the present participle “are being” here.
Context: ...he client via npm. After this step, you are be able to access Artemis locally as you u...

(BEEN_PART_AGREEMENT)


20-20: Fix possessive pronoun

-Playwright needs users for it's tests.
+Playwright needs users for its tests.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~20-~20: Did you mean “its” (the possessive pronoun)?
Context: ...Setup users Playwright needs users for it's tests. If you do not have users set up,...

(ITS_PREMIUM)


1-27: Add prerequisites section

The README should include a prerequisites section at the beginning that lists:

  • Required software (Docker, Node.js version, etc.)
  • System requirements
  • Required permissions
  • Network requirements

This will help users prepare their environment before starting the setup process.

Would you like me to help draft the prerequisites section?

🧰 Tools
🪛 LanguageTool

[grammar] ~14-~14: Consider using either the present participle “are being” here.
Context: ...he client via npm. After this step, you are be able to access Artemis locally as you u...

(BEEN_PART_AGREEMENT)


[uncategorized] ~20-~20: Did you mean “its” (the possessive pronoun)?
Context: ...Setup users Playwright needs users for it's tests. If you do not have users set up,...

(ITS_PREMIUM)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 8036d43 and b9ad82f.

📒 Files selected for processing (8)
  • docs/dev/playwright.rst (2 hunks)
  • src/test/playwright/package.json (1 hunks)
  • src/test/playwright/playwright.env (1 hunks)
  • supporting_scripts/playwright/README.md (1 hunks)
  • supporting_scripts/playwright/runArtemisInDocker_linux.sh (1 hunks)
  • supporting_scripts/playwright/runArtemisInDocker_macOS.sh (1 hunks)
  • supporting_scripts/playwright/setupUsers.sh (1 hunks)
  • supporting_scripts/playwright/startPlaywright.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
supporting_scripts/playwright/setupUsers.sh

[warning] 13-13: In POSIX sh, 'source' in place of '.' is undefined.

(SC3046)

🪛 LanguageTool
supporting_scripts/playwright/README.md

[grammar] ~14-~14: Consider using either the present participle “are being” here.
Context: ...he client via npm. After this step, you are be able to access Artemis locally as you u...

(BEEN_PART_AGREEMENT)


[uncategorized] ~20-~20: Did you mean “its” (the possessive pronoun)?
Context: ...Setup users Playwright needs users for it's tests. If you do not have users set up,...

(ITS_PREMIUM)

🔇 Additional comments (2)
src/test/playwright/playwright.env (1)

Line range hint 1-14: Verify environment variable usage across the application

The removal of the CREATE_USERS variable and template changes might affect other parts of the application.

src/test/playwright/package.json (1)

Line range hint 6-14: Verify dependency versions for security

The dependencies use fixed versions. Let's verify they are up-to-date and secure.

✅ Verification successful

Dependencies are up-to-date and secure

All dependencies in the package.json are using their latest versions:

  • @playwright/test: 1.49.0 (latest)
  • cross-env: 7.0.3 (latest)
  • dayjs: 1.11.13 (latest)
  • dotenv: 16.4.7 (latest)
  • junit-merge: 2.0.0 (latest)
  • npm-check-updates: 17.1.11 (latest)
  • npm-run-all: 4.1.5 (latest)
  • simple-git: 3.27.0 (latest)

No security vulnerabilities were found in the npm audit.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for latest versions and known vulnerabilities

echo "Checking latest versions:"
for pkg in @playwright/test cross-env dayjs dotenv junit-merge npm-check-updates npm-run-all simple-git uuid; do
    echo -n "$pkg: "
    npm view $pkg version
done

echo -e "\nChecking for known vulnerabilities:"
npm audit --json | jq '.advisories'

Length of output: 1849

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 7, 2024
@SimonEntholzer SimonEntholzer changed the title Feature/playwright/simplify setup 3 Development: Run e2e tests on bamboo Dec 7, 2024
@SimonEntholzer SimonEntholzer changed the base branch from develop to feature/playwright/simplify-setup December 8, 2024 08:53
@SimonEntholzer SimonEntholzer changed the base branch from feature/playwright/simplify-setup to develop December 8, 2024 08:53
@SimonEntholzer SimonEntholzer dismissed coderabbitai[bot]’s stale review December 8, 2024 08:53

The base branch was changed.

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 and nitpick comments (4)
docs/dev/playwright.rst (4)

15-18: Add the full repository path to the scripts location

The path supportingScripts/playwright should be made more specific to help users locate it easily. Consider adding the full repository path or clarifying if it's relative to the project root.

-For a quick test setup with only three steps, you can use the scripts provided in `supportingScripts/playwright`.
+For a quick test setup with only three steps, you can use the scripts provided in `<repository_root>/supportingScripts/playwright`.

55-56: Document the purpose of timeout configurations

The new timeout configurations look good, but consider adding brief comments explaining when each timeout is used and why these specific values were chosen.

-        FAST_TEST_TIMEOUT_SECONDS=45
-        SLOW_TEST_TIMEOUT_SECONDS=180
+        # Used for quick operations like navigation and simple form submissions
+        FAST_TEST_TIMEOUT_SECONDS=45
+        # Used for long-running operations like file uploads and complex workflows
+        SLOW_TEST_TIMEOUT_SECONDS=180

70-71: Add error handling guidance for the setup script

The script execution instruction should include guidance on common errors and troubleshooting steps.

-        setupUsers.sh
+        # Execute the user setup script
+        ./setupUsers.sh
+        
+        # If the script fails, verify that:
+        # 1. The script has execute permissions (chmod +x setupUsers.sh)
+        # 2. The Artemis server is running and accessible
+        # 3. The admin credentials in playwright.env are correct

78-79: Specify OS-specific installation requirements

The note about manual installation on some operating systems should specify which OS versions are affected and provide the corresponding package manager commands.

-    Install Playwright browser binaries, set up the environment to ensure Playwright can locate these binaries.
-    On some operating systems this might not work, and playwright needs to be manually installed via a package manager.
+    Install Playwright browser binaries, set up the environment to ensure Playwright can locate these binaries.
+    Note: On some Linux distributions (e.g., Ubuntu 20.04) or macOS versions, you might need to install additional
+    dependencies via package manager:
+    
+    Ubuntu/Debian:
+    sudo apt-get install libwebkit2gtk-4.0-dev
+    
+    macOS:
+    brew install webkit
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b9ad82f and 0291567.

📒 Files selected for processing (2)
  • docs/dev/playwright.rst (2 hunks)
  • src/test/playwright/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/test/playwright/package.json
🔇 Additional comments (1)
docs/dev/playwright.rst (1)

Line range hint 10-86: Documentation updates look comprehensive and well-structured

The changes provide clear instructions for both quick and manual setup paths, with good configuration details and important warnings. The documentation successfully guides users through the setup process while highlighting potential pitfalls.

@SimonEntholzer
Copy link
Contributor Author

Not needed any more as PR #9796 runs on bamboo again

@SimonEntholzer SimonEntholzer deleted the feature/playwright/simplify-setup-3 branch December 10, 2024 11:17
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.

1 participant