Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit 8262004

Browse files
authored
Merge 0761730 into 9e75d76
2 parents 9e75d76 + 0761730 commit 8262004

File tree

2 files changed

+53
-15
lines changed

2 files changed

+53
-15
lines changed

.github/workflows/e2e-tests.yml

+44-14
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ jobs:
2020
pr_git_sha: ${{ steps.set_pr_git_sha.outputs.pr_git_sha }}
2121

2222
steps:
23+
# For non-fork PRs
24+
- uses: actions/checkout@v2
25+
if: ${{ github.event.inputs.pull_request_id == '' }}
26+
with:
27+
ref: ${{ github.event.inputs.sha || github.ref }}
28+
2329
# For manually run PRs
2430
- name: Initialize empty git repository
2531
if: ${{ github.event.inputs.pull_request_id != '' }}
@@ -50,6 +56,37 @@ jobs:
5056
sha: ${{ steps.set_pr_git_sha.outputs.pr_git_sha || github.event.inputs.sha || github.sha }}
5157
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
5258

59+
- name: Use Node.js ${{ matrix.node-version }}
60+
uses: actions/setup-node@v2
61+
with:
62+
node-version: "12.x"
63+
64+
- name: Build
65+
run: yarn --frozen-lockfile
66+
67+
- name: Install test utils
68+
run: |
69+
cd packages/e2e-tests/test-utils
70+
yarn --frozen-lockfile
71+
72+
- name: "Compress build"
73+
run: tar -caf build.tar.gz ./packages ./node_modules
74+
75+
- name: Wait for existing workflow to complete before e2e tests
76+
uses: softprops/turnstyle@v1
77+
with:
78+
poll-interval-seconds: 15
79+
same-branch-only: false
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
83+
- name: "Upload build"
84+
uses: actions/upload-artifact@v2
85+
with:
86+
name: build.tar.gz
87+
path: build.tar.gz
88+
retention-days: 1
89+
5390
run-e2e-tests:
5491
needs: [initialize]
5592
runs-on: [ubuntu-latest]
@@ -96,21 +133,13 @@ jobs:
96133
with:
97134
node-version: ${{ matrix.node-version }}
98135

99-
- run: yarn --frozen-lockfile
100-
# TODO: build once and cache for all e2e tests
101-
102-
- name: Install test utils
103-
run: |
104-
cd packages/e2e-tests/test-utils
105-
yarn --frozen-lockfile
106-
107-
- name: Wait for existing workflow to complete before e2e tests
108-
uses: softprops/turnstyle@v1
136+
- name: "Download build"
137+
uses: actions/download-artifact@v2
109138
with:
110-
poll-interval-seconds: 15
111-
same-branch-only: false
112-
env:
113-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
name: build.tar.gz
140+
141+
- name: "Uncompress build"
142+
run: tar -xf build.tar.gz
114143

115144
- name: Run e2e tests
116145
env:
@@ -125,6 +154,7 @@ jobs:
125154
yarn --frozen-lockfile
126155
sleep $[($RANDOM % 15) + 1]s # Sleep 1-15 seconds to try to avoid throttling
127156
yarn e2e:ci
157+
timeout-minutes: 30 # In case something goes wrong
128158

129159
- name: Mark end-to-end tests as failed
130160
# For manual runs (e.g for fork PRs) don't update commit status as there won't be permissions to do so

packages/e2e-tests/next-app-with-locales/cypress/integration/pages.test.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,15 @@ describe("Pages Tests", () => {
222222
].forEach(({ path }) => {
223223
it(`serves page ${path} with correct content soon`, () => {
224224
cy.visit(path);
225-
cy.location("pathname").should("eq", path);
225+
226+
// Next.js currently behaves inconsistently here,
227+
// dropping the default locale for static pages
228+
if (path === "/en/fallback/d") {
229+
cy.location("pathname").should("eq", "/fallback/d");
230+
} else {
231+
cy.location("pathname").should("eq", path);
232+
}
233+
226234
cy.contains(`Hello ${path.slice(-1)}`);
227235
});
228236
});

0 commit comments

Comments
 (0)