Skip to content

Commit

Permalink
Add visual css testing tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Muda committed Oct 5, 2023
1 parent 6cf3ed4 commit 2898472
Show file tree
Hide file tree
Showing 10 changed files with 4,250 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/css
/dist
/node_modules
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.
58 changes: 58 additions & 0 deletions __tests__/zumer-examples.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const puppeteer = require('puppeteer');

describe('Test Zumer CSS examples', () => {
let browser;

beforeAll(async () => {
browser = await puppeteer.launch({
headless: 'new',
// `headless: true` (default) enables old Headless;
// `headless: 'new'` enables new Headless;
// `headless: false` enables “headful” mode.
});
});

it('Index', async () => {
const page = await browser.newPage();
await page.goto('http://localhost:5500/examples/');
const image = await page.screenshot();

expect(image).toMatchImageSnapshot();
});

it('Generic', async () => {
const page = await browser.newPage();
await page.goto('http://localhost:5500/examples/generic.html');
const image = await page.screenshot();

expect(image).toMatchImageSnapshot();
});

it('Spread', async () => {
const page = await browser.newPage();
await page.goto('http://localhost:5500/examples/spread.html');
const image = await page.screenshot();

expect(image).toMatchImageSnapshot();
});

it('Watch', async () => {
const page = await browser.newPage();
await page.goto('http://localhost:5500/examples/watch.html');
const image = await page.screenshot();

expect(image).toMatchImageSnapshot();
});

it('Sector grid', async () => {
const page = await browser.newPage();
await page.goto('http://localhost:5500/examples/arcgrid.html');
const image = await page.screenshot();

expect(image).toMatchImageSnapshot();
});

afterAll(async () => {
await browser.close();
});
});
19 changes: 19 additions & 0 deletions jest-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2018 American Express Travel Related Services Company, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/

// eslint runs from root and only looks at root package.json
// eslint-disable-next-line import/no-unresolved
const { toMatchImageSnapshot } = require('jest-image-snapshot');

expect.extend({ toMatchImageSnapshot });
Loading

0 comments on commit 2898472

Please sign in to comment.