Skip to content

Commit 8df980e

Browse files
author
Kent C. Dodds
authored
feat: upgrade to [email protected] (#41)
BREAKING CHANGES: this upgrades dom-testing-library which has some small breaking changes: https://github.com/testing-library/dom-testing-library/releases/tag/v4.0.0
1 parent 6b3a422 commit 8df980e

File tree

3 files changed

+42
-52
lines changed

3 files changed

+42
-52
lines changed

cypress/integration/commands.spec.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ describe('dom-testing-library commands', () => {
88
.type('Hello Placeholder')
99
})
1010

11-
it('getByText', () => {
12-
cy.getByText('Button Text').click()
13-
})
14-
1511
it('getByLabelText', () => {
1612
cy.getByLabelText('Label For Input Labelled By Id')
1713
.click()
@@ -31,8 +27,10 @@ describe('dom-testing-library commands', () => {
3127
})
3228

3329
it('queryByText', () => {
34-
cy.queryByText('Button Text').should('exist')
35-
cy.queryByText('Non-existing Button Text').should('not.exist')
30+
cy.queryAllByText('Button Text').should('exist')
31+
cy.queryByText('Non-existing Button Text', {timeout: 100}).should(
32+
'not.exist',
33+
)
3634
})
3735

3836
it('getByText within', () => {
@@ -54,7 +52,7 @@ describe('dom-testing-library commands', () => {
5452
expect(err.message).to.eq(errorMessage)
5553
})
5654

57-
cy.getByTestId(testId).click()
55+
cy.getByTestId(testId, {timeout: 100}).click()
5856
})
5957

6058
it('getByText only throws the error message', () => {
@@ -64,7 +62,7 @@ describe('dom-testing-library commands', () => {
6462
expect(err.message).to.eq(errorMessage)
6563
})
6664

67-
cy.getByText('Some random text').click()
65+
cy.getByText('Some random text', {timeout: 100}).click()
6866
})
6967
})
7068

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@
5050
"license": "MIT",
5151
"dependencies": {
5252
"@babel/runtime": "^7.4.3",
53-
"dom-testing-library": "^3.12.4"
53+
"dom-testing-library": "^4.0.0"
5454
},
5555
"devDependencies": {
5656
"cypress": "3.2.0",
57-
"dtslint": "^0.6.0",
58-
"kcd-scripts": "^1.1.3",
57+
"dtslint": "^0.7.1",
58+
"kcd-scripts": "^1.2.2",
5959
"npm-run-all": "^4.1.2",
6060
"serve": "^11.0.0",
61-
"typescript": "^3.1.6",
61+
"typescript": "^3.4.5",
6262
"wait-port": "^0.2.2"
6363
},
6464
"peerDependencies": {

src/__tests__/__snapshots__/commands.js.snap

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,53 @@
22

33
exports[`exports expected commands 1`] = `
44
Array [
5+
"queryAllByLabelText",
6+
"getAllByLabelText",
7+
"queryByLabelText",
8+
"getByLabelText",
9+
"findAllByLabelText",
10+
"findByLabelText",
11+
"queryByPlaceholderText",
12+
"queryAllByPlaceholderText",
513
"getByPlaceholderText",
614
"getAllByPlaceholderText",
7-
"queryByText",
15+
"findAllByPlaceholderText",
16+
"findByPlaceholderText",
817
"queryAllByText",
18+
"queryByText",
919
"getByText",
1020
"getAllByText",
11-
"queryByLabelText",
12-
"queryAllByLabelText",
13-
"getByLabelText",
14-
"getAllByLabelText",
15-
"queryByAltText",
21+
"findAllByText",
22+
"findByText",
23+
"queryAllByDisplayValue",
24+
"queryByDisplayValue",
25+
"getByDisplayValue",
26+
"getAllByDisplayValue",
27+
"findAllByDisplayValue",
28+
"findByDisplayValue",
1629
"queryAllByAltText",
30+
"queryByAltText",
1731
"getByAltText",
1832
"getAllByAltText",
19-
"queryBySelectText",
20-
"queryAllBySelectText",
21-
"getBySelectText",
22-
"getAllBySelectText",
23-
"getByTestId",
24-
"getAllByTestId",
25-
"queryByTitle",
33+
"findAllByAltText",
34+
"findByAltText",
2635
"queryAllByTitle",
36+
"queryByTitle",
2737
"getByTitle",
2838
"getAllByTitle",
29-
"getByValue",
30-
"getAllByValue",
31-
"queryByDisplayValue",
32-
"queryAllByDisplayValue",
33-
"getByDisplayValue",
34-
"getAllByDisplayValue",
39+
"findAllByTitle",
40+
"findByTitle",
41+
"queryByRole",
42+
"queryAllByRole",
3543
"getAllByRole",
3644
"getByRole",
37-
"findByLabelText",
38-
"findAllByLabelText",
39-
"findByPlaceholderText",
40-
"findAllByPlaceholderText",
41-
"findByText",
42-
"findAllByText",
43-
"findByAltText",
44-
"findAllByAltText",
45-
"findByTitle",
46-
"findAllByTitle",
47-
"findByDisplayValue",
48-
"findAllByDisplayValue",
49-
"findByRole",
5045
"findAllByRole",
51-
"findByTestId",
52-
"findAllByTestId",
53-
"queryByPlaceholderText",
54-
"queryAllByPlaceholderText",
46+
"findByRole",
5547
"queryByTestId",
5648
"queryAllByTestId",
57-
"queryByValue",
58-
"queryAllByValue",
59-
"queryByRole",
60-
"queryAllByRole",
49+
"getByTestId",
50+
"getAllByTestId",
51+
"findAllByTestId",
52+
"findByTestId",
6153
]
6254
`;

0 commit comments

Comments
 (0)