Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: use better(?) plugin for snapshots
  • Loading branch information
joshuaellis committed May 4, 2022
commit b04367935f317af981ca0d4d2065b9b536ee0911
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.
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.
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.
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 removed .yarn/cache/blob-npm-0.0.5-5e6b11bda5-ca6a025f11.zip
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.
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.
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.
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.
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 removed .yarn/cache/phin-npm-2.9.3-8661be52b1-7e2abd7be7.zip
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/timm-npm-1.7.1-4d0984663a-c80df538ec.zip
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 removed .yarn/cache/utif-npm-2.0.1-b6892ce22a-66b0bffc18.zip
Binary file not shown.
Binary file removed .yarn/cache/ws-npm-7.4.6-9c9a725604-3a990b32ed.zip
Binary file not shown.
Binary file removed .yarn/cache/xhr-npm-2.6.0-c4a4d64db8-a1db277e37.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
159 changes: 0 additions & 159 deletions cypress/integration/__snapshots__/parallax.spec.js.snap

This file was deleted.

28 changes: 22 additions & 6 deletions cypress/integration/parallax.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ const ANIMATION_WAIT = 4000

describe('Parallax - vertical', () => {
const HEIGHT = Cypress.config('viewportHeight')
const WIDTH = Cypress.config('viewportWidth')

beforeEach(() => {
cy.visit('/vertical')
})

it('should translate layers as expected', () => {
// intial snapshot
cy.findByTestId('container').toMatchSnapshot()
console.log(HEIGHT, WIDTH)

cy.findByTestId('container').matchImageSnapshot('vertical #1', {
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
})

// initial layer positions
cy.findByTestId('default-layer')
Expand Down Expand Up @@ -37,7 +42,9 @@ describe('Parallax - vertical', () => {
cy.wait(ANIMATION_WAIT)

// halfway snapshot
cy.findByTestId('container').toMatchSnapshot()
cy.findByTestId('container').matchImageSnapshot('vertical #2', {
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
})

// halfway layer positions
cy.findByTestId('default-layer')
Expand Down Expand Up @@ -65,7 +72,9 @@ describe('Parallax - vertical', () => {
cy.wait(ANIMATION_WAIT)

// final snapshot
cy.findByTestId('container').toMatchSnapshot()
cy.findByTestId('container').matchImageSnapshot('vertical #3', {
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
})

// final layer positions
cy.findAllByTestId(/-layer/).each(layer =>
Expand All @@ -83,6 +92,7 @@ describe('Parallax - vertical', () => {
})

describe('Parallax - horizontal', () => {
const HEIGHT = Cypress.config('viewportHeight')
const WIDTH = Cypress.config('viewportWidth')

beforeEach(() => {
Expand All @@ -91,7 +101,9 @@ describe('Parallax - horizontal', () => {

it('should translate layers as expected', () => {
// intial snapshot
cy.findByTestId('container').toMatchSnapshot()
cy.findByTestId('container').matchImageSnapshot('horizontal #1', {
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
})

// initial layer positions
cy.findByTestId('default-layer')
Expand Down Expand Up @@ -119,7 +131,9 @@ describe('Parallax - horizontal', () => {
cy.wait(ANIMATION_WAIT)

// halfway snapshot
cy.findByTestId('container').toMatchSnapshot()
cy.findByTestId('container').matchImageSnapshot('horizontal #2', {
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
})

// halfway layer positions
cy.findByTestId('default-layer')
Expand Down Expand Up @@ -148,7 +162,9 @@ describe('Parallax - horizontal', () => {
cy.wait(ANIMATION_WAIT)

// final snapshot
cy.findByTestId('container').toMatchSnapshot()
cy.findByTestId('container').matchImageSnapshot('horizontal #3', {
clip: { x: 0, y: 0, width: WIDTH, height: HEIGHT },
})

// final layer positions
cy.findAllByTestId(/-layer/).each(layer =>
Expand Down
4 changes: 2 additions & 2 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { initPlugin } = require('cypress-plugin-snapshots/plugin')
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin')

module.exports = (on, config) => {
initPlugin(on, config)
addMatchImageSnapshotPlugin(on, config)
return config
}
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.
3 changes: 3 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
import '@testing-library/cypress/add-commands'
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'

addMatchImageSnapshotCommand()
1 change: 0 additions & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

// Import commands.js using ES2015 syntax:
import './commands'
import 'cypress-plugin-snapshots/commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"test:unit": "jest",
"test:cov": "jest --coverage",
"test:ts": "tsc --noEmit",
"test:e2e": "start-server-and-test 'yarn vite serve packages/parallax/test' http-get://localhost:3000 'yarn cypress run'",
"test:e2e": "start-server-and-test 'yarn vite serve packages/parallax/test --host' http-get://localhost:3000 'yarn cypress run'",
"test": "yarn test:ts && yarn test:unit && yarn test:e2e",
"release": "yarn test:ts && yarn test:unit && yarn build && yarn changeset publish && yarn",
"vers": "yarn changeset version"
Expand Down Expand Up @@ -88,8 +88,8 @@
"@types/styled-components": "^5.1.22",
"@types/three": "^0.137.0",
"@vitejs/plugin-react-refresh": "^1.3.6",
"cypress": "^9.4.1",
"cypress-plugin-snapshots": "^1.4.4",
"cypress": "^9.6.0",
"cypress-image-snapshot": "^4.0.1",
"flush-microtasks": "^1.0.1",
"husky": "^7.0.4",
"jest": "^27.5.1",
Expand Down
Loading