diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 00000000..3e0aec1c --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,104 @@ +name: e2e + +on: + pull_request: + paths-ignore: + - "**.md" + - "docs/**" + schedule: + # Mondays at 06:00 UTC + - cron: "0 6 * * 1" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: e2e-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + playwright: + name: Playwright against GitLab CE + runs-on: ubuntu-latest + # GitLab's first boot alone takes several minutes. + timeout-minutes: 60 + defaults: + run: + shell: bash + env: + E2E_DIR: e2e/playwright + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: npm + cache-dependency-path: | + webapp/package-lock.json + e2e/playwright/package-lock.json + + # The browser and the containers share these names. + - name: Map E2E hostnames + run: echo "127.0.0.1 mattermost gitlab.test" | sudo tee -a /etc/hosts + + # Runs in the background so GitLab's boot overlaps with the plugin build. + - name: Start Mattermost, GitLab, and the runner + run: | + (make e2e-env-up > "$RUNNER_TEMP/server-up.log" 2>&1; echo $? > "$RUNNER_TEMP/server-up.exit") & + + - name: Build the plugin bundle + run: make dist + + - name: Install E2E dependencies + run: | + cd "$E2E_DIR" + npm ci + npx playwright install --with-deps chromium + + - name: Type-check the suite + run: | + cd "$E2E_DIR" + npm run tsc + + - name: Wait for the servers to be healthy + timeout-minutes: 20 + run: | + while [ ! -f "$RUNNER_TEMP/server-up.exit" ]; do sleep 5; done + cat "$RUNNER_TEMP/server-up.log" + exit "$(cat "$RUNNER_TEMP/server-up.exit")" + + - name: Run the suite + run: | + cd "$E2E_DIR" + npm test + + - name: Collect container logs + if: failure() + run: | + cd "$E2E_DIR" + mkdir -p results + docker compose ps -a > results/containers.txt + docker compose logs --no-color > results/containers.log + + - name: Upload results + if: failure() || cancelled() + uses: actions/upload-artifact@v4 + with: + name: e2e-results-${{ github.run_id }}-${{ github.run_attempt }} + path: e2e/playwright/results + retention-days: 14 + + - name: Stop the servers + if: always() + run: make e2e-env-down diff --git a/README.md b/README.md index c4df5c9e..70fa3f42 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,10 @@ Team members can stay up-to-date with how many reviews, todos, assigned issues, ## Development This plugin contains both a server and web app portion. Read our documentation about the [Developer Workflow](https://developers.mattermost.com/integrate/plugins/developer-workflow/) and [Developer Setup](https://developers.mattermost.com/integrate/plugins/developer-setup/) for more information about developing and extending plugins. + +### Playwright e2e tests + +Setup and commands are documented in [e2e/playwright/README.md](e2e/playwright/README.md). From the repo root, `make e2e-env-up` starts Mattermost and GitLab, and `make e2e` runs the suite. ## Help wanted! diff --git a/build/custom.mk b/build/custom.mk index a275feee..1736cdca 100644 --- a/build/custom.mk +++ b/build/custom.mk @@ -1,5 +1,27 @@ # Include custom targets and environment variables here +E2E_DIR = e2e/playwright + +$(E2E_DIR)/node_modules: $(E2E_DIR)/package.json $(E2E_DIR)/package-lock.json + cd $(E2E_DIR) && npm ci && npx playwright install chromium + touch $@ + +## Starts the disposable Mattermost and GitLab servers used by the E2E suite. +.PHONY: e2e-env-up +e2e-env-up: + $(E2E_DIR)/scripts/ensure-hosts.sh + cd $(E2E_DIR) && docker compose up -d --wait + +## Stops the E2E servers and wipes their data. +.PHONY: e2e-env-down +e2e-env-down: + cd $(E2E_DIR) && docker compose down -v + +## Builds the plugin and runs the Playwright E2E suite against PW_BASE_URL (default http://mattermost:8065). +.PHONY: e2e +e2e: dist $(E2E_DIR)/node_modules + cd $(E2E_DIR) && npm run tsc && npm test + ## Generates mock golang interfaces for testing .PHONY: mock mock: diff --git a/e2e/playwright/.gitignore b/e2e/playwright/.gitignore new file mode 100644 index 00000000..5fc81b84 --- /dev/null +++ b/e2e/playwright/.gitignore @@ -0,0 +1,5 @@ +node_modules +results +.env +storage_state +.gitlab-credentials.json diff --git a/e2e/playwright/README.md b/e2e/playwright/README.md new file mode 100644 index 00000000..76e9df9d --- /dev/null +++ b/e2e/playwright/README.md @@ -0,0 +1,94 @@ +# GitLab plugin E2E tests + +Playwright suite that drives the plugin against a disposable Mattermost server and a GitLab Community Edition container. GitLab users, the trusted OAuth application, and webhook settings are created with `gitlab-rails runner`. Groups, projects, issues, and merge requests are created by the specs through the GitLab API. + +Built on [`@mattermost/playwright-lib`](https://www.npmjs.com/package/@mattermost/playwright-lib) (fixtures, page objects, and admin bootstrap), so no `mattermost` monorepo checkout is needed. + +## Host names + +The browser and both containers share two hostnames. Add this line to `/etc/hosts` once: + +```text +127.0.0.1 mattermost gitlab.test +``` + +`scripts/ensure-hosts.sh` checks that both names resolve and prints the line when they do not. It does not edit `/etc/hosts`. + +The suite needs Node.js 20 or newer. GitLab needs about 4 GB of RAM. The first boot takes several minutes. + +## Running + +From the repo root: + +```sh +make e2e-env-up # Mattermost 11.11, Postgres, GitLab CE, and a GitLab runner +make e2e # build the plugin bundle, install deps, run the suite +make e2e-env-down # stop and wipe both servers +``` + +Or from this directory, after `make dist` and `make e2e-env-up`: + +```sh +npm ci && npx playwright install chromium +npm test # headless +npm run test:headed # watch the browser +npm run test:ui # Playwright UI mode +npm run show-report # open the last HTML report +``` + +`global_setup.ts` creates the sysadmin, a single `gitlab-e2e` team (a second team would move the GitLab buttons out of the channel header), and a regular member, `gitlab-e2e-user`, that the specs act as. Only the install wizard and the `/gitlab instance` checks use the sysadmin. Setup then bootstraps GitLab, uploads the newest `dist/*.tar.gz`, and writes the GitLab URL and OAuth credentials into the plugin config. It then runs `/gitlab instance install` and completes the wizard in the GitLab bot DM with the same OAuth application, so `gitlab-e2e` becomes the default instance. The suite is safe to rerun against the same server: the bootstrap recreates the OAuth application and the runner registration, and setup disconnects both Mattermost users and uninstalls the old instance before installing it again. It also closes any issues and merge requests still assigned to or awaiting review from `gitlab-e2e`, and clears its to-dos, so an interrupted run does not skew the sidebar counts. The first test then reconnects through the OAuth popup. + +Setup deletes every other team the sysadmin belongs to. It only does so on `http://mattermost:8065` unless `PW_DELETE_OTHER_TEAMS=true` is set. + +The bootstrap also creates a personal access token for `gitlab-e2e`. Specs use it to act as the connected user, for example to approve merge requests or clear to-dos. Root performs most GitLab actions so that the connected user receives the DMs. + +GitLab Community Edition has no group webhooks, so the group-subscription test adds its webhook on the project inside the group. + +### Coverage + +| Spec | Covers | +| --- | --- | +| `connect` | OAuth connect and disconnect, and the `disconnect` command | +| `commands` | `help`, `about`, `me`, `instance list`, `connect`, `settings`, `todo`, and usage errors | +| `subscriptions` | Add, list, delete, `unsubscribe`, custom features, validation, permissions, `webhook list` | +| `channel_events` | Issue, merge request, comment, push, tag, and release posts | +| `feature_filters` | Label filters, feature exclusion, confidential issues | +| `dm_notifications` | Assignment, comment, mention, review, approval, merge DMs, and muting with `settings` | +| `notifications` | Project and group subscriptions, plus the assigned issue and merge request lists | +| `sidebar` | Review and to-do lists and counts | +| `post_actions` | Create GitLab issue (incl. label, assignee, and milestone) and attach to issue from the post menu, and `/gitlab issue create` | +| `webapp_integrations` | Link tooltips and the profile popover attribute | +| `pipelines` | `/gitlab pipelines run`, plus pipeline, job, and deployment posts on the runner | +| `permalinks` | Blob permalink code previews (`fixme`, see below) | + +`pipelines` includes a `fixme` test for the failed-pipeline DM. The plugin does not deliver that DM to the pipeline author today ([MM-71329](https://mattermost.atlassian.net/browse/MM-71329)). + +`permalinks` is a `fixme`: the code-preview feature only recognizes `gitlab.com` permalinks (`gitlabPermalinkRegex` in `server/plugin.go` is anchored to that host) and `EnableCodePreview` defaults to `public`, which skips the suite's private projects. That host restriction is a product bug (code previews never work for self-hosted GitLab) and will be tracked in a separate ticket. Exercising it against the self-hosted `gitlab.test` stack needs the regex to accept the configured host. + +### Writing tests + +Specs follow the [Mattermost Playwright guidelines](https://github.com/mattermost/mattermost/blob/master/e2e-tests/playwright/CLAUDE.OPTIONAL.md): + +- Every test has a JSDoc block with `@objective` (and `@precondition` when the setup is not the default), the `@gitlab_plugin` tag, and `// #` action and `// *` verification comments. +- Specs hold no selectors. Mattermost UI goes through `@mattermost/playwright-lib` page objects, and the plugin's UI through the components in `support/components/` (`GitlabRhs`, `GitlabSidebar`, `CreateIssueModal`, `AttachCommentModal`, `GitlabLinkTooltip`, `GitlabProfileAttribute`). +- Components locate elements by role, label, or text. Test ids are kept only for elements without an accessible name: the header counts, sidebar items, the connected username, subscription rows, and the link tooltip. + +### CI + +`.github/workflows/e2e.yml` runs the suite on every pull request except those that only change Markdown files or files under `docs/`, weekly on Mondays at 06:00 UTC, and on demand from the Actions tab. It boots the stack on the runner while the plugin builds, then runs the full suite. When a run fails, the Playwright report, traces, and container logs are uploaded as the `e2e-results-*` artifact. + +### Environment + +| Variable | Default | +| --- | --- | +| `PW_BASE_URL` | `http://mattermost:8065` | +| `PW_ADMIN_USERNAME` / `PW_ADMIN_PASSWORD` | `sysadmin` / `Sys@dmin-sample1` | +| `PW_HEADLESS` | `true` | +| `PW_REGULAR_USER_PASSWORD` | `gitlab-e2e-user`'s password. Required unless `PW_BASE_URL` is `http://mattermost:8065` | +| `PW_DELETE_OTHER_TEAMS` | unset (only deletes other teams on `http://mattermost:8065`) | +| `MM_IMAGE` (docker compose) | `mattermost/mattermost-enterprise-edition:11.11` (release-1.x plugins bundle React 18 or older, so they cannot run on Mattermost 12) | +| `GITLAB_IMAGE` (docker compose) | `gitlab/gitlab-ce:18.11.12-ce.0` | +| `GITLAB_RUNNER_IMAGE` (docker compose) | `gitlab/gitlab-runner:alpine-v18.11.4` | +| `GITLAB_ROOT_PASSWORD` | `Kv7-Qm4n-Wx2p-L9` | + +GitLab rejects passwords that contain a predictable word or part of the account name, username, or email. The defaults above avoid that check. The GitLab user the suite connects is `gitlab-e2e`. Its password is printed into `.gitlab-credentials.json` by the bootstrap and is not a secret outside this local stack. diff --git a/e2e/playwright/docker-compose.yml b/e2e/playwright/docker-compose.yml new file mode 100644 index 00000000..0fb79a18 --- /dev/null +++ b/e2e/playwright/docker-compose.yml @@ -0,0 +1,114 @@ +# Disposable Mattermost and GitLab Community Edition for the plugin E2E suite. +# npm run server:up # start and wait until healthy +# npm run server:down # stop and wipe all data +# +# The host must resolve mattermost and gitlab.test to 127.0.0.1 so the browser +# and the containers share one pair of URLs. scripts/ensure-hosts.sh checks this. +name: gitlab-plugin-e2e + +services: + postgres: + image: postgres:16-alpine + environment: + POSTGRES_USER: mmuser + POSTGRES_PASSWORD: mostest + POSTGRES_DB: mattermost_test + healthcheck: + test: ["CMD-SHELL", "pg_isready -U mmuser -d mattermost_test"] + interval: 5s + timeout: 5s + retries: 20 + networks: + - e2e + + mattermost: + # Must satisfy plugin.json's min_server_version. Only amd64 images are + # published; on Apple silicon Docker Desktop runs them under emulation. + image: ${MM_IMAGE:-mattermost/mattermost-enterprise-edition:11.11} + platform: linux/amd64 + hostname: mattermost + depends_on: + postgres: + condition: service_healthy + ports: + - "127.0.0.1:8065:8065" + environment: + MM_SQLSETTINGS_DRIVERNAME: postgres + MM_SQLSETTINGS_DATASOURCE: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10 + # GitLab delivers webhooks to this name over the Compose network. + MM_SERVICESETTINGS_SITEURL: http://mattermost:8065 + MM_SERVICESETTINGS_ENABLEONBOARDINGFLOW: "false" + MM_SERVICESETTINGS_ENABLETUTORIAL: "false" + MM_SERVICESETTINGS_ENABLESECURITYFIXALERT: "false" + MM_PLUGINSETTINGS_ENABLE: "true" + MM_PLUGINSETTINGS_ENABLEUPLOADS: "true" + MM_PLUGINSETTINGS_AUTOMATICPREPACKAGEDPLUGINS: "false" + MM_RATELIMITSETTINGS_ENABLE: "false" + MM_ANNOUNCEMENTSETTINGS_ADMINNOTICESENABLED: "false" + MM_ANNOUNCEMENTSETTINGS_USERNOTICESENABLED: "false" + MM_LOGSETTINGS_CONSOLELEVEL: INFO + # The image is distroless (no shell/curl), so the healthcheck pings the + # server through mmctl over the local-mode socket. + MM_SERVICESETTINGS_ENABLELOCALMODE: "true" + healthcheck: + test: ["CMD", "/mattermost/bin/mmctl", "--local", "system", "status"] + interval: 5s + timeout: 10s + retries: 60 + start_period: 20s + networks: + e2e: + aliases: + - mattermost + + gitlab: + image: ${GITLAB_IMAGE:-gitlab/gitlab-ce:18.11.12-ce.0} + hostname: gitlab.test + shm_size: "256m" + depends_on: + mattermost: + condition: service_healthy + ports: + - "127.0.0.1:8929:8929" + environment: + # GitLab rejects weak passwords: no predictable words, and nothing from the + # root user's name, username, or email (root, admin, example). + GITLAB_ROOT_PASSWORD: ${GITLAB_ROOT_PASSWORD:-Kv7-Qm4n-Wx2p-L9} + GITLAB_OMNIBUS_CONFIG: | + external_url 'http://gitlab.test:8929' + nginx['listen_https'] = false + letsencrypt['enable'] = false + prometheus_monitoring['enable'] = false + alertmanager['enable'] = false + node_exporter['enable'] = false + redis_exporter['enable'] = false + postgres_exporter['enable'] = false + gitlab_exporter['enable'] = false + puma['worker_processes'] = 0 + sidekiq['max_concurrency'] = 5 + gitlab_kas['enable'] = false + registry['enable'] = false + gitlab_pages['enable'] = false + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:8929/-/readiness"] + interval: 20s + timeout: 10s + retries: 30 + start_period: 300s + networks: + e2e: + aliases: + - gitlab.test + + # Runs CI jobs for the pipeline, job, and deployment specs. Global setup + # registers it against GitLab with a shell executor. + gitlab-runner: + image: ${GITLAB_RUNNER_IMAGE:-gitlab/gitlab-runner:alpine-v18.11.4} + depends_on: + gitlab: + condition: service_healthy + networks: + - e2e + +networks: + e2e: {} diff --git a/e2e/playwright/global_setup.ts b/e2e/playwright/global_setup.ts new file mode 100644 index 00000000..6e67ed1e --- /dev/null +++ b/e2e/playwright/global_setup.ts @@ -0,0 +1,13 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import './support/env'; + +import {baseGlobalSetup} from '@mattermost/playwright-lib'; + +import {prepareServer} from './support/plugin'; + +export default async function globalSetup() { + await baseGlobalSetup(); + await prepareServer(); +} diff --git a/e2e/playwright/package-lock.json b/e2e/playwright/package-lock.json new file mode 100644 index 00000000..2cb408a7 --- /dev/null +++ b/e2e/playwright/package-lock.json @@ -0,0 +1,1934 @@ +{ + "name": "mattermost-plugin-gitlab-e2e", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "mattermost-plugin-gitlab-e2e", + "devDependencies": { + "@mattermost/client": "11.4.0", + "@mattermost/playwright-lib": "11.4.0", + "@mattermost/types": "11.4.0", + "@playwright/test": "1.64.1", + "@types/node": "^22.20.5", + "typescript": "^5.9.3" + } + }, + "node_modules/@axe-core/playwright": { + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@axe-core/playwright/-/playwright-4.11.0.tgz", + "integrity": "sha512-70vBT/Ylqpm65RQz2iCG2o0JJCEG/WCNyefTr2xcOcr1CoSee60gNQYUMZZ7YukoKkFLv26I/jjlsvwwp532oQ==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "axe-core": "~4.11.0" + }, + "peerDependencies": { + "playwright-core": ">= 1.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@mattermost/client": { + "version": "11.4.0", + "resolved": "https://registry.npmjs.org/@mattermost/client/-/client-11.4.0.tgz", + "integrity": "sha512-QzYIpxFRPA+NDCCxk9bPwnFRpgZq8d1KKYXic8AJJiPXjja6IJDOkpDfGgo4b1q0AofUQ+u7Js3Fh2mxerwz5g==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@mattermost/types": "11.4.0", + "typescript": "^4.3.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@mattermost/playwright-lib": { + "version": "11.4.0", + "resolved": "https://registry.npmjs.org/@mattermost/playwright-lib/-/playwright-lib-11.4.0.tgz", + "integrity": "sha512-rzKROUwzDK3qMoV4wXZBW3RfHePmH0GhhqYNJtt74qT1JMKSqpLbSFYtcrRsF9MgPQRc5ZxwWHSKerj31Zx9qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@axe-core/playwright": "4.11.0", + "@mattermost/client": "11.3.0", + "@mattermost/types": "11.3.0", + "@percy/cli": "1.31.8", + "@percy/playwright": "1.0.10", + "async-wait-until": "2.0.31", + "axe-core": "4.11.1", + "chalk": "4.1.2", + "deepmerge": "4.3.1", + "dotenv": "17.2.3", + "luxon": "3.7.2", + "mime-types": "3.0.2", + "uuid": "13.0.0" + }, + "peerDependencies": { + "@playwright/test": ">=1.55.0" + } + }, + "node_modules/@mattermost/playwright-lib/node_modules/@mattermost/client": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/@mattermost/client/-/client-11.3.0.tgz", + "integrity": "sha512-ulDcKXRcmxwqsqqRJemyq47UlpSVnPNKQrg/FHfEEzgLdhTlnrdMnRGZUssuCeZ9DXRkSw+uZwudiJoJ0bc47A==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@mattermost/types": "11.3.0", + "typescript": "^4.3.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@mattermost/playwright-lib/node_modules/@mattermost/types": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/@mattermost/types/-/types-11.3.0.tgz", + "integrity": "sha512-ZjkF1D28Jn+7Agki2de1FIFIWx7LbdqqIaaZ5JgOGpqtkkr9PQ0AW+WLOoEzokWEZ54dXB9INSuGLEczTfrt8w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "typescript": "^4.3.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@mattermost/types": { + "version": "11.4.0", + "resolved": "https://registry.npmjs.org/@mattermost/types/-/types-11.4.0.tgz", + "integrity": "sha512-oYt7vvsa60hPpujcCBYeyd+22OwprEAtFXgVJrsdd9pR1qkEGU4F+uv8bh6ZTBSZAQnc2/xXQPZJGGR06toteA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "typescript": "^4.3.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@percy/cli": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/cli/-/cli-1.31.8.tgz", + "integrity": "sha512-soyU/AgK3dkKIv1tNKIaU4oi+JBroWhpvm29LlQMeLk87cItkt/Lp3aTs3HHXUKZqYGuhLQlci11n2uLtUvmVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/cli-app": "1.31.8", + "@percy/cli-build": "1.31.8", + "@percy/cli-command": "1.31.8", + "@percy/cli-config": "1.31.8", + "@percy/cli-exec": "1.31.8", + "@percy/cli-snapshot": "1.31.8", + "@percy/cli-upload": "1.31.8", + "@percy/client": "1.31.8", + "@percy/logger": "1.31.8" + }, + "bin": { + "percy": "bin/run.cjs" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/cli-app": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/cli-app/-/cli-app-1.31.8.tgz", + "integrity": "sha512-kbSv+ZVf/fpk5R8ewLb8LwHftTOHT2XJ6MNU9s81sKEv9iDqsf6vIiDF+/nKMSsMX+ns1evw+4I2vEjASmDzoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/cli-command": "1.31.8", + "@percy/cli-exec": "1.31.8" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/cli-build": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/cli-build/-/cli-build-1.31.8.tgz", + "integrity": "sha512-aPZV6Lv7BRbGFqdGGPgfV8mMjgnoYQQQ7E1GFyVbZvsOrmqOif3osrmvwSwO7kd730cmKfhzg2iHbVBzEg+z4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/cli-command": "1.31.8" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/cli-command": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/cli-command/-/cli-command-1.31.8.tgz", + "integrity": "sha512-nANwIfbLS78OJ9LV7WE4A6Tp1bN9OLpIPsZR7RgfNxG8YZFkyprbDA2zV+p6IYcfKoSnJBBD9isIUL+ITK+cgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/config": "1.31.8", + "@percy/core": "1.31.8", + "@percy/logger": "1.31.8" + }, + "bin": { + "percy-cli-readme": "bin/readme.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/cli-config": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/cli-config/-/cli-config-1.31.8.tgz", + "integrity": "sha512-VmJkkwUkckbQVXecgQAewHR1lMWh/t8mEbVR9W/8iX/H1hOg1ONADFxNC/qfi3PhOO5kdWktS4r51jc0BgIEDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/cli-command": "1.31.8" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/cli-exec": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/cli-exec/-/cli-exec-1.31.8.tgz", + "integrity": "sha512-SRZNwIZCyh38OtGWwPcQuwMVxeViHy4kP/Y0QJleDaOdH34MITwQuNMquf4Q7vZmEJ1mCamZpy/WUCDJICTuWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/cli-command": "1.31.8", + "@percy/logger": "1.31.8", + "cross-spawn": "^7.0.3", + "which": "^2.0.2" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/cli-snapshot": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/cli-snapshot/-/cli-snapshot-1.31.8.tgz", + "integrity": "sha512-RQNx7eUq7Xml/EtQjsYvb9nWP/Wk4vf5SqAYHjAXSDDiK1K4BHdcxT7+GO1F+qq720/KgjwnC/JmBTulpC5a5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/cli-command": "1.31.8", + "yaml": "^2.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/cli-upload": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/cli-upload/-/cli-upload-1.31.8.tgz", + "integrity": "sha512-yuegEGVcxd/PneheBfd0D9HE36EkdPS6u3m9m6Y8GPkN0UN7eOVxoOqfPHT9wCRfUjR3K9qcdBvo11S6biLWTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/cli-command": "1.31.8", + "fast-glob": "^3.2.11", + "image-size": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/client": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/client/-/client-1.31.8.tgz", + "integrity": "sha512-MxhOY5DWJnW3dsmzYICgYOyKCFLwJcaC19jTsonfmQHBa8/cKs4mUKnrUgvtJlOsW6mSk6WrAn8vUUwZ4438xQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/config": "1.31.8", + "@percy/env": "1.31.8", + "@percy/logger": "1.31.8", + "pac-proxy-agent": "^7.0.2", + "pako": "^2.1.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/config": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/config/-/config-1.31.8.tgz", + "integrity": "sha512-iK7n0YOlmk4ITvQ8l4BeaInrS/cE8MqD+368cAEGVhPjGjarDKZ06FvEZXoxU8J+4LZbNyN9h/o+2UDtFRPYyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/logger": "1.31.8", + "ajv": "^8.6.2", + "cosmiconfig": "^8.0.0", + "yaml": "^2.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/core": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/core/-/core-1.31.8.tgz", + "integrity": "sha512-p5KWNvbU8GUlA/DxV8q9N0alSzaEKx8aJxgO8TkmMA3HalMl/HogYw5+B7tvOUU0CAw9ar5vXyPXuOIm4wpqvA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "@percy/client": "1.31.8", + "@percy/config": "1.31.8", + "@percy/dom": "1.31.8", + "@percy/logger": "1.31.8", + "@percy/monitoring": "1.31.8", + "@percy/webdriver-utils": "1.31.8", + "content-disposition": "^0.5.4", + "cross-spawn": "^7.0.3", + "extract-zip": "^2.0.1", + "fast-glob": "^3.2.11", + "micromatch": "^4.0.8", + "mime-types": "^2.1.34", + "pako": "^2.1.0", + "path-to-regexp": "^6.3.0", + "rimraf": "^3.0.2", + "ws": "^8.17.1", + "yaml": "^2.4.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/core/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@percy/core/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@percy/dom": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/dom/-/dom-1.31.8.tgz", + "integrity": "sha512-uw4aOTTXWgj3dZPrDlM+j0+MzwDz9u8EfE92fi2HsyqDXgp0hw957b3F/YEE9TMR27s9OgwXKnOCd8zauoj0Ew==", + "dev": true, + "license": "MIT" + }, + "node_modules/@percy/env": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/env/-/env-1.31.8.tgz", + "integrity": "sha512-nIwSkwIijMCxvRZE2MV1rn51NGHM3EgRayuKxgkhevzc1s4Y785GTS8CZyJaPshs1fWVBork87Tm9Tbuh3u1PQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/logger": "1.31.8" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/logger": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/logger/-/logger-1.31.8.tgz", + "integrity": "sha512-OqnrtfmCdKW+2Z8LYk8Jc9HK0P89TJqp2qWnM913eDeoYZOKJX+2IyAZfsaFTcfEBAqHn0v1eynfldRedbTk3A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/monitoring": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/monitoring/-/monitoring-1.31.8.tgz", + "integrity": "sha512-NBLQIoXWZb1Oi8M6Q6o8rmA6PzZi+65cxgyoKXHboxF7wAb8i8Vyc2JM7zTvay6RZ6JGuVHpqkxPcQaarxM1IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/config": "1.31.8", + "@percy/logger": "1.31.8", + "@percy/sdk-utils": "1.31.8", + "systeminformation": "^5.25.11" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/playwright": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@percy/playwright/-/playwright-1.0.10.tgz", + "integrity": "sha512-lq2Mbqz/SfguQn4PdbNwApmzZpA/3gWO7STLlyLNYd0r4btGd7Nfxyxkf/t78rgh2ErwGcLUuPbxGPpZ3XXLVw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "playwright-core": ">=1" + } + }, + "node_modules/@percy/sdk-utils": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/sdk-utils/-/sdk-utils-1.31.8.tgz", + "integrity": "sha512-S+qxi4TIOvToAD5j89nkdDj0Xj5CH8YJxpI6ZRVJE/UQE+amHIP34KiTdrWKw5aPlYEwNPeNn9UlXz5HUr5Z9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "pac-proxy-agent": "^7.0.2" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@percy/webdriver-utils": { + "version": "1.31.8", + "resolved": "https://registry.npmjs.org/@percy/webdriver-utils/-/webdriver-utils-1.31.8.tgz", + "integrity": "sha512-mfKR5EaXTTTLXX2JBFKmz9OphhHHBIMwe6lkI/hVgl1jvnTV2FXSSS2xb2Sume86uGFyj53NRH+HTNf/tepQKg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@percy/config": "1.31.8", + "@percy/sdk-utils": "1.31.8" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@playwright/test": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.64.1.tgz", + "integrity": "sha512-IaYGml/nSOiZWROfPtuIL7neuu9qDOZ3TNvNljUIrhDMxiGTgPjzj/g9p9RxpS2tSepPDRY+UwAaEeiKtUvIAg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.20.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.5.tgz", + "integrity": "sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ajv": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz", + "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/async-wait-until": { + "version": "2.0.31", + "resolved": "https://registry.npmjs.org/async-wait-until/-/async-wait-until-2.0.31.tgz", + "integrity": "sha512-9VCfHvc4f36oT6sG5p16aKc9zojf3wF4FrjNDxU3Db51SJ1bQ5lWAWtQDDZPysTwSLKBDzNZ083qPkTIj6XnrA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.14.0", + "npm": ">= 1.0.0" + }, + "funding": { + "type": "individual", + "url": "http://paypal.me/devlatoau" + } + }, + "node_modules/axe-core": { + "version": "4.11.1", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.11.1.tgz", + "integrity": "sha512-BASOg+YwO2C+346x3LZOeoovTIoTrRqEsqMa6fmfAV0P+U9mFr9NsyOEpiYvFjbc64NMrSswhV50WdXzdb/Z5A==", + "dev": true, + "license": "MPL-2.0", + "engines": { + "node": ">=4" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/basic-ftp": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.3.1.tgz", + "integrity": "sha512-bopVNp6ugyA150DDuZfPFdt1KZ5a94ZDiwX4hMgZDzF+GttD80lEy8kj98kbyhLXnPvhtIo93mdnLIjpCAeeOw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/dotenv": { + "version": "17.2.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz", + "integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-uri": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz", + "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fastq": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz", + "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-uri": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz", + "integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/image-size": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-1.2.1.tgz", + "integrity": "sha512-rH+46sQJ2dlwfjfhCyNx5thzrv+dtmBIhPHk0zgRUukHzZ/kRueTJXoYYsclBaKcSMBWuGbOFXtioLpzTb5euw==", + "dev": true, + "license": "MIT", + "dependencies": { + "queue": "6.0.2" + }, + "bin": { + "image-size": "bin/image-size.js" + }, + "engines": { + "node": ">=16.x" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ip-address": { + "version": "10.7.4", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.4.tgz", + "integrity": "sha512-DWBMKyeM25D70nrIiTkgQth59/G+naKOTep6huF9j+GmeK3DMD60Zvxg5d5qQnz+38AHgou6ean2LECX+lrKDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/luxon": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.7.2.tgz", + "integrity": "sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/netmask": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.1.1.tgz", + "integrity": "sha512-eonl3sLUha+S1GzTPxychyhnUzKyeQkZ7jLjKrBagJgPla13F+uQ71HgpFefyHgqrjEbCPkDArxYsjY8/+gLKA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/pac-proxy-agent": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", + "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.6", + "pac-resolver": "^7.0.1", + "socks-proxy-agent": "^8.0.5" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "dev": true, + "license": "MIT", + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pako": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.2.0.tgz", + "integrity": "sha512-zJq6RP/5q+TO2OpFV3FHzlPnFjmkb7Nc99a5SNjJE+uu/PkpChs+NIZSSzbBoD+6kjiISXjfYdwj1ZRQ81dz/w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "(MIT AND Zlib)" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/playwright": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.1.tgz", + "integrity": "sha512-HCrVhHr5QQuwYoswEUGTb7gGp522yflbv/ST8nF4sFWGuLjQCt17Q/EubpGGSNKYn1tsTCPZxqHhHCfVURu7UA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/playwright-core": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.1.tgz", + "integrity": "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/pump": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz", + "integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/queue": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/queue/-/queue-6.0.2.tgz", + "integrity": "sha512-iHZWu+q3IdFZFX36ro/lKBkSvfkztY5Y7HMiPlOUjhupPcG2JMfst2KKEpu5XndviX/3UhFbRngUPNKtgvtZiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "~2.0.3" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.10.tgz", + "integrity": "sha512-e0VyvkVTwVYViNovRkZ9aodhxVlyoMn7eJhVUPxZ+eK9P/7CBkxvvsBOHqFPEH416726W8tLXXXjKwqgTErrCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ip-address": "^10.1.1", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.5", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", + "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/systeminformation": { + "version": "5.33.16", + "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-5.33.16.tgz", + "integrity": "sha512-R+Lh69IJXfJj6bfyH1In5cIR9FTr4hBS39YvlZHZjsK1p9cuELPq7hplZZIb56ZESMMb+DzdKqqE6Iomi01Mvg==", + "dev": true, + "license": "MIT", + "os": [ + "darwin", + "linux", + "win32", + "freebsd", + "openbsd", + "netbsd", + "sunos", + "android" + ], + "bin": { + "systeminformation": "lib/cli.js" + }, + "engines": { + "node": ">=10.0.0" + }, + "funding": { + "type": "Buy me a coffee", + "url": "https://www.buymeacoffee.com/systeminfo" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/uuid": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-13.0.0.tgz", + "integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist-node/bin/uuid" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ws": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz", + "integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/yaml": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.1.tgz", + "integrity": "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==", + "dev": true, + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + } + } +} diff --git a/e2e/playwright/package.json b/e2e/playwright/package.json new file mode 100644 index 00000000..032605d4 --- /dev/null +++ b/e2e/playwright/package.json @@ -0,0 +1,21 @@ +{ + "name": "mattermost-plugin-gitlab-e2e", + "private": true, + "scripts": { + "test": "playwright test", + "test:headed": "PW_HEADLESS=false playwright test", + "test:ui": "playwright test --ui", + "show-report": "playwright show-report results/reporter", + "server:up": "docker compose up -d --wait", + "server:down": "docker compose down -v", + "tsc": "tsc --noEmit" + }, + "devDependencies": { + "@mattermost/client": "11.4.0", + "@mattermost/playwright-lib": "11.4.0", + "@mattermost/types": "11.4.0", + "@playwright/test": "1.64.1", + "@types/node": "^22.20.5", + "typescript": "^5.9.3" + } +} diff --git a/e2e/playwright/playwright.config.ts b/e2e/playwright/playwright.config.ts new file mode 100644 index 00000000..984559a9 --- /dev/null +++ b/e2e/playwright/playwright.config.ts @@ -0,0 +1,39 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import './support/env'; + +import {defineConfig} from '@playwright/test'; +import {testConfig} from '@mattermost/playwright-lib'; + +// One GitLab user and one set of subscriptions, so the suite stays serial. +export default defineConfig({ + testDir: './tests', + globalSetup: require.resolve('./global_setup'), + outputDir: './results/output', + fullyParallel: false, + workers: 1, + retries: process.env.CI ? 1 : 0, + timeout: 2 * 60 * 1000, + expect: {timeout: 15 * 1000}, + reporter: [ + ['list'], + ['html', {outputFolder: './results/reporter', open: 'never'}], + ...(process.env.CI ? [['github'] as const] : []), + ], + use: { + baseURL: testConfig.baseURL, + headless: testConfig.headless, + launchOptions: {slowMo: testConfig.slowMo}, + viewport: {width: 1280, height: 1024}, + trace: 'retain-on-failure', + screenshot: 'only-on-failure', + video: 'retain-on-failure', + }, + projects: [ + { + name: 'chrome', + use: {browserName: 'chromium'}, + }, + ], +}); diff --git a/e2e/playwright/scripts/bootstrap-gitlab.rb b/e2e/playwright/scripts/bootstrap-gitlab.rb new file mode 100644 index 00000000..3f05592a --- /dev/null +++ b/e2e/playwright/scripts/bootstrap-gitlab.rb @@ -0,0 +1,144 @@ +# frozen_string_literal: true + +# Idempotent GitLab fixture for the Mattermost plugin E2E suite. +# Creates a trusted OAuth application, the gitlab-e2e user, an admin token, +# and the settings that let webhooks reach the Compose network. +# Groups and projects are created later by the specs. + +APP_NAME = 'Mattermost GitLab Plugin E2E' +REDIRECT_URI = 'http://mattermost:8065/plugins/com.github.manland.mattermost-plugin-gitlab/oauth/complete' +E2E_USERNAME = 'gitlab-e2e' +E2E_EMAIL = 'gitlab-e2e@example.com' +# GitLab rejects weak passwords, including any password that contains the +# user's name, username, email, or a predictable word such as "password". +E2E_PASSWORD = 'Ht6-Yr8c-Bn3q-W5' +E2E_NAME = 'GitLab E2E' +TOKEN_NAME = 'e2e-admin' +RUNNER_NAME = 'e2e-runner' +SCOPES = 'api read_user' + +def organization + if Organizations::Organization.respond_to?(:default_organization) + Organizations::Organization.default_organization + else + Organizations::Organization.first + end +end + +def ensure_local_webhooks(settings) + settings.allow_local_requests_from_web_hooks_and_services = true + if settings.respond_to?(:dns_rebinding_protection_enabled=) + settings.dns_rebinding_protection_enabled = false + end + settings.save! +end + +def ensure_user(admin, org) + user = User.find_by_username(E2E_USERNAME) + if user.nil? + result = Users::CreateService.new(admin, { + username: E2E_USERNAME, + email: E2E_EMAIL, + name: E2E_NAME, + password: E2E_PASSWORD, + password_confirmation: E2E_PASSWORD, + skip_confirmation: true, + organization_id: org.id, + admin: false, + }).execute + raise "failed to create #{E2E_USERNAME}: #{result.message}" unless result.success? + + user = result.payload[:user] + else + user.password = E2E_PASSWORD + user.password_confirmation = E2E_PASSWORD + user.skip_reconfirmation! + user.confirmed_at ||= Time.current + user.save! + end + raise "failed to save #{E2E_USERNAME}: #{user.errors.full_messages.to_sentence}" unless user.persisted? + + user +end + +def ensure_token(admin, target, org) + target.personal_access_tokens.where(name: TOKEN_NAME).find_each do |existing| + existing.update!(revoked: true) + end + + result = PersonalAccessTokens::CreateService.new( + current_user: admin, + target_user: target, + organization_id: org.id, + params: { + name: TOKEN_NAME, + scopes: ['api'], + expires_at: 30.days.from_now.to_date, + }, + ).execute + raise "failed to create token for #{target.username}: #{result.message}" unless result.success? + + raw = result.payload[:personal_access_token].token + raise "token for #{target.username} has no readable plaintext value" if raw.blank? + + raw +end + +def ensure_runner(admin) + Ci::Runner.where(description: RUNNER_NAME).find_each(&:destroy!) + + result = Ci::Runners::CreateRunnerService.new( + user: admin, + params: {runner_type: 'instance_type', description: RUNNER_NAME, run_untagged: true}, + ).execute + raise "failed to create runner: #{result.message}" unless result.success? + + result.payload[:runner].token +end + +def ensure_oauth_application(org) + Authn::OauthApplication.where(name: APP_NAME).find_each(&:destroy!) + + app = Authn::OauthApplication.new( + name: APP_NAME, + redirect_uri: REDIRECT_URI, + scopes: SCOPES, + confidential: true, + trusted: true, + organization_id: org.id, + ) + app.save! + raise "failed to create OAuth application: #{app.errors.full_messages.to_sentence}" unless app.persisted? + + secret = app.plaintext_secret + raise 'OAuth application secret was not available after create' if secret.blank? + + [app.uid, secret] +end + +admin = User.find_by_username('root') +raise 'root user not found' if admin.nil? + +org = organization +raise 'default organization not found' if org.nil? + +ensure_local_webhooks(ApplicationSetting.current) +user = ensure_user(admin, org) +admin_token = ensure_token(admin, admin, org) +e2e_token = ensure_token(admin, user, org) +runner_token = ensure_runner(admin) +client_id, client_secret = ensure_oauth_application(org) + +payload = { + gitlab_url: 'http://gitlab.test:8929', + client_id: client_id, + client_secret: client_secret, + admin_token: admin_token, + e2e_token: e2e_token, + runner_token: runner_token, + e2e_user_id: user.id, + e2e_username: user.username, + e2e_password: E2E_PASSWORD, + root_user_id: admin.id, +} +puts "E2E_CREDENTIALS_JSON=#{payload.to_json}" diff --git a/e2e/playwright/scripts/bootstrap-gitlab.sh b/e2e/playwright/scripts/bootstrap-gitlab.sh new file mode 100755 index 00000000..399383ae --- /dev/null +++ b/e2e/playwright/scripts/bootstrap-gitlab.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# Runs the Rails bootstrap inside the GitLab container and writes credentials for the specs. +set -eu + +cd "$(dirname "$0")/.." + +output="$(docker compose exec -T gitlab gitlab-rails runner - < scripts/bootstrap-gitlab.rb)" +json="$(printf '%s\n' "$output" | sed -n 's/^E2E_CREDENTIALS_JSON=//p' | tail -n 1)" + +if [ -z "$json" ]; then + echo "GitLab bootstrap did not print credentials." >&2 + printf '%s\n' "$output" >&2 + exit 1 +fi + +printf '%s\n' "$json" > .gitlab-credentials.json +echo "Wrote e2e/playwright/.gitlab-credentials.json" + +runner_token="$(node -e 'process.stdout.write(require("./.gitlab-credentials.json").runner_token)')" +docker compose exec -T gitlab-runner gitlab-runner unregister --all-runners >/dev/null 2>&1 || true +docker compose exec -T gitlab-runner gitlab-runner register \ + --non-interactive \ + --url http://gitlab.test:8929 \ + --token "$runner_token" \ + --executor shell \ + --name e2e-runner +echo "Registered the e2e GitLab runner" diff --git a/e2e/playwright/scripts/ensure-hosts.sh b/e2e/playwright/scripts/ensure-hosts.sh new file mode 100755 index 00000000..d58aec6f --- /dev/null +++ b/e2e/playwright/scripts/ensure-hosts.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Confirms the host can resolve the names shared by the browser and the containers. +set -eu + +resolves() { + name="$1" + if command -v python3 >/dev/null 2>&1; then + python3 -c 'import socket, sys; socket.getaddrinfo(sys.argv[1], None)' "$name" >/dev/null 2>&1 + return $? + fi + if command -v dscacheutil >/dev/null 2>&1; then + dscacheutil -q host -a name "$name" | grep -q 'ip_address:' + return $? + fi + getent hosts "$name" >/dev/null 2>&1 +} + +missing="" +for name in mattermost gitlab.test; do + if ! resolves "$name"; then + missing="$missing $name" + fi +done + +if [ -n "$missing" ]; then + echo "The E2E hostnames are not resolvable:$missing" >&2 + echo "Add this line to /etc/hosts, then retry:" >&2 + echo "127.0.0.1 mattermost gitlab.test" >&2 + exit 1 +fi diff --git a/e2e/playwright/support/admin.ts b/e2e/playwright/support/admin.ts new file mode 100644 index 00000000..d9b84e61 --- /dev/null +++ b/e2e/playwright/support/admin.ts @@ -0,0 +1,68 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import './env'; + +import {Client4} from '@mattermost/client'; +import type {UserProfile} from '@mattermost/types/users'; +import {testConfig} from '@mattermost/playwright-lib'; + +import {TEAM_NAME} from './constants'; + +const DISPOSABLE_SERVER_URL = 'http://mattermost:8065'; + +export function isDisposableServer() { + return new URL(testConfig.baseURL).origin === DISPOSABLE_SERVER_URL; +} + +// A fixed user, rather than a random one per test, keeps a single GitLab OAuth connection across specs. +const REGULAR_USER = { + username: 'gitlab-e2e-user', + email: 'gitlab-e2e-user@example.com', +}; + +// The default password is public, so other servers must supply their own. +function regularUserPassword() { + const password = process.env.PW_REGULAR_USER_PASSWORD; + if (password) { + return password; + } + if (!isDisposableServer()) { + throw new Error(`Set PW_REGULAR_USER_PASSWORD to run against ${testConfig.baseURL}.`); + } + return 'Gl-E2e-Member#2026'; +} + +async function login(username: string, password: string) { + const client = new Client4(); + client.setUrl(testConfig.baseURL); + const profile = await client.login(username, password); + return {client, user: {...profile, password}}; +} + +// loginAdmin returns a Client4 authenticated as the sysadmin configured via +// PW_ADMIN_USERNAME/PW_ADMIN_PASSWORD. Usable outside test fixtures (e.g. in +// global setup), unlike pw.getAdminClient(). +export function loginAdmin() { + return login(testConfig.adminUsername, testConfig.adminPassword); +} + +export function loginRegularUser() { + return login(REGULAR_USER.username, regularUserPassword()); +} + +export async function ensureRegularUser(adminClient: Client4) { + const password = regularUserPassword(); + let user: UserProfile; + try { + user = await adminClient.getUserByUsername(REGULAR_USER.username); + } catch { + user = await adminClient.createUser({...REGULAR_USER, password} as UserProfile, '', ''); + } + if (user.roles.split(' ').includes('system_admin')) { + throw new Error(`${REGULAR_USER.username} must not be a system admin`); + } + + const team = await adminClient.getTeamByName(TEAM_NAME); + await adminClient.addToTeam(team.id, user.id); +} diff --git a/e2e/playwright/support/components/gitlab_rhs.ts b/e2e/playwright/support/components/gitlab_rhs.ts new file mode 100644 index 00000000..262929fd --- /dev/null +++ b/e2e/playwright/support/components/gitlab_rhs.ts @@ -0,0 +1,97 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, type ChannelsPage} from '@mattermost/playwright-lib'; +import type {Locator, Page} from '@playwright/test'; + +import {PLUGIN_ID} from '../constants'; +import type {GitlabCredentials} from '../credentials'; + +import {GitlabSidebar} from './gitlab_sidebar'; + +// The subscriptions view the GitLab app-bar icon opens in the right-hand sidebar. +export class GitlabRhs { + readonly container: Locator; + readonly appBarIcon: Locator; + readonly connectLink: Locator; + readonly username: Locator; + readonly noSubscriptions: Locator; + + constructor(private readonly channelsPage: ChannelsPage) { + this.container = channelsPage.sidebarRight.container; + + // Mattermost renders the app-bar icon, so it only has the id Mattermost assigns. + // The plugin id contains dots, so an #id selector would parse them as classes. + this.appBarIcon = channelsPage.appBar.container.locator(`[id="app-bar-icon-${PLUGIN_ID}"]`); + this.connectLink = this.container.getByRole('link', {name: 'Connect account', exact: true}); + this.username = this.container.getByTestId('gitlab-rhs-username'); + this.noSubscriptions = this.container.getByText('There are no GitLab subscriptions available in this channel.'); + } + + // Subscription rows have no role, so they keep a test id. + subscription(path: string) { + return this.container.getByTestId('gitlab-rhs-subscription').filter({hasText: path}); + } + + subscriptionFeature(path: string, feature: string) { + return this.subscription(path).getByText(feature, {exact: true}); + } + + // The icon toggles the right-hand sidebar. When the sidebar already shows a + // GitLab item list, close it first so the next click opens the subscriptions + // view instead of hiding the sidebar. + async open() { + if (await this.isOpen()) { + return; + } + const sidebar = new GitlabSidebar(this.channelsPage); + if (await sidebar.isListOpen()) { + await this.appBarIcon.click(); + await expect(this.container).toBeHidden(); + } + await this.appBarIcon.click(); + await expect(this.username.or(this.connectLink)).toBeVisible(); + } + + async isOpen() { + return await this.username.isVisible() || await this.connectLink.isVisible(); + } + + async isConnected() { + return this.username.isVisible(); + } + + // Connects through the GitLab OAuth popup that "Connect account" opens. + async connect(credentials: GitlabCredentials) { + const popupPromise = this.channelsPage.page.waitForEvent('popup'); + await this.connectLink.click(); + await new GitlabSignInPopup(await popupPromise).signIn(credentials.e2e_username, credentials.e2e_password); + await expect(this.username).toHaveText(credentials.e2e_username, {timeout: 30000}); + } +} + +export class GitlabSignInPopup { + readonly username: Locator; + readonly password: Locator; + readonly signInButton: Locator; + readonly authorizeButton: Locator; + + constructor(readonly page: Page) { + this.username = page.getByLabel('Username or primary email'); + this.password = page.getByLabel('Password', {exact: true}); + this.signInButton = page.getByRole('button', {name: 'Sign in', exact: true}); + this.authorizeButton = page.getByRole('button', {name: /^Authorize/}); + } + + async signIn(username: string, password: string) { + await this.username.fill(username); + await this.password.fill(password); + await this.signInButton.click(); + + // A trusted application skips the consent screen. Approve it if the app was not marked trusted. + const needsConsent = await this.authorizeButton.waitFor({state: 'visible', timeout: 8000}).then(() => true).catch(() => false); + if (needsConsent) { + await this.authorizeButton.click(); + } + } +} diff --git a/e2e/playwright/support/components/gitlab_sidebar.ts b/e2e/playwright/support/components/gitlab_sidebar.ts new file mode 100644 index 00000000..04b5a14b --- /dev/null +++ b/e2e/playwright/support/components/gitlab_sidebar.ts @@ -0,0 +1,80 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, type ChannelsPage} from '@mattermost/playwright-lib'; +import type {Locator, Page} from '@playwright/test'; + +const LISTS = { + mergeRequests: {button: 'Merge requests assigned', count: 'gitlab-header-merge-requests-count', title: 'Merge Requests Assigned'}, + reviews: {button: 'Merge requests needing review', count: 'gitlab-header-reviews-count', title: 'Merge Requests Needing Review'}, + issues: {button: 'Issues', count: 'gitlab-header-issues-count', title: 'Issues'}, + todos: {button: 'To-Do list', count: 'gitlab-header-todos-count', title: 'To-Do List'}, +}; + +export type GitlabList = keyof typeof LISTS; + +// The GitLab buttons in the left sidebar header and the item list each one opens +// in the right-hand sidebar. The header only renders while the user is in a single team. +export class GitlabSidebar { + readonly page: Page; + readonly header: Locator; + readonly list: Locator; + readonly refreshButton: Locator; + readonly refreshIcon: Locator; + readonly emptyList: Locator; + + constructor(channelsPage: ChannelsPage) { + this.page = channelsPage.page; + this.header = channelsPage.sidebarLeft.container; + this.list = channelsPage.sidebarRight.container; + this.refreshButton = this.header.getByRole('link', {name: 'Refresh', exact: true}); + this.refreshIcon = this.refreshButton.locator('i.fa-refresh'); + this.emptyList = this.list.getByText('You have no active items'); + } + + button(list: GitlabList) { + return this.header.getByLabel(LISTS[list].button, {exact: true}); + } + + // The counts are bare numbers without an accessible name, so they keep test ids. + count(list: GitlabList) { + return this.header.getByTestId(LISTS[list].count); + } + + heading(list: GitlabList) { + return this.list.getByRole('link', {name: LISTS[list].title, exact: true}); + } + + item(id: number) { + return this.list.getByTestId(`gitlab-sidebar-item-${id}`); + } + + itemTitle(id: number) { + return this.list.getByTestId(`gitlab-sidebar-item-title-${id}`); + } + + // The webapp ignores a Refresh click while an earlier fetch (the one on mount, or a + // previous click) is still in flight, so wait for the spinner to stop, then wait for + // the fetch this click starts. Otherwise the click can be dropped and the counts stay stale. + async refresh() { + await expect(this.refreshIcon).not.toHaveClass(/fa-spin/); + const fetched = this.page.waitForResponse((response) => response.url().endsWith('/lhs-data') && response.request().method() === 'GET'); + await this.refreshButton.click(); + await fetched; + } + + async openList(list: GitlabList) { + await this.button(list).click(); + await expect(this.heading(list)).toBeVisible(); + } + + async isListOpen() { + for (const list of Object.keys(LISTS) as GitlabList[]) { + // eslint-disable-next-line no-await-in-loop + if (await this.heading(list).isVisible()) { + return true; + } + } + return false; + } +} diff --git a/e2e/playwright/support/components/index.ts b/e2e/playwright/support/components/index.ts new file mode 100644 index 00000000..3359c68d --- /dev/null +++ b/e2e/playwright/support/components/index.ts @@ -0,0 +1,7 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +export {GitlabRhs, GitlabSignInPopup} from './gitlab_rhs'; +export {GitlabSidebar, type GitlabList} from './gitlab_sidebar'; +export {AttachCommentModal, CreateIssueModal} from './issue_modals'; +export {GitlabLinkTooltip, GitlabProfileAttribute} from './popovers'; diff --git a/e2e/playwright/support/components/issue_modals.ts b/e2e/playwright/support/components/issue_modals.ts new file mode 100644 index 00000000..dad81e44 --- /dev/null +++ b/e2e/playwright/support/components/issue_modals.ts @@ -0,0 +1,173 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect} from '@mattermost/playwright-lib'; +import type {Locator, Page, Request} from '@playwright/test'; + +abstract class IssueModal { + readonly container: Locator; + readonly closeButton: Locator; + + protected constructor(protected readonly page: Page, title: string) { + // On Mattermost 11 the modal's root wrapper also has role="dialog", so the title + // matches two nested dialogs. The last one in document order is the modal itself. + this.container = page.getByRole('dialog').filter({has: page.getByRole('heading', {name: title, exact: true})}).last(); + this.closeButton = this.container.getByRole('button', {name: 'Close'}); + } + + async toBeVisible() { + await expect(this.container).toBeVisible(); + } + + async toBeHidden() { + await expect(this.container).toBeHidden(); + } + + async close() { + await this.closeButton.click(); + } + + // The selectors are react-select inputs whose options render outside the modal. + protected async select(combobox: Locator, text: string) { + await combobox.fill(text); + await this.page.getByRole('option', {name: new RegExp(escapeRegExp(text))}).click(); + } +} + +export class CreateIssueModal extends IssueModal { + readonly project: Locator; + readonly title: Locator; + readonly description: Locator; + readonly submitButton: Locator; + + constructor(page: Page) { + super(page, 'Create GitLab Issue'); + this.project = this.container.getByLabel('Project', {exact: true}); + this.title = this.container.getByLabel('Issue title', {exact: true}); + this.description = this.container.getByLabel('Issue description', {exact: true}); + this.submitButton = this.container.getByRole('button', {name: 'Submit', exact: true}); + } + + // Works around a webapp bug, to be tracked in a separate ticket: selecting a project + // mounts the label, assignee, and milestone pickers, and each fetches its options twice + // (both useEffects in issue_attribute_selector.tsx run). When a fetch resolves, the + // picker re-applies the selection from the render that started it (initially [] for + // labels and assignees), so a label or assignee picked between the two responses is + // cleared. Wait for all option fetches to settle. Remove once the webapp is fixed. + async selectProject(path: string) { + const requested = new Set(); + let pending = 0; + const optionEndpoint = (request: Request) => (/\/api\/v1\/(labels|assignees|milestones)\?/).exec(request.url())?.[1]; + const onStart = (request: Request) => { + const endpoint = optionEndpoint(request); + if (endpoint) { + requested.add(endpoint); + pending++; + } + }; + const onEnd = (request: Request) => { + if (optionEndpoint(request)) { + pending--; + } + }; + this.page.on('request', onStart); + this.page.on('requestfinished', onEnd); + this.page.on('requestfailed', onEnd); + try { + await this.select(this.project, path); + + // Each endpoint is requested, then nothing is in flight. This holds whether a + // picker fetches once or twice: both fetches start in the same render, before + // either can finish, so pending cannot reach 0 between them. + await expect.poll(() => requested.size === 3 && pending === 0).toBe(true); + + // requestfinished only means the response arrived; the picker applies it in a + // later page task. Run one page task and a frame so arrived responses are + // applied and rendered. The pickers' loading spinner is no signal: the two + // loads share one flag, and it clears after the first. + await this.page.evaluate(() => new Promise((resolve) => { + setTimeout(() => requestAnimationFrame(() => resolve()), 0); + })); + } finally { + this.page.off('request', onStart); + this.page.off('requestfinished', onEnd); + this.page.off('requestfailed', onEnd); + } + } + + async selectLabel(name: string) { + await this.chooseAttribute('Labels', name); + } + + async selectAssignee(username: string) { + await this.chooseAttribute('Assignees', username); + } + + async selectMilestone(title: string) { + await this.chooseAttribute('Milestone', title); + } + + // The label, assignee, and milestone selectors wrap a react-select whose Setting + // label is not tied to its input, so scope by the form group that holds the label. + private attributeGroup(label: string): Locator { + return this.container.locator('div.form-group.less').filter({has: this.page.getByText(label, {exact: true})}); + } + + // Picks an option with Enter. Clicking the portalled option does not commit the + // multi-select pickers (labels, assignees); Enter works for both the multi and single + // selectors. Escape is avoided because it clears the committed value. + // + // Enter commits the highlighted option, which after typing is the first filtered one + // (a-bug when picking bug). Hovering highlights the exact option instead. react-select + // ignores the first mouse move after a keypress, so move onto the option twice. + // aria-activedescendant cannot confirm the highlight: react-select omits it on macOS. + private async chooseAttribute(label: string, text: string) { + const group = this.attributeGroup(label); + const combobox = group.getByRole('combobox'); + await combobox.fill(text); + const option = this.page.getByRole('option', {name: new RegExp(`^${escapeRegExp(text)}$`)}); + await option.hover({position: {x: 5, y: 5}}); + await option.hover({position: {x: 10, y: 8}}); + await combobox.press('Enter'); + + // * Verify the pick is shown so a dropped selection fails here, not at submit + await expect(group.getByText(text, {exact: true})).toBeVisible(); + } + + // Waits until the chosen label, assignee, and milestone are all shown as chips, so + // a submit does not race the react-select state update for the earlier picks. + async expectSelections(label: string, assignee: string, milestone: string) { + await expect(this.attributeGroup('Labels').getByText(label, {exact: true})).toBeVisible(); + await expect(this.attributeGroup('Assignees').getByText(assignee, {exact: true})).toBeVisible(); + await expect(this.attributeGroup('Milestone').getByText(milestone, {exact: true})).toBeVisible(); + } + + async submit() { + await this.submitButton.click(); + } +} + +export class AttachCommentModal extends IssueModal { + readonly issue: Locator; + readonly message: Locator; + readonly attachButton: Locator; + + constructor(page: Page) { + super(page, 'Attach Message to GitLab Issue'); + this.issue = this.container.getByLabel('Gitlab Issue', {exact: true}); + this.message = this.container.getByLabel('Message Attached to GitLab Issue', {exact: true}); + this.attachButton = this.container.getByRole('button', {name: 'Attach', exact: true}); + } + + async selectIssue(title: string) { + await this.select(this.issue, title); + } + + async attach() { + await this.attachButton.click(); + } +} + +function escapeRegExp(text: string) { + return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} diff --git a/e2e/playwright/support/components/popovers.ts b/e2e/playwright/support/components/popovers.ts new file mode 100644 index 00000000..d8641e13 --- /dev/null +++ b/e2e/playwright/support/components/popovers.ts @@ -0,0 +1,42 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import type {ChannelsPage, ChannelsPost} from '@mattermost/playwright-lib'; +import type {Locator} from '@playwright/test'; + +// The preview the plugin shows while hovering a GitLab issue or merge request link. +export class GitlabLinkTooltip { + // The tooltip is a plain box without a role, so it keeps a test id. + readonly container: Locator; + + constructor(channelsPage: ChannelsPage) { + this.container = channelsPage.page.getByTestId('gitlab-link-tooltip'); + } + + title(title: string) { + return this.container.getByRole('heading', {name: title, exact: true}); + } + + number(iid: number) { + return this.container.getByText(`#${iid}`, {exact: true}); + } + + async hoverLink(post: ChannelsPost, url: string) { + await post.container.getByRole('link', {name: url, exact: true}).hover(); + } +} + +// The GitLab account link the plugin adds to Mattermost's user profile popover. +export class GitlabProfileAttribute { + readonly popover: Locator; + + constructor(channelsPage: ChannelsPage) { + this.popover = channelsPage.userProfilePopover.container; + } + + // The accessible name is prefixed with the GitLab icon glyph. + link(gitlabUsername: string) { + const escaped = gitlabUsername.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + return this.popover.getByRole('link', {name: new RegExp(`(^|\\s)${escaped}$`)}); + } +} diff --git a/e2e/playwright/support/constants.ts b/e2e/playwright/support/constants.ts new file mode 100644 index 00000000..fec92efd --- /dev/null +++ b/e2e/playwright/support/constants.ts @@ -0,0 +1,18 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +export const PLUGIN_ID = 'com.github.manland.mattermost-plugin-gitlab'; + +export const TEAM_NAME = 'gitlab-e2e'; +export const TOWN_SQUARE = 'town-square'; + +export const GITLAB_URL = 'http://gitlab.test:8929'; + +// AES-128/192/256 keys must be 16, 24, or 32 bytes. This one is 32. +export const ENCRYPTION_KEY = 'e2e-gitlab-plugin-encryption-key'; +export const WEBHOOK_SECRET = 'e2e-webhook-secret'; + +export const INSTANCE_NAME = 'gitlab-e2e'; +export const BOT_USERNAME = 'gitlab'; + +export const WEBHOOK_TIMEOUT = 45000; diff --git a/e2e/playwright/support/credentials.ts b/e2e/playwright/support/credentials.ts new file mode 100644 index 00000000..d94db113 --- /dev/null +++ b/e2e/playwright/support/credentials.ts @@ -0,0 +1,27 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import fs from 'node:fs'; +import path from 'node:path'; + +export type GitlabCredentials = { + gitlab_url: string; + client_id: string; + client_secret: string; + admin_token: string; + e2e_token: string; + runner_token: string; + e2e_user_id: number; + e2e_username: string; + e2e_password: string; + root_user_id: number; +}; + +const CREDENTIALS_PATH = path.resolve(__dirname, '../.gitlab-credentials.json'); + +export function loadCredentials(): GitlabCredentials { + if (!fs.existsSync(CREDENTIALS_PATH)) { + throw new Error(`Missing ${CREDENTIALS_PATH}. Run \`make e2e-env-up\` and the global setup bootstrap first.`); + } + return JSON.parse(fs.readFileSync(CREDENTIALS_PATH, 'utf8')) as GitlabCredentials; +} diff --git a/e2e/playwright/support/env.ts b/e2e/playwright/support/env.ts new file mode 100644 index 00000000..85ccf1e0 --- /dev/null +++ b/e2e/playwright/support/env.ts @@ -0,0 +1,4 @@ +// Defaults used by @mattermost/playwright-lib, which reads process.env while its +// module is evaluated. Import this before that package. +process.env.PW_BASE_URL = process.env.PW_BASE_URL || 'http://mattermost:8065'; +process.env.PW_HEADLESS = process.env.PW_HEADLESS || 'true'; diff --git a/e2e/playwright/support/gitlab_api.ts b/e2e/playwright/support/gitlab_api.ts new file mode 100644 index 00000000..c7903d43 --- /dev/null +++ b/e2e/playwright/support/gitlab_api.ts @@ -0,0 +1,366 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import type {GitlabCredentials} from './credentials'; + +const ACCESS_LEVELS = {guest: 10, owner: 50}; +const POLL_INTERVAL_MS = 1000; + +export type AccessLevel = keyof typeof ACCESS_LEVELS; + +export type GitlabGroup = { + id: number; + path: string; +}; + +export type GitlabProject = { + id: number; + path: string; + path_with_namespace: string; + default_branch: string; + web_url: string; +}; + +export type GitlabIssue = { + id: number; + iid: number; + title: string; + web_url: string; +}; + +export type GitlabIssueDetail = GitlabIssue & { + description: string; + labels: string[]; + assignees: Array<{username: string}>; + milestone: {title: string} | null; +}; + +export type GitlabMergeRequest = { + id: number; + iid: number; + title: string; + web_url: string; + source_branch: string; +}; + +export type GitlabPipeline = { + id: number; + status: string; +}; + +export type GitlabTodo = { + id: number; + action_name: string; + target: {iid: number; title: string}; +}; + +type IssueOptions = { + assigneeIds?: number[]; + labels?: string[]; + confidential?: boolean; + description?: string; +}; + +type MergeRequestOptions = { + targetBranch: string; + assigneeIds?: number[]; + reviewerIds?: number[]; + description?: string; +}; + +export class GitlabApi { + private readonly baseURL: string; + + private readonly token: string; + + constructor(credentials: GitlabCredentials, token = credentials.admin_token) { + this.baseURL = credentials.gitlab_url.replace(/\/$/, ''); + this.token = token; + } + + // Acts as the GitLab user connected in Mattermost, so events it triggers are sent by that user. + static asConnectedUser(credentials: GitlabCredentials) { + return new GitlabApi(credentials, credentials.e2e_token); + } + + async createGroup(path: string): Promise { + return this.request('POST', '/groups', { + name: path, + path, + visibility: 'private', + }); + } + + async createProject(groupId: number, path: string): Promise { + const project = await this.request('POST', '/projects', { + name: path, + path, + namespace_id: groupId, + visibility: 'private', + initialize_with_readme: true, + }); + project.default_branch = await this.waitForDefaultBranch(project.id); + return project; + } + + async addMember(groupId: number, userId: number, accessLevel: AccessLevel) { + await this.request('POST', `/groups/${groupId}/members`, { + user_id: userId, + access_level: ACCESS_LEVELS[accessLevel], + }); + } + + async createLabel(projectId: number, name: string) { + await this.request('POST', `/projects/${projectId}/labels`, {name, color: '#428BCA'}); + } + + // The plugin's milestone selector lists the project's milestones plus those of its + // parent groups (listAllProjectMilestones in server/gitlab/api.go), so a group + // milestone also covers the inherited case. + async createGroupMilestone(groupId: number, title: string) { + await this.request('POST', `/groups/${groupId}/milestones`, {title}); + } + + async createIssue(projectId: number, title: string, options: IssueOptions = {}): Promise { + return this.request('POST', `/projects/${projectId}/issues`, { + title, + description: options.description, + assignee_ids: options.assigneeIds, + labels: options.labels?.join(','), + confidential: options.confidential, + }); + } + + async updateIssue(projectId: number, iid: number, changes: Record) { + await this.request('PUT', `/projects/${projectId}/issues/${iid}`, changes); + } + + async closeIssue(projectId: number, iid: number) { + await this.updateIssue(projectId, iid, {state_event: 'close'}); + } + + async reopenIssue(projectId: number, iid: number) { + await this.updateIssue(projectId, iid, {state_event: 'reopen'}); + } + + async commentOnIssue(projectId: number, iid: number, body: string) { + await this.request('POST', `/projects/${projectId}/issues/${iid}/notes`, {body}); + } + + async listIssues(projectId: number): Promise> { + return this.request('GET', `/projects/${projectId}/issues?per_page=100`); + } + + async findIssue(projectId: number, title: string): Promise { + const issues = await this.request('GET', `/projects/${projectId}/issues?per_page=100`); + return issues.find((issue) => issue.title === title); + } + + async listIssueComments(projectId: number, iid: number): Promise> { + return this.request('GET', `/projects/${projectId}/issues/${iid}/notes?per_page=100`); + } + + async commitFile(projectId: number, branch: string, filePath: string, content: string, message: string, startBranch?: string) { + await this.request('POST', `/projects/${projectId}/repository/commits`, { + branch, + start_branch: startBranch, + commit_message: message, + actions: [{action: 'create', file_path: filePath, content}], + }); + } + + async createBranch(projectId: number, branch: string, ref: string) { + await this.request('POST', `/projects/${projectId}/repository/branches`, {branch, ref}); + } + + async createMergeRequest(projectId: number, title: string, options: MergeRequestOptions): Promise { + const branch = `e2e-${Date.now().toString(36)}${Math.random().toString(16).slice(2, 6)}`; + await this.commitFile(projectId, branch, `${branch}.md`, 'e2e', `Add ${branch}`, options.targetBranch); + return this.request('POST', `/projects/${projectId}/merge_requests`, { + source_branch: branch, + target_branch: options.targetBranch, + title, + description: options.description, + assignee_ids: options.assigneeIds, + reviewer_ids: options.reviewerIds, + }); + } + + async updateMergeRequest(projectId: number, iid: number, changes: Record) { + await this.request('PUT', `/projects/${projectId}/merge_requests/${iid}`, changes); + } + + async closeMergeRequest(projectId: number, iid: number) { + await this.updateMergeRequest(projectId, iid, {state_event: 'close'}); + } + + async reopenMergeRequest(projectId: number, iid: number) { + await this.updateMergeRequest(projectId, iid, {state_event: 'reopen'}); + } + + async approveMergeRequest(projectId: number, iid: number) { + await this.request('POST', `/projects/${projectId}/merge_requests/${iid}/approve`); + } + + async unapproveMergeRequest(projectId: number, iid: number) { + await this.request('POST', `/projects/${projectId}/merge_requests/${iid}/unapprove`); + } + + async commentOnMergeRequest(projectId: number, iid: number, body: string) { + await this.request('POST', `/projects/${projectId}/merge_requests/${iid}/notes`, {body}); + } + + // GitLab checks mergeability asynchronously, so a merge right after creation can be rejected. + async mergeMergeRequest(projectId: number, iid: number) { + await this.poll(`merge request !${iid} to merge`, async () => { + const response = await this.send('PUT', `/projects/${projectId}/merge_requests/${iid}/merge`); + if (response.ok) { + return true; + } + if ([405, 406, 409, 422].includes(response.status)) { + return false; + } + throw new Error(`Merging !${iid} failed (${response.status}): ${await response.text()}`); + }); + } + + async createTag(projectId: number, name: string, ref: string) { + await this.request('POST', `/projects/${projectId}/repository/tags`, {tag_name: name, ref}); + } + + async deleteTag(projectId: number, name: string) { + await this.request('DELETE', `/projects/${projectId}/repository/tags/${encodeURIComponent(name)}`); + } + + async createRelease(projectId: number, tagName: string, name: string, ref: string) { + await this.request('POST', `/projects/${projectId}/releases`, {tag_name: tagName, name, ref}); + } + + async waitForPipeline(projectId: number, ref: string, status: string): Promise { + let found: GitlabPipeline | undefined; + await this.poll(`a ${status} pipeline on ${ref}`, async () => { + const pipelines = await this.request('GET', `/projects/${projectId}/pipelines?ref=${encodeURIComponent(ref)}`); + found = pipelines.find((pipeline) => pipeline.status === status); + return Boolean(found); + }, 180000); + return found!; + } + + async listTodos(): Promise { + return this.request('GET', '/todos?state=pending'); + } + + async markAllTodosDone() { + await this.request('POST', '/todos/mark_as_done'); + } + + // Group deletion is delayed, so close open items first to keep them out of the sidebar lists. + async closeOpenItems(projectId: number) { + const issues = await this.request('GET', `/projects/${projectId}/issues?state=opened&per_page=100`); + for (const issue of issues) { + // eslint-disable-next-line no-await-in-loop + await this.closeIssue(projectId, issue.iid); + } + const mergeRequests = await this.request('GET', `/projects/${projectId}/merge_requests?state=opened&per_page=100`); + for (const mergeRequest of mergeRequests) { + // eslint-disable-next-line no-await-in-loop + await this.closeMergeRequest(projectId, mergeRequest.iid); + } + } + + // Sidebar counts span every project, so items left open by an interrupted run would skew them. + async closeItemsInvolving(userId: number) { + const queries: Array<[string, string]> = [ + ['issues', `assignee_id=${userId}`], + ['merge_requests', `assignee_id=${userId}`], + ['merge_requests', `reviewer_id=${userId}`], + ]; + for (const [kind, filter] of queries) { + // eslint-disable-next-line no-await-in-loop + const items = await this.listAllPages<{iid: number; project_id: number}>(`/${kind}?scope=all&state=opened&per_page=100&${filter}`); + for (const item of items) { + // eslint-disable-next-line no-await-in-loop + await this.request('PUT', `/projects/${item.project_id}/${kind}/${item.iid}`, {state_event: 'close'}); + } + } + } + + async deleteGroup(groupId: number) { + const response = await this.send('DELETE', `/groups/${groupId}`); + if (response.status === 404) { + return; + } + if (!response.ok) { + const body = await response.text(); + throw new Error(`DELETE /groups/${groupId} failed (${response.status}): ${body}`); + } + } + + private async waitForDefaultBranch(projectId: number) { + let branch = ''; + await this.poll(`project ${projectId} to report a default branch`, async () => { + const project = await this.request('GET', `/projects/${projectId}`); + branch = project.default_branch; + return Boolean(branch); + }); + return branch; + } + + private async poll(description: string, check: () => Promise, timeoutMs = 30000) { + const deadline = Date.now() + timeoutMs; + while (Date.now() < deadline) { + // eslint-disable-next-line no-await-in-loop + if (await check()) { + return; + } + // eslint-disable-next-line no-await-in-loop + await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS)); + } + throw new Error(`Timed out waiting for ${description}`); + } + + // Collects every page before the caller changes anything, since edits would shift the offsets. + private async listAllPages(apiPath: string): Promise { + const items: T[] = []; + let page = '1'; + while (page) { + // eslint-disable-next-line no-await-in-loop + const response = await this.send('GET', `${apiPath}&page=${page}`); + // eslint-disable-next-line no-await-in-loop + const text = await response.text(); + if (!response.ok) { + throw new Error(`GET ${apiPath} failed (${response.status}): ${text}`); + } + items.push(...JSON.parse(text) as T[]); + page = response.headers.get('x-next-page') ?? ''; + } + return items; + } + + private async request(method: string, apiPath: string, body?: unknown): Promise { + const response = await this.send(method, apiPath, body); + const text = await response.text(); + if (!response.ok) { + throw new Error(`${method} ${apiPath} failed (${response.status}): ${text}`); + } + if (!text) { + return undefined as T; + } + return JSON.parse(text) as T; + } + + private send(method: string, apiPath: string, body?: unknown) { + return fetch(`${this.baseURL}/api/v4${apiPath}`, { + method, + headers: { + 'PRIVATE-TOKEN': this.token, + 'Content-Type': 'application/json', + }, + body: body === undefined ? undefined : JSON.stringify(body), + }); + } +} + +export function uniquePath(prefix: string) { + return `${prefix}${Math.random().toString(16).slice(2, 8)}`; +} diff --git a/e2e/playwright/support/instance.ts b/e2e/playwright/support/instance.ts new file mode 100644 index 00000000..c2d74fed --- /dev/null +++ b/e2e/playwright/support/instance.ts @@ -0,0 +1,93 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import './env'; + +import type {Client4} from '@mattermost/client'; +import {ChannelsPage, TestBrowser, testConfig} from '@mattermost/playwright-lib'; +import {chromium, expect, type Page} from '@playwright/test'; + +import {loginAdmin, loginRegularUser} from './admin'; +import {BOT_USERNAME, INSTANCE_NAME, PLUGIN_ID, TEAM_NAME, TOWN_SQUARE} from './constants'; +import {loadCredentials} from './credentials'; + +const WIZARD_STEP_TIMEOUT = 15000; + +async function executeCommand(client: Client4, command: string) { + const team = await client.getTeamByName(TEAM_NAME); + const channel = await client.getChannelByName(team.id, TOWN_SQUARE); + await client.executeCommand(command, {channel_id: channel.id, team_id: team.id}); +} + +async function defaultInstanceName(client: Client4) { + const config = await client.getConfig(); + const settings = config.PluginSettings.Plugins?.[PLUGIN_ID] as Record | undefined; + return settings?.defaultinstancename; +} + +// Earlier runs leave identical wizard prompts in the DM, so each step waits for the newest post. +async function expectWizardStep(channelsPage: ChannelsPage, text: string) { + await channelsPage.centerView.waitUntilLastPostContains(text, WIZARD_STEP_TIMEOUT); +} + +async function clickWizardButton(channelsPage: ChannelsPage, text: string, name: string) { + await expectWizardStep(channelsPage, text); + const post = await channelsPage.centerView.getLastPost(); + await post.container.getByRole('button', {name, exact: true}).click(); +} + +async function submitDialog(page: Page, fields: Record) { + const dialog = page.getByRole('dialog'); + await expect(dialog).toBeVisible(); + for (const [placeholder, value] of Object.entries(fields)) { + // eslint-disable-next-line no-await-in-loop + await dialog.getByPlaceholder(placeholder).fill(value); + } + await dialog.getByRole('button', {name: 'Save & continue'}).click(); + await expect(dialog).toBeHidden(); +} + +// installInstance walks the `/gitlab instance install` wizard in the GitLab bot DM +// with the OAuth application created by the GitLab bootstrap. The bootstrap +// recreates that application on every run, so an existing instance is removed first +// to keep its client secret current. +export async function installInstance() { + const credentials = loadCredentials(); + const {client, user} = await loginAdmin(); + + // The bootstrap recreates the OAuth application, which revokes tokens from an earlier connection. + await executeCommand(client, '/gitlab disconnect'); + await executeCommand((await loginRegularUser()).client, '/gitlab disconnect'); + await executeCommand(client, `/gitlab instance uninstall ${INSTANCE_NAME}`); + await executeCommand(client, '/gitlab instance install'); + + const browser = await chromium.launch({headless: testConfig.headless}); + try { + const {page} = await new TestBrowser(browser).login(user); + const channelsPage = new ChannelsPage(page); + await page.goto(`${testConfig.baseURL}/${TEAM_NAME}/messages/@${BOT_USERNAME}`); + await channelsPage.toBeVisible(); + + await clickWizardButton(channelsPage, 'Are you using gitlab.com?', 'No'); + await submitDialog(page, {'Enter GitLab URL': credentials.gitlab_url}); + + await clickWizardButton(channelsPage, 'Register an OAuth Application in GitLab', 'Continue'); + + await clickWizardButton(channelsPage, 'Application ID', 'Continue'); + await submitDialog(page, { + 'Enter GitLab Instance name': INSTANCE_NAME, + 'Enter GitLab OAuth Application ID': credentials.client_id, + 'Enter GitLab OAuth Secret': credentials.client_secret, + }); + + await clickWizardButton(channelsPage, 'default GitLab instance', 'Yes'); + await expectWizardStep(channelsPage, 'Connect your GitLab account'); + } finally { + await browser.close(); + } + + const installed = await defaultInstanceName(client); + if (installed !== INSTANCE_NAME) { + throw new Error(`Expected default GitLab instance ${INSTANCE_NAME}, got ${String(installed)}`); + } +} diff --git a/e2e/playwright/support/plugin.ts b/e2e/playwright/support/plugin.ts new file mode 100644 index 00000000..03a02d64 --- /dev/null +++ b/e2e/playwright/support/plugin.ts @@ -0,0 +1,135 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {execFileSync} from 'node:child_process'; +import fs from 'node:fs'; +import path from 'node:path'; + +import './env'; + +import type {Client4} from '@mattermost/client'; +import {testConfig} from '@mattermost/playwright-lib'; + +import {ensureRegularUser, isDisposableServer, loginAdmin} from './admin'; +import {ENCRYPTION_KEY, PLUGIN_ID, TEAM_NAME, WEBHOOK_SECRET} from './constants'; +import {loadCredentials} from './credentials'; +import {GitlabApi} from './gitlab_api'; +import {installInstance} from './instance'; + +const DIST_DIR = path.resolve(__dirname, '../../../dist'); +const E2E_DIR = path.resolve(__dirname, '..'); +type PluginSettingValues = Record; + +export function findPluginBundle(): string { + const bundles = fs.existsSync(DIST_DIR) ? fs.readdirSync(DIST_DIR).filter((f) => f.startsWith(PLUGIN_ID) && f.endsWith('.tar.gz')) : []; + if (bundles.length === 0) { + throw new Error(`No plugin bundle found in ${DIST_DIR}. Run \`make dist\` from the repo root first.`); + } + + return bundles. + map((f) => path.join(DIST_DIR, f)). + sort((a, b) => fs.statSync(b).mtimeMs - fs.statSync(a).mtimeMs)[0]; +} + +export async function installPlugin(client: Client4, bundlePath: string) { + const bytes = fs.readFileSync(bundlePath); + const file = new File([bytes], path.basename(bundlePath), {type: 'application/gzip'}); + await client.uploadPlugin(file, true); +} + +export async function restartPlugin(client: Client4) { + await client.disablePlugin(PLUGIN_ID); + await client.enablePlugin(PLUGIN_ID); + await waitForPlugin(client); +} + +async function waitForPlugin(client: Client4) { + const deadline = Date.now() + 20000; + while (Date.now() < deadline) { + const plugins = await client.getPlugins(); + if (plugins.active.some((plugin) => plugin.id === PLUGIN_ID)) { + return; + } + // eslint-disable-next-line no-await-in-loop + await new Promise((resolve) => setTimeout(resolve, 500)); + } + throw new Error(`Timed out waiting for ${PLUGIN_ID} to become active`); +} + +async function patchPluginSettings(client: Client4, patch: PluginSettingValues) { + const config = await client.getConfig(); + const plugins = (config.PluginSettings.Plugins ?? {}) as Record; + plugins[PLUGIN_ID] = {...(plugins[PLUGIN_ID] ?? {}), ...patch}; + config.PluginSettings.Plugins = plugins as typeof config.PluginSettings.Plugins; + await client.updateConfig(config); +} + +// OAuth for connecting accounts comes from the instance installed by +// installInstance. The legacy client id and secret are still required: the +// plugin's configuration check rejects authenticated commands without them, and +// its GitLab API client reads gitlaburl from these settings. +export async function configurePlugin(client: Client4) { + const credentials = loadCredentials(); + await patchPluginSettings(client, { + gitlaburl: credentials.gitlab_url, + gitlaboauthclientid: credentials.client_id, + gitlaboauthclientsecret: credentials.client_secret, + encryptionkey: ENCRYPTION_KEY, + webhooksecret: WEBHOOK_SECRET, + enableprivaterepo: true, + usepreregisteredapplication: false, + }); +} + +export function bootstrapGitlab() { + execFileSync(path.join(E2E_DIR, 'scripts/ensure-hosts.sh'), {stdio: 'inherit'}); + execFileSync(path.join(E2E_DIR, 'scripts/bootstrap-gitlab.sh'), {stdio: 'inherit'}); +} + +// ensureTeam keeps a single team so the channel-header GitLab buttons render. +// Those buttons are hidden once the user belongs to more than one team. +export async function ensureTeam(client: Client4) { + const teams = await client.getMyTeams(); + if (!teams.some((team) => team.name === TEAM_NAME)) { + await client.createTeam({ + name: TEAM_NAME, + display_name: 'GitLab E2E', + type: 'O', + } as Parameters[0]); + } + + const others = (await client.getMyTeams()).filter((team) => team.name !== TEAM_NAME); + if (others.length === 0) { + return; + } + + if (!isDisposableServer() && process.env.PW_DELETE_OTHER_TEAMS !== 'true') { + throw new Error(`Refusing to delete teams ${others.map((team) => team.name).join(', ')} on ${testConfig.baseURL}. ` + + 'Leave them first, or set PW_DELETE_OTHER_TEAMS=true to allow deleting them on this non-disposable server.'); + } + await Promise.all(others.map((team) => client.deleteTeam(team.id))); +} + +async function resetGitlabState() { + const credentials = loadCredentials(); + await new GitlabApi(credentials).closeItemsInvolving(credentials.e2e_user_id); + await GitlabApi.asConnectedUser(credentials).markAllTodosDone(); +} + +export async function prepareServer() { + const {client} = await loginAdmin(); + await ensureTeam(client); + await ensureRegularUser(client); + bootstrapGitlab(); + + const bundle = findPluginBundle(); + // eslint-disable-next-line no-console + console.log(`Installing ${bundle}`); + await installPlugin(client, bundle); + await configurePlugin(client); + await restartPlugin(client); + await installInstance(); + + // Runs once every Mattermost user is disconnected, so closing old items sends no DMs. + await resetGitlabState(); +} diff --git a/e2e/playwright/support/sandbox.ts b/e2e/playwright/support/sandbox.ts new file mode 100644 index 00000000..504e4c9a --- /dev/null +++ b/e2e/playwright/support/sandbox.ts @@ -0,0 +1,42 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {loadCredentials, type GitlabCredentials} from './credentials'; +import {GitlabApi, uniquePath, type AccessLevel, type GitlabGroup, type GitlabProject} from './gitlab_api'; + +// A private group and project owned by root. The connected GitLab user joins the +// group with the given access, or not at all when access is 'none'. +export type Sandbox = { + credentials: GitlabCredentials; + root: GitlabApi; + user: GitlabApi; + group: GitlabGroup; + project: GitlabProject; + path: string; +}; + +export async function createSandbox(access: AccessLevel | 'none' = 'owner'): Promise { + const credentials = loadCredentials(); + const root = new GitlabApi(credentials); + const group = await root.createGroup(uniquePath('e2e')); + const project = await root.createProject(group.id, 'repo'); + if (access !== 'none') { + await root.addMember(group.id, credentials.e2e_user_id, access); + } + return { + credentials, + root, + user: GitlabApi.asConnectedUser(credentials), + group, + project, + path: project.path_with_namespace, + }; +} + +export async function destroySandbox(sandbox: Sandbox | undefined) { + if (!sandbox) { + return; + } + await sandbox.root.closeOpenItems(sandbox.project.id); + await sandbox.root.deleteGroup(sandbox.group.id); +} diff --git a/e2e/playwright/support/ui.ts b/e2e/playwright/support/ui.ts new file mode 100644 index 00000000..ae615353 --- /dev/null +++ b/e2e/playwright/support/ui.ts @@ -0,0 +1,113 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {ChannelsPage, ChannelsPost, expect, testConfig, type PlaywrightExtended} from '@mattermost/playwright-lib'; +import type {Page} from '@playwright/test'; + +import {loginAdmin, loginRegularUser} from './admin'; +import {GitlabRhs} from './components'; +import {BOT_USERNAME, TEAM_NAME, TOWN_SQUARE, WEBHOOK_TIMEOUT} from './constants'; +import {loadCredentials} from './credentials'; + +// Specs act as a regular member. Use {asAdmin: true} only for sysadmin-gated commands. +export async function openTownSquare(pw: PlaywrightExtended, {asAdmin = false} = {}) { + const {user} = asAdmin ? await loginAdmin() : await loginRegularUser(); + const {channelsPage} = await pw.testBrowser.login(user); + await channelsPage.goto(TEAM_NAME, TOWN_SQUARE); + await channelsPage.toBeVisible(); + return channelsPage; +} + +export async function runSlashCommand(channelsPage: ChannelsPage, command: string) { + const postCreate = channelsPage.centerView.postCreate; + await postCreate.input.fill(command); + + // Pressing Enter would pick a slash-command autocomplete suggestion. + await postCreate.sendMessageButton.click(); + await expect(postCreate.input).toHaveValue(''); +} + +function postsWithText(page: Page, ...texts: Array) { + let posts = new ChannelsPage(page).centerView.container.getByTestId('postView'); + for (const text of texts) { + posts = posts.filter({hasText: text}); + } + return posts; +} + +// The newest center-channel post containing every given fragment. +export function postWithText(page: Page, ...texts: Array) { + return new ChannelsPost(postsWithText(page, ...texts).last()); +} + +export async function expectPostWithin(page: Page, timeout: number, ...texts: Array) { + await expect(postWithText(page, ...texts).container).toBeVisible({timeout}); +} + +// Webhook deliveries are asynchronous, so allow time for GitLab to send them. +export async function expectPost(page: Page, ...texts: Array) { + await expectPostWithin(page, WEBHOOK_TIMEOUT, ...texts); +} + +export async function expectNoPost(page: Page, ...texts: Array) { + await expect(postsWithText(page, ...texts)).toHaveCount(0); +} + +// Earlier commands, and webhook posts landing in between, can leave matching posts +// on screen, so wait for one more match than before the command ran. +export async function runCommandExpecting(channelsPage: ChannelsPage, command: string, reply: string | RegExp) { + const replies = postsWithText(channelsPage.page, reply); + const before = await replies.count(); + await runSlashCommand(channelsPage, command); + await expect(replies).toHaveCount(before + 1); + return new ChannelsPost(replies.last()); +} + +export async function subscribe(channelsPage: ChannelsPage, path: string, features?: string) { + const command = features ? `/gitlab subscriptions add ${path} ${features}` : `/gitlab subscriptions add ${path}`; + await runCommandExpecting(channelsPage, command, `Successfully subscribed to ${path}`); +} + +export async function addWebhook(channelsPage: ChannelsPage, path: string) { + await runCommandExpecting(channelsPage, `/gitlab webhook add ${path}`, 'Webhook Created'); +} + +export async function safeUnsubscribe(channelsPage: ChannelsPage | undefined, path: string | undefined) { + if (!channelsPage || !path) { + return; + } + try { + await runSlashCommand(channelsPage, `/gitlab subscriptions delete ${path}`); + } catch { + // The subscription may already have been removed, or the composer may be unavailable. + } +} + +export async function openBotDirectMessage(channelsPage: ChannelsPage) { + await channelsPage.page.goto(`${testConfig.baseURL}/${TEAM_NAME}/messages/@${BOT_USERNAME}`); + await channelsPage.toBeVisible(); +} + +// Plugin post actions are listed under the post's "Message actions" button. +export async function openPostMenuAction(channelsPage: ChannelsPage, post: ChannelsPost, action: string) { + await post.hover(); + await post.postMenu.actionsButton.click(); + await channelsPage.page.getByRole('menuitem', {name: action}).click(); +} + +export async function disconnectAccount(channelsPage: ChannelsPage) { + await runCommandExpecting(channelsPage, '/gitlab disconnect', 'Disconnected your GitLab account.'); + await expect(new GitlabRhs(channelsPage).connectLink).toBeVisible(); +} + +export async function ensureConnected(pw: PlaywrightExtended) { + const channelsPage = await openTownSquare(pw); + const rhs = new GitlabRhs(channelsPage); + await rhs.open(); + const credentials = loadCredentials(); + if (!await rhs.isConnected()) { + await rhs.connect(credentials); + } + await expect(rhs.username).toHaveText(credentials.e2e_username); + return channelsPage; +} diff --git a/e2e/playwright/tests/channel_events.spec.ts b/e2e/playwright/tests/channel_events.spec.ts new file mode 100644 index 00000000..e2ed4b94 --- /dev/null +++ b/e2e/playwright/tests/channel_events.spec.ts @@ -0,0 +1,161 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {test, type ChannelsPage} from '@mattermost/playwright-lib'; + +import {uniquePath} from '../support/gitlab_api'; +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import {addWebhook, ensureConnected, expectPost, safeUnsubscribe, subscribe} from '../support/ui'; + +const ALL_CHANNEL_FEATURES = [ + 'issues', + 'merges', + 'pushes', + 'issue_comments', + 'merge_request_comments', + // issue_assigns does not exist on release-1.13 (added in #709). + 'merge_request_assigns', + 'tag', + 'releases', +].join(','); + +test.describe('channel notifications for subscribed events', () => { + let sandbox: Sandbox; + let channelsPage: ChannelsPage; + + test.beforeEach(async ({pw}) => { + sandbox = await createSandbox(); + channelsPage = await ensureConnected(pw); + await subscribe(channelsPage, sandbox.path, ALL_CHANNEL_FEATURES); + await addWebhook(channelsPage, sandbox.path); + }); + + test.afterEach(async () => { + await safeUnsubscribe(channelsPage, sandbox?.path); + await destroySandbox(sandbox); + }); + + /** + * @objective Verify every issue lifecycle event posts in a channel subscribed to the project + * + * @precondition + * Town Square is subscribed to a new project with every channel feature, and the project has a plugin webhook + */ + test('posts issue creation, labels, comments, and state changes in the subscribed channel', {tag: '@gitlab_plugin'}, async () => { + const {root, project} = sandbox; + const page = channelsPage.page; + + // # Open an issue in GitLab + const issue = await root.createIssue(project.id, `E2E lifecycle issue ${uniquePath('')}`); + + // * Verify the new issue is posted + await expectPost(page, issue.title, 'new issue by'); + + // # Label the issue + await root.createLabel(project.id, 'bug'); + await root.updateIssue(project.id, issue.iid, {labels: 'bug'}); + + // * Verify the label change is posted + await expectPost(page, issue.title, 'issue labeled bug by'); + + // Issue assignment channel posts do not exist on release-1.13 (added in #709). + + // # Comment on the issue + const comment = `Issue comment ${uniquePath('')}`; + await root.commentOnIssue(project.id, issue.iid, comment); + + // * Verify the comment is posted + await expectPost(page, 'New comment by root', comment); + + // # Close and reopen the issue + await root.closeIssue(project.id, issue.iid); + + // * Verify both state changes are posted + await expectPost(page, issue.title, 'closed by'); + await root.reopenIssue(project.id, issue.iid); + await expectPost(page, issue.title, 'reopened by'); + }); + + /** + * @objective Verify every merge request lifecycle event posts in a channel subscribed to the project + * + * @precondition + * Town Square is subscribed to a new project with every channel feature, and the project has a plugin webhook + */ + test('posts merge request creation, assignment, comments, approvals, and merges in the subscribed channel', {tag: '@gitlab_plugin'}, async () => { + const {root, user, project, credentials} = sandbox; + const page = channelsPage.page; + + // # Open a merge request in GitLab + const mergeRequest = await root.createMergeRequest(project.id, `E2E lifecycle MR ${uniquePath('')}`, {targetBranch: project.default_branch}); + + // * Verify the new merge request is posted + await expectPost(page, mergeRequest.title, 'new merge-request by'); + + // # Assign the connected user + await root.updateMergeRequest(project.id, mergeRequest.iid, {assignee_ids: [credentials.e2e_user_id]}); + + // * Verify the assignment is posted + await expectPost(page, mergeRequest.title, `was assigned to ${credentials.e2e_username}`); + + // # Comment on the merge request + const comment = `MR comment ${uniquePath('')}`; + await root.commentOnMergeRequest(project.id, mergeRequest.iid, comment); + + // * Verify the comment is posted + await expectPost(page, 'New comment by root', comment); + + // # Approve and then unapprove as the connected user + await user.approveMergeRequest(project.id, mergeRequest.iid); + + // * Verify the approval and the requested changes are posted + await expectPost(page, mergeRequest.title, `was approved by ${credentials.e2e_username}`); + await user.unapproveMergeRequest(project.id, mergeRequest.iid); + await expectPost(page, mergeRequest.title, `changes were requested by ${credentials.e2e_username}`); + + // # Close, reopen, and merge the merge request + await root.closeMergeRequest(project.id, mergeRequest.iid); + + // * Verify each state change is posted + await expectPost(page, mergeRequest.title, 'was closed by'); + await root.reopenMergeRequest(project.id, mergeRequest.iid); + await expectPost(page, mergeRequest.title, 'was reopened by'); + await root.mergeMergeRequest(project.id, mergeRequest.iid); + await expectPost(page, mergeRequest.title, 'was merged by'); + }); + + /** + * @objective Verify pushes, tag changes, and releases post in a channel subscribed to the project + * + * @precondition + * Town Square is subscribed to a new project with every channel feature, and the project has a plugin webhook + */ + test('posts pushes, tag creation and deletion, and releases in the subscribed channel', {tag: '@gitlab_plugin'}, async () => { + const {root, project, path} = sandbox; + const page = channelsPage.page; + const branch = project.default_branch; + + // # Push a commit to the default branch + const commitMessage = `E2E push ${uniquePath('')}`; + await root.commitFile(project.id, branch, `${uniquePath('push')}.md`, 'e2e', commitMessage); + + // * Verify the push is posted with its commit message + await expectPost(page, `has pushed 1 commit to ${path}`, commitMessage); + + // # Create and then delete a tag + const tag = uniquePath('v1.0.0-e2e'); + await root.createTag(project.id, tag, branch); + + // * Verify the tag creation and deletion are posted + await expectPost(page, `New tag ${tag}`); + await root.deleteTag(project.id, tag); + await expectPost(page, `${tag} Tag deleted by`); + + // # Publish a release + const releaseName = `E2E release ${uniquePath('')}`; + await root.createRelease(project.id, uniquePath('v2.0.0-e2e'), releaseName, branch); + + // * Verify the release is posted + await expectPost(page, 'Release: create', releaseName); + }); +}); diff --git a/e2e/playwright/tests/commands.spec.ts b/e2e/playwright/tests/commands.spec.ts new file mode 100644 index 00000000..aca43fdd --- /dev/null +++ b/e2e/playwright/tests/commands.spec.ts @@ -0,0 +1,115 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {test} from '@mattermost/playwright-lib'; + +import {GITLAB_URL, INSTANCE_NAME} from '../support/constants'; +import {loadCredentials} from '../support/credentials'; +import {ensureConnected, openTownSquare, runCommandExpecting} from '../support/ui'; + +const UNKNOWN_ACTION = 'Unknown action, please use /gitlab help to see all actions available.'; + +test.describe('slash commands', () => { + /** + * @objective Verify /gitlab help, about, and unknown actions reply with usage information + */ + test('shows help, build information, and the unknown action reply', {tag: '@gitlab_plugin'}, async ({pw}) => { + // # Log in as a connected member and open Town Square + const channelsPage = await ensureConnected(pw); + + // # Run /gitlab help, /gitlab about, and an unknown action + // * Verify each command replies with its help, version, or usage text + await runCommandExpecting(channelsPage, '/gitlab help', 'Mattermost GitLab Plugin - Slash Command Help'); + await runCommandExpecting(channelsPage, '/gitlab about', /GitLab version/i); + await runCommandExpecting(channelsPage, '/gitlab unknown-action', UNKNOWN_ACTION); + }); + + /** + * @objective Verify /gitlab me reports the linked GitLab account + */ + test('shows the connected GitLab profile from /gitlab me', {tag: '@gitlab_plugin'}, async ({pw}) => { + // # Log in as a connected member and open Town Square + const credentials = loadCredentials(); + const channelsPage = await ensureConnected(pw); + + // # Run /gitlab me + const profile = await runCommandExpecting(channelsPage, '/gitlab me', 'You are connected to GitLab as:'); + + // * Verify the reply names the connected GitLab user + await profile.toContainText(credentials.e2e_username); + + // On release-1.13, /gitlab connect while connected offers a new connection (fixed in #720), so it is not checked here. + }); + + /** + * @objective Verify /gitlab instance commands are limited to system admins + * + * @precondition + * The gitlab-e2e instance was installed by global setup + */ + test('restricts /gitlab instance list to system admins', {tag: '@gitlab_plugin'}, async ({pw}) => { + // # Run /gitlab instance list as a regular member + const memberPage = await ensureConnected(pw); + + // * Verify the member is refused + await runCommandExpecting(memberPage, '/gitlab instance list', 'Only System Admins are allowed to manage instances.'); + + // # Run /gitlab instance list as the sysadmin + const adminPage = await openTownSquare(pw, {asAdmin: true}); + const instances = await runCommandExpecting(adminPage, '/gitlab instance list', 'Installed GitLab Instances'); + + // * Verify the installed instance and its URL are listed + await instances.toContainText(INSTANCE_NAME); + await instances.toContainText(GITLAB_URL); + }); + + /** + * @objective Verify /gitlab settings toggles reminders and notifications and rejects invalid input + */ + test('updates personal settings and rejects invalid values', {tag: '@gitlab_plugin'}, async ({pw}) => { + // # Log in as a connected member and open Town Square + const channelsPage = await ensureConnected(pw); + + // # Toggle reminders and notifications off and on + // * Verify each change is confirmed (release-1.13 does not echo the setting name and value, added in #721) + await runCommandExpecting(channelsPage, '/gitlab settings reminders off', 'Settings updated.'); + await runCommandExpecting(channelsPage, '/gitlab settings reminders on', 'Settings updated.'); + await runCommandExpecting(channelsPage, '/gitlab settings notifications off', 'Settings updated.'); + await runCommandExpecting(channelsPage, '/gitlab settings notifications on', 'Settings updated.'); + + // # Run /gitlab settings with an invalid value, an unknown setting, and no arguments + // * Verify each is rejected with a usage error + await runCommandExpecting(channelsPage, '/gitlab settings notifications maybe', 'Invalid value. Accepted values are: "on" or "off".'); + await runCommandExpecting(channelsPage, '/gitlab settings colors on', 'Unknown setting.'); + await runCommandExpecting(channelsPage, '/gitlab settings', 'Please specify both a setting and value.'); + }); + + /** + * @objective Verify /gitlab todo replies with the to-do summary sections + */ + test('lists the to-do summary from /gitlab todo', {tag: '@gitlab_plugin'}, async ({pw}) => { + // # Log in as a connected member and run /gitlab todo + const channelsPage = await ensureConnected(pw); + const summary = await runCommandExpecting(channelsPage, '/gitlab todo', 'To-Do list'); + + // * Verify the summary includes the review and assigned merge request sections + await summary.toContainText('Review Requests'); + await summary.toContainText('Merge Requests Assigned'); + }); + + /** + * @objective Verify incomplete pipeline, webhook, and issue commands reply with usage errors + */ + test('reports usage errors for incomplete pipeline, webhook, and issue commands', {tag: '@gitlab_plugin'}, async ({pw}) => { + // # Log in as a connected member and open Town Square + const channelsPage = await ensureConnected(pw); + + // # Run pipeline, webhook, and issue commands with missing or unsupported arguments + // * Verify each replies with its usage error + await runCommandExpecting(channelsPage, '/gitlab pipelines', 'Invalid pipelines command. Available commands are run, list'); + await runCommandExpecting(channelsPage, '/gitlab pipelines run e2e-missing/repo', 'Please specify a repository and a branch.'); + await runCommandExpecting(channelsPage, '/gitlab webhook add', UNKNOWN_ACTION); + await runCommandExpecting(channelsPage, '/gitlab issue', "Invalid issue command. Available command is 'create'."); + await runCommandExpecting(channelsPage, '/gitlab issue close', 'This command is not implemented yet. Command: close'); + }); +}); diff --git a/e2e/playwright/tests/connect.spec.ts b/e2e/playwright/tests/connect.spec.ts new file mode 100644 index 00000000..b471d327 --- /dev/null +++ b/e2e/playwright/tests/connect.spec.ts @@ -0,0 +1,52 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, test} from '@mattermost/playwright-lib'; + +import {GitlabRhs} from '../support/components'; +import {loadCredentials} from '../support/credentials'; +import {disconnectAccount, ensureConnected, openTownSquare, runCommandExpecting} from '../support/ui'; + +/** + * @objective Verify a regular member can link their GitLab account through the OAuth popup + * + * @precondition + * The GitLab OAuth application is marked trusted, so GitLab skips the consent screen + */ +test('connects a regular member to GitLab through the OAuth popup in the subscriptions sidebar', {tag: '@gitlab_plugin'}, async ({pw}) => { + // # Log in as a regular member and open the GitLab subscriptions sidebar + const credentials = loadCredentials(); + const channelsPage = await openTownSquare(pw); + const rhs = new GitlabRhs(channelsPage); + await rhs.open(); + + // # Disconnect first if an earlier run left the member connected + if (await rhs.isConnected()) { + await disconnectAccount(channelsPage); + } + + // # Connect through the GitLab sign-in popup + await rhs.connect(credentials); + + // * Verify the sidebar shows the connected GitLab username + await expect(rhs.username).toHaveText(credentials.e2e_username); +}); + +/** + * @objective Verify /gitlab disconnect unlinks the member's GitLab account + * + * @precondition + * The member is connected to GitLab + */ +test('disconnects the member with the /gitlab disconnect command', {tag: '@gitlab_plugin'}, async ({pw}) => { + // # Log in as a connected member and open the GitLab subscriptions sidebar + const channelsPage = await ensureConnected(pw); + + // # Disconnect through the slash command + // * Verify the sidebar offers to connect (checked inside disconnectAccount) + await disconnectAccount(channelsPage); + + // * Verify /gitlab me reports the account is no longer linked + // Later specs reconnect through ensureConnected, so no reconnect is needed here. + await runCommandExpecting(channelsPage, '/gitlab me', 'You must connect your account to GitLab first'); +}); diff --git a/e2e/playwright/tests/dm_notifications.spec.ts b/e2e/playwright/tests/dm_notifications.spec.ts new file mode 100644 index 00000000..b115e8a5 --- /dev/null +++ b/e2e/playwright/tests/dm_notifications.spec.ts @@ -0,0 +1,156 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {test, type ChannelsPage} from '@mattermost/playwright-lib'; + +import {uniquePath} from '../support/gitlab_api'; +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import { + addWebhook, + ensureConnected, + expectNoPost, + expectPost, + openBotDirectMessage, + runCommandExpecting, + safeUnsubscribe, + subscribe, +} from '../support/ui'; + +// Root acts in GitLab, and the connected user receives the bot DMs. DMs do not +// depend on channel subscriptions, only on the project webhook. +test.describe('direct message notifications', () => { + let sandbox: Sandbox; + let channelsPage: ChannelsPage; + + test.beforeEach(async ({pw}) => { + sandbox = await createSandbox(); + channelsPage = await ensureConnected(pw); + await addWebhook(channelsPage, sandbox.path); + await openBotDirectMessage(channelsPage); + }); + + test.afterEach(async () => { + await safeUnsubscribe(channelsPage, sandbox?.path); + await destroySandbox(sandbox); + }); + + /** + * @objective Verify the GitLab bot DMs the connected user about activity on issues they are assigned to or mentioned in + * + * @precondition + * A new project has a plugin webhook, and the member is viewing their DM with the GitLab bot + */ + test('DMs the connected user about issue assignment, comments, mentions, and state changes', {tag: '@gitlab_plugin'}, async () => { + const {root, project, path, credentials} = sandbox; + const page = channelsPage.page; + const reference = (iid: number) => `${path}#${iid}`; + + // # Open an issue assigned to the connected user + const issue = await root.createIssue(project.id, `E2E DM issue ${uniquePath('')}`, {assigneeIds: [credentials.e2e_user_id]}); + + // * Verify the assignment DM arrives + await expectPost(page, `assigned you to issue ${reference(issue.iid)}`); + + // # Comment on the assigned issue + await root.commentOnIssue(project.id, issue.iid, 'Plain follow-up'); + + // * Verify the comment DM arrives + await expectPost(page, `commented on your issue ${reference(issue.iid)}`); + + // # Mention the user on an issue they are not assigned to + // A user gets one DM per webhook event, so an assignee who is also mentioned only hears about the comment. + const other = await root.createIssue(project.id, `E2E DM mention ${uniquePath('')}`); + const mention = `ping ${uniquePath('')}`; + await root.commentOnIssue(project.id, other.iid, `@${credentials.e2e_username} ${mention}`); + + // * Verify the mention DM arrives + await expectPost(page, `mentioned you on ${reference(other.iid)}`, mention); + + // # Close and reopen the assigned issue + // The unassignment DM does not exist on release-1.13 (added in #709). + await root.closeIssue(project.id, issue.iid); + + // * Verify a DM arrives for each change + await expectPost(page, `closed your issue ${reference(issue.iid)}`); + await root.reopenIssue(project.id, issue.iid); + await expectPost(page, `reopened your issue ${reference(issue.iid)}`); + }); + + /** + * @objective Verify the GitLab bot DMs the connected user about review requests and activity on their merge requests + * + * @precondition + * A new project has a plugin webhook, and the member is viewing their DM with the GitLab bot + */ + test('DMs the connected user about merge request reviews, comments, approvals, and merges', {tag: '@gitlab_plugin'}, async () => { + const {root, user, project, path, credentials} = sandbox; + const page = channelsPage.page; + + // # Open a merge request assigned to the connected user + const assigned = await root.createMergeRequest(project.id, `E2E DM review ${uniquePath('')}`, { + targetBranch: project.default_branch, + assigneeIds: [credentials.e2e_user_id], + }); + + // * Verify the assignment DM arrives + await expectPost(page, `requested your review on #${assigned.iid} in ${path}`); + + // # Add the connected user as a reviewer + await root.updateMergeRequest(project.id, assigned.iid, {reviewer_ids: [credentials.e2e_user_id]}); + + // * Verify the review request DM arrives + await expectPost(page, `requested your review on merge request #${assigned.iid} in ${path}`); + + // # Comment on and close the merge request + await root.commentOnMergeRequest(project.id, assigned.iid, 'Looks good'); + + // * Verify the comment and close DMs arrive + await expectPost(page, `commented on your merge request ${path}#${assigned.iid}`); + await root.closeMergeRequest(project.id, assigned.iid); + await expectPost(page, `closed your merge request #${assigned.iid} in ${path}`); + + // # Approve and merge a merge request authored by the connected user + const authored = await user.createMergeRequest(project.id, `E2E DM authored ${uniquePath('')}`, {targetBranch: project.default_branch}); + await root.approveMergeRequest(project.id, authored.iid); + + // * Verify the approval and merge DMs arrive + await expectPost(page, `approved your merge request #${authored.iid} in ${path}`); + await root.mergeMergeRequest(project.id, authored.iid); + await expectPost(page, `merged your merge request #${authored.iid} in ${path}`); + }); + + /** + * @objective Verify turning notifications off stops mention DMs until they are turned back on + * + * @precondition + * A new project has a plugin webhook, and the member is viewing their DM with the GitLab bot + */ + test('stops sending mention DMs while notifications are turned off', {tag: '@gitlab_plugin'}, async () => { + const {root, project, path, credentials} = sandbox; + const page = channelsPage.page; + const issue = await root.createIssue(project.id, `E2E muted ${uniquePath('')}`); + const muted = `muted ${uniquePath('')}`; + const heard = `heard ${uniquePath('')}`; + + // # Subscribe the DM channel to issue comments, so a channel post shows each comment webhook was handled + await subscribe(channelsPage, path, 'issue_comments'); + try { + // # Turn notifications off and mention the user + await runCommandExpecting(channelsPage, '/gitlab settings notifications off', 'Settings updated.'); + await root.commentOnIssue(project.id, issue.iid, `@${credentials.e2e_username} ${muted}`); + + // * Verify the comment webhook was handled + await expectPost(page, 'New comment by root', muted); + } finally { + // # Turn notifications back on + await runCommandExpecting(channelsPage, '/gitlab settings notifications on', 'Settings updated.'); + } + + // # Mention the user again + await root.commentOnIssue(project.id, issue.iid, `@${credentials.e2e_username} ${heard}`); + + // * Verify only the mention made after notifications were turned on is DMed + await expectPost(page, 'mentioned you on', heard); + await expectNoPost(page, 'mentioned you on', muted); + }); +}); diff --git a/e2e/playwright/tests/feature_filters.spec.ts b/e2e/playwright/tests/feature_filters.spec.ts new file mode 100644 index 00000000..8624e561 --- /dev/null +++ b/e2e/playwright/tests/feature_filters.spec.ts @@ -0,0 +1,100 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {test, type ChannelsPage} from '@mattermost/playwright-lib'; + +import {uniquePath} from '../support/gitlab_api'; +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import {addWebhook, ensureConnected, expectNoPost, expectPost, safeUnsubscribe, subscribe} from '../support/ui'; + +// GitLab does not guarantee webhook order, so each negative check is made only +// after a later event that does reach the channel has been posted. +test.describe('subscription feature filters', () => { + let sandbox: Sandbox; + let channelsPage: ChannelsPage; + + test.beforeEach(async ({pw}) => { + sandbox = await createSandbox(); + channelsPage = await ensureConnected(pw); + await addWebhook(channelsPage, sandbox.path); + }); + + test.afterEach(async () => { + await safeUnsubscribe(channelsPage, sandbox?.path); + await destroySandbox(sandbox); + }); + + /** + * @objective Verify a label filter limits issue posts to issues carrying that label + * + * @precondition + * A new project has a plugin webhook + */ + test('posts only issues carrying the subscribed label', {tag: '@gitlab_plugin'}, async () => { + const {root, project, path} = sandbox; + + // # Subscribe to issues labeled "bug" + await subscribe(channelsPage, path, 'issues,label:"bug"'); + await root.createLabel(project.id, 'bug'); + + // # Open one unlabeled and one labeled issue + const unlabeled = await root.createIssue(project.id, `E2E unlabeled ${uniquePath('')}`); + const labeled = await root.createIssue(project.id, `E2E labeled ${uniquePath('')}`, {labels: ['bug']}); + + // * Verify only the labeled issue is posted + await expectPost(channelsPage.page, labeled.title, 'new issue by'); + await expectNoPost(channelsPage.page, unlabeled.title); + }); + + // The issue_assigns-only test is omitted: the feature does not exist on release-1.13 (added in #709). + + /** + * @objective Verify an issues subscription skips merge request and push events + * + * @precondition + * A new project has a plugin webhook + */ + test('skips merge requests and pushes when only issues are subscribed', {tag: '@gitlab_plugin'}, async () => { + const {root, project, path} = sandbox; + + // # Subscribe to issues only + await subscribe(channelsPage, path, 'issues'); + + // # Open a merge request and then an issue + const mergeRequest = await root.createMergeRequest(project.id, `E2E unsubscribed MR ${uniquePath('')}`, {targetBranch: project.default_branch}); + const issue = await root.createIssue(project.id, `E2E subscribed issue ${uniquePath('')}`); + + // * Verify only the issue is posted + await expectPost(channelsPage.page, issue.title, 'new issue by'); + await expectNoPost(channelsPage.page, mergeRequest.title); + await expectNoPost(channelsPage.page, `has pushed 1 commit to ${path}`); + }); + + /** + * @objective Verify confidential issues post only when the subscription includes confidential_issues + * + * @precondition + * A new project has a plugin webhook + */ + test('posts confidential issues only when confidential_issues is subscribed', {tag: '@gitlab_plugin'}, async () => { + const {root, project, path} = sandbox; + + // # Subscribe to issues without confidential issues + await subscribe(channelsPage, path, 'issues'); + + // # Open a confidential issue and then a public one + const hidden = await root.createIssue(project.id, `E2E hidden confidential ${uniquePath('')}`, {confidential: true}); + const visible = await root.createIssue(project.id, `E2E public ${uniquePath('')}`); + + // * Verify only the public issue is posted + await expectPost(channelsPage.page, visible.title, 'new issue by'); + await expectNoPost(channelsPage.page, hidden.title); + + // # Add confidential issues to the subscription and open another confidential issue + await subscribe(channelsPage, path, 'issues,confidential_issues'); + const shown = await root.createIssue(project.id, `E2E shown confidential ${uniquePath('')}`, {confidential: true}); + + // * Verify the confidential issue is posted + await expectPost(channelsPage.page, shown.title, 'new issue by'); + }); +}); diff --git a/e2e/playwright/tests/notifications.spec.ts b/e2e/playwright/tests/notifications.spec.ts new file mode 100644 index 00000000..fee43397 --- /dev/null +++ b/e2e/playwright/tests/notifications.spec.ts @@ -0,0 +1,111 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, test, type ChannelsPage} from '@mattermost/playwright-lib'; + +import {GitlabSidebar} from '../support/components'; +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import type {GitlabIssue, GitlabMergeRequest} from '../support/gitlab_api'; +import {addWebhook, ensureConnected, expectPost, safeUnsubscribe, subscribe} from '../support/ui'; + +const COUNT_TIMEOUT = 20000; + +test.describe('subscription notifications', () => { + let sandbox: Sandbox | undefined; + let channelsPage: ChannelsPage | undefined; + let subscriptionPath = ''; + + test.afterEach(async () => { + await safeUnsubscribe(channelsPage, subscriptionPath); + await destroySandbox(sandbox); + sandbox = undefined; + channelsPage = undefined; + }); + + /** + * @objective Verify a project subscription posts project events and the sidebar lists only the items assigned to the connected user + */ + test('posts project events and lists the connected user\'s issues and merge requests in the sidebar', {tag: '@gitlab_plugin'}, async ({pw}) => { + sandbox = await createSandbox(); + const {root, project, credentials, path} = sandbox; + subscriptionPath = path; + + // # Subscribe Town Square to a new project and add the plugin webhook + channelsPage = await ensureConnected(pw); + await subscribe(channelsPage, path); + await addWebhook(channelsPage, path); + + // # Open an issue for the connected user, an issue for root, and a merge request for the connected user + const mine = await root.createIssue(project.id, `E2E issue ${path}`, {assigneeIds: [credentials.e2e_user_id]}); + const others = await root.createIssue(project.id, `E2E root issue ${path}`, {assigneeIds: [credentials.root_user_id]}); + const mergeRequest = await root.createMergeRequest(project.id, `E2E merge request ${path}`, { + targetBranch: project.default_branch, + assigneeIds: [credentials.e2e_user_id], + }); + + // * Verify each item is posted in the channel + await expectPost(channelsPage.page, mine.title); + await expectPost(channelsPage.page, others.title); + await expectPost(channelsPage.page, mergeRequest.title); + + // * Verify the sidebar lists only the connected user's items + await expectSidebarLists(channelsPage, mine, others, mergeRequest); + }); + + /** + * @objective Verify a group subscription posts events from a project in that group + * + * @precondition + * GitLab Community Edition has no group webhooks, so the project in the group gets a project webhook + */ + test('posts events from a project covered by a group subscription', {tag: '@gitlab_plugin'}, async ({pw}) => { + sandbox = await createSandbox(); + const {root, project, credentials, group, path} = sandbox; + subscriptionPath = group.path; + + // # Subscribe Town Square to the group and add a webhook to the project in it + channelsPage = await ensureConnected(pw); + await subscribe(channelsPage, group.path); + await addWebhook(channelsPage, path); + + // # Open an issue for the connected user, an issue for root, and a merge request for the connected user + const mine = await root.createIssue(project.id, `E2E group issue ${path}`, {assigneeIds: [credentials.e2e_user_id]}); + const others = await root.createIssue(project.id, `E2E group root issue ${path}`, {assigneeIds: [credentials.root_user_id]}); + const mergeRequest = await root.createMergeRequest(project.id, `E2E group merge request ${path}`, { + targetBranch: project.default_branch, + assigneeIds: [credentials.e2e_user_id], + }); + + // * Verify each item is posted in the channel + await expectPost(channelsPage.page, mine.title); + await expectPost(channelsPage.page, others.title); + await expectPost(channelsPage.page, mergeRequest.title); + + // * Verify the sidebar lists only the connected user's items + await expectSidebarLists(channelsPage, mine, others, mergeRequest); + }); +}); + +async function expectSidebarLists(channelsPage: ChannelsPage, mine: GitlabIssue, others: GitlabIssue, mergeRequest: GitlabMergeRequest) { + const sidebar = new GitlabSidebar(channelsPage); + + // # Refresh the GitLab sidebar counts + await sidebar.refresh(); + + // * Verify one issue and one merge request are counted + await expect(sidebar.count('issues')).toHaveText('1', {timeout: COUNT_TIMEOUT}); + await expect(sidebar.count('mergeRequests')).toHaveText('1', {timeout: COUNT_TIMEOUT}); + + // # Open the issues list + await sidebar.openList('issues'); + + // * Verify it lists the connected user's issue and not root's + await expect(sidebar.itemTitle(mine.id)).toHaveText(mine.title); + await expect(sidebar.item(others.id)).toHaveCount(0); + + // # Open the assigned merge requests list + await sidebar.openList('mergeRequests'); + + // * Verify it lists the connected user's merge request + await expect(sidebar.itemTitle(mergeRequest.id)).toHaveText(mergeRequest.title); +} diff --git a/e2e/playwright/tests/permalinks.spec.ts b/e2e/playwright/tests/permalinks.spec.ts new file mode 100644 index 00000000..0ca139dd --- /dev/null +++ b/e2e/playwright/tests/permalinks.spec.ts @@ -0,0 +1,54 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, test} from '@mattermost/playwright-lib'; + +import {uniquePath} from '../support/gitlab_api'; +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import {ensureConnected, postWithText} from '../support/ui'; + +// The code-preview feature (MessageWillBePosted) expands GitLab blob permalinks in a +// post into an inline code block. It cannot run against this stack as the plugin ships: +// - gitlabPermalinkRegex in server/plugin.go only matches the literal host +// "gitlab.com", so a self-hosted gitlab.test permalink is never recognized. +// - EnableCodePreview defaults to "public", which skips private projects, and the +// sandbox projects are private. +// The first is a product bug, to be tracked in a separate ticket: code previews never +// work for self-hosted GitLab. The test is kept as fixme to document the intended +// behavior. Enabling it needs that fix plus a public project or EnableCodePreview +// relaxed for the run. +test.describe('code preview permalinks', () => { + let sandbox: Sandbox; + + test.beforeEach(async () => { + sandbox = await createSandbox(); + }); + + test.afterEach(async () => { + await destroySandbox(sandbox); + }); + + /** + * @objective Verify a GitLab blob permalink in a post is expanded into an inline code preview + * + * @precondition + * A new project the connected user owns has a file to preview + */ + test.fixme('expands a GitLab blob permalink into a code preview', {tag: '@gitlab_plugin'}, async ({pw}) => { + const {root, project} = sandbox; + const branch = project.default_branch; + const fileName = `${uniquePath('preview')}.md`; + const previewLine = `preview line ${uniquePath('')}`; + + // # Commit a file whose contents the preview should show + await root.commitFile(project.id, branch, fileName, `${previewLine}\nsecond line\n`, 'Add preview file'); + + // # Post a blob permalink pointing at the first line of the file + const channelsPage = await ensureConnected(pw); + const permalink = `${project.web_url}/-/blob/${branch}/${fileName}#L1`; + await channelsPage.centerView.postMessage(permalink); + + // * Verify the post is replaced with a code preview of the referenced line + await expect(postWithText(channelsPage.page, previewLine).container).toBeVisible(); + }); +}); diff --git a/e2e/playwright/tests/pipelines.spec.ts b/e2e/playwright/tests/pipelines.spec.ts new file mode 100644 index 00000000..87da724f --- /dev/null +++ b/e2e/playwright/tests/pipelines.spec.ts @@ -0,0 +1,127 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {test, type ChannelsPage} from '@mattermost/playwright-lib'; + +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import { + addWebhook, + ensureConnected, + expectPostWithin, + openBotDirectMessage, + runCommandExpecting, + safeUnsubscribe, + subscribe, +} from '../support/ui'; + +const FAILING_BRANCH = 'failing'; + +// Runs on the gitlab-runner service. The build job fails on FAILING_BRANCH, and +// the deploy job creates a deployment to the production environment. +const CI_CONFIG = `stages: [build, deploy] +build: + stage: build + script: + - test "$CI_COMMIT_REF_NAME" != "${FAILING_BRANCH}" +deploy: + stage: deploy + script: + - echo deploying + environment: production +`; + +const PIPELINE_TIMEOUT = 150000; + +test.describe('pipelines', () => { + let sandbox: Sandbox; + let channelsPage: ChannelsPage; + + test.beforeEach(async ({pw}) => { + test.setTimeout(6 * 60 * 1000); + sandbox = await createSandbox(); + channelsPage = await ensureConnected(pw); + await addWebhook(channelsPage, sandbox.path); + }); + + test.afterEach(async () => { + await safeUnsubscribe(channelsPage, sandbox?.path); + await destroySandbox(sandbox); + }); + + /** + * @objective Verify /gitlab pipelines run starts pipelines, and a subscribed channel gets pipeline, job, and deployment posts + * + * @precondition + * The gitlab-runner service is registered, and a new project has a plugin webhook + */ + test('runs pipelines from /gitlab pipelines run and posts pipeline, job, and deployment events', {tag: '@gitlab_plugin'}, async () => { + const {project, path, credentials} = sandbox; + const branch = project.default_branch; + const username = credentials.e2e_username; + + // # Run a pipeline before the project has CI configuration + // * Verify the command reports the pipeline could not run + await runCommandExpecting(channelsPage, `/gitlab pipelines run ${path} ${branch}`, 'failed to run pipeline for Project'); + + // # Add CI configuration and run a pipeline without a pipeline subscription + await addCiConfig(sandbox); + const unsubscribedReply = await runPipeline(channelsPage, path, branch); + + // * Verify the reply warns the channel is not subscribed to pipeline events + await unsubscribedReply.toContainText('This channel is currently not subscribed to pipeline event'); + + // # Subscribe to pipeline, job, and deployment events and run a pipeline + await subscribe(channelsPage, path, 'pipeline,jobs,deployments'); + const subscribedReply = await runPipeline(channelsPage, path, branch); + + // * Verify the reply no longer warns and the successful run is posted + await subscribedReply.toNotContainText('not subscribed to pipeline event'); + await expectPipelinePost(channelsPage, 'New pipeline from', `by ${username}`); + await expectPipelinePost(channelsPage, 'Pipeline Job Stage: build', 'Status: success'); + await expectPipelinePost(channelsPage, 'Deployment Stage: success'); + await expectPipelinePost(channelsPage, `Pipeline by ${username} success for`, 'Add CI configuration'); + + // # Run a pipeline on the branch whose build fails + await runPipeline(channelsPage, path, FAILING_BRANCH); + + // * Verify the failed job and pipeline are posted + await expectPipelinePost(channelsPage, 'Pipeline Job Stage: build', 'Status: failed'); + await expectPipelinePost(channelsPage, `Pipeline by ${username} fail for`); + }); + + /** + * @objective Verify the pipeline author gets a DM from the GitLab bot when their pipeline fails + * + * @precondition + * The gitlab-runner service is registered, and a new project has a plugin webhook + */ + // The plugin sends the event sender a refresh before dispatching DMs and then + // skips users who already got a refresh, so the sender never receives this DM. + // https://mattermost.atlassian.net/browse/MM-71329 + test.fixme('DMs the pipeline author when their pipeline fails', {tag: '@gitlab_plugin'}, async () => { + const {path} = sandbox; + + // # Add CI configuration and run a pipeline on the branch whose build fails + await addCiConfig(sandbox); + await runPipeline(channelsPage, path, FAILING_BRANCH); + + // # Open the DM with the GitLab bot + await openBotDirectMessage(channelsPage); + + // * Verify the failed-pipeline DM arrives + await expectPipelinePost(channelsPage, `${path} Your pipeline has failed for`); + }); +}); + +async function runPipeline(channelsPage: ChannelsPage, path: string, ref: string) { + return runCommandExpecting(channelsPage, `/gitlab pipelines run ${path} ${ref}`, 'Pipeline info'); +} + +async function addCiConfig({root, project}: Sandbox) { + await root.commitFile(project.id, project.default_branch, '.gitlab-ci.yml', CI_CONFIG, 'Add CI configuration'); + await root.createBranch(project.id, FAILING_BRANCH, project.default_branch); +} + +async function expectPipelinePost(channelsPage: ChannelsPage, ...texts: string[]) { + await expectPostWithin(channelsPage.page, PIPELINE_TIMEOUT, ...texts); +} diff --git a/e2e/playwright/tests/post_actions.spec.ts b/e2e/playwright/tests/post_actions.spec.ts new file mode 100644 index 00000000..24745ae8 --- /dev/null +++ b/e2e/playwright/tests/post_actions.spec.ts @@ -0,0 +1,176 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, test} from '@mattermost/playwright-lib'; + +import {AttachCommentModal, CreateIssueModal} from '../support/components'; +import {uniquePath} from '../support/gitlab_api'; +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import {ensureConnected, openPostMenuAction, runSlashCommand} from '../support/ui'; + +const GITLAB_TIMEOUT = 20000; + +test.describe('post menu actions and the issue modal', () => { + let sandbox: Sandbox; + + test.beforeEach(async () => { + sandbox = await createSandbox(); + }); + + test.afterEach(async () => { + await destroySandbox(sandbox); + }); + + /** + * @objective Verify "Create GitLab Issue" in the post menu creates an issue whose description is the post message + */ + test('creates a GitLab issue from the post menu with the post as its description', {tag: '@gitlab_plugin'}, async ({pw}) => { + const {root, project, path} = sandbox; + const message = `Create an issue from this post ${uniquePath('')}`; + const title = `E2E issue from post ${uniquePath('')}`; + + // # Post a message as a connected member + const channelsPage = await ensureConnected(pw); + await channelsPage.centerView.postMessage(message); + const post = await channelsPage.centerView.getLastPost(); + await post.toContainText(message); + + // # Open "Create GitLab Issue" from the post menu + // With more than 100 projects the selector filters whatever list it has when typing + // starts, so the project list must finish loading first. + const projectsLoaded = channelsPage.page.waitForResponse((response) => response.url().endsWith('/api/v1/projects') && response.ok()); + await openPostMenuAction(channelsPage, post, 'Create GitLab Issue'); + const modal = new CreateIssueModal(channelsPage.page); + + // * Verify the description is prefilled with the post message + await expect(modal.description).toHaveValue(message); + await projectsLoaded; + + // # Pick the project, enter a title, and submit + await modal.selectProject(path); + await modal.title.fill(title); + await modal.submit(); + + // * Verify the modal closes and GitLab has the issue with the post in its description + await modal.toBeHidden(); + await expect.poll(async () => { + const issue = (await root.listIssues(project.id)).find((candidate) => candidate.title === title); + return issue?.description ?? ''; + }, {timeout: GITLAB_TIMEOUT}).toContain(message); + }); + + /** + * @objective Verify "Attach to GitLab Issue" in the post menu adds the post message as a comment on the chosen issue + */ + test('attaches a post to an existing GitLab issue from the post menu', {tag: '@gitlab_plugin'}, async ({pw}) => { + const {root, project} = sandbox; + const issue = await root.createIssue(project.id, `E2E attach target ${uniquePath('')}`); + const message = `Attach this post ${uniquePath('')}`; + + // # Post a message as a connected member + const channelsPage = await ensureConnected(pw); + await channelsPage.centerView.postMessage(message); + const post = await channelsPage.centerView.getLastPost(); + await post.toContainText(message); + + // # Open "Attach to GitLab Issue" from the post menu + await openPostMenuAction(channelsPage, post, 'Attach to GitLab Issue'); + const modal = new AttachCommentModal(channelsPage.page); + + // * Verify the message is prefilled with the post + await expect(modal.message).toHaveValue(message); + + // # Pick the issue and attach the post + await modal.selectIssue(issue.title); + await modal.attach(); + + // * Verify the modal closes and the issue has a comment with the post + await modal.toBeHidden(); + await expect.poll(async () => { + const comments = await root.listIssueComments(project.id, issue.iid); + return comments.filter((comment) => !comment.system).map((comment) => comment.body).join('\n'); + }, {timeout: GITLAB_TIMEOUT}).toContain(message); + }); + + /** + * @objective Verify the issue modal applies a selected label, assignee, and milestone to the created GitLab issue + * + * @precondition + * A new project the connected user owns has a label, a similarly named decoy label, and a milestone + */ + test('creates a GitLab issue with a label, assignee, and milestone chosen in the modal', {tag: '@gitlab_plugin'}, async ({pw}) => { + const {root, project, group, path, credentials} = sandbox; + const milestone = `v1.0-${uniquePath('')}`; + const title = `E2E issue with attributes ${uniquePath('')}`; + await root.createLabel(project.id, 'bug'); + + // A decoy that contains the typed text and sorts first, so picking bug must not take it. + await root.createLabel(project.id, 'a-bug'); + await root.createGroupMilestone(group.id, milestone); + + // # Open the issue modal from /gitlab issue create + const channelsPage = await ensureConnected(pw); + const projectsLoaded = channelsPage.page.waitForResponse((response) => response.url().endsWith('/api/v1/projects') && response.ok()); + await runSlashCommand(channelsPage, `/gitlab issue create ${title}`); + const modal = new CreateIssueModal(channelsPage.page); + await expect(modal.title).toHaveValue(title); + + // # Pick the project, then its label, assignee, and milestone + await projectsLoaded; + await modal.selectProject(path); + await modal.selectLabel('bug'); + await modal.selectAssignee(credentials.e2e_username); + await modal.selectMilestone(milestone); + + // * Verify all picks are reflected in the modal, then submit + // Submitting immediately after the last keyboard pick can outrun the + // react-select state update, so wait until every pick is shown. + await modal.expectSelections('bug', credentials.e2e_username, milestone); + await modal.submit(); + + // * Verify the modal closes and GitLab has the issue with the chosen attributes + await modal.toBeHidden(); + await expect.poll(async () => { + const issue = await root.findIssue(project.id, title); + if (!issue) { + return undefined; + } + return { + labels: issue.labels, + assignees: issue.assignees.map((assignee) => assignee.username), + milestone: issue.milestone?.title, + }; + }, {timeout: GITLAB_TIMEOUT}).toEqual({ + labels: ['bug'], + assignees: [credentials.e2e_username], + milestone, + }); + }); + + /** + * @objective Verify /gitlab issue create opens the issue modal with the given title and requires a project + */ + test('opens the issue modal from /gitlab issue create with the title prefilled', {tag: '@gitlab_plugin'}, async ({pw}) => { + const title = `E2E modal title ${uniquePath('')}`; + + // # Run /gitlab issue create with a title + const channelsPage = await ensureConnected(pw); + await runSlashCommand(channelsPage, `/gitlab issue create ${title}`); + const modal = new CreateIssueModal(channelsPage.page); + + // * Verify the modal opens with the title prefilled + await expect(modal.title).toHaveValue(title); + + // # Submit without picking a project + await modal.submit(); + + // * Verify the modal stays open + await modal.toBeVisible(); + + // # Close the modal + await modal.close(); + + // * Verify the modal closes + await modal.toBeHidden(); + }); +}); diff --git a/e2e/playwright/tests/sidebar.spec.ts b/e2e/playwright/tests/sidebar.spec.ts new file mode 100644 index 00000000..7b8ea57a --- /dev/null +++ b/e2e/playwright/tests/sidebar.spec.ts @@ -0,0 +1,95 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, test} from '@mattermost/playwright-lib'; + +import {GitlabSidebar} from '../support/components'; +import {uniquePath, type GitlabTodo} from '../support/gitlab_api'; +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import {ensureConnected} from '../support/ui'; + +const EXPECTED_TODOS = 2; +const COUNT_TIMEOUT = 20000; +const TODO_POLL_TIMEOUT = 30000; + +test.describe('sidebar review and to-do lists', () => { + let sandbox: Sandbox; + + test.beforeEach(async () => { + sandbox = await createSandbox(); + await sandbox.user.markAllTodosDone(); + }); + + test.afterEach(async () => { + await sandbox?.user.markAllTodosDone(); + await destroySandbox(sandbox); + }); + + /** + * @objective Verify the sidebar counts and lists merge requests needing review and pending to-dos, and clears them once done + * + * @precondition + * The connected GitLab user starts with no pending to-dos + */ + test('lists merge requests needing review and pending to-dos in the GitLab sidebar', {tag: '@gitlab_plugin'}, async ({pw}) => { + const {root, user, project, credentials} = sandbox; + + // # Request the connected user's review on a merge request and assign them an issue + const review = await root.createMergeRequest(project.id, `E2E needs review ${uniquePath('')}`, { + targetBranch: project.default_branch, + reviewerIds: [credentials.e2e_user_id], + }); + const issue = await root.createIssue(project.id, `E2E todo issue ${uniquePath('')}`, {assigneeIds: [credentials.e2e_user_id]}); + const todos = await waitForTodos(sandbox); + + // # Log in and refresh the GitLab sidebar counts + const channelsPage = await ensureConnected(pw); + const sidebar = new GitlabSidebar(channelsPage); + await sidebar.refresh(); + + // * Verify one review and both to-dos are counted + await expect(sidebar.count('reviews')).toHaveText('1', {timeout: COUNT_TIMEOUT}); + await expect(sidebar.count('todos')).toHaveText(String(EXPECTED_TODOS), {timeout: COUNT_TIMEOUT}); + + // # Open the merge requests needing review list + await sidebar.openList('reviews'); + + // * Verify it lists the merge request + await expect(sidebar.itemTitle(review.id)).toHaveText(review.title); + + // # Open the to-do list + await sidebar.openList('todos'); + + // * Verify it lists the issue assignment and the review request + await expect(sidebar.item(todoFor(todos, issue.iid, 'assigned').id)).toContainText(issue.title); + await expect(sidebar.item(todoFor(todos, review.iid, 'review_requested').id)).toContainText(review.title); + + // # Mark every to-do done in GitLab and refresh the counts + // Wait for GitLab to report no pending to-dos before refreshing, since the + // sidebar refresh is a single fetch and would otherwise read a stale list. + await user.markAllTodosDone(); + await waitForNoTodos(sandbox); + await sidebar.refresh(); + + // * Verify the to-do count and list are empty + await expect(sidebar.count('todos')).toHaveText('0', {timeout: COUNT_TIMEOUT}); + await expect(sidebar.emptyList).toBeVisible(); + }); +}); + +async function waitForTodos(sandbox: Sandbox) { + await expect.poll(async () => (await sandbox.user.listTodos()).length, {timeout: TODO_POLL_TIMEOUT}).toBe(EXPECTED_TODOS); + return sandbox.user.listTodos(); +} + +async function waitForNoTodos(sandbox: Sandbox) { + await expect.poll(async () => (await sandbox.user.listTodos()).length, {timeout: TODO_POLL_TIMEOUT}).toBe(0); +} + +function todoFor(todos: GitlabTodo[], iid: number, action: string) { + const todo = todos.find((candidate) => candidate.target.iid === iid && candidate.action_name === action); + if (!todo) { + throw new Error(`No ${action} to-do for !${iid}: ${JSON.stringify(todos)}`); + } + return todo; +} diff --git a/e2e/playwright/tests/subscriptions.spec.ts b/e2e/playwright/tests/subscriptions.spec.ts new file mode 100644 index 00000000..11fb1269 --- /dev/null +++ b/e2e/playwright/tests/subscriptions.spec.ts @@ -0,0 +1,207 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, test, type ChannelsPage} from '@mattermost/playwright-lib'; + +import {GitlabRhs} from '../support/components'; +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import { + addWebhook, + ensureConnected, + expectPost, + postWithText, + runCommandExpecting, + safeUnsubscribe, + subscribe, +} from '../support/ui'; + +test.describe('subscriptions', () => { + let sandbox: Sandbox | undefined; + let channelsPage: ChannelsPage | undefined; + + test.afterEach(async () => { + if (sandbox) { + await safeUnsubscribe(channelsPage, sandbox.path); + } + await destroySandbox(sandbox); + sandbox = undefined; + channelsPage = undefined; + }); + + /** + * @objective Verify a project subscription can be added, listed in the command reply and the sidebar, and deleted + */ + test('adds, lists, and deletes a project subscription from slash commands and the sidebar', {tag: '@gitlab_plugin'}, async ({pw}) => { + sandbox = await createSandbox(); + const {path} = sandbox; + + // # Open the GitLab subscriptions sidebar + channelsPage = await ensureConnected(pw); + const rhs = new GitlabRhs(channelsPage); + await rhs.open(); + + // * Verify the channel has no subscriptions + await expect(rhs.noSubscriptions).toBeVisible(); + + // # Subscribe to the project + await runCommandExpecting(channelsPage, `/gitlab subscriptions add ${path}`, 'A Webhook is needed'); + + // * Verify the sidebar shows the subscription + await expect(rhs.subscription(path)).toBeVisible(); + + // # List the subscriptions + await runCommandExpecting(channelsPage, '/gitlab subscriptions list', 'Subscriptions in this channel'); + + // * Verify the reply shows the project with the default features + await expectPost(channelsPage.page, `${path} - merges,issues,tag`); + + // # Delete the subscription + await runCommandExpecting(channelsPage, `/gitlab subscriptions delete ${path}`, 'Successfully deleted subscription'); + + // * Verify the sidebar and the list reply show no subscriptions + await expect(rhs.noSubscriptions).toBeVisible(); + await runCommandExpecting(channelsPage, '/gitlab subscriptions list', 'Currently there are no subscriptions in this channel'); + }); + + /** + * @objective Verify /gitlab unsubscribe removes a project subscription and rejects a missing repository + */ + test('removes a project subscription with the /gitlab unsubscribe command', {tag: '@gitlab_plugin'}, async ({pw}) => { + sandbox = await createSandbox(); + const {path} = sandbox; + + // # Open the GitLab subscriptions sidebar and subscribe to the project + channelsPage = await ensureConnected(pw); + const rhs = new GitlabRhs(channelsPage); + await rhs.open(); + await subscribe(channelsPage, path); + + // * Verify the sidebar shows the subscription + await expect(rhs.subscription(path)).toBeVisible(); + + // # Unsubscribe from the project + await runCommandExpecting(channelsPage, `/gitlab unsubscribe ${path}`, 'Successfully deleted subscription'); + + // * Verify the sidebar and the list reply show no subscriptions + await expect(rhs.noSubscriptions).toBeVisible(); + await runCommandExpecting(channelsPage, '/gitlab subscriptions list', 'Currently there are no subscriptions in this channel'); + + // # Run unsubscribe without a repository + // * Verify it replies with its usage error + await runCommandExpecting(channelsPage, '/gitlab unsubscribe', 'Please specify a repository.'); + }); + + /** + * @objective Verify a subscription keeps custom features, shows them in the sidebar, and is replaced by a later subscription + */ + test('stores custom subscription features and shows them in the sidebar', {tag: '@gitlab_plugin'}, async ({pw}) => { + sandbox = await createSandbox(); + const {path} = sandbox; + const features = 'issues,merges,pushes,pipeline,label:"bug"'; + + // # Open the GitLab subscriptions sidebar and subscribe with custom features + channelsPage = await ensureConnected(pw); + const rhs = new GitlabRhs(channelsPage); + await rhs.open(); + await subscribe(channelsPage, path, features); + + // * Verify the list reply and the sidebar show each feature + await runCommandExpecting(channelsPage, '/gitlab subscriptions list', `${path} - ${features}`); + for (const feature of ['issues', 'merges', 'pushes', 'pipeline']) { + // eslint-disable-next-line no-await-in-loop + await expect(rhs.subscriptionFeature(path, feature)).toBeVisible(); + } + + // # Subscribe again with a different feature + await subscribe(channelsPage, path, 'tag'); + + // * Verify the feature list is replaced rather than a second subscription added + await runCommandExpecting(channelsPage, '/gitlab subscriptions list', `${path} - tag`); + await expect(rhs.subscription(path)).toHaveCount(1); + }); + + /** + * @objective Verify subscribing does not ask for a webhook when the project already has one + */ + test('skips the webhook prompt when subscribing to a project that already has a webhook', {tag: '@gitlab_plugin'}, async ({pw}) => { + sandbox = await createSandbox(); + const {path} = sandbox; + channelsPage = await ensureConnected(pw); + + // # List the project's webhooks before and after adding one + // * Verify the list is empty and then includes the plugin webhook + await runCommandExpecting(channelsPage, `/gitlab webhook list ${path}`, `No webhooks found in ${path}`); + await addWebhook(channelsPage, path); + await runCommandExpecting(channelsPage, `/gitlab webhook list ${path}`, 'Merge Request Events'); + + // # Subscribe to the project + await subscribe(channelsPage, path); + + // * Verify the reply does not ask for a webhook + await postWithText(channelsPage.page, `Successfully subscribed to ${path}`).toNotContainText('A Webhook is needed'); + }); + + /** + * @objective Verify subscriptions with unknown features or misused label filters are rejected + */ + test('rejects unknown features and label filters without issues or merges', {tag: '@gitlab_plugin'}, async ({pw}) => { + sandbox = await createSandbox(); + const {path} = sandbox; + channelsPage = await ensureConnected(pw); + + // # Subscribe with an unknown feature, a label filter without issues or merges, and an unquoted label + // * Verify each is rejected with its validation error + await runCommandExpecting(channelsPage, `/gitlab subscriptions add ${path} issues,bogus`, 'unknown features bogus'); + await runCommandExpecting(channelsPage, `/gitlab subscriptions add ${path} pushes,label:"bug"`, "label filters require 'merges' or 'issues' feature"); + await runCommandExpecting(channelsPage, `/gitlab subscriptions add ${path} issues,label:bug`, 'each label must be wrapped in quotes'); + + // * Verify no subscription was created + await runCommandExpecting(channelsPage, '/gitlab subscriptions list', 'Currently there are no subscriptions in this channel'); + }); + + /** + * @objective Verify a project the connected GitLab user cannot see cannot be subscribed to + * + * @precondition + * The connected GitLab user is not a member of the new project + */ + test('rejects subscriptions to projects the connected user cannot see', {tag: '@gitlab_plugin'}, async ({pw}) => { + sandbox = await createSandbox('none'); + channelsPage = await ensureConnected(pw); + + // # Subscribe to the project + // * Verify the project is reported as not found + await runCommandExpecting(channelsPage, `/gitlab subscriptions add ${sandbox.path}`, 'Resource with such path is not found.'); + }); + + /** + * @objective Verify a GitLab guest cannot create subscriptions or manage webhooks for a project + * + * @precondition + * The connected GitLab user is a guest of the new project's group + */ + test('rejects subscriptions and webhook commands from project guests', {tag: '@gitlab_plugin'}, async ({pw}) => { + sandbox = await createSandbox('guest'); + const {path} = sandbox; + channelsPage = await ensureConnected(pw); + + // # Subscribe to the project and list its webhooks + // * Verify both are refused for lack of permissions + await runCommandExpecting(channelsPage, `/gitlab subscriptions add ${path}`, "You don't have the permissions to create subscriptions for this project."); + await runCommandExpecting(channelsPage, `/gitlab webhook list ${path}`, "You don't have permission to manage webhooks"); + }); + + /** + * @objective Verify incomplete subscription commands reply with usage errors + */ + test('reports usage errors for incomplete subscription commands', {tag: '@gitlab_plugin'}, async ({pw}) => { + channelsPage = await ensureConnected(pw); + + // # Run subscription commands without a subcommand or repository, and delete an unknown subscription + // * Verify each replies with its usage error + await runCommandExpecting(channelsPage, '/gitlab subscriptions', 'Invalid subscribe command. Available commands are add, delete, and list'); + await runCommandExpecting(channelsPage, '/gitlab subscriptions add', 'Please provide the owner[/repo]'); + await runCommandExpecting(channelsPage, '/gitlab subscriptions delete', 'Please specify a repository.'); + await runCommandExpecting(channelsPage, '/gitlab subscriptions delete e2e-missing/repo', 'Subscription not found, please check repository name.'); + }); +}); diff --git a/e2e/playwright/tests/webapp_integrations.spec.ts b/e2e/playwright/tests/webapp_integrations.spec.ts new file mode 100644 index 00000000..854da5eb --- /dev/null +++ b/e2e/playwright/tests/webapp_integrations.spec.ts @@ -0,0 +1,78 @@ +// Copyright (c) 2019-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {expect, test, type ChannelsPage} from '@mattermost/playwright-lib'; + +import {GitlabLinkTooltip, GitlabProfileAttribute} from '../support/components'; +import {uniquePath} from '../support/gitlab_api'; +import {createSandbox, destroySandbox, type Sandbox} from '../support/sandbox'; +import {ensureConnected, runCommandExpecting} from '../support/ui'; + +test.describe('link tooltips and profile attributes', () => { + let sandbox: Sandbox; + + test.beforeEach(async () => { + sandbox = await createSandbox(); + }); + + test.afterEach(async () => { + await destroySandbox(sandbox); + }); + + /** + * @objective Verify hovering GitLab issue and merge request links in a post shows the plugin's preview tooltip + */ + test('previews GitLab issue and merge request links on hover', {tag: '@gitlab_plugin'}, async ({pw}) => { + const {root, project} = sandbox; + const issue = await root.createIssue(project.id, `E2E tooltip issue ${uniquePath('')}`); + const mergeRequest = await root.createMergeRequest(project.id, `E2E tooltip MR ${uniquePath('')}`, {targetBranch: project.default_branch}); + const channelsPage = await ensureConnected(pw); + + // # Post and hover an issue link, then a merge request link + // * Verify each tooltip shows the item's title and number + // GitLab 18 reports issue URLs as /-/work_items/, which the tooltip does not + // recognize, so the test posts the /-/issues/ form that GitLab still serves. + await expectTooltip(channelsPage, `${project.web_url}/-/issues/${issue.iid}`, issue.title, issue.iid); + await expectTooltip(channelsPage, mergeRequest.web_url, mergeRequest.title, mergeRequest.iid); + }); + + /** + * @objective Verify the user profile popover links to the connected GitLab account + */ + test('shows the linked GitLab account in the user profile popover', {tag: '@gitlab_plugin'}, async ({pw}) => { + const {credentials} = sandbox; + const channelsPage = await ensureConnected(pw); + + // # Post a message after a bot reply, since consecutive posts by one user hide the avatar + await runCommandExpecting(channelsPage, '/gitlab me', 'You are connected to GitLab as:'); + await channelsPage.centerView.postMessage(`Profile popover ${uniquePath('')}`); + + // # Open the profile popover from the post's avatar + const post = await channelsPage.centerView.getLastPost(); + await post.profileIcon.click(); + await channelsPage.userProfilePopover.toBeVisible(); + + // * Verify the popover links to the GitLab profile + const link = new GitlabProfileAttribute(channelsPage).link(credentials.e2e_username); + await expect(link).toHaveAttribute('href', `${credentials.gitlab_url}/${credentials.e2e_username}`); + }); +}); + +async function expectTooltip(channelsPage: ChannelsPage, url: string, title: string, iid: number) { + const tooltip = new GitlabLinkTooltip(channelsPage); + + // # Post the link and hover it + await channelsPage.centerView.postMessage(url); + const post = await channelsPage.centerView.getLastPost(); + await tooltip.hoverLink(post, url); + + // * Verify the tooltip shows the title and number + await expect(tooltip.title(title)).toBeVisible(); + await expect(tooltip.number(iid)).toBeVisible(); + + // # Move the pointer away + await channelsPage.page.mouse.move(0, 0); + + // * Verify the tooltip closes + await expect(tooltip.container).toBeHidden(); +} diff --git a/e2e/playwright/tsconfig.json b/e2e/playwright/tsconfig.json new file mode 100644 index 00000000..747dbe66 --- /dev/null +++ b/e2e/playwright/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "commonjs", + "moduleResolution": "node", + "esModuleInterop": true, + "strict": true, + "skipLibCheck": true, + "noEmit": true, + "types": ["node"] + }, + "include": ["./**/*.ts"], + "exclude": ["node_modules", "results"] +} diff --git a/webapp/src/components/gitlab_issue_selector.tsx b/webapp/src/components/gitlab_issue_selector.tsx index be0f0291..ce737d0a 100644 --- a/webapp/src/components/gitlab_issue_selector.tsx +++ b/webapp/src/components/gitlab_issue_selector.tsx @@ -132,6 +132,7 @@ const GitlabIssueSelector = ({name, required, theme, onChange, error, value, add <> {serverError} { const gitlabUrl = new URL(connectedGitlabUrl); const init = async () => { if (url.host === gitlabUrl.host && validateGitlabUrl(href)) { - const linkInfo = getInfoAboutLink(href, url.hostname); + const linkInfo = getInfoAboutLink(href, url.host); let res; switch (linkInfo?.type) { case LINK_TYPES.ISSUES: @@ -127,7 +127,10 @@ const LinkTooltip = ({href, show}: Props) => { const {formatText, messageHtmlToComponent} = window.PostUtils; return ( -
+
( />
{'Signed in as'}
-
{props.username}
+
{props.username}
{ return ( -
+

{'Repository'}

(isTeamSidebar ? {} : {'data-testid': id}); + return (
{'Merge requests assigned'}} > this.openRHS(RHSStates.PRS)} style={button} > - {yourAssignedPrs.length} + {yourAssignedPrs.length} {'Merge requests needing review'}} > this.openRHS(RHSStates.REVIEWS)} style={button} > - {reviews.length} + {reviews.length} {'Issues'}} > this.openRHS(RHSStates.ISSUES)} style={button} > - {yourAssignedIssues.length} + {yourAssignedIssues.length} {'To-Do list'}} > this.openRHS(RHSStates.TODOS)} style={button} > - {todos.length} + {todos.length} {'Refresh'}} > diff --git a/webapp/src/utils/tooltip_utils.test.ts b/webapp/src/utils/tooltip_utils.test.ts index b17cc7ba..f5fc0bd6 100644 --- a/webapp/src/utils/tooltip_utils.test.ts +++ b/webapp/src/utils/tooltip_utils.test.ts @@ -3,7 +3,7 @@ import {describe, expect, it} from '@jest/globals'; -import {validateGitlabUrl, isValidUrl} from './tooltip_utils'; +import {validateGitlabUrl, isValidUrl, getInfoAboutLink} from './tooltip_utils'; describe('validateGitlabUrl should work as expected', () => { it('Should return true for valid GitLab repository URL', () => { @@ -20,6 +20,24 @@ describe('validateGitlabUrl should work as expected', () => { const url = 'not a URL'; expect(validateGitlabUrl(url)).toBe(false); }); + + it('Should return the same result when called repeatedly', () => { + const url = 'https://gitlab.com/username/repo/-/issues/1'; + expect(validateGitlabUrl(url)).toBe(true); + expect(validateGitlabUrl(url)).toBe(true); + }); +}); + +describe('getInfoAboutLink should work as expected', () => { + it('Should parse links on a GitLab host with a port', () => { + const url = 'http://gitlab.test:8929/group/repo/-/merge_requests/12'; + expect(getInfoAboutLink(url, new URL(url).host)).toEqual({ + owner: 'group', + repo: 'repo', + type: 'merge_requests', + number: '12', + }); + }); }); describe('isValidUrl should work as expected', () => { diff --git a/webapp/src/utils/tooltip_utils.ts b/webapp/src/utils/tooltip_utils.ts index 013ead9e..68e29a04 100644 --- a/webapp/src/utils/tooltip_utils.ts +++ b/webapp/src/utils/tooltip_utils.ts @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. // Regex to match if a URl is valid merge request of issue URL -const gitlabRegexPattern = /https?:\/\/(www\.)?.*\/([\w.?-]+)\/([\w-]+)\/-\/([\w-]+)\/([\d-]+$)/g; +const gitlabRegexPattern = /https?:\/\/(www\.)?.*\/([\w.?-]+)\/([\w-]+)\/-\/([\w-]+)\/([\d-]+$)/; export const validateGitlabUrl = (url: string): boolean => { return gitlabRegexPattern.test(url);