Skip to content

Commit

Permalink
test e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Sridhar committed Jun 28, 2023
1 parent 3828d82 commit b448320
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 66 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ executors:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_ACCESS_TOKEN


test_env_vars: &test_env_vars
environment:
NPM_REGISTRY: http://0.0.0.0:4873/
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/callable-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: 'E2E Tests'

on:
workflow_call:
inputs:
package:
required: true
type: string
test_name:
required: true
type: string
framework:
required: true
type: string
category:
required: true
type: string
sample_name:
required: true
type: string
spec:
# optional - the script will use sample_name by default
type: string
default: ''
browser:
type: string
default: ''
amplifyjs_dir:
# optional - dir to amplify js workspace
type: string
default: ''

jobs:
unit_test:
name: Unit Tests - ${{ inputs.package }}
runs-on: ubuntu-latest
steps:
- name: Install ${{ inputs.test_name }} >> sample
run: |
echo "Current NPM registry: " $(yarn config get registry)
~/amplify-js/.circleci/retry-yarn-script.sh -s 'install' -n 3
- name: Run cypress tests for ${{ inputs.test_name }} sample on dev
run: |
cd ~/amplify-js-samples-staging
~/amplify-js/.circleci/retry-yarn-script.sh -s \
'ci:test ${{ inputs.framework }} \
${{ inputs.category }} \
${{ inputs.sample_name }} \
${{ inputs.spec }} \
${{ inputs.browser }} \
dev \
${{ inputs.amplifyjs_dir }}' -n 3
- name: Run cypress tests for ${{ inputs.test_name }} sample on prod
run: |
cd ~/amplify-js-samples-staging
~/amplify-js/.circleci/retry-yarn-script.sh -s \
'ci:test ${{ inputs.framework }} \
${{ inputs.category }} \
${{ inputs.sample_name }} \
${{ inputs.spec }} \
${{ inputs.browser }} \
prod \
${{ inputs.amplifyjs_dir }}' -n 3
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 https://github.com/actions/upload-artifact/commit/0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: my-artifact
path: |
~/amplify-js-samples-staging/cypress/videos
~/amplify-js-samples-staging/cypress/screenshots
76 changes: 32 additions & 44 deletions .github/workflows/callable-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,66 +14,54 @@ jobs:
e2e-tests:
name: Runs E2E tests
runs-on: ubuntu-latest

strategy:
matrix:
BROWSER: [chrome, firefox]
BROWSER: [chrome]
steps:
- name: Where we at?
run: |
pwd
ls
- name: Checkout repository
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
with:
# Minimal depth 2 so we can checkout the commit before possible merge commit.
fetch-depth: 2
path: aws-amplify
- name: Where we at?
run: |
pwd
ls
- name: Setup node and build the repository
uses: ./aws-amplify/.github/actions/node-and-build
# - name: Checkout repository
# uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
# with:
# # Minimal depth 2 so we can checkout the commit before possible merge commit.
# fetch-depth: 2
# path: aws-amplify
# - name: Setup node and build the repository
# uses: ./aws-amplify/.github/actions/node-and-build

- name: Checkout staging repo
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f
with:
repository: ashwinkumar6/amplify-js-samples-staging
path: aws-amplify-staging
token: ${{ secrets.GH_PAT }}
fetch-depth: 2
- name: Where we at?
run: |
pwd
ls
- name: Prepare staging repo
run: |
yarn
working-directory: ./aws-amplify-staging

- name: Start verdaccio
run: |
npx [email protected] &
sleep 15 # TODO waits until verdaccio is up and running
# - name: Start verdaccio
# run: |
# npx [email protected] &
# sleep 15 # TODO waits until verdaccio is up and running

- name: Publish to verdaccio
run: |
pwd
ls
npm i -g npm-cli-adduser
npm-cli-adduser
sleep 1
yarn config set registry $NPM_REGISTRY
npm set registry $NPM_REGISTRY
git config --global user.email $NPM_EMAIL
git config --global user.name $NPM_USER
git status
git --no-pager diff
.circleci/retry-yarn-script.sh -s publish:verdaccio -n 5 -r true
yarn info aws-amplify@unstable description
npm info aws-amplify@unstable version
working-directory: ./aws-amplify
shell: bash
# - name: Publish to verdaccio
# run: |
# pwd
# ls
# npm i -g npm-cli-adduser
# npm-cli-adduser
# sleep 1
# yarn config set registry $NPM_REGISTRY
# npm set registry $NPM_REGISTRY
# git config --global user.email $NPM_EMAIL
# git config --global user.name $NPM_USER
# git status
# git --no-pager diff
# .circleci/retry-yarn-script.sh -s publish:verdaccio -n 5 -r true
# yarn info aws-amplify@unstable description
# npm info aws-amplify@unstable version
# working-directory: ./aws-amplify
# shell: bash

- name: Run E2E test
run: |
Expand Down
45 changes: 23 additions & 22 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ name: E2E test
on: [push]

jobs:
prebuild:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
with:
# Minimal depth 2 so we can checkout the commit before possible merge commit.
fetch-depth: 2
path: aws-amplify
- name: Setup node and build the repository
uses: ./aws-amplify/.github/actions/node-and-build
test-checkout:
runs-on: ubuntu-latest
steps:
- name: Checkout stating repo
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f
with:
repository: ashwinkumar6/amplify-js-samples-staging
path: aws-amplify-staging
token: ${{ secrets.GH_PAT }}
# prebuild:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
# with:
# # Minimal depth 2 so we can checkout the commit before possible merge commit.
# fetch-depth: 2
# path: aws-amplify
# - name: Setup node and build the repository
# uses: ./aws-amplify/.github/actions/node-and-build

# test-checkout:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout stating repo
# uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f
# with:
# repository: ashwinkumar6/amplify-js-samples-staging
# path: aws-amplify-staging
# token: ${{ secrets.GH_PAT }}

e2e:
needs: prebuild
# needs: prebuild
uses: ./.github/workflows/callable-e2e.yml
secrets: inherit
secrets: inherit

0 comments on commit b448320

Please sign in to comment.