Skip to content

Commit

Permalink
Set cron for playwright tests (#4621)
Browse files Browse the repository at this point in the history
* Cron for playwright

* Cron for playwright

* Update .github/workflows/run-test-cron.yml

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

---------

Co-authored-by: Mikail <6186720+NyanKiyoshi@users.noreply.github.com>
  • Loading branch information
andrzejewsky and NyanKiyoshi committed Jan 17, 2024
1 parent 7c7c73c commit 4d82f8f
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-buckets-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Add cron job for PW tests
75 changes: 75 additions & 0 deletions .github/workflows/run-test-cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Run test by cron

on:
schedule:
# At 2:00 AM UTC on Monday, Wednesday, and Friday
- cron: "00 2 * * 1,3,5"

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
initialize-cloud:
runs-on: ubuntu-22.04
outputs:
POOL_NAME: ${{ steps.pool_variables.outputs.POOL_NAME }}
POOL_INSTANCE: ${{ steps.pool_variables.outputs.POOL_INSTANCE }}
BASE_URL: ${{ steps.cloud_variables.outputs.BASE_URL }}
API_URL: ${{ steps.cloud_variables.outputs.API_URL }}
BACKUP_ID: ${{ steps.cloud_variables.outputs.BACKUP_ID }}
BACKUP_VER: ${{ steps.cloud_variables.outputs.BACKUP_VER }}
BACKUP_NAME: ${{ steps.cloud_variables.outputs.BACKUP_NAME }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: ./.github/actions

- name: Generate variables
id: cloud_variables
uses: ./.github/actions/prepare-tests-variables
with:
CLI_TOKEN: ${{ secrets.STAGING_TOKEN }}
MODE: main

- name: Prepare instances
id: pool_variables
uses: ./.github/actions/prepare-instance
with:
STRATEGY: reload
CLI_TOKEN: ${{ secrets.STAGING_TOKEN }}
BASE_URL: ${{ steps.cloud_variables.outputs.BASE_URL }}
API_URL: ${{ steps.cloud_variables.outputs.API_URL }}
POOL_NAME: ${{ steps.cloud_variables.outputs.POOL_NAME }}
POOL_INSTANCE: ${{ steps.cloud_variables.outputs.POOL_INSTANCE }}
BACKUP_ID: ${{ steps.cloud_variables.outputs.BACKUP_ID }}

run-tests:
runs-on: ubuntu-22.04
needs: initialize-cloud
strategy:
fail-fast: false
matrix:
shard: [1/2, 2/2]
steps:
- uses: actions/checkout@v4

- name: Run playwright tests
uses: ./.github/actions/run-pw-tests
with:
SHARD: ${{ matrix.shard }}
BASE_URL: ${{ needs.initialize-cloud.outputs.BASE_URL }}
API_URL: ${{ needs.initialize-cloud.outputs.API_URL }}
E2E_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }}
E2E_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }}
E2E_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}

merge-reports:
if: '!cancelled()'
needs: run-tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Merge playwright reports
uses: ./.github/actions/merge-pw-reports
3 changes: 0 additions & 3 deletions .github/workflows/tests-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ on:
- firefox
- all

schedule:
- cron: "00 2 * * 1,3,5"

repository_dispatch:
types: [automation-tests-event]

Expand Down

0 comments on commit 4d82f8f

Please sign in to comment.