Skip to content

Commit 80c46a6

Browse files
committed
Test e2e prod
1 parent ec6b1b8 commit 80c46a6

File tree

4 files changed

+35
-248
lines changed

4 files changed

+35
-248
lines changed

.github/workflows/callable-local-e2e-test.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,36 @@ jobs:
6262
uses: ./amplify-data/.github/actions/load-verdaccio-with-amplify-data
6363
- name: Make script executable
6464
run: chmod +x ./amplify-data/scripts/retry-npm-script.sh
65-
- name: Run cypress tests for webpack e2e test dev
65+
# - name: Run cypress tests for webpack e2e test dev
66+
# shell: bash
67+
# working-directory: ./amplify-data
68+
# env:
69+
# E2E_FRAMEWORK: ${{ inputs.framework }}
70+
# E2E_SAMPLE_NAME: ${{ matrix.sample_name }}
71+
# E2E_SPEC: ${{ inputs.spec }}
72+
# E2E_BROWSER: ${{ matrix.browser }}
73+
# E2E_BACKEND: ${{ inputs.backend }}
74+
# E2E_RETRY_COUNT: ${{ inputs.retry_count }}
75+
# E2E_TEST_NAME: ${{ inputs.test_name }}
76+
# E2E_NPM_SCRIPT: ${{ inputs.npm_script }}
77+
# E2E_ENV: ${{ inputs.env }}
78+
# run: |
79+
# if [ -z "$E2E_NPM_SCRIPT" ]; then
80+
# ../amplify-data/scripts/retry-npm-script.sh -s \
81+
# "ci:test \
82+
# $E2E_FRAMEWORK \
83+
# $E2E_SAMPLE_NAME \
84+
# $E2E_SPEC \
85+
# $E2E_BROWSER \
86+
# dev \
87+
# $E2E_BACKEND \
88+
# --env $(echo $E2E_ENV | jq -r 'tostring')" \
89+
# $E2E_NPM_SCRIPT \
90+
# -n $E2E_RETRY_COUNT
91+
# else
92+
# echo "Skipping specialized yarn script execution in the dev environment."
93+
# fi
94+
- name: Run cypress tests for ${{ inputs.test_name }} prod
6695
shell: bash
6796
working-directory: ./amplify-data
6897
env:
@@ -74,6 +103,7 @@ jobs:
74103
E2E_RETRY_COUNT: ${{ inputs.retry_count }}
75104
E2E_TEST_NAME: ${{ inputs.test_name }}
76105
E2E_NPM_SCRIPT: ${{ inputs.npm_script }}
106+
E2E_NPM_SCRIPT_ARGS: ${{ inputs.npm_script_args }}
77107
E2E_ENV: ${{ inputs.env }}
78108
run: |
79109
if [ -z "$E2E_NPM_SCRIPT" ]; then
@@ -83,13 +113,13 @@ jobs:
83113
$E2E_SAMPLE_NAME \
84114
$E2E_SPEC \
85115
$E2E_BROWSER \
86-
dev \
116+
prod \
87117
$E2E_BACKEND \
88118
--env $(echo $E2E_ENV | jq -r 'tostring')" \
89119
$E2E_NPM_SCRIPT \
90120
-n $E2E_RETRY_COUNT
91121
else
92-
echo "Skipping specialized yarn script execution in the dev environment."
122+
npm run "$E2E_NPM_SCRIPT" "$E2E_NPM_SCRIPT_ARGS"
93123
fi
94124
- name: Upload artifact
95125
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 https://github.com/actions/upload-artifact/commit/0b7f8abb1508181956e8e162db84b466c27e18ce

.github/workflows/callable-local-e2e-webpack-test.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

scripts/test.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {parseArgs} from 'node:util';
33
import fsExtra from 'fs-extra';
44
import common from './common.js';
55
const {logError} = common;
6-
const { pathExistsSync } = fsExtra
6+
const { pathExistsSync } = fsExtra;
77

88
const defaultTimeout = 5 * 60 * 1000; // 5 minutes
99

@@ -117,17 +117,6 @@ const runAppOnProd = ({ framework, sample, backend, env }) => {
117117
const sampleDir = sampleDirectory({ framework, sample });
118118
let distDir; // distribution directory
119119
if (framework === FRAMEWORKS.webpack) {
120-
const { name } = JSON.parse(fs.readFileSync(`${sampleDir}/package.json`));
121-
distDir = `${sampleDir}/dist/${name}`;
122-
} else if (framework === FRAMEWORKS.react || framework === FRAMEWORKS.next) {
123-
distDir = `${sampleDir}/build`;
124-
} else if (framework === FRAMEWORKS.vue || framework === FRAMEWORKS.vite) {
125-
distDir = `${sampleDir}/dist`;
126-
} else if (framework === FRAMEWORKS.rollup) {
127-
distDir = `${sampleDir}/public`;
128-
} else if (framework === FRAMEWORKS.ionic) {
129-
distDir = `${sampleDir}/www`;
130-
} else if (framework === FRAMEWORKS.javascript) {
131120
distDir = `${sampleDir}/dist`;
132121
} else {
133122
logError(`unknown framework: ${framework}`);
@@ -151,7 +140,7 @@ const runAppOnProd = ({ framework, sample, backend, env }) => {
151140
const command = [
152141
envVars && `export ${envVars}`,
153142
install,
154-
`npm --prefix ${sampleDir} run ${buildCommand} ${prodFlag}`,
143+
`npm run ${buildCommand} --prefix ${sampleDir}`,
155144
serveCommand,
156145
]
157146
.filter(Boolean)

scripts/webpack-test.js

Lines changed: 0 additions & 186 deletions
This file was deleted.

0 commit comments

Comments
 (0)