Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
fixing Percy datepicker example
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Oct 22, 2020
1 parent 64ab627 commit 93cd432
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions examples/visual-testing-with-percy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"description": "Visual diffing for component testing",
"private": true,
"scripts": {
"test": "cypress-expect run --passing 2",
"test": "cypress-expect run --passing 3",
"cy:open": "cypress open"
},
"devDependencies": {
"@date-io/date-fns": "2.10.6",
"@date-io/date-fns": "1",
"@material-ui/core": "4.9.5",
"@material-ui/pickers": "3.2.10",
"@percy/cypress": "2.3.2",
Expand Down
28 changes: 13 additions & 15 deletions examples/visual-testing-with-percy/src/DatePicker.cy-spec.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
/// <reference types="cypress" />
import React from 'react'
import { mount } from 'cypress-react-unit-test'
// import MaterialUIPickers from './DatePicker'
import MaterialUIPickers from './DatePicker'

describe('Material UI date picker', () => {
it('sanity', () => {
expect(mount).to.be.a('function')
})

// https://github.com/bahmutov/cypress-react-unit-test/issues/507
// SKIP https://github.com/bahmutov/cypress-react-unit-test/pull/506#issuecomment-714124015
// it.skip('works', () => {
// mount(<MaterialUIPickers />)
// // confirm the DOM has rendered the widget
// cy.get('#date-picker-inline').should('have.value', '08/18/2014')
// // then take visual snapshot
// cy.percySnapshot('Datepicker initial')
it('works', () => {
mount(<MaterialUIPickers />)
// confirm the DOM has rendered the widget
cy.get('#date-picker-inline').should('have.value', '08/18/2014')
// then take visual snapshot
cy.percySnapshot('Datepicker initial')

// cy.get('button[aria-label="change date"]').click()
// // confirm the DOM has rendered the widget
// cy.get('.MuiPickersBasePicker-container').should('be.visible')
// // then take visual snapshot
// cy.percySnapshot('Datepicker opened')
// })
cy.get('button[aria-label="change date"]').click()
// confirm the DOM has rendered the widget
cy.get('.MuiPickersBasePicker-container').should('be.visible')
// then take visual snapshot
cy.percySnapshot('Datepicker opened')
})
})

0 comments on commit 93cd432

Please sign in to comment.