Skip to content

Commit

Permalink
test: ensure that connected before making screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed May 15, 2023
1 parent 58b7bcf commit 8e3fb84
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 5 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ on: [pull_request]
jobs:
main:
runs-on: ubuntu-latest
env:
CYPRESS_PLUGIN_VISUAL_REGRESSION_UPDATE_IMAGES: ${{ contains(github.event.head_commit.message, ' [update screenshots]') }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v3
with:
# TODO: update to 18 after updating cypress
node-version: 16.x
node-version: 18.x
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- run: npm ci --legacy-peer-deps # TODO: remove --legacy-peer-deps after updating dependencies
- run: npm test
- uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ env.CYPRESS_PLUGIN_VISUAL_REGRESSION_UPDATE_IMAGES == true }}
if: always()
with:
commit_message: "chore: update e2e screenshots"
file_pattern: 'tests/e2e/*.png'
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions tests/e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,11 @@ Cypress.Commands.overwrite('visit', (originalFn, url, options = {}) => originalF
));

Cypress.Commands.add('getState', () => JSON.parse(localStorage.vuex));

Cypress.Commands.overwrite('matchImage', (originalFn, ...args) => {
cy.get('body').then(($body) => {
if ($body.find('.connection-status.connecting').length === 0) return;
cy.get('.connection-status.test-net').should('be.visible');
});
originalFn(...args);
});

0 comments on commit 8e3fb84

Please sign in to comment.