Skip to content

Commit b2a9873

Browse files
committed
chore(catalyst): CATALYST-1297 Use test matrix
1 parent c694fd6 commit b2a9873

2 files changed

Lines changed: 44 additions & 131 deletions

File tree

.github/workflows/basic.yml

Lines changed: 34 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -87,68 +87,31 @@ jobs:
8787
run: pnpm run test
8888

8989
e2e-tests:
90-
name: E2E Functional Tests
90+
name: E2E Functional Tests (${{ matrix.name }})
9191

9292
runs-on: ubuntu-latest
9393

94-
steps:
95-
- name: Checkout code
96-
uses: actions/checkout@v4
97-
with:
98-
fetch-depth: 2
99-
100-
- uses: pnpm/action-setup@v3
101-
102-
- name: Use Node.js
103-
uses: actions/setup-node@v4
104-
with:
105-
node-version-file: ".nvmrc"
106-
cache: "pnpm"
107-
108-
- name: Install dependencies
109-
run: pnpm install --frozen-lockfile
110-
111-
- name: Install Playwright browsers
112-
run: pnpm exec playwright install --with-deps chromium webkit
113-
working-directory: ./core
114-
115-
- name: Build catalyst-client
116-
run: pnpm --filter @bigcommerce/catalyst-client build
117-
118-
- name: Build catalyst-core
119-
run: pnpm --filter @bigcommerce/catalyst-core build
120-
121-
- name: Start server
122-
run: |
123-
pnpm start &
124-
npx wait-on http://localhost:3000 --timeout 60000
125-
working-directory: ./core
126-
env:
127-
PORT: 3000
128-
AUTH_SECRET: ${{ secrets.TESTS_AUTH_SECRET }}
129-
AUTH_TRUST_HOST: ${{ vars.TESTS_AUTH_TRUST_HOST }}
130-
BIGCOMMERCE_TRUSTED_PROXY_SECRET: ${{ secrets.BIGCOMMERCE_TRUSTED_PROXY_SECRET }}
131-
TESTS_LOCALE: ${{ vars.TESTS_LOCALE }}
132-
DEFAULT_REVALIDATE_TARGET: 1
133-
134-
- name: Run E2E tests
135-
run: pnpm exec playwright test tests/ui/e2e
136-
working-directory: ./core
137-
env:
138-
PLAYWRIGHT_TEST_BASE_URL: http://localhost:3000
139-
140-
- name: Upload test results
141-
if: ${{ !cancelled() }}
142-
uses: actions/upload-artifact@v4
143-
with:
144-
name: playwright-report
145-
path: ./core/.tests/reports/
146-
retention-days: 3
147-
148-
e2e-tests-no-trailing:
149-
name: E2E Functional Tests (TRAILING_SLASH=false)
150-
151-
runs-on: ubuntu-latest
94+
strategy:
95+
matrix:
96+
include:
97+
- name: default
98+
browsers: chromium webkit
99+
test-filter: tests/ui/e2e
100+
trailing-slash: true
101+
locale-var: TESTS_LOCALE
102+
artifact-name: playwright-report
103+
- name: TRAILING_SLASH=false
104+
browsers: chromium
105+
test-filter: tests/ui/e2e --grep @no-trailing-slash
106+
trailing-slash: false
107+
locale-var: TESTS_LOCALE
108+
artifact-name: playwright-report-no-trailing
109+
- name: alternate locale
110+
browsers: chromium
111+
test-filter: tests/ui/e2e --grep @alternate-locale
112+
trailing-slash: true
113+
locale-var: TESTS_ALTERNATE_LOCALE
114+
artifact-name: playwright-report-alternate-locale
152115

153116
steps:
154117
- name: Checkout code
@@ -168,73 +131,17 @@ jobs:
168131
run: pnpm install --frozen-lockfile
169132

