Skip to content

Commit

Permalink
Integrate cypress component tests (#1922)
Browse files Browse the repository at this point in the history
* Integrate cypress component tests

* Install latest cypress version

* Fix new tests

* Skip TimePicker tests
  • Loading branch information
dmtrKovalenko committed Jun 25, 2020
1 parent e98eb44 commit 88cb622
Show file tree
Hide file tree
Showing 15 changed files with 688 additions and 246 deletions.
4 changes: 3 additions & 1 deletion cypress.json
Expand Up @@ -4,5 +4,7 @@
"supportFile": "e2e/support/index.js",
"pluginsFile": "e2e/plugins/index.js",
"chromeWebSecurity": false,
"projectId": "qow28y"
"projectId": "qow28y",
"experimentalComponentTesting": true,
"componentFolder": "./e2e/component"
}
1 change: 0 additions & 1 deletion docs/package.json
Expand Up @@ -71,7 +71,6 @@
"safe-json-stringify": "^1.2.0",
"sinon": "^9.0.2",
"styled-jsx": "^3.3.0",
"ts-loader": "^7.0.5",
"typescript": "^3.8.3",
"yup": "^0.28.5"
},
Expand Down
66 changes: 38 additions & 28 deletions docs/prop-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions e2e/component/DatePicker.spec.tsx
@@ -0,0 +1,29 @@
import * as React from 'react';
import { mountStaticPicker } from '../test-utils';
import { StaticDatePicker } from '@material-ui/pickers';

describe('<DatePicker />', () => {
it('Renders and show todays date', () => {
mountStaticPicker(defaultProps => <StaticDatePicker {...defaultProps} />);

cy.findByTestId('datepicker-toolbar-date').contains('Sat, Oct 7');
});

it('Switches between months', () => {
mountStaticPicker(defaultProps => <StaticDatePicker {...defaultProps} />);

cy.findByTestId('calendar-month-text').contains('October');

cy.findByTestId('previous-arrow-button')
.click()
.click();
cy.findByTestId('next-arrow-button')
.click()
.click()
.click();

cy.wait(350);

cy.findByTestId('calendar-month-text').contains('November');
});
});

1 comment on commit 88cb622

@vercel
Copy link

@vercel vercel bot commented on 88cb622 Jun 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.