Skip to content

Commit

Permalink
E2E: Take screenshot after each & upload artifacts on CI failed
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jul 27, 2023
1 parent 81d5d97 commit b34dc7a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ jobs:
- name: Setup
run: sudo apt-get install -y libgbm-dev
- name: Test
id: test
run: |
yarn
cd npm-package && yarn && cd ..
yarn test
yarn build
xvfb-run --auto-servernum yarn test-e2e
- name: Upload artifacts on failure
if: ${{ failure() && steps.test.conclusion == 'failure' }}
uses: actions/upload-artifact@v3
with:
name: desktop-artifacts
path: desktop-apps/bricks-electron-launcher/artifacts
retention-days: 1
build-test-macos:
runs-on: macOS-latest
steps:
Expand All @@ -33,12 +41,20 @@ jobs:
node-version: 18.x
cache: 'yarn'
- name: Test
id: test
run: |
yarn
cd npm-package && yarn && cd ..
yarn test
yarn build
yarn test-e2e
- name: Upload artifacts on failure
if: ${{ failure() && steps.test.conclusion == 'failure' }}
uses: actions/upload-artifact@v3
with:
name: desktop-artifacts
path: desktop-apps/bricks-electron-launcher/artifacts
retention-days: 1
build-test-windows:
runs-on: windows-2022
steps:
Expand All @@ -48,6 +64,7 @@ jobs:
node-version: 18.x
cache: 'yarn'
- name: Test
id: test
shell: bash
run: |
yarn config set network-timeout 500000 -g
Expand All @@ -56,3 +73,10 @@ jobs:
yarn build
yarn test
yarn test-e2e
- name: Upload artifacts on failure
if: ${{ failure() && steps.test.conclusion == 'failure' }}
uses: actions/upload-artifact@v3
with:
name: desktop-artifacts
path: desktop-apps/bricks-electron-launcher/artifacts
retention-days: 1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ release/
tmp/
config_test
.idea/
artifacts/
5 changes: 5 additions & 0 deletions __e2e__/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ describe('Application launch', () => {
await mainWindow.waitForLoadState()
})

afterEach(async () => {
const state = expect.getState()
await mainWindow.screenshot({ path: `./artifacts/${state.currentTestName}.png` })
})

afterAll(async () => {
await electronApp.close()
})
Expand Down

0 comments on commit b34dc7a

Please sign in to comment.