170133
- name: Install Playwright browsers
171-
run: pnpm exec playwright install --with-deps chromium
172-
working-directory: ./core
173-
174-
- name: Build catalyst-client
175-
run: pnpm --filter @bigcommerce/catalyst-client build
176-
177-
- name: Build catalyst-core
178-
run: pnpm --filter @bigcommerce/catalyst-core build
179-
180-
- name: Start server
181-
run: |
182-
pnpm start &
183-
npx wait-on http://localhost:3000 --timeout 60000
184-
working-directory: ./core
185-
env:
186-
PORT: 3000
187-
AUTH_SECRET: ${{ secrets.TESTS_AUTH_SECRET }}
188-
AUTH_TRUST_HOST: ${{ vars.TESTS_AUTH_TRUST_HOST }}
189-
BIGCOMMERCE_TRUSTED_PROXY_SECRET: ${{ secrets.BIGCOMMERCE_TRUSTED_PROXY_SECRET }}
190-
TESTS_LOCALE: ${{ vars.TESTS_LOCALE }}
191-
TRAILING_SLASH: false
192-
193-
- name: Run E2E tests
194-
run: pnpm exec playwright test tests/ui/e2e --grep @no-trailing-slash
134+
run: pnpm exec playwright install --with-deps ${{ matrix.browsers }}
195135
working-directory: ./core
196-
env:
197-
PLAYWRIGHT_TEST_BASE_URL: http://localhost:3000
198-
199-
- name: Upload test results
200-
if: ${{ !cancelled() }}
201-
uses: actions/upload-artifact@v4
202-
with:
203-
name: playwright-report-no-trailing
204-
path: ./core/.tests/reports/
205-
retention-days: 3
206-
207-
e2e-tests-alternate-locale:
208-
name: E2E Functional Tests (alternate locale)
209-
210-
runs-on: ubuntu-latest
211-
212-
steps:
213-
- name: Checkout code
214-
uses: actions/checkout@v4
215-
with:
216-
fetch-depth: 2
217-
218-
- uses: pnpm/action-setup@v3
219-
220-
- name: Use Node.js
221-
uses: actions/setup-node@v4
222-
with:
223-
node-version-file: ".nvmrc"
224-
cache: "pnpm"
225-
226-
- name: Install dependencies
227-
run: pnpm install --frozen-lockfile
228136

229-
- name: Install Playwright browsers
230-
run: pnpm exec playwright install --with-deps chromium
231-
working-directory: ./core
137+
# - name: Build catalyst-client
138+
# run: pnpm --filter @bigcommerce/catalyst-client build
232139

233-
- name: Build catalyst-client
234-
run: pnpm --filter @bigcommerce/catalyst-client build
140+
# - name: Build catalyst-core
141+
# run: pnpm --filter @bigcommerce/catalyst-core build
235142

236-
- name: Build catalyst-core
237-
run: pnpm --filter @bigcommerce/catalyst-core build
143+
- name: Build catalyst
144+
run: pnpm build
238145

239146
- name: Start server
240147
run: |
@@ -246,10 +153,12 @@ jobs:
246153
AUTH_SECRET: ${{ secrets.TESTS_AUTH_SECRET }}
247154
AUTH_TRUST_HOST: ${{ vars.TESTS_AUTH_TRUST_HOST }}
248155
BIGCOMMERCE_TRUSTED_PROXY_SECRET: ${{ secrets.BIGCOMMERCE_TRUSTED_PROXY_SECRET }}
249-
TESTS_LOCALE: ${{ vars.TESTS_ALTERNATE_LOCALE }}
156+
TESTS_LOCALE: ${{ vars[matrix.locale-var] }}
157+
TRAILING_SLASH: ${{ matrix.trailing-slash }}
158+
DEFAULT_REVALIDATE_TARGET: ${{ matrix.name == 'default' && '1' || '' }}
250159

251160
- name: Run E2E tests
252-
run: pnpm exec playwright test tests/ui/e2e --grep @alternate-locale
161+
run: pnpm exec playwright test ${{ matrix.test-filter }}
253162
working-directory: ./core
254163
env:
255164
PLAYWRIGHT_TEST_BASE_URL: http://localhost:3000
@@ -258,6 +167,6 @@ jobs:
258167
if: ${{ !cancelled() }}
259168
uses: actions/upload-artifact@v4
260169
with:
261-
name: playwright-report-alternate-locale
170+
name: ${{ matrix.artifact-name }}
262171
path: ./core/.tests/reports/
263172
retention-days: 3

core/tests/ui/e2e/compare.spec.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,16 @@ test('Validate compare page with alternate currency', async ({ page, catalog, cu
5555
await page.goto(`/compare/?ids=${product.id},${productWithVariants.id}`);
5656
await page.waitForLoadState('networkidle');
5757
await expect(
58-
page.getByText(
59-
format.number(product.price, {
60-
style: 'currency',
61-
currency: defaultCurrency,
62-
}),
63-
),
58+
page
59+
60+
.getByText(
61+
format.number(product.price, {
62+
style: 'currency',
63+
currency: defaultCurrency,
64+
65+
}),
66+
)
67+
.first(),
6468
).toBeVisible();
6569

6670
await currency.selectCurrency(alternateCurrency);

0 commit comments

Comments
 (0)