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

Add Playwright end-to-end tests #928

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

ErvinRacz
Copy link
Contributor

@ErvinRacz ErvinRacz commented Feb 3, 2025

Add Playwright end-to-end tests

  • Added Playwright configuration and workflows for running tests on push and pull requests.
  • Created end-to-end tests for applications, channels, groups, instances, and packages.
  • Added global setup and teardown scripts for database initialization and cleanup.
  • Updated .gitignore to exclude Playwright test results and reports.
  • Installed necessary dependencies for Playwright and PostgreSQL client.

How to use

npx playwright test --ui

Testing done

Testing will be done with the PR and the added github workflow.

  • Add instructions in readme how to run the test

- Added Playwright configuration and workflows for running tests on push and pull requests.
- Created end-to-end tests for applications, channels, groups, instances, and packages.
- Added global setup and teardown scripts for database initialization and cleanup.
- Updated `.gitignore` to exclude Playwright test results and reports.
- Installed necessary dependencies for Playwright and PostgreSQL client.
- Remove 'runs-on' duplication
- Update artifact path to `playwright-report` and remove unnecessary unzip step
- Added a new README.md file in the frontend/e2e directory with detailed instructions on installing dependencies, running tests, developing tests, debugging, and using GitHub Actions for Playwright.
- Updated the GitHub Actions workflow (playwright.yml) to include a group of log lines that provide a summary of the Playwright test report and instructions for analyzing test failures.
@ErvinRacz ErvinRacz marked this pull request as ready for review February 5, 2025 13:02
@ErvinRacz ErvinRacz requested a review from Copilot February 5, 2025 13:02
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 19 out of 29 changed files in this pull request and generated 2 comments.

Files not reviewed (10)
  • frontend/.gitignore: Language not supported
  • frontend/e2e/mask-and-fix-dynamic-parts.css: Language not supported
  • frontend/package-lock.json: Language not supported
  • frontend/package.json: Language not supported
  • frontend/e2e/README.md: Evaluated as low risk
  • frontend/e2e/application.spec.ts: Evaluated as low risk
  • frontend/e2e/global.setup.ts: Evaluated as low risk
  • frontend/e2e/group.spec.ts: Evaluated as low risk
  • frontend/e2e/package.spec.ts: Evaluated as low risk
  • frontend/e2e/channel.spec.ts: Evaluated as low risk
Comments suppressed due to low confidence (2)

frontend/e2e/instance.spec.ts:10

  • [nitpick] The variable name 'instances' is ambiguous. It should be renamed to 'instanceCount'.
await expect(page.getByRole('link', { name: 'instances' })).toContainText('1instances');

frontend/e2e/helpers.ts:23

  • The appName parameter is typed as 'any', which is not ideal. It should be typed as 'string'.
export async function deleteApplication(page: Page, appName: any) {

frontend/e2e/instance.spec.ts Outdated Show resolved Hide resolved
frontend/e2e/global.teardown.ts Outdated Show resolved Hide resolved
@ErvinRacz
Copy link
Contributor Author

@tormath1
Do you know if we could host the generated test summary report in the github pages under a folder like playwright-report?

It would be helpful to be able to access it easily in case of test failure.
Currently to see what went wrong, you would need to download the artifact and unzip it.

I tried something like this, but the runner got no permissions:

  deploy-report:
    if: always()
    runs-on: ubuntu-latest
    needs: test
    permissions:
      contents: write
    steps:
      - name: Download Playwright Report Artifact
        uses: actions/download-artifact@v4
        with:
          name: playwright-report
          path: playwright-report

      - name: Deploy Playwright Report to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: playwright-report
          publish_branch: gh-pages
          destination_dir: playwright-report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant