diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d7bea76 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gitlab/gitlab-playwright-currents"] + path = gitlab/gitlab-playwright-currents + url = https://gitlab.com/currents.dev/gitlab-playwright-currents.git diff --git a/README.md b/README.md index b5f4006..0313195 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/gitlab/README.md b/gitlab/README.md new file mode 100644 index 0000000..4dc8599 --- /dev/null +++ b/gitlab/README.md @@ -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. + +

+ +

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

+ +

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

+ +

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