Skip to content

Commit eb372f2

Browse files
authored
feat(deps): bump peer to React 18 (#1385)
1 parent 1219a68 commit eb372f2

15 files changed

Lines changed: 269 additions & 895 deletions

File tree

.circleci/config.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ defaults: &defaults
4343
cypress: &cypress
4444
working_directory: ~/docsearch
4545
docker:
46-
- image: cypress/browsers:node13.8.0-chrome81-ff75
46+
- image: cypress/browsers:node16.13.2-chrome100-ff98
4747
environment:
4848
## this enables colors in the output
4949
TERM: xterm
@@ -141,15 +141,9 @@ jobs:
141141
- run:
142142
name: Cypress test Actions
143143
command: yarn run cy:run
144-
- store_test_results:
145-
path: cypress-results
146-
- store_artifacts:
147-
path: cypress\screenshots
148-
- store_artifacts:
149-
path: cypress\videos
150144

151145
workflows:
152-
version: 2.1
146+
version: 2
153147
ci:
154148
jobs:
155149
- build
@@ -158,8 +152,7 @@ workflows:
158152
- build
159153
- test_types
160154
- test_unit
161-
# TODO: Enable again once Cypress is installed on the repo.
162-
# - test_cypress
155+
- test_cypress
163156
- release:
164157
filters:
165158
branches:

.percy.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

bundlesize.config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
},
77
{
88
"path": "packages/docsearch-react/dist/umd/index.js",
9-
"maxSize": "20.25 kB"
9+
"maxSize": "20.15 kB"
1010
},
1111
{
1212
"path": "packages/docsearch-js/dist/umd/index.js",
13-
"maxSize": "28.25 kB"
13+
"maxSize": "28.05 kB"
1414
}
1515
]
1616
}

cypress/integration/search/actions.spec.ts

