Skip to content

Commit

Permalink
chore(repo): add ssr two clients E2E
Browse files Browse the repository at this point in the history
  • Loading branch information
HuiSF committed Jun 6, 2024
1 parent 322cc48 commit d4c409e
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/integ-config/integ-specialized.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tests:
# SSR context isolation
- test_name: integ_ssr_context_isolation
desc: 'SSR Context Isolation'
framework: next
category: ssr-adapter
sample_name: ssr-context-isolation
spec: ssr-context-isolation
70 changes: 70 additions & 0 deletions .github/workflows/callable-e2e-test-specialized.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: E2E Test Specialized
run-name: e2e_specialized.${{ inputs.test_name }}

on:
workflow_call:
inputs:
test_name:
required: true
type: string
framework:
required: true
type: string
category:
required: true
type: string
sample_name:
required: true
type: string
timeout_minutes:
required: true
type: number

env:
AMPLIFY_DIR: /home/runner/work/amplify-js/amplify-js/amplify-js
CYPRESS_GOOGLE_CLIENTID: ${{ secrets.CYPRESS_GOOGLE_CLIENTID }}
CYPRESS_GOOGLE_CLIENT_SECRET: ${{ secrets.CYPRESS_GOOGLE_CLIENT_SECRET }}
CYPRESS_GOOGLE_REFRESH_TOKEN: ${{ secrets.CYPRESS_GOOGLE_REFRESH_TOKEN }}

jobs:
e2e-test:
name: E2E Specialized ${{ inputs.test_name }}
runs-on: ubuntu-latest
strategy:
matrix:
sample_name:
- ${{ fromJson(inputs.sample_name) }}
fail-fast: false
timeout-minutes: ${{ inputs.timeout_minutes }}

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: amplify-js
- name: Setup node and build the repository
uses: ./amplify-js/.github/actions/node-and-build
- name: Setup samples staging repository
uses: ./amplify-js/.github/actions/setup-samples-staging
with:
GH_TOKEN_STAGING_READ: ${{ secrets.GH_TOKEN_STAGING_READ }}
- name: Load Verdaccio with AmplifyJs
uses: ./amplify-js/.github/actions/load-verdaccio-with-amplify-js
- name: Run Sample
shell: bash
working-directory: amplify-js-samples-staging/samples/${{ inputs.framework }}/${{ inputs.category }}/${{ matrix.sample_name }}
run: yarn run:sample
- name: Run tests
shell: bash
working-directory: amplify-js-samples-staging
run: chmod +x scripts/test-ssr-context-isolation.sh && yarn ci:ssr-context-isolation
- name: Upload artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 https://github.com/actions/upload-artifact/commit/0b7f8abb1508181956e8e162db84b466c27e18ce
if: failure()
with:
name: ${{ inputs.test_name }}
if-no-files-found: ignore
path: |
amplify-js-samples-staging/cypress/videos
amplify-js-samples-staging/cypress/screenshots
retention-days: 14
18 changes: 18 additions & 0 deletions .github/workflows/callable-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ jobs:
echo "INTEG_CONFIG=$(cat .github/integ-config/integ-all.yml | yq '.tests' -o=json | jq -c .)" >> $GITHUB_OUTPUT
echo "INTEG_CONFIG_HEADLESS=$(cat .github/integ-config/integ-all-headless.yml | yq '.tests' -o=json | jq -c .)" >> $GITHUB_OUTPUT
echo "DETOX_INTEG_CONFIG=$(cat .github/integ-config/detox-integ-all.yml | yq -o=json | jq -c .)" >> $GITHUB_OUTPUT
echo "INTEG_CONFIG_SPECIALIZED=$(cat .github/integ-config/integ-specialized.yml | yq -o=json | jq -c .)" >> $GITHUB_OUTPUT
working-directory: ./amplify-js
outputs:
integ-config: ${{ steps.load_config.outputs.INTEG_CONFIG }}
integ-config-headless: ${{ steps.load_config.outputs.INTEG_CONFIG_HEADLESS }}
detox-integ-config: ${{ steps.load_config.outputs.DETOX_INTEG_CONFIG }}
integ-specialized-config: ${{ steps.load_config.outputs.INTEG_CONFIG_SPECIALIZED }}

e2e-test-runner:
name: E2E test runnner
Expand Down Expand Up @@ -73,3 +75,19 @@ jobs:
test_name: ${{ matrix.integ-config.test_name }}
working_directory: ${{ matrix.integ-config.working_directory }}
timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 45 }}

specialized-e2e-test-runner:
name: Specialized E2E test runner
needs: e2e-prep
strategy:
matrix:
integ-config: ${{ fromJson(needs.e2e-prep.outputs.integ-specialized-config) }}
fail-fast: false
secrets: inherit
uses: ./.github/workflows/callable-e2e-test-specialized.yml
with:
test_name: ${{ matrix.integ-config.test_name }}
framework: ${{ matrix.integ-config.framework }}
category: ${{ matrix.integ-config.category }}
sample_name: ${{ toJSON(matrix.integ-config.sample_name) || '[""]' }}
timeout_minutes: ${{ matrix.integ-config.timeout_minutes || 35 }}

0 comments on commit d4c409e

Please sign in to comment.