Skip to content

Commit 4ea2a85

Browse files
RajaBellebonflexdinesh
authored andcommitted
Bump Cypress 4.1.0 + update tests
1 parent 79c9e9d commit 4ea2a85

File tree

7 files changed

+5055
-5400
lines changed

7 files changed

+5055
-5400
lines changed

.circleci/config.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22

33
docker_defaults: &docker_defaults
44
docker:
5-
- image: cypress/base:13.6.0
5+
- image: cypress/browsers:node12.13.0-chrome78-ff70
66
environment:
77
TERM: xterm
88
working_directory: ~/project/repo
@@ -20,6 +20,7 @@ install_steps: &install_steps
2020
- dependency-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
2121
- dependency-cache-{{ .Branch }}-
2222
- dependency-cache-
23+
- cache-{{ checksum "package.json" }}
2324
- run:
2425
name: Installing Dependencies
2526
command: |
@@ -28,7 +29,7 @@ install_steps: &install_steps
2829
name: Save node_modules cache
2930
key: dependency-cache-{{ .Branch }}-{{ checksum "package.json" }}
3031
paths:
31-
- node_modules/
32+
- ~/.cache
3233
- persist_to_workspace:
3334
root: ~/project
3435
paths:
@@ -67,4 +68,7 @@ jobs:
6768
- run:
6869
name: Running E2E tests
6970
command: |
71+
yarn global add cypress
72+
yarn install --silent
73+
cypress install
7074
yarn e2e

cypress.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"baseUrl": "http://localhost:8000/cypress-tests",
3-
"screenshotOnHeadlessFailure": false,
4-
"videoRecording": false
3+
"video": false
54
}
+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
const selector = require('../fixtures/selectors.json');
2+
3+
const viewport = ['macbook-15', 'iphone-6'];
4+
5+
describe('Multi Select ',() => {
6+
7+
before(function() {
8+
cy.visit('http://localhost:8000/cypress-tests');
9+
cy.title().should('equal', 'React-Select');
10+
cy.get('h1').should('contain', 'Test Page for Cypress');
11+
});
12+
13+
viewport.forEach(view => {
14+
before(function() {
15+
cy.viewport(view);
16+
});
17+
beforeEach(function() {
18+
cy.reload();
19+
});
20+
21+
it(
22+
'Should display several default values that can be removed ' + view,
23+
() => {
24+
cy
25+
.get(selector.multiSelectDefaultValues)
26+
.then(function($defaultValue) {
27+
expect($defaultValue).to.have.length(2);
28+
expect($defaultValue.eq(0)).to.contain('Purple');
29+
expect($defaultValue.eq(1)).to.contain('Red');
30+
});
31+
32+
cy
33+
.get(selector.firstMultiValueRemove)
34+
.click()
35+
.get(selector.multiSelectDefaultValues)
36+
.then(function($defaultValue) {
37+
expect($defaultValue).to.have.length(1);
38+
expect($defaultValue.eq(0)).to.contain('Red');
39+
})
40+
.get(selector.menuMulti)
41+
.should('not.be.visible');
42+
}
43+
);
44+
45+
it(
46+
'Should be able to remove values on keyboard actions ' + view,
47+
() => {
48+
cy
49+
.get(selector.multiSelectInput)
50+
.click()
51+
.type('{backspace}', { force: true })
52+
.get(selector.multiSelectDefaultValues)
53+
.then(function($defaultValue) {
54+
expect($defaultValue).to.have.length(1);
55+
expect($defaultValue.eq(0)).to.contain('Purple');
56+
})
57+
.get(selector.multiSelectInput)
58+
.type('{backspace}', { force: true })
59+
.get(selector.placeHolderMulti)
60+
.should('contain', 'Select...');
61+
}
62+
);
63+
64+
it(
65+
'Should select different options using - click and enter ' + view,
66+
() => {
67+
cy
68+
.get(selector.menuMulti)
69+
.should('not.exist')
70+
.get(selector.toggleMenuMulti)
71+
.click()
72+
.get(selector.menuMulti)
73+
.should('exist')
74+
.get(selector.menuMulti)
75+
.should('be.visible')
76+
.get(selector.menuOption)
77+
.contains('Orange')
78+
.click()
79+
.get(selector.toggleMenuMulti)
80+
.click()
81+
.get(selector.menuOption)
82+
.contains('Yellow')
83+
.click()
84+
.get(selector.multiSelectInput)
85+
.click({ force: true })
86+
.type('Slate', { force: true })
87+
.type('{enter}', { force: true })
88+
.get(selector.multiSelectDefaultValues)
89+
.then(function($defaultValue) {
90+
expect($defaultValue).to.have.length(5);
91+
expect($defaultValue.eq(0)).to.contain('Purple');
92+
expect($defaultValue.eq(1)).to.contain('Red');
93+
expect($defaultValue.eq(2)).to.contain('Orange');
94+
expect($defaultValue.eq(3)).to.contain('Yellow');
95+
expect($defaultValue.eq(4)).to.contain('Slate');
96+
});
97+
});
98+
});
99+
});

0 commit comments

Comments
 (0)