Lines changed: 50 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,137 @@
1+
/// <reference path="../../support/commands.d.ts" />
2+
13
describe('Start', () => {
24
beforeEach(() => {
35
cy.visit(Cypress.config().baseUrl!);
46
});
57

6-
it('Open Modal on Search Button click', () => {
7-
cy.get('.DocSearch-Button').click();
8-
cy.get('.DocSearch-Modal').should('be.visible');
9-
cy.get('.DocSearch-Input').should('be.focus');
10-
cy.percySnapshot('modal-opened');
8+
it('Open modal on search button click', () => {
9+
cy.openModal();
10+
cy.modalIsVisibleAndFocused();
1111
});
1212

13-
it('Open Modal with key shortcut on Windows/Linux', () => {
13+
it('Open modal with key shortcut on Windows/Linux', () => {
1414
cy.get('body').type('{ctrl}k');
15-
cy.get('.DocSearch-Modal').should('be.visible');
16-
cy.get('.DocSearch-Input').should('be.focus');
15+
cy.modalIsVisibleAndFocused();
1716
});
1817

19-
it('Open Modal with key shortcut on macOS', () => {
18+
it('Open modal with key shortcut on macOS', () => {
2019
cy.get('body').type('{meta}k');
21-
cy.get('.DocSearch-Modal').should('be.visible');
22-
cy.get('.DocSearch-Input').should('be.focus');
20+
cy.modalIsVisibleAndFocused();
2321
});
2422

25-
it('Open Modal with forward slash key shortcut', () => {
23+
it('Open modal with forward slash key shortcut', () => {
2624
cy.get('body').type('/');
27-
cy.get('.DocSearch-Modal').should('be.visible');
28-
cy.get('.DocSearch-Input').should('be.focus');
25+
cy.modalIsVisibleAndFocused();
2926
});
3027
});
3128

3229
describe('End', () => {
3330
beforeEach(() => {
3431
cy.visit(Cypress.config().baseUrl!);
35-
cy.get('.DocSearch-Button').click();
32+
cy.openModal();
3633
});
3734

38-
it('Close Modal with Esc key', () => {
39-
cy.get('body').type('{esc}');
40-
cy.get('.DocSearch-Modal').should('not.be.visible');
41-
cy.percySnapshot('modal-closed');
35+
it('Close modal with Esc key', () => {
36+
cy.closeModal();
37+
cy.modalIsNotVisible();
4238
});
4339

44-
it('Close Modal by clicking outside its container', () => {
40+
it('Close modal by clicking outside its container', () => {
4541
cy.get('.DocSearch-Container').click();
46-
cy.get('.DocSearch-Modal').should('not.be.visible');
42+
cy.modalIsNotVisible();
4743
});
4844

49-
it('Close Modal with key shortcut on Windows/Linux', () => {
45+
it('Close modal with key shortcut on Windows/Linux', () => {
5046
cy.get('body').type('{ctrl}k');
51-
cy.get('.DocSearch-Modal').should('not.be.visible');
47+
cy.modalIsNotVisible();
5248
});
5349

54-
it('Close Modal with key shortcut on macOS', () => {
50+
it('Close modal with key shortcut on macOS', () => {
5551
cy.get('body').type('{meta}k');
56-
cy.get('.DocSearch-Modal').should('not.be.visible');
52+
cy.modalIsNotVisible();
5753
});
5854
});
5955

6056
describe('Search', () => {
6157
beforeEach(() => {
6258
cy.visit(Cypress.config().baseUrl!);
63-
cy.get('.DocSearch-Button').click();
59+
cy.openModal();
6460
});
6561

66-
it('Results are displayed after a Query', () => {
67-
cy.get('.DocSearch-Input').type('get');
62+
it('Results are displayed after a query', () => {
63+
cy.typeQueryMatching();
6864
cy.get('.DocSearch-Hits').should('be.visible');
69-
cy.percySnapshot('search-results');
7065
});
7166

7267
it('Query can be cleared', () => {
73-
cy.get('.DocSearch-Input').type('get');
68+
cy.typeQueryMatching();
7469
cy.get('.DocSearch-Reset').click();
75-
cy.get('.DocSearch-Hits').should('not.be.visible');
70+
cy.get('.DocSearch-Hits').should('not.exist');
7671
cy.contains('No recent searches').should('be.visible');
7772
});
7873

79-
it('Keyboard Navigation leads to result', () => {
80-
cy.get('.DocSearch-Input').type('get');
74+
it('Keyboard navigation leads to result', () => {
75+
const currentURL = cy.url();
76+
77+
cy.typeQueryMatching();
8178
cy.get('.DocSearch-Input').type('{downArrow}{downArrow}{upArrow}');
8279
cy.get('.DocSearch-Input').type('{enter}');
83-
cy.url().should('include', '/docs/getalgoliahits');
84-
cy.percySnapshot('result-page-anchor');
80+
cy.on('url:changed', (newUrl) => {
81+
expect(newUrl).not.equal(currentURL);
82+
});
8583
});
8684

87-
it('Pointer Navigation leads to result', () => {
88-
cy.get('.DocSearch-Input').type('get');
85+
it('Pointer navigation leads to result', () => {
86+
const currentURL = cy.url();
87+
88+
cy.typeQueryMatching();
8989
cy.get('.DocSearch-Hits #docsearch-item-1 > a').click({ force: true });
90-
cy.url().should('include', '/docs/getalgoliahits');
90+
cy.on('url:changed', (newUrl) => {
91+
expect(newUrl).not.equal(currentURL);
92+
});
9193
});
9294

93-
it("No Results are displayed if query doesn't match", () => {
94-
cy.get('.DocSearch-Input').type('zzzzz');
95-
cy.contains('No results for "zzzzz"').should('be.visible');
96-
cy.percySnapshot('no-results');
95+
it("No results are displayed if query doesn't match", () => {
96+
cy.typeQueryNotMatching();
97+
cy.contains('No results for').should('be.visible');
9798
});
9899
});
99100

100101
describe('Recent and Favorites', () => {
101102
beforeEach(() => {
102103
cy.visit(Cypress.config().baseUrl!);
103-
cy.get('.DocSearch-Button').click();
104-
cy.get('.DocSearch-Input').type('get');
105-
cy.get('.DocSearch-Hits #docsearch-item-0 > a').click({ force: true });
104+
cy.openModal();
105+
cy.typeQueryMatching();
106+
cy.get('#docsearch-item-0 > a').click({ force: true }).wait(3000);
107+
cy.openModal();
108+
cy.contains('Recent').should('be.visible');
106109
});
107110

108111
it('Recent search is displayed after visiting a result', () => {
109-
cy.get('.DocSearch-Button').click();
110-
cy.contains('Recent').should('be.visible');
111112
cy.get('#docsearch-item-0').should('be.visible');
112-
cy.percySnapshot('recent-search');
113113
});
114114

115115
it('Recent search can be deleted', () => {
116-
cy.get('.DocSearch-Button').click();
117116
cy.get('#docsearch-item-0')
118117
.find('[title="Remove this search from history"]')
119118
.trigger('click');
120119
cy.contains('No recent searches').should('be.visible');
121120
});
122121

123122
it('Recent search can be favorited', () => {
124-
cy.get('.DocSearch-Button').click();
125123
cy.get('#docsearch-item-0')
126124
.find('[title="Save this search"]')
127125
.trigger('click');
128-
cy.contains('Favorites').should('be.visible');
126+
cy.contains('Favorite').should('be.visible');
129127
cy.get('#docsearch-item-0').should('be.visible');
130-
cy.percySnapshot('favorite');
131128
});
132129

133130
it('Favorite can be deleted', () => {
134-
cy.get('.DocSearch-Button').click();
135131
cy.get('#docsearch-item-0')
136132
.find('[title="Save this search"]')
137133
.trigger('click');
138-
cy.wait(2000);
134+
cy.contains('Favorite').should('be.visible');
139135
cy.get('#docsearch-item-0')
140136
.find('[title="Remove this search from favorites"]')
141137
.trigger('click');

cypress/integration/search/screenshots.spec.ts

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)