Skip to content

Commit b563936

Browse files
authored
E2E test updates (#93)
* E2E tests update * updating e2e workflow * updated e2e workflow
1 parent 6ebba3c commit b563936

3 files changed

Lines changed: 37 additions & 11 deletions

File tree

.github/workflows/e2e-tests.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: e2e tests
22

33
on:
4-
# Nightly workflow - Run at 2 AM UTC daily
4+
# Scheduled workflow
5+
# 13:00 UTC ~= 8:00 AM ET (EST)
6+
# 01:00 UTC ~= 8:00 PM ET (EST)
57
schedule:
6-
- cron: '0 2 * * *'
7-
# Post-merge - Run after changes are merged to main
8-
push:
9-
branches: [main]
8+
- cron: '0 13 * * *'
9+
- cron: '0 1 * * *'
1010
# Manual trigger - Support workflow_dispatch for on-demand runs
1111
workflow_dispatch:
1212
inputs:
@@ -32,9 +32,10 @@ on:
3232
type: string
3333
jobs:
3434
e2e-tests:
35+
# E2E tests run only on the current LTS Node version for stability and speed.
3536
strategy:
3637
matrix:
37-
node-version: [22.x, 24.x]
38+
node-version: [22.x]
3839
runs-on: ubuntu-latest
3940
environment: e2e-dev
4041
timeout-minutes: 25
@@ -129,7 +130,7 @@ jobs:
129130
retention-days: 30
130131

131132
- name: Notify on Failure
132-
if: failure() && (github.event_name == 'schedule' || github.event_name == 'push') && steps.check-secrets.outputs.has-secrets == 'true'
133+
if: failure() && github.event_name == 'schedule' && steps.check-secrets.outputs.has-secrets == 'true'
133134
uses: actions/github-script@v7
134135
with:
135136
script: |

packages/b2c-cli/test/functional/e2e/sites-operations.test.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ describe('Sites Operations E2E Tests', function () {
2727
let serverHostname: string;
2828
let ownSandboxId: null | string = null;
2929

30+
async function sleep(ms: number): Promise<void> {
31+
await new Promise((resolve) => {
32+
setTimeout(resolve, ms);
33+
});
34+
}
35+
3036
before(async function () {
3137
if (!process.env.SFCC_CLIENT_ID || !process.env.SFCC_CLIENT_SECRET) {
3238
this.skip();
@@ -66,13 +72,32 @@ describe('Sites Operations E2E Tests', function () {
6672
console.log(`Created dedicated sandbox ${ownSandboxId} at ${serverHostname}`);
6773
}
6874

69-
const importResult = await runCLI(['job', 'import', SITE_ARCHIVE_PATH, '--server', serverHostname]);
75+
async function runImportWithRetry(remainingRetries: number) {
76+
const importResult = await runCLI(['job', 'import', SITE_ARCHIVE_PATH, '--server', serverHostname]);
77+
if (importResult.exitCode === 0) return importResult;
78+
79+
const msg = importResult.stderr || importResult.stdout;
80+
const isTransient = /fetch failed|ECONNRESET|ETIMEDOUT/i.test(msg);
81+
82+
if (!isTransient || remainingRetries <= 0) return importResult;
83+
84+
console.warn(
85+
`Sites E2E: transient import error, retrying after delay (remaining retries: ${remainingRetries}):`,
86+
msg,
87+
);
88+
await sleep(2000);
89+
return runImportWithRetry(remainingRetries - 1);
90+
}
91+
92+
const importResult = await runImportWithRetry(2);
7093

7194
if (importResult.exitCode !== 0) {
7295
const msg = importResult.stderr || importResult.stdout;
7396
// If the sandbox/client lacks permissions, treat this as a valid customer scenario
74-
// and skip the suite rather than failing in before().
75-
if (/not\s+allowed|unauthorized|forbidden|401|403/i.test(msg)) {
97+
// and skip the suite rather than failing in before(). Also skip on transient
98+
// network issues where the underlying HTTP fetch fails.
99+
if (/not\s+allowed|unauthorized|forbidden|401|403|fetch failed/i.test(msg)) {
100+
console.warn('Sites E2E: skipping suite due to import error:', msg);
76101
this.skip();
77102
}
78103
expect(importResult.exitCode).to.equal(0, msg);

packages/b2c-cli/test/functional/e2e/webdav-operations.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ describe('WebDAV Operations E2E Tests', function () {
368368
if (result.exitCode !== 0) return false;
369369
const response = JSON.parse(result.stdout);
370370
return response.entries?.some((e: any) => entryName(e) === testFileName);
371-
});
371+
}, 300_000);
372372
});
373373
});
374374
});

0 commit comments

Comments
 (0)