Skip to content

Commit

Permalink
test: browser tests (#778)
Browse files Browse the repository at this point in the history
Browser tests!

Ok, so I'd kind of given up on maintaining the snapshot tests. But now that we're trying to add mdx, I _really_ want them. This PR adds a link to the latest app css bundles so there are lots of little changes to the styles. As well, we changed the layout of the demo app a bit, so I had to expand the viewport of the test browser.
  • Loading branch information
kellyjosephprice authored Jul 11, 2023
1 parent a50de42 commit 856aa87
Show file tree
Hide file tree
Showing 19 changed files with 37 additions and 3 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,35 @@ jobs:

- name: Run tests
run: npm test

visual:
name: 'Visual Tests'
if: "!contains(github.event.head_commit.message, 'SKIP CI')"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v3

- name: Run visual tests (node ${{ matrix.node-version }})
run: make ci

- name: Upload snapshot diffs
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: snapshots-diffs
path: __tests__/browser/__image_snapshots__/__diff_output__

- name: Update regression test snapshots
if: ${{ failure() }}
run: make updateSnapshot

- name: Upload snapshots
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: image-snapshots
path: __tests__/browser/__image_snapshots__/
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ RUN npm install

COPY . ./

RUN mkdir -p __tests__/browser/__image_snapshots__/__diff_output__

RUN make emojis

EXPOSE 9966
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions __tests__/browser/markdown.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
describe('visual regression tests', () => {
describe('rdmd syntax', () => {
beforeEach(async () => {
// At 1025 the TOC disappears
await page.setViewport({ width: 1026, height: 800 });
// The ToC disappears somewhere below 1200, 1175-ish?
await page.setViewport({ width: 1400, height: 800 });
});

const docs = [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"start": "webpack serve --config ./webpack.dev.js --open --mode development",
"test": "jest --coverage --runInBand --testPathIgnorePatterns '__tests__/browser'",
"test.watch": "jest --watch --coverage=false --testPathIgnorePatterns '__tests__/browser'",
"test.browser": "jest --runInBand --testPathPattern '__tests__/browser'",
"test.browser": "jest --config jest.browser.js --runInBand --testPathPattern '__tests__/browser'",
"watch": "webpack -w --progress --mode production"
},
"dependencies": {
Expand Down

0 comments on commit 856aa87

Please sign in to comment.