Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "gitlab/gitlab-playwright-currents"]
path = gitlab/gitlab-playwright-currents
url = https://gitlab.com/currents.dev/gitlab-playwright-currents.git
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Examples demonstrating Playwright integration with Currents, including sharding,
| [**GitHub Actions — Orchestration**](playwright/ci/github-actions/orchestration/) | Optimized parallel execution with load balancing |
| [**GitHub Actions — Rerun Failed**](playwright/ci/github-actions/rerun-failed/) | Rerun only failed tests from a previous build |
| [**GitHub Actions — Visual Testing**](playwright/ci/github-actions/argos/) | Integration with Argos for visual regression testing |
| [**GitLab CI**](gitlab/) | Playwright + Currents on GitLab CI ([source on GitLab](https://gitlab.com/currents.dev/gitlab-playwright-currents)) |
| [**Jenkins**](playwright/ci/jenkins/jenkins-last-failed/) | Advanced Jenkins setup with Docker, Sharding, and "Last Failed" rerun |
| [**Nx Monorepo**](playwright/ci/nx/) | Playwright in an Nx workspace |

Expand Down
73 changes: 73 additions & 0 deletions gitlab/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# 🎭 Currents - Playwright - GitLab CI/CD

This repo showcases [Playwright](https://playwright.dev/) integration with [Currents](https://currents.dev). The example is based on https://github.com/MarcusFelling/demo.playwright, the [basic](./basic) test scenarios.

<p align="center">
<img width="830" src="https://static.currents.dev/currents-playwright-banner-gh.png" />
</p>

See the [`.gitlab-ci.yml`](.gitlab-ci.yml) file - it created a GitLab CI pipeline with 3 workers using 3 [Playwright Shards](https://playwright.dev/docs/test-sharding).

Example command:

```sh
npx pwc --key $CURRENTS_RECORD_KEY --project-id bnsqNa --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
```

## Setup

- Create an account at https://app.currents.dev and grab the **Project ID** and **Record Key**.
- Add `CURRENTS_RECORD_KEY` as [GitLab CI/CD Secrets](https://docs.gitlab.com/ee/ci/variables/) (make sure it's not protected)
- [Optional] Add `CURRENTS_API_KEY` as [GitLab CI/CD Secrets](https://docs.gitlab.com/ee/ci/variables/) (only used in the examples with `npx currents api` commands)

Additional resources:

- Playwright Features on Currents: https://currents.dev/playwright
- Integration Documentation: https://currents.dev/readme/integration-with-playwright/currents-playwright
- CI Build ID Guide: https://currents.dev/readme/guides/cypress-ci-build-id

## Additional examples

- [`.gitlab-ci.yml`](.gitlab-ci.yml) - The basic 3 parrallel job sharded pipeline
- Examples of running only the failed tests when retrying a CI pipeline/job
- For `playwright test` (with currents reporter) : [`./gitlab/ci/with-reruns-reporter.yml`](./gitlab/ci/with-reruns-reporter.yml)
- For `pwc` : [`./gitlab/ci/with-reruns-pwc.yml`](./gitlab/ci/with-reruns-pwc.yml)
- For `pwc-p` (orchestration) : [`./gitlab/ci/with-reruns-pwcp.yml`](./gitlab/ci/with-reruns-pwcp.yml)

## GitLab CI Playwright Results

The results are being reported to Currents for more efficient troubleshooting, and monitoring test suite flakiness and performance.

Currents will collect the following information:

- console output
- screenshots
- videos
- trace files
- timing
- outcomes
- flaky tests
- error details
- tags for more convenient management of the tests

### GitLab Merge Request Notes

Take a look at the example merge request: https://gitlab.com/currents.dev/gitlab-playwright-currents/-/merge_requests/3

When [GitLab integration](https://currents.dev/readme/integrations/gitlab) is enabled, Currents will post a Merge Commit note with run results:

<p align="center">
<img width="830" src="https://static.currents.dev/currents-gitlab-merge-note.png" />
</p>

In addition, Currents will post an [External Status check](https://docs.gitlab.com/ee/user/project/merge_requests/status_checks.html) for every Playwright project configured. For example:

<p align="center">
<img src="https://static.currents.dev/currents-gitlab-status-check.png" />
</p>

### Example of Playwright run reported to GitLab CI/CD

<a href="https://static.currents.dev/currents-gitlab-results-example.mp4">
Video
</a>