Skip to content

Commit

Permalink
Merge pull request #5443 from novuhq/inf-348-cypress-and-playwright-t…
Browse files Browse the repository at this point in the history
…ests-4-times-a-day

Create a CI pipeline to run cypress and playwright tests 4 times a day
  • Loading branch information
AliaksandrRyzhou authored Apr 25, 2024
2 parents afa6420 + 179aaa0 commit ad45d6e
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,9 @@
"eazy",
"Maizzle",
"MJML",
"localstorage"
"localstorage",
"elif",
"websockets"
],
"flagWords": [],
"patterns": [
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/scheduled_e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Scheduled E2E tests

on:
workflow_dispatch:
schedule:
- cron: '0 12-19/2 * * 1-5'
permissions:
contents: read
packages: write
deployments: write
id-token: write
actions: write

env:
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
test_web:
name: Test Web Cypress
uses: ./.github/workflows/reusable-web-e2e.yml
secrets: inherit
with:
ee: true

test_widget:
name: Test Widget Cypress
uses: ./.github/workflows/reusable-widget-e2e.yml
with:
ee: true
secrets: inherit

release_decision:
name: Release Decision
if: always()
runs-on: ubuntu-latest
needs:
- test_widget
- test_web
steps:
- uses: actions/checkout@v4
- name: Check and manage workflows
run: |
needs_json='${{ toJSON(needs) }}'
web_status=$(echo "$needs_json" | jq -r '.test_web.result')
widget_status=$(echo "$needs_json" | jq -r '.test_widget.result')
workflows_map=$(cat << EOF
prod-deploy-widget.yml: $widget_status
prod-deploy-web.yml: $web_status
EOF
)
while IFS= read -r line; do
filename=$(echo "$line" | awk -F ':' '{print $1}')
status=$(echo "$line" | awk -F ':' '{print $2}' | awk '{$1=$1};1') # Trim whitespace
echo "Workflow $filename status: $status"
if [[ "$status" == "failure" ]]; then
echo "Disabling workflow $filename. The E2E test has failed."
gh workflow disable "$filename"
elif [[ "$status" == "success" ]]; then
echo "Enabling workflow $filename. The E2E tests have passed."
gh workflow enable "$filename"
else
echo "Unknown status for workflow $filename: $status"
fi
done <<< "$workflows_map"
4 changes: 4 additions & 0 deletions apps/widget/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { defineConfig } from 'cypress';
export default defineConfig({
chromeWebSecurity: false,
video: false,
retries: {
runMode: 3,
openMode: 0,
},
projectId: 'kedzap',
env: {
NODE_ENV: 'test',
Expand Down

0 comments on commit ad45d6e

Please sign in to comment.