Skip to content

Commit

Permalink
Run cypress tests on release 3.18 (#4851)
Browse files Browse the repository at this point in the history
* Run automation tests on release (#4775)

* Test PR - running playwright tests after deployment

* Test PR - running playwright tests after deployment

* Rerun job

* open draft PR

* Add check

* Add check

* Add check

* Add check

* Add check

* Add check

* Add check

* Add check

* Update check

* Update check

* Update check

* Update check

* Update check

* Update check

* Update check

* Update check

* Move create check to seperate file

* Move create check to seperate file

* Move create check to seperate file

* Move create check to seperate file

* Move create check to seperate file

* Move create check to seperate file

* Move create check to seperate file

* Move create check to seperate file

* Move create check to seperate file

* Move create check to seperate file

* Move create check to seperate file

* Check if PR exist

* Check if PR exist

* Check if PR exist

* Check if PR exist

* restore data from snapshot

* Allow user without app permission access apps view (#4738)

* Allow user without app permission access apps view

* Use css subgrid instead of multiple map loops

* Add protection to queries and mutation that use App fragments

* Allow user to see manage app view

* Refactor app permission check to hook

* Protect routes

* shouldShowInstalledApps

* Refactor AppListPage, write test for loading, empty state with checking manage_app perm

* Change manage button label depend on manage_apps

* Improve typing

* Extract messages

* ButtonWithTooltip

* Refactor HeaderOptions, block action when no manage_apps

* Improve buttons

* Add changset

* Adjust singlePermission tests

* Remove required hasManagedAppsPermission when default

* Improve action icons

* Improve naming and refactor AppListCardInstallButton

* Improve changset

* Improve tests

* [E2E] Fixing flaky e2e tests (#4751)

* adding extra assertion to translation tests

* updating assertion in attribute tests

* modifying assertions for gift card tests

* [E2E] Fixing another batch of flaky tests (#4756)

* updating tests for extra assertions and adding skip to App test

* updating tests for extra assertions

* updating tests for extra assertions and temporarily commenting not working assertions

* adding PW test for readonly Apps access (#4755)

* [QA] Correcting e2e test case ids (#4764)

* correcting test case ids

* fixing flaky test

* Update .changeset/serious-books-wave.md

Co-authored-by: Jonatan Witoszek <jonatanwitoszek@gmail.com>

---------

Co-authored-by: Jonatan Witoszek <jonatanwitoszek@gmail.com>

* New github action for gathering metrics (#4762)

* New github action for metrics gathering

* metrics file name containing date

* search query repo update

* Update .github/workflows/repo-metrics.yml

Co-authored-by: Mikolaj Stempniewicz <mikolaj@stempniewicz.net>

* Update repo-metrics.yml

* Update repo-metrics.yml

* Update .github/workflows/repo-metrics.yml

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

---------

Co-authored-by: Mikolaj Stempniewicz <mikolaj@stempniewicz.net>
Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* Gathering pull requests metrics (#4766)

* fix workflow dispatch trigger

* fix workflow dispatch trigger

* metrics for pr

* removed date from file name

* on push added

* wip

* date in issue name, workflow dispatch trigger

* Create long-keys-compare.md

* add siteSettings basic test (#4759)

* Remove babel (#4711)

* Remove babel

* Add changeset

* Fix showing empty tooltip when no content by bumping macaw-ui to newest (#4771)

* Bump macaw

* Add changeset

* [E2E] Tests for page types (#4765)

* add changeset

* add test data

* add tests and  update data-test-id

* code review fixes

* spaces

* adding test for permission groups (#4758)

* fixing flaky tests (#4772)

* Send tests results when running manually (#4737)

* Send tests results when running manually

* Send tests results when running manually

* Send tests results when running manually

* Check if it is working

* Fix init testmo

* Fix submit threads

* Fix working directory when sending results to testmo

* Add name and tag

* Add name and tag

* Fix run name

* Add reports when tests run by cron

* Fix messages skip ci

* Fix messages [skip ci]

* Sending playwright tests results to slack and testmo

* Update .github/workflows/tests-nightly.yml

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* changes fter review

* fix changeset

---------

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* Fix version

* Run tests

* Run tests on correct branch

* Update status check if job failed

* Update status check if job failed

* Manual order transaction refund (#4774)

* Order manual transaction view init

* Connect RHF

* Add sending mutation

* Refactor, add intl, fix form validation

* extract messages

* Add changeset

* Refactor transactions tiles

* Improve loading and disable state, fix radio group control

* Hadle no transactions

* Write tests

* extract messages

* Refactor fragments

* Move mutation to form component

* Fix test

* fixing flaky tests (#4772) (#4778)

* Show all transaction in manual refund view (#4779)

* Order manual transaction view init

* Connect RHF

* Add sending mutation

* Refactor, add intl, fix form validation

* extract messages

* Add changeset

* Refactor transactions tiles

* Improve loading and disable state, fix radio group control

* Hadle no transactions

* Write tests

* extract messages

* Refactor fragments

* Move mutation to form component

* Fix test

* Show all transactions

* Add changeset

* Update tests

* Extract messages

* Fix typo

* Improve tooltip

* [E2E] [QA] Optimizing playwright setup and playwright.config.ts files (#4741)

* adding condition to not create json file if it does exist

* adding cache

* adding cache

* updating yml files

* fixing GH action

* fixing flaky test

* adding randomization to tests execution

* reverting

* fixing flaky tests

* updating other gh workflows consisting of pw test run

* Fix version

* Fix checkout

* [E2E] Tests for product types (#4757)

* initial commit with changelog

* add test for update product type

* add test to delete several product types

* add test to remove product type with asigned product

* fix numering and assertion after removing types

* typo

* update test data

* add assertions

* remove stripe and emails plugins app replacement message (#4777)

* switch version to 3.19

* Fix submit results

* Fix update check

* Fix update check

* Fix update check

* Fix script

* Fix status

* test trigger run tests on release job

* last test

* last test

* [E2E] Use dummy app in delete app test (#4789)

* replace app

* update test data

* fixing flaky gift cards tests (#4785)

* Fix workflow name

* Fix names

* Fix names

* do not run cypress if higher version

* do not run cypress if higher version

* do not run cypress if higher version

* do not run cypress if higher version

* do not run cypress if higher version

* do not run cypress if higher version

* do not run cypress if higher version

* do not run cypress if higher version

* do not run cypress if higher version

* do not run cypress if higher version

* test for lower versions run only cypress

* test for lower versions run only cypress

* test for lower versions run only cypress

* test for lower versions run only cypress

* test for lower versions run only cypress

* test for lower versions run only cypress

* test for lower versions run only cypress

* test for lower versions run only cypress

* test for higher versions - playwright

* Delete test workflow

* Add changeset

* Update .github/actions/checks/create-pull-request-check/action.yml

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* Update .github/workflows/prepare-release.yml

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* use jq, don't use string interpolation

* Check if still works after review changes

* Fix crete check

* Fix crete check

* Fix crete check

* Remove leftovers

* Fix head sha

* Fix head sha

* Fix head sha

* Fix head sha

* cleanup after tests

* Update .github/actions/checks/create-pull-request-check/action.yml

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* tests if works after review changes

* tests if works after review changes

* Remove testing workflow

* Update .github/actions/checks/update-pull-request-check/action.yml

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* Update .github/workflows/run-tests-on-release.yml

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* Update .github/actions/prepare-api-variables/action.yml

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>

* merge deploy and prepare release workflows

---------

Co-authored-by: Paweł Chyła <chyla1988@gmail.com>
Co-authored-by: Renata <renata.gajzlerowicz@gmail.com>
Co-authored-by: Jonatan Witoszek <jonatanwitoszek@gmail.com>
Co-authored-by: wojteknowacki <124166231+wojteknowacki@users.noreply.github.com>
Co-authored-by: Mikolaj Stempniewicz <mikolaj@stempniewicz.net>
Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>
Co-authored-by: M.Graczyk <michalina.graczyk@saleor.io>
Co-authored-by: Anna Szczęch <30683248+szczecha@users.noreply.github.com>
Co-authored-by: Lukasz Ostrowski <lukasz.ostrowski@saleor.io>

* Run cypress tests for releases on 3.18

* Run cypress tests for releases on 3.18

* Run cypress tests for releases on 3.18

* Run cypress tests for releases on 3.18

* fix testmo id

* fix testmo id

* remove test workflow

* Fix statuses

---------

Co-authored-by: Paweł Chyła <chyla1988@gmail.com>
Co-authored-by: Renata <renata.gajzlerowicz@gmail.com>
Co-authored-by: Jonatan Witoszek <jonatanwitoszek@gmail.com>
Co-authored-by: wojteknowacki <124166231+wojteknowacki@users.noreply.github.com>
Co-authored-by: Mikolaj Stempniewicz <mikolaj@stempniewicz.net>
Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>
Co-authored-by: M.Graczyk <michalina.graczyk@saleor.io>
Co-authored-by: Anna Szczęch <30683248+szczecha@users.noreply.github.com>
Co-authored-by: Lukasz Ostrowski <lukasz.ostrowski@saleor.io>
  • Loading branch information
10 people committed May 27, 2024
1 parent ad6c8b7 commit 28383b2
Show file tree
Hide file tree
Showing 12 changed files with 822 additions and 147 deletions.
5 changes: 5 additions & 0 deletions .changeset/hip-clocks-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Run cypress or playwright tests on release
77 changes: 77 additions & 0 deletions .github/actions/checks/create-pull-request-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Create-check
description: "Creates check for PR"
inputs:
PR_HEAD:
description: "Head of PR on which create check"
required: true
CHECK_NAME:
description: "Name of check"
required: true
STATUS:
description: "Status of check"
required: true
TITLE:
description: "Title of check"
required: true
DETAILS_URL:
description: "Details url"
required: true

outputs:
CHECK_ID:
description: "CHECK_ID"
value: ${{ steps.create-check.outputs.check_id }}

runs:
using: composite
steps:
- name: Get Pull Request head_sha
shell: bash
env:
GH_TOKEN: ${{ github.token }}
PR_HEAD: ${{ inputs.PR_HEAD }}
run: |
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/saleor/saleor-dashboard/pulls?head=saleor:${PR_HEAD}" > data.json
head_sha_with_quotes=$(jq '.[0] | .head.sha' data.json)
echo "PULL_REQUEST_HEAD_SHA=${head_sha_with_quotes//\"/}" >> "$GITHUB_ENV"
- name: Create check
if: ${{ env.PULL_REQUEST_HEAD_SHA }}
shell: bash
id: create-check
env:
GH_TOKEN: ${{ github.token }}
NAME: ${{ inputs.CHECK_NAME }}
STATUS: ${{ inputs.STATUS }}
TITLE: ${{ inputs.TITLE }}
run: |
payload=$(\
jq --null-input \
--arg name "$NAME" \
--arg head_sha "$PULL_REQUEST_HEAD_SHA" \
--arg status "$STATUS" \
--arg title "$TITLE" \
--arg details_url "$DETAILS_URL" \
'{
"name": $name,
"head_sha": $head_sha,
"status": $status,
"output": {
"title": $title,
"summary": "",
"text": "",
"details_url": $details_url
}
}'
)
check_id=$(curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/saleor/saleor-dashboard/check-runs \
-d "$payload" | jq -r '.id') ; echo "check_id=$check_id" >> "$GITHUB_OUTPUT"
69 changes: 69 additions & 0 deletions .github/actions/checks/update-pull-request-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Create-check
description: "Creates check for PR"
inputs:
CHECK_ID:
description: "Check id"
required: true
CHECK_NAME:
description: "Name of check - must be the same here and in create check"
required: true
STATUS:
description: "Status of check"
required: true
CONCLUSION:
description: "Conclusion of check, required if status completed"
required: false
TITLE:
description: "Title of check"
required: true
SUMMARY:
description: "Summary of check"
required: true
DETAILS_URL:
description: "Url with details to check"
required: true

runs:
using: composite
steps:
- name: Update check
shell: bash
env:
GH_TOKEN: ${{ github.token }}
CHECK_ID: ${{ inputs.CHECK_ID }}
NAME: ${{ inputs.CHECK_NAME }}
STATUS: ${{ inputs.STATUS }}
CONCLUSION: ${{inputs.CONCLUSION}}
TITLE: ${{ inputs.TITLE }}
SUMMARY: ${{ inputs.SUMMARY }}
DETAILS_URL: ${{ inputs.DETAILS_URL }}
run: |
payload=$(\
jq --null-input \
--arg name "$NAME" \
--arg status "$STATUS" \
--arg conclusion "$CONCLUSION" \
--arg title "$TITLE" \
--arg summary "$SUMMARY" \
--arg details_url "$DETAILS_URL" \
'{
"name": $name,
"status": $status,
"conclusion": $conclusion,
"output": {
"title": $title,
"summary": $summary,
"text": "",
"details_url": $details_url
}
}'
)
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/saleor/saleor-dashboard/check-runs/$CHECK_ID" \
-d "$payload"
95 changes: 95 additions & 0 deletions .github/actions/prepare-api-variables/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Prepare api variables
description: Prepare env config for cloud

inputs:
MODE:
description: "The mode of running tests (pull-request, release, main)"
required: true
VERSION:
description: "Version if you want to run from different branch"
required: false

outputs:
BASE_URL:
description: "Dashboard base url"
value: ${{ steps.generate.outputs.BASE_URL }}
API_URL:
description: "API url"
value: ${{ steps.generate.outputs.API_URL }}
BASE_URL_DOMAIN:
description: "Dashboard domain"
value: ${{ steps.generate.outputs.BASE_URL_DOMAIN }}
POOL_NAME:
description: "The name of the instance"
value: ${{ steps.generate.outputs.POOL_NAME }}
POOL_INSTANCE:
description: "The full URL of the instance"
value: ${{ steps.generate.outputs.POOL_INSTANCE }}
BACKUP_NAMESPACE:
description: "The backup namespace"
value: ${{ steps.generate.outputs.BACKUP_NAMESPACE }}

runs:
using: "composite"
steps:
- name: Generate
id: generate
shell: bash
env:
MODE: ${{ inputs.MODE }}
PULL_REQUEST_NUMBER: ${{ github.event.number }}
PREFIX: pr-

run: |
if [[ "$MODE" == 'pull-request' ]]; then
echo "BASE_URL=https://${PREFIX}${PULL_REQUEST_NUMBER}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT
echo "API_URL=https://${PREFIX}${PULL_REQUEST_NUMBER}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT
echo "BASE_URL_DOMAIN=${PREFIX}${PULL_REQUEST_NUMBER}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT
echo "POOL_NAME=${PREFIX}${PULL_REQUEST_NUMBER}" >> $GITHUB_OUTPUT
echo "POOL_INSTANCE=https://${PREFIX}${PULL_REQUEST_NUMBER}.staging.saleor.cloud" >> $GITHUB_OUTPUT
echo "BACKUP_NAMESPACE=snapshot-automation-tests" >> $GITHUB_OUTPUT
exit 0
fi
if [[ "$MODE" == 'release' ]]; then
CURRENT_BRANCH=$(echo "${GITHUB_REF}" | sed "s/refs\/heads\///")
VERSION_SLUG=$(echo "${CURRENT_BRANCH}" | sed "s/\.//")
echo "BASE_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/dashboard/" >> $GITHUB_OUTPUT
echo "API_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT
echo "BASE_URL_DOMAIN=v${VERSION_SLUG}.staging.saleor.cloud" >> $GITHUB_OUTPUT
echo "POOL_NAME=${CURRENT_BRANCH} Staging" >> $GITHUB_OUTPUT
echo "POOL_INSTANCE=https://v${VERSION_SLUG}.staging.saleor.cloud/" >> $GITHUB_OUTPUT
echo "BACKUP_NAMESPACE=snapshot-automation-tests-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
exit 0
fi
if [[ "$MODE" == 'main' ]]; then
echo "BASE_URL=https://automation-dashboard.staging.saleor.cloud/dashboard/" >> $GITHUB_OUTPUT
echo "API_URL=https://automation-dashboard.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT
echo "BASE_URL_DOMAIN=automation-dashboard.staging.saleor.cloud" >> $GITHUB_OUTPUT
echo "POOL_NAME=automation-dashboard" >> $GITHUB_OUTPUT
echo "POOL_INSTANCE=https://automation-dashboard.staging.saleor.cloud" >> $GITHUB_OUTPUT
echo "BACKUP_NAMESPACE=snapshot-automation-tests" >> $GITHUB_OUTPUT
exit 0
fi
if [[ "$MODE" == 'from-version' ]]; then
VERSION_SLUG=$(echo "${VERSION/./}")
echo "BASE_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/dashboard/" >> "$GITHUB_OUTPUT"
echo "API_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/graphql/" >> "$GITHUB_OUTPUT"
echo "BASE_URL_DOMAIN=v${VERSION_SLUG}.staging.saleor.cloud" >> "$GITHUB_OUTPUT"
echo "POOL_NAME=${VERSION} Staging" >> "$GITHUB_OUTPUT"
echo "POOL_INSTANCE=https://v${VERSION_SLUG}.staging.saleor.cloud/" >> "$GITHUB_OUTPUT"
echo "BACKUP_NAMESPACE=snapshot-automation-tests-${VERSION}" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Unknown mode: $MODE" >&2
exit 1
41 changes: 41 additions & 0 deletions .github/actions/prepare-backups-variables/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Prepare backup variables
description: Prepare database snapshots
inputs:
CLI_TOKEN:
description: "Saleor cli token"
required: true
BACKUP_NAMESPACE:
description: "The backups namespace"
required: true
outputs:
BACKUP_ID:
description: "The ID of backup"
value: ${{ steps.backup.outputs.BACKUP_ID }}
BACKUP_VER:
description: "The version of backup"
value: ${{ steps.backup.outputs.BACKUP_VER }}
BACKUP_NAME:
description: "The name of backup"
value: ${{ steps.backup.outputs.BACKUP_NAME }}
runs:
using: "composite"
steps:
- name: Saleor login
uses: ./.github/actions/cli-login
with:
token: ${{ inputs.CLI_TOKEN }}

- name: Obtain backup id
id: backup
shell: bash
env:
BACKUP_NAME: ${{ inputs.BACKUP_NAMESPACE }}
run: |
BACKUPS=$(npx saleor backup list --name="$BACKUP_NAME" --latest --json)
BACKUP_ID=$(echo "$BACKUPS" | jq -r '.[0].key')
BACKUP_VER=$(echo "$BACKUPS" | jq -r '.[0].saleor_version')
BACKUP_NAME=$(echo "$BACKUPS" | jq -r '.[0].name')
echo "BACKUP_ID=$BACKUP_ID" >> $GITHUB_OUTPUT
echo "BACKUP_VER=$BACKUP_VER" >> $GITHUB_OUTPUT
echo "BACKUP_NAME=$BACKUP_NAME" >> $GITHUB_OUTPUT
70 changes: 70 additions & 0 deletions .github/actions/prepare-instance/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Prepare instance
description: Prepare cloud instance for testing
inputs:
STRATEGY:
description: "How to create the new instance (create|reload)"
required: false
default: "create"
CLI_TOKEN:
description: "Saleor cli token"
required: true
BASE_URL:
description: "Dashboard base url"
required: true
API_URL:
description: "API url"
required: true
POOL_NAME:
description: "The name of the instance"
required: true
POOL_INSTANCE:
description: "The full URL of the instance"
required: true
BACKUP_ID:
description: "The id of backup"
required: true
runs:
using: "composite"
steps:
- name: Saleor login
uses: ./.github/actions/cli-login
with:
token: ${{ inputs.CLI_TOKEN }}

- name: Instance check
if: ${{ inputs.STRATEGY == 'reload' }}
shell: bash
id: instance_check
env:
INSTANCE_NAME: ${{ inputs.POOL_NAME }}
run: |
set +o pipefail
INSTANCE_KEY=$(npx saleor env show "$INSTANCE_NAME" --json | jq .key)
echo "INSTANCE_KEY=$INSTANCE_KEY" >> $GITHUB_OUTPUT
- name: Reload snapshot
shell: bash
if: ${{ steps.instance_check.outputs.INSTANCE_KEY }}
env:
BACKUP_ID: ${{ inputs.BACKUP_ID }}
INSTANCE_NAME: ${{ inputs.POOL_NAME }}
run: |
npx saleor backup restore "$BACKUP_ID" \
--environment="$INSTANCE_NAME" \
--skip-webhooks-update
- name: Create new instance
shell: bash
if: ${{ !steps.instance_check.outputs.INSTANCE_KEY }}
env:
BACKUP_ID: ${{ inputs.BACKUP_ID }}
INSTANCE_NAME: ${{ inputs.POOL_NAME }}
run: |
npx saleor env create "$INSTANCE_NAME" \
--project=project-for-pr-testing \
--database=snapshot \
--restore-from="$BACKUP_ID" \
--saleor=saleor-master-staging \
--domain="$INSTANCE_NAME" \
--skip-restrict \
--skip-webhooks-update
Loading

0 comments on commit 28383b2

Please sign in to comment.