Skip to content

Commit ebb0b44

Browse files
feat: e2e dev preview tests
1 parent f9fd83c commit ebb0b44

2 files changed

Lines changed: 72 additions & 7 deletions

File tree

.github/workflows/test.yml

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,76 @@ jobs:
3030
uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main
3131
nuts:
3232
needs: linux-unit-tests
33-
uses: salesforcecli/github-workflows/.github/workflows/nut.yml@main
34-
secrets: inherit
33+
name: NUTs (${{ matrix.os }})
34+
runs-on: ${{ matrix.os }}
3535
strategy:
3636
matrix:
3737
os: [ubuntu-latest, windows-latest]
3838
fail-fast: false
39-
with:
40-
os: ${{ matrix.os }}
41-
# Install Playwright browsers and system deps before NUTs (component-preview tests use Chromium)
42-
command: yarn playwright install --with-deps && yarn test:nuts
39+
steps:
40+
- name: Configure git longpaths if on Windows
41+
if: runner.os == 'Windows'
42+
run: git config --system core.longpaths true
43+
44+
- uses: actions/checkout@v4
45+
46+
- uses: google/wireit@setup-github-actions-caching/v2
47+
continue-on-error: true
48+
49+
- uses: actions/setup-node@v4
50+
with:
51+
node-version: lts/*
52+
cache: yarn
53+
54+
- name: Cache node modules
55+
id: cache-nodemodules
56+
uses: actions/cache@v4
57+
env:
58+
cache-name: cache-node-modules
59+
with:
60+
path: '**/node_modules'
61+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
62+
63+
- name: add CLI as global dependency
64+
uses: salesforcecli/github-workflows/.github/actions/retry@main
65+
with:
66+
max_attempts: 3
67+
command: npm install @salesforce/cli@nightly -g
68+
69+
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main
70+
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
71+
72+
- name: Install wireit
73+
run: yarn add wireit@^0.14.12
74+
75+
- run: yarn compile
76+
77+
- name: Install Playwright browsers
78+
run: yarn playwright install --with-deps
79+
80+
- name: Check that oclif config exists
81+
id: is-oclif-plugin
82+
run: echo "bool=$(jq 'if .oclif then true else false end' package.json)" >> "$GITHUB_OUTPUT"
83+
84+
- run: yarn oclif manifest
85+
if: steps.is-oclif-plugin.outputs.bool == 'true'
86+
87+
- name: NUTs with 3 attempts
88+
uses: salesforcecli/github-workflows/.github/actions/retry@main
89+
with:
90+
max_attempts: 3
91+
command: yarn test:nuts
92+
retry_on: error
93+
env:
94+
TESTKIT_AUTH_URL: ${{ secrets.TESTKIT_AUTH_URL }}
95+
TESTKIT_HUB_USERNAME: ${{ secrets.TESTKIT_HUB_USERNAME }}
96+
TESTKIT_JWT_CLIENT_ID: ${{ secrets.TESTKIT_JWT_CLIENT_ID }}
97+
TESTKIT_JWT_KEY: ${{ secrets.TESTKIT_JWT_KEY }}
98+
TESTKIT_HUB_INSTANCE: ${{ secrets.TESTKIT_HUB_INSTANCE }}
99+
ONEGP_TESTKIT_AUTH_URL: ${{ secrets.ONEGP_TESTKIT_AUTH_URL }}
100+
SF_CHANGE_CASE_SFDX_AUTH_URL: ${{ secrets.SF_CHANGE_CASE_SFDX_AUTH_URL }}
101+
SF_CHANGE_CASE_TEMPLATE_ID: ${{ secrets.SF_CHANGE_CASE_TEMPLATE_ID }}
102+
SF_CHANGE_CASE_CONFIGURATION_ITEM: ${{ secrets.SF_CHANGE_CASE_CONFIGURATION_ITEM }}
103+
TESTKIT_SETUP_RETRIES: 2
104+
SF_DISABLE_TELEMETRY: true
105+
DEBUG: ${{ vars.DEBUG }}

test/commands/lightning/dev/component-preview/hmr.nut.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ describe('lightning preview hot module reload', () => {
100100

101101
it('should re-render component and hot reload .css changes', async () => {
102102
// Assert initial color
103-
const greeting = page.locator('.greeting');
103+
// Assert initial HTML
104+
const greeting = page.getByText(INITIAL_GREETING);
105+
expect(await greeting.textContent()).to.equal(INITIAL_GREETING);
104106
const initialGreetingColor = await greeting.evaluate((e) => window.getComputedStyle(e).color);
105107
expect(initialGreetingColor).to.equal(BLUE);
106108

0 commit comments

Comments
 (0)