Compare commits

...

11 Commits

Author SHA1 Message Date
c43bf6bb99 add headless option 2024-08-19 20:40:43 +10:00
1d570b9449 try legit google chrome with --enable-gpu 2024-08-19 20:30:31 +10:00
24f2351412 add --enable-gpu launch option 2024-08-19 19:58:52 +10:00
bbc13469c2 Desktop "Chrome" 2024-08-19 18:37:42 +10:00
5c291d2c21 try chromium instead of branded browser 2024-08-19 18:12:54 +10:00
041a83e7c7 disable vector install 2024-08-18 13:01:54 +10:00
5f523278f3 use gh browsers 2024-08-18 12:50:51 +10:00
6ee9105a2c troubleshoot gh failing macos test 2024-08-18 12:34:18 +10:00
cee27abe95 fux
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-08-17 14:27:17 -07:00
ef2e7d83b0 fix outputs
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-08-17 14:26:31 -07:00
b3ecaeb7fa updates
Signed-off-by: Jess Frazelle <github@jessfraz.com>
2024-08-17 14:16:45 -07:00
3 changed files with 314 additions and 305 deletions

View File

@ -1,7 +1,7 @@
name: Playwright Tests name: Playwright Tests
on: on:
push: push:
branches: [ main ] branches: [ main, ryanrosello-og/troubleshoot-turn-on-macos ]
pull_request: pull_request:
branches: [ main ] branches: [ main ]
@ -38,9 +38,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
shardIndex: [1, 2, 3, 4] shardIndex: [1]
shardTotal: [4] shardTotal: [1]
os: [ubuntu-latest, windows-latest] os: [macos-14]
# os: [ubuntu-latest, windows-latest, macos-14]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
needs: check-rust-changes needs: check-rust-changes
steps: steps:
@ -55,15 +56,19 @@ jobs:
- name: Install dependencies - name: Install dependencies
shell: bash shell: bash
run: yarn run: yarn
- name: Cache Playwright Browsers # - name: Cache Playwright Browsers
uses: actions/cache@v4 # uses: actions/cache@v4
with: # with:
path: | # path: |
~/.cache/ms-playwright/ # ~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }} # key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Browsers - name: Install Playwright Browsers
shell: bash
run: yarn playwright install --with-deps run: yarn playwright install --with-deps
# - name: install chrome from the cask macos
# if: ${{ startsWith(matrix.os, 'macos') }}
# shell: bash
# run: |
# brew install --cask google-chrome
- name: Download Wasm Cache - name: Download Wasm Cache
id: download-wasm id: download-wasm
if: needs.check-rust-changes.outputs.rust-changed == 'false' if: needs.check-rust-changes.outputs.rust-changed == 'false'
@ -92,28 +97,28 @@ jobs:
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './src/wasm-lib'
- name: install good sed # - name: install good sed
if: ${{ startsWith(matrix.os, 'macos') }} # if: ${{ startsWith(matrix.os, 'macos') }}
shell: bash # shell: bash
run: | # run: |
brew install gnu-sed # brew install gnu-sed
echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH # echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
- name: Install vector # - name: Install vector
shell: bash # shell: bash
if: ${{ !startsWith(matrix.os, 'windows') }} # if: ${{ !startsWith(matrix.os, 'windows') }}
run: | # run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh # curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
chmod +x /tmp/vector.sh # chmod +x /tmp/vector.sh
/tmp/vector.sh -y -no-modify-path # /tmp/vector.sh -y -no-modify-path
mkdir -p /tmp/vector # mkdir -p /tmp/vector
cp .github/workflows/vector.toml /tmp/vector.toml # cp .github/workflows/vector.toml /tmp/vector.toml
sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml # sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml
sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml # sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml
sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml # sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml
sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml # sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml
sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml # sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml
cat /tmp/vector.toml # cat /tmp/vector.toml
${HOME}/.vector/bin/vector --config /tmp/vector.toml & # ${HOME}/.vector/bin/vector --config /tmp/vector.toml &
- name: Build Wasm (because rust diff) - name: Build Wasm (because rust diff)
if: needs.check-rust-changes.outputs.rust-changed == 'true' if: needs.check-rust-changes.outputs.rust-changed == 'true'
shell: bash shell: bash
@ -125,111 +130,112 @@ jobs:
- name: build web - name: build web
run: yarn build:local run: yarn build:local
shell: bash shell: bash
- name: Run ubuntu/chrome snapshots # - name: Run playwright/chrome snapshots
shell: bash # shell: bash
run: | # run: |
yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --retries="3" --update-snapshots --grep=@snapshot --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} # yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --retries="3" --update-snapshots --grep=@snapshot --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
env: # env:
CI: true # CI: true
NODE_ENV: development # NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} # VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true # VITE_KC_SKIP_AUTH: true
token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} # token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }} # snapshottoken: ${{ secrets.KITTYCAD_API_TOKEN }}
- uses: actions/upload-artifact@v4 # - uses: actions/upload-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }} # if: ${{ !cancelled() && (success() || failure()) }}
with: # with:
name: playwright-report-ubuntu-snapshot-${{ matrix.shardIndex }}-${{ github.sha }} # name: playwright-report-${{matrix.os}}-snapshot-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/ # path: playwright-report/
retention-days: 30 # retention-days: 30
overwrite: true # overwrite: true
- name: Clean up test-results # - name: Clean up test-results
if: ${{ !cancelled() && (success() || failure()) }} # if: ${{ !cancelled() && (success() || failure()) }}
continue-on-error: true # continue-on-error: true
run: rm -r test-results # run: rm -r test-results
- name: check for changes # - name: check for changes
shell: bash # shell: bash
id: git-check # id: git-check
run: | # run: |
git add . # git add .
if git status | grep -q "Changes to be committed" # if git status | grep -q "Changes to be committed"
then echo "modified=true" >> $GITHUB_OUTPUT # then echo "modified=true" >> $GITHUB_OUTPUT
else echo "modified=false" >> $GITHUB_OUTPUT # else echo "modified=false" >> $GITHUB_OUTPUT
fi # fi
- name: Commit changes, if any # - name: Commit changes, if any
if: steps.git-check.outputs.modified == 'true' # if: steps.git-check.outputs.modified == 'true'
shell: bash # shell: bash
run: | # run: |
git add . # git add .
git config --local user.email "github-actions[bot]@users.noreply.github.com" # git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]" # git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git # git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin # git fetch origin
echo ${{ github.head_ref }} # echo ${{ github.head_ref }}
git checkout ${{ github.head_ref }} # git checkout ${{ github.head_ref }}
git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true # git commit -am "A snapshot a day keeps the bugs away! 📷🐛 (OS: ${{matrix.os}})" || true
git push # git push
git push origin ${{ github.head_ref }} # git push origin ${{ github.head_ref }}
# only upload artifacts if there's actually changes # # only upload artifacts if there's actually changes
- uses: actions/upload-artifact@v4 # - uses: actions/upload-artifact@v4
if: steps.git-check.outputs.modified == 'true' # if: steps.git-check.outputs.modified == 'true'
with: # with:
name: playwright-report-ubuntu-${{ matrix.shardIndex }}-${{ github.sha }} # name: playwright-report-${{matrix.os}}-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/ # path: playwright-report/
retention-days: 30 # retention-days: 30
- uses: actions/download-artifact@v4 # - uses: actions/download-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }} # if: ${{ !cancelled() && (success() || failure()) }}
continue-on-error: true # continue-on-error: true
with: # with:
name: test-results-ubuntu-${{ matrix.shardIndex }}-${{ github.sha }} # name: test-results-${{matrix.os}}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/ # path: test-results/
- name: Run playwright/chrome flow (with retries) - name: Run playwright/chrome flow (with retries)
id: retry id: retry
if: ${{ !cancelled() && (success() || failure()) }} if: ${{ !cancelled() && (success() || failure()) }}
shell: bash shell: bash
run: | run: |
if [[ ! -f "test-results/.last-run.json" ]]; then yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --grep="@focus" --grep-invert="@snapshot|@electron" || true
# if no last run artifact, than run plawright normally # if [[ ! -f "test-results/.last-run.json" ]]; then
echo "run playwright normally" # # if no last run artifact, than run plawright normally
yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --grep-invert="@snapshot|@electron" || true # echo "run playwright normally"
# # send to axiom # yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --grep-invert="@snapshot|@electron" || true
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1 # # # send to axiom
fi # node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
# fi
retry=1 # retry=1
max_retrys=4 # max_retrys=4
# retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues # # retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues
while [[ $retry -le $max_retrys ]]; do # while [[ $retry -le $max_retrys ]]; do
if [[ -f "test-results/.last-run.json" ]]; then # if [[ -f "test-results/.last-run.json" ]]; then
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json) # failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
if [[ $failed_tests -gt 0 ]]; then # if [[ $failed_tests -gt 0 ]]; then
echo "retried=true" >>$GITHUB_OUTPUT # echo "retried=true" >>$GITHUB_OUTPUT
echo "run playwright with last failed tests and retry $retry" # echo "run playwright with last failed tests and retry $retry"
yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --last-failed --grep-invert="@snapshot|@electron" || true # yarn playwright test --project="Google Chrome" --config=playwright.ci.config.ts --last-failed --grep-invert="@snapshot|@electron" || true
# send to axiom # # send to axiom
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1 # node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
retry=$((retry + 1)) # retry=$((retry + 1))
else # else
echo "retried=false" >>$GITHUB_OUTPUT # echo "retried=false" >>$GITHUB_OUTPUT
exit 0 # exit 0
fi # fi
else # else
echo "retried=false" >>$GITHUB_OUTPUT # echo "retried=false" >>$GITHUB_OUTPUT
exit 0 # exit 0
fi # fi
done # done
echo "retried=false" >>$GITHUB_OUTPUT # echo "retried=false" >>$GITHUB_OUTPUT
if [[ -f "test-results/.last-run.json" ]]; then # if [[ -f "test-results/.last-run.json" ]]; then
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json) # failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
if [[ $failed_tests -gt 0 ]]; then # if [[ $failed_tests -gt 0 ]]; then
# if it still fails after 3 retrys, then fail the job # # if it still fails after 3 retrys, then fail the job
exit 1 # exit 1
fi # fi
fi # fi
exit 0 # exit 0
env: env:
CI: true CI: true
NODE_ENV: development NODE_ENV: development
@ -244,193 +250,193 @@ jobs:
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: always() if: always()
with: with:
name: test-results-ubuntu-${{ matrix.shardIndex }}-${{ github.sha }} name: test-results-${{matrix.os}}-${{ matrix.shardIndex }}-${{ github.sha }}
path: test-results/ path: test-results/
retention-days: 30 retention-days: 30
overwrite: true overwrite: true
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: always() if: always()
with: with:
name: playwright-report-ubuntu-${{ matrix.shardIndex }}-${{ github.sha }} name: playwright-report-${{matrix.os}}-${{ matrix.shardIndex }}-${{ github.sha }}
path: playwright-report/ path: playwright-report/
retention-days: 30 retention-days: 30
overwrite: true overwrite: true
playwright-electron: # playwright-electron:
strategy: # strategy:
fail-fast: false # fail-fast: false
matrix: # matrix:
os: [ubuntu-latest, windows-latest, macos-14] # os: [ubuntu-latest, windows-latest, macos-14]
timeout-minutes: 30 # timeout-minutes: 30
runs-on: ${{ matrix.os }} # runs-on: ${{ matrix.os }}
needs: check-rust-changes # needs: check-rust-changes
steps: # steps:
- name: Tune GitHub-hosted runner network # - name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1 # uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v4 # - uses: actions/checkout@v4
- uses: actions/setup-node@v4 # - uses: actions/setup-node@v4
with: # with:
node-version-file: '.nvmrc' # node-version-file: '.nvmrc'
cache: 'yarn' # cache: 'yarn'
- uses: KittyCAD/action-install-cli@main # - uses: KittyCAD/action-install-cli@main
- name: Install dependencies # - name: Install dependencies
shell: bash # shell: bash
run: yarn # run: yarn
- name: Cache Playwright Browsers # - name: Cache Playwright Browsers
uses: actions/cache@v4 # uses: actions/cache@v4
with: # with:
path: | # path: |
~/.cache/ms-playwright/ # ~/.cache/ms-playwright/
key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }} # key: ${{ runner.os }}-playwright-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Browsers # - name: Install Playwright Browsers
shell: bash # shell: bash
run: yarn playwright install chromium --with-deps # run: yarn playwright install chromium --with-deps
- name: Download Wasm Cache # - name: Download Wasm Cache
id: download-wasm # id: download-wasm
if: needs.check-rust-changes.outputs.rust-changed == 'false' # if: needs.check-rust-changes.outputs.rust-changed == 'false'
uses: dawidd6/action-download-artifact@v6 # uses: dawidd6/action-download-artifact@v6
continue-on-error: true # continue-on-error: true
with: # with:
github_token: ${{secrets.GITHUB_TOKEN}} # github_token: ${{secrets.GITHUB_TOKEN}}
name: wasm-bundle # name: wasm-bundle
workflow: build-and-store-wasm.yml # workflow: build-and-store-wasm.yml
branch: main # branch: main
path: src/wasm-lib/pkg # path: src/wasm-lib/pkg
- name: copy wasm blob # - name: copy wasm blob
if: needs.check-rust-changes.outputs.rust-changed == 'false' # if: needs.check-rust-changes.outputs.rust-changed == 'false'
shell: bash # shell: bash
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public # run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public
continue-on-error: true # continue-on-error: true
- name: Setup Rust # - name: Setup Rust
uses: dtolnay/rust-toolchain@stable # uses: dtolnay/rust-toolchain@stable
- name: Cache Wasm (because rust diff) # - name: Cache Wasm (because rust diff)
if: needs.check-rust-changes.outputs.rust-changed == 'true' # if: needs.check-rust-changes.outputs.rust-changed == 'true'
uses: Swatinem/rust-cache@v2 # uses: Swatinem/rust-cache@v2
with: # with:
workspaces: './src/wasm-lib' # workspaces: './src/wasm-lib'
- name: OR Cache Wasm (because wasm cache failed) # - name: OR Cache Wasm (because wasm cache failed)
if: steps.download-wasm.outcome == 'failure' # if: steps.download-wasm.outcome == 'failure'
uses: Swatinem/rust-cache@v2 # uses: Swatinem/rust-cache@v2
with: # with:
workspaces: './src/wasm-lib' # workspaces: './src/wasm-lib'
- name: install good sed # - name: install good sed
if: ${{ startsWith(matrix.os, 'macos') }} # if: ${{ startsWith(matrix.os, 'macos') }}
shell: bash # shell: bash
run: | # run: |
brew install gnu-sed # brew install gnu-sed
echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH # echo "/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH
- name: Install vector # - name: Install vector
if: ${{ !startsWith(matrix.os, 'windows') }} # if: ${{ !startsWith(matrix.os, 'windows') }}
shell: bash # shell: bash
run: | # run: |
curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh # curl --proto '=https' --tlsv1.2 -sSfL https://sh.vector.dev > /tmp/vector.sh
chmod +x /tmp/vector.sh # chmod +x /tmp/vector.sh
/tmp/vector.sh -y -no-modify-path # /tmp/vector.sh -y -no-modify-path
mkdir -p /tmp/vector # mkdir -p /tmp/vector
cp .github/workflows/vector.toml /tmp/vector.toml # cp .github/workflows/vector.toml /tmp/vector.toml
sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml # sed -i "s#GITHUB_WORKFLOW#${GITHUB_WORKFLOW}#g" /tmp/vector.toml
sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml # sed -i "s#GITHUB_REPOSITORY#${GITHUB_REPOSITORY}#g" /tmp/vector.toml
sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml # sed -i "s#GITHUB_SHA#${GITHUB_SHA}#g" /tmp/vector.toml
sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml # sed -i "s#GITHUB_REF_NAME#${GITHUB_REF_NAME}#g" /tmp/vector.toml
sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml # sed -i "s#GH_ACTIONS_AXIOM_TOKEN#${{secrets.GH_ACTIONS_AXIOM_TOKEN}}#g" /tmp/vector.toml
cat /tmp/vector.toml # cat /tmp/vector.toml
${HOME}/.vector/bin/vector --config /tmp/vector.toml & # ${HOME}/.vector/bin/vector --config /tmp/vector.toml &
- name: Build Wasm (because rust diff) # - name: Build Wasm (because rust diff)
if: needs.check-rust-changes.outputs.rust-changed == 'true' # if: needs.check-rust-changes.outputs.rust-changed == 'true'
shell: bash # shell: bash
run: yarn build:wasm # run: yarn build:wasm
- name: OR Build Wasm (because wasm cache failed) # - name: OR Build Wasm (because wasm cache failed)
if: steps.download-wasm.outcome == 'failure' # if: steps.download-wasm.outcome == 'failure'
shell: bash # shell: bash
run: yarn build:wasm # run: yarn build:wasm
- name: build electron # - name: build electron
shell: bash # shell: bash
run: yarn electron:package # run: yarn electron:package
- uses: actions/download-artifact@v4 # - uses: actions/download-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }} # if: ${{ !cancelled() && (success() || failure()) }}
continue-on-error: true # continue-on-error: true
with: # with:
name: test-results-ubuntu-${{ github.sha }} # name: test-results-${{matrix.os}}-${{ github.sha }}
path: test-results/ # path: test-results/
- name: Run electron tests (with retries) # - name: Run electron tests (with retries)
id: retry # id: retry
if: ${{ !cancelled() && (success() || failure()) }} # if: ${{ !cancelled() && (success() || failure()) }}
shell: bash # shell: bash
run: | # run: |
if [[ ! -f "test-results/.last-run.json" ]]; then # if [[ ! -f "test-results/.last-run.json" ]]; then
# if no last run artifact, than run plawright normally # # if no last run artifact, than run plawright normally
echo "run playwright normally" # echo "run playwright normally"
if [[ "$IS_UBUNTU" == "true" ]]; then # if [[ "$IS_UBUNTU" == "true" ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true # xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true
else # else
yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true # yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true
fi # fi
# # send to axiom # # # send to axiom
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1 # node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
fi # fi
retry=1 # retry=1
max_retrys=2 # max_retrys=2
# retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues # # retry failed tests, doing our own retries because using inbuilt playwright retries causes connection issues
while [[ $retry -le $max_retrys ]]; do # while [[ $retry -le $max_retrys ]]; do
if [[ -f "test-results/.last-run.json" ]]; then # if [[ -f "test-results/.last-run.json" ]]; then
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json) # failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
if [[ $failed_tests -gt 0 ]]; then # if [[ $failed_tests -gt 0 ]]; then
echo "retried=true" >>$GITHUB_OUTPUT # echo "retried=true" >>$GITHUB_OUTPUT
echo "run playwright with last failed tests and retry $retry" # echo "run playwright with last failed tests and retry $retry"
if [[ "$IS_UBUNTU" == "true" ]]; then # if [[ "$IS_UBUNTU" == "true" ]]; then
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true # xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true
else # else
yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true # yarn playwright test --config=playwright.electron.config.ts --grep=@electron || true
fi # fi
# send to axiom # # send to axiom
node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1 # node playwrightProcess.mjs | tee /tmp/github-actions.log > /dev/null 2>&1
retry=$((retry + 1)) # retry=$((retry + 1))
else # else
echo "retried=false" >>$GITHUB_OUTPUT # echo "retried=false" >>$GITHUB_OUTPUT
exit 0 # exit 0
fi # fi
else # else
echo "retried=false" >>$GITHUB_OUTPUT # echo "retried=false" >>$GITHUB_OUTPUT
exit 0 # exit 0
fi # fi
done # done
echo "retried=false" >>$GITHUB_OUTPUT # echo "retried=false" >>$GITHUB_OUTPUT
if [[ -f "test-results/.last-run.json" ]]; then # if [[ -f "test-results/.last-run.json" ]]; then
failed_tests=$(jq '.failedTests | length' test-results/.last-run.json) # failed_tests=$(jq '.failedTests | length' test-results/.last-run.json)
if [[ $failed_tests -gt 0 ]]; then # if [[ $failed_tests -gt 0 ]]; then
# if it still fails after 3 retrys, then fail the job # # if it still fails after 3 retrys, then fail the job
exit 1 # exit 1
fi # fi
fi # fi
exit 0 # exit 0
env: # env:
CI: true # CI: true
NODE_ENV: development # NODE_ENV: development
VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} # VITE_KC_DEV_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN_DEV }}
VITE_KC_SKIP_AUTH: true # VITE_KC_SKIP_AUTH: true
IS_UBUNTU: ${{ startsWith(matrix.os, 'ubuntu') && 'true' || 'false' }} # IS_UBUNTU: ${{ startsWith(matrix.os, 'ubuntu') && 'true' || 'false' }}
#DEBUG: 'pw:browser*' # #DEBUG: 'pw:browser*'
- name: send to axiom # - name: send to axiom
if: ${{ !cancelled() && (success() || failure()) && !startsWith(matrix.os, 'windows') }} # if: ${{ !cancelled() && (success() || failure()) && !startsWith(matrix.os, 'windows') }}
shell: bash # shell: bash
run: | # run: |
node playwrightProcess.mjs | tee /tmp/github-actions.log # node playwrightProcess.mjs | tee /tmp/github-actions.log
- uses: actions/upload-artifact@v4 # - uses: actions/upload-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }} # if: ${{ !cancelled() && (success() || failure()) }}
with: # with:
name: test-results-electron-${{ github.sha }} # name: test-results-electron-${{ github.sha }}
path: test-results/ # path: test-results/
retention-days: 30 # retention-days: 30
overwrite: true # overwrite: true
- uses: actions/upload-artifact@v4 # - uses: actions/upload-artifact@v4
if: ${{ !cancelled() && (success() || failure()) }} # if: ${{ !cancelled() && (success() || failure()) }}
with: # with:
name: playwright-report-electron-${{ github.sha }} # name: playwright-report-electron-${{ github.sha }}
path: playwright-report/ # path: playwright-report/
retention-days: 30 # retention-days: 30
overwrite: true # overwrite: true

View File

@ -131,7 +131,7 @@ test.describe('Onboarding tests', () => {
await expect(page.url()).not.toContain('onboarding') await expect(page.url()).not.toContain('onboarding')
}) })
test('Onboarding redirects and code updating', async ({ page }) => { test('Onboarding redirects and code updating @focus', async ({ page }) => {
const u = await getUtils(page) const u = await getUtils(page)
// Override beforeEach test setup // Override beforeEach test setup

View File

@ -42,6 +42,9 @@ export default defineConfig({
/* Chromium is the only one with these permission types */ /* Chromium is the only one with these permission types */
permissions: ['clipboard-write', 'clipboard-read'], permissions: ['clipboard-write', 'clipboard-read'],
}, },
launchOptions: {
args: process.env.CI ? ['--headless', '--enable-gpu'] : [],
},
}, // or 'chrome-beta' }, // or 'chrome-beta'
}, },
{ {