Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/e2e-test_local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# do everything the e2e-test.yml does, but faster and locally
name: E2E Tests & Update Web Service
on:
workflow_call:
inputs:
ref:
type: string
default: ${{ github.ref }}
app_id:
description: GitHub App ID for Auth (or client ID)
type: string
required: true
secrets:
app_secret:
description: GitHub App client secret for Auth
required: true

jobs:
e2e-tests:
name: Test
runs-on: ubuntu-latest
env:
CYPRESS_RESPONSE_TIMEOUT: 200000
CYPRESS_DEFAULT_COMMAND_TIMEOUT: 30000
CYPRESS_RETRIES: 2
strategy:
matrix:
include:
- branch: develop
webpack: dev
- branch: master
webpack: update
steps:
- uses: actions/checkout@v6
if: ${{ !env.ACT }}
with:
path: plugins/plugin_ABDesigner
ref: ${{ inputs.ref }}
- name: Local act mode
if: ${{ env.ACT }}
run: echo "ACT mode - skipping external-repo e2e flow."
- name: Generate a token
if: ${{ !env.ACT }}
id: generate-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ inputs.app_id }}
private-key: ${{ secrets.app_secret }}
repositories: ab_service_web

- uses: actions/checkout@v6
if: ${{ !env.ACT }}
with:
path: web
repository: CruGlobal/ab_service_web
token: ${{ steps.generate-token.outputs.token }}
ref: ${{ matrix.branch }}

- run: npm i
if: ${{ !env.ACT }}
working-directory: plugins/plugin_ABDesigner
- name: Webpack
if: ${{ !env.ACT }}
run: npm run build:${{ matrix.webpack }}
working-directory: plugins/plugin_ABDesigner

# webpack expects the folder to be called "web" ab-install action expects "ab_service_web"
- run: mv web ab_service_web
if: ${{ !env.ACT }}
- uses: CruGlobal/ab-install-action@v1
if: ${{ !env.ACT }}
with:
port: 8080
folder: ab
repository: CruGlobal/ab_service_web

- name: Check out kitchen-sink tests
if: ${{ !env.ACT }}
uses: actions/checkout@v6
with:
repository: CruGlobal/kitchensink_app
path: ab/test/e2e/cypress/e2e/kitchensink_app

# These next steps are to save our ablogs to file
- run: npm install pm2@latest -g
if: ${{ !env.ACT }}
- name: Save Logs
if: ${{ !env.ACT }}
run: pm2 start ./logs.js -- --toFile logs/ABServices.log
working-directory: ./ab

# Skipping the wait step. Cypress has a bit of wait time built in.
# - name: Wait for AB
# if: false
# uses: ifaxity/wait-on-action@v1.1.0
# with:
# resource: http://localhost:8080
# timeout: 300000

- name: Run Cypress Tests
if: ${{ !env.ACT }}
run: npm run test:e2e:ab-designer -- --browser chrome
working-directory: ./ab

- uses: actions/upload-artifact@v6
if: ${{ failure() && !env.ACT }}
with:
name: cypress-screenshots
path: ./ab/test/e2e/cypress/screenshots

- uses: actions/upload-artifact@v6
if: ${{ failure() && !env.ACT }}
with:
name: ABServices.log
path: ./ab/logs/ABServices.log
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build:dev": "webpack-cli --config webpack.dev.js",
"build:update": "webpack-cli --config webpack.prod.js",
"test": "mocha --config test/.mocharc.js test/**/*.test.js test/**/**/*.test.js",
"act": "act -W .github/workflows/e2e-test_local.yml -j e2e-tests --container-architecture linux/amd64",
"watch": "webpack-cli --config webpack.dev.js --watch --progress",
"break": "node --inspect-brk=9229 ./node_modules/.bin/webpack-cli --watch --progress"
},
Expand Down
Loading