bukazu-portal-react 3.3.3 → 3.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/build/index.css +1 -1
  2. package/build/portal.es.js +19931 -20259
  3. package/build/portal.umd.js +80 -82
  4. package/package.json +9 -7
  5. package/.env.development +0 -1
  6. package/.eslintrc +0 -25
  7. package/.github/dependabot.yml +0 -11
  8. package/.github/workflows/node.js.yml +0 -31
  9. package/.github/workflows/npm-publish.yml +0 -33
  10. package/.nvmrc +0 -1
  11. package/.prettierrc +0 -6
  12. package/.vscode/settings.json +0 -24
  13. package/CHANGELOG.MD +0 -93
  14. package/babel.config.json +0 -6
  15. package/calendar.html +0 -16
  16. package/coverage/clover.xml +0 -28
  17. package/coverage/coverage-final.json +0 -2
  18. package/coverage/lcov-report/base.css +0 -224
  19. package/coverage/lcov-report/block-navigation.js +0 -87
  20. package/coverage/lcov-report/favicon.png +0 -0
  21. package/coverage/lcov-report/helper.ts.html +0 -142
  22. package/coverage/lcov-report/index.html +0 -116
  23. package/coverage/lcov-report/prettify.css +0 -1
  24. package/coverage/lcov-report/prettify.js +0 -2
  25. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  26. package/coverage/lcov-report/sorter.js +0 -196
  27. package/coverage/lcov.info +0 -36
  28. package/cypress/e2e/.examples/actions.spec.js +0 -299
  29. package/cypress/e2e/.examples/aliasing.spec.js +0 -39
  30. package/cypress/e2e/.examples/assertions.spec.js +0 -177
  31. package/cypress/e2e/.examples/connectors.spec.js +0 -97
  32. package/cypress/e2e/.examples/cookies.spec.js +0 -77
  33. package/cypress/e2e/.examples/cypress_api.spec.js +0 -202
  34. package/cypress/e2e/.examples/files.spec.js +0 -89
  35. package/cypress/e2e/.examples/local_storage.spec.js +0 -52
  36. package/cypress/e2e/.examples/location.spec.js +0 -32
  37. package/cypress/e2e/.examples/misc.spec.js +0 -104
  38. package/cypress/e2e/.examples/navigation.spec.js +0 -56
  39. package/cypress/e2e/.examples/network_requests.spec.js +0 -163
  40. package/cypress/e2e/.examples/querying.spec.js +0 -114
  41. package/cypress/e2e/.examples/spies_stubs_clocks.spec.js +0 -205
  42. package/cypress/e2e/.examples/traversal.spec.js +0 -121
  43. package/cypress/e2e/.examples/utilities.spec.js +0 -110
  44. package/cypress/e2e/.examples/viewport.spec.js +0 -59
  45. package/cypress/e2e/.examples/waiting.spec.js +0 -31
  46. package/cypress/e2e/.examples/window.spec.js +0 -22
  47. package/cypress/e2e/booking.spec.js +0 -81
  48. package/cypress/e2e/calendar.spec.js +0 -21
  49. package/cypress/e2e/search.spec.js +0 -25
  50. package/cypress/fixtures/example.json +0 -5
  51. package/cypress/plugins/index.js +0 -16
  52. package/cypress/support/commands.js +0 -25
  53. package/cypress/support/commands.ts +0 -37
  54. package/cypress/support/component-index.html +0 -12
  55. package/cypress/support/component.ts +0 -39
  56. package/cypress/support/e2e.js +0 -20
  57. package/cypress.config.ts +0 -15
  58. package/dev.tsx +0 -44
  59. package/index.html +0 -15
  60. package/invalid-calendar.html +0 -16
  61. package/jest.config.js +0 -195
  62. package/postcss.config.js +0 -17
  63. package/reviews.html +0 -16
  64. package/src/_lib/SearchQueries.ts +0 -145
  65. package/src/_lib/Tracking.ts +0 -51
  66. package/src/_lib/countries/de.json +0 -998
  67. package/src/_lib/countries/en.json +0 -998
  68. package/src/_lib/countries/es.json +0 -998
  69. package/src/_lib/countries/fr.json +0 -998
  70. package/src/_lib/countries/it.json +0 -998
  71. package/src/_lib/countries/nl.json +0 -998
  72. package/src/_lib/countries.ts +0 -15
  73. package/src/_lib/date_helper.ts +0 -27
  74. package/src/_lib/queries.ts +0 -244
  75. package/src/components/App.tsx +0 -108
  76. package/src/components/AppContext.ts +0 -14
  77. package/src/components/CalendarPage/BookingForm.tsx +0 -49
  78. package/src/components/CalendarPage/Calendar.tsx +0 -49
  79. package/src/components/CalendarPage/CalendarPage.tsx +0 -43
  80. package/src/components/CalendarPage/CalendarParts/CalendarContext.tsx +0 -89
  81. package/src/components/CalendarPage/CalendarParts/CalendarHeader.tsx +0 -72
  82. package/src/components/CalendarPage/CalendarParts/DayClasses.ts +0 -113
  83. package/src/components/CalendarPage/CalendarParts/GenerateCalendar.tsx +0 -72
  84. package/src/components/CalendarPage/CalendarParts/Legend.tsx +0 -33
  85. package/src/components/CalendarPage/CalendarParts/MonthHeader.tsx +0 -15
  86. package/src/components/CalendarPage/CalendarParts/Months.tsx +0 -37
  87. package/src/components/CalendarPage/CalendarParts/RenderCells.tsx +0 -97
  88. package/src/components/CalendarPage/CalendarParts/SingleMonth.tsx +0 -72
  89. package/src/components/CalendarPage/CalendarParts/StartBooking.tsx +0 -17
  90. package/src/components/CalendarPage/CalendarParts/WeekDays.tsx +0 -27
  91. package/src/components/CalendarPage/FormCreator.tsx +0 -230
  92. package/src/components/CalendarPage/FormItems/Date.tsx +0 -61
  93. package/src/components/CalendarPage/FormItems/NumberSelect.tsx +0 -39
  94. package/src/components/CalendarPage/FormItems/Select.tsx +0 -38
  95. package/src/components/CalendarPage/FormItems/index.ts +0 -4
  96. package/src/components/CalendarPage/PriceField/Price.tsx +0 -58
  97. package/src/components/CalendarPage/PriceField/Queries.ts +0 -23
  98. package/src/components/CalendarPage/PriceField/index.tsx +0 -129
  99. package/src/components/CalendarPage/Summary/CostRow.tsx +0 -58
  100. package/src/components/CalendarPage/Summary/CostSection.tsx +0 -15
  101. package/src/components/CalendarPage/Summary/CostSummary.tsx +0 -61
  102. package/src/components/CalendarPage/Summary/Description.tsx +0 -27
  103. package/src/components/CalendarPage/Summary/InsurancesAndRequired.tsx +0 -68
  104. package/src/components/CalendarPage/Summary/Object.tsx +0 -59
  105. package/src/components/CalendarPage/Summary/OnSite.tsx +0 -36
  106. package/src/components/CalendarPage/Summary/OptionalNotOnSite.tsx +0 -43
  107. package/src/components/CalendarPage/Summary/OptionalOnSite.tsx +0 -39
  108. package/src/components/CalendarPage/Summary/Queries.ts +0 -31
  109. package/src/components/CalendarPage/Summary/RentAndDiscount.tsx +0 -30
  110. package/src/components/CalendarPage/Summary/Totals.tsx +0 -89
  111. package/src/components/CalendarPage/Summary/cost_types.d.ts +0 -31
  112. package/src/components/CalendarPage/Summary/index.tsx +0 -24
  113. package/src/components/CalendarPage/calender_types.d.ts +0 -16
  114. package/src/components/CalendarPage/formParts/AssistanceMessage.tsx +0 -60
  115. package/src/components/CalendarPage/formParts/BookingHelpers.tsx +0 -47
  116. package/src/components/CalendarPage/formParts/BookingOrOption.tsx +0 -35
  117. package/src/components/CalendarPage/formParts/CancelInsuranceText.tsx +0 -69
  118. package/src/components/CalendarPage/formParts/DefaultBookingFields.ts +0 -105
  119. package/src/components/CalendarPage/formParts/DiscountCode.tsx +0 -62
  120. package/src/components/CalendarPage/formParts/Guests.tsx +0 -77
  121. package/src/components/CalendarPage/formParts/OptionalBookingFields.tsx +0 -148
  122. package/src/components/CalendarPage/formParts/OptionalCosts.tsx +0 -103
  123. package/src/components/CalendarPage/formParts/SuccessMessage.tsx +0 -31
  124. package/src/components/CalendarPage/formParts/Validations.tsx +0 -64
  125. package/src/components/CalendarPage/formParts/discount.tsx +0 -69
  126. package/src/components/CalendarPage/formParts/form_types.d.ts +0 -38
  127. package/src/components/CalendarPage/formParts/insurances.tsx +0 -62
  128. package/src/components/CalendarPage/formParts/radioButtons.tsx +0 -66
  129. package/src/components/Error/ApiError.tsx +0 -33
  130. package/src/components/Error/IntegrationError.tsx +0 -62
  131. package/src/components/Error/index.ts +0 -4
  132. package/src/components/ErrorBoundary.tsx +0 -34
  133. package/src/components/Modal/index.tsx +0 -46
  134. package/src/components/ReviewsPage/Queries.ts +0 -26
  135. package/src/components/ReviewsPage/ReviewsPage.tsx +0 -45
  136. package/src/components/ReviewsPage/Score.tsx +0 -29
  137. package/src/components/ReviewsPage/SingleReview.tsx +0 -38
  138. package/src/components/ReviewsPage/note.tsx +0 -17
  139. package/src/components/SafeBooking.tsx +0 -96
  140. package/src/components/SearchPage/Field.tsx +0 -75
  141. package/src/components/SearchPage/Filters.tsx +0 -91
  142. package/src/components/SearchPage/Paginator.tsx +0 -63
  143. package/src/components/SearchPage/Results.tsx +0 -129
  144. package/src/components/SearchPage/SearchPage.tsx +0 -115
  145. package/src/components/SearchPage/SingleResult.tsx +0 -93
  146. package/src/components/SearchPage/filters/Categories.tsx +0 -57
  147. package/src/components/SearchPage/filters/DateFilter.tsx +0 -34
  148. package/src/components/SearchPage/filters/List.tsx +0 -80
  149. package/src/components/SearchPage/filters/NumberFilter.tsx +0 -37
  150. package/src/components/SearchPage/filters/Radio.tsx +0 -46
  151. package/src/components/SearchPage/filters/Select.tsx +0 -85
  152. package/src/components/SearchPage/filters/__tests__/helper.spec.js +0 -13
  153. package/src/components/SearchPage/filters/filter_types.d.ts +0 -25
  154. package/src/components/SearchPage/filters/helper.ts +0 -19
  155. package/src/components/icons/ArrowLeft.svg.tsx +0 -20
  156. package/src/components/icons/ArrowRight.svg.tsx +0 -16
  157. package/src/components/icons/Reload.svg.tsx +0 -23
  158. package/src/components/icons/info.svg.tsx +0 -24
  159. package/src/components/icons/loading.svg.tsx +0 -98
  160. package/src/custom.d.ts +0 -10
  161. package/src/index.tsx +0 -104
  162. package/src/locales/de.json +0 -137
  163. package/src/locales/en.json +0 -137
  164. package/src/locales/es.json +0 -132
  165. package/src/locales/fr.json +0 -132
  166. package/src/locales/it.json +0 -128
  167. package/src/locales/nl.json +0 -138
  168. package/src/styles/calendar.css +0 -317
  169. package/src/styles/datepicker.css +0 -6
  170. package/src/styles/field.css +0 -105
  171. package/src/styles/filters.css +0 -92
  172. package/src/styles/form.css +0 -219
  173. package/src/styles/main.css +0 -80
  174. package/src/styles/modal.css +0 -79
  175. package/src/styles/pagination.css +0 -92
  176. package/src/styles/price-overview.css +0 -111
  177. package/src/styles/result.css +0 -142
  178. package/src/styles/results.css +0 -50
  179. package/src/styles/reviews.css +0 -90
  180. package/src/styles/success.css +0 -9
  181. package/src/types.d.ts +0 -91
  182. package/tmp/cache/vite/last-build-production.json +0 -7
  183. package/tsconfig.json +0 -17
  184. package/vite.config.ts +0 -31
@@ -1,299 +0,0 @@
1
- /// <reference types="cypress" />
2
-
3
- context('Actions', () => {
4
- beforeEach(() => {
5
- cy.visit('https://example.cypress.io/commands/actions')
6
- })
7
-
8
- // https://on.cypress.io/interacting-with-elements
9
-
10
- it('.type() - type into a DOM element', () => {
11
- // https://on.cypress.io/type
12
- cy.get('.action-email')
13
- .type('fake@email.com').should('have.value', 'fake@email.com')
14
-
15
- // .type() with special character sequences
16
- .type('{leftarrow}{rightarrow}{uparrow}{downarrow}')
17
- .type('{del}{selectall}{backspace}')
18
-
19
- // .type() with key modifiers
20
- .type('{alt}{option}') //these are equivalent
21
- .type('{ctrl}{control}') //these are equivalent
22
- .type('{meta}{command}{cmd}') //these are equivalent
23
- .type('{shift}')
24
-
25
- // Delay each keypress by 0.1 sec
26
- .type('slow.typing@email.com', { delay: 100 })
27
- .should('have.value', 'slow.typing@email.com')
28
-
29
- cy.get('.action-disabled')
30
- // Ignore error checking prior to type
31
- // like whether the input is visible or disabled
32
- .type('disabled error checking', { force: true })
33
- .should('have.value', 'disabled error checking')
34
- })
35
-
36
- it('.focus() - focus on a DOM element', () => {
37
- // https://on.cypress.io/focus
38
- cy.get('.action-focus').focus()
39
- .should('have.class', 'focus')
40
- .prev().should('have.attr', 'style', 'color: orange;')
41
- })
42
-
43
- it('.blur() - blur off a DOM element', () => {
44
- // https://on.cypress.io/blur
45
- cy.get('.action-blur').type('About to blur').blur()
46
- .should('have.class', 'error')
47
- .prev().should('have.attr', 'style', 'color: red;')
48
- })
49
-
50
- it('.clear() - clears an input or textarea element', () => {
51
- // https://on.cypress.io/clear
52
- cy.get('.action-clear').type('Clear this text')
53
- .should('have.value', 'Clear this text')
54
- .clear()
55
- .should('have.value', '')
56
- })
57
-
58
- it('.submit() - submit a form', () => {
59
- // https://on.cypress.io/submit
60
- cy.get('.action-form')
61
- .find('[type="text"]').type('HALFOFF')
62
-
63
- cy.get('.action-form').submit()
64
- .next().should('contain', 'Your form has been submitted!')
65
- })
66
-
67
- it('.click() - click on a DOM element', () => {
68
- // https://on.cypress.io/click
69
- cy.get('.action-btn').click()
70
-
71
- // You can click on 9 specific positions of an element:
72
- // -----------------------------------
73
- // | topLeft top topRight |
74
- // | |
75
- // | |
76
- // | |
77
- // | left center right |
78
- // | |
79
- // | |
80
- // | |
81
- // | bottomLeft bottom bottomRight |
82
- // -----------------------------------
83
-
84
- // clicking in the center of the element is the default
85
- cy.get('#action-canvas').click()
86
-
87
- cy.get('#action-canvas').click('topLeft')
88
- cy.get('#action-canvas').click('top')
89
- cy.get('#action-canvas').click('topRight')
90
- cy.get('#action-canvas').click('left')
91
- cy.get('#action-canvas').click('right')
92
- cy.get('#action-canvas').click('bottomLeft')
93
- cy.get('#action-canvas').click('bottom')
94
- cy.get('#action-canvas').click('bottomRight')
95
-
96
- // .click() accepts an x and y coordinate
97
- // that controls where the click occurs :)
98
-
99
- cy.get('#action-canvas')
100
- .click(80, 75) // click 80px on x coord and 75px on y coord
101
- .click(170, 75)
102
- .click(80, 165)
103
- .click(100, 185)
104
- .click(125, 190)
105
- .click(150, 185)
106
- .click(170, 165)
107
-
108
- // click multiple elements by passing multiple: true
109
- cy.get('.action-labels>.label').click({ multiple: true })
110
-
111
- // Ignore error checking prior to clicking
112
- cy.get('.action-opacity>.btn').click({ force: true })
113
- })
114
-
115
- it('.dblclick() - double click on a DOM element', () => {
116
- // https://on.cypress.io/dblclick
117
-
118
- // Our app has a listener on 'dblclick' event in our 'scripts.js'
119
- // that hides the div and shows an input on double click
120
- cy.get('.action-div').dblclick().should('not.be.visible')
121
- cy.get('.action-input-hidden').should('be.visible')
122
- })
123
-
124
- it('.rightclick() - right click on a DOM element', () => {
125
- // https://on.cypress.io/rightclick
126
-
127
- // Our app has a listener on 'contextmenu' event in our 'scripts.js'
128
- // that hides the div and shows an input on right click
129
- cy.get('.rightclick-action-div').rightclick().should('not.be.visible')
130
- cy.get('.rightclick-action-input-hidden').should('be.visible')
131
- })
132
-
133
- it('.check() - check a checkbox or radio element', () => {
134
- // https://on.cypress.io/check
135
-
136
- // By default, .check() will check all
137
- // matching checkbox or radio elements in succession, one after another
138
- cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]')
139
- .check().should('be.checked')
140
-
141
- cy.get('.action-radios [type="radio"]').not('[disabled]')
142
- .check().should('be.checked')
143
-
144
- // .check() accepts a value argument
145
- cy.get('.action-radios [type="radio"]')
146
- .check('radio1').should('be.checked')
147
-
148
- // .check() accepts an array of values
149
- cy.get('.action-multiple-checkboxes [type="checkbox"]')
150
- .check(['checkbox1', 'checkbox2']).should('be.checked')
151
-
152
- // Ignore error checking prior to checking
153
- cy.get('.action-checkboxes [disabled]')
154
- .check({ force: true }).should('be.checked')
155
-
156
- cy.get('.action-radios [type="radio"]')
157
- .check('radio3', { force: true }).should('be.checked')
158
- })
159
-
160
- it('.uncheck() - uncheck a checkbox element', () => {
161
- // https://on.cypress.io/uncheck
162
-
163
- // By default, .uncheck() will uncheck all matching
164
- // checkbox elements in succession, one after another
165
- cy.get('.action-check [type="checkbox"]')
166
- .not('[disabled]')
167
- .uncheck().should('not.be.checked')
168
-
169
- // .uncheck() accepts a value argument
170
- cy.get('.action-check [type="checkbox"]')
171
- .check('checkbox1')
172
- .uncheck('checkbox1').should('not.be.checked')
173
-
174
- // .uncheck() accepts an array of values
175
- cy.get('.action-check [type="checkbox"]')
176
- .check(['checkbox1', 'checkbox3'])
177
- .uncheck(['checkbox1', 'checkbox3']).should('not.be.checked')
178
-
179
- // Ignore error checking prior to unchecking
180
- cy.get('.action-check [disabled]')
181
- .uncheck({ force: true }).should('not.be.checked')
182
- })
183
-
184
- it('.select() - select an option in a <select> element', () => {
185
- // https://on.cypress.io/select
186
-
187
- // at first, no option should be selected
188
- cy.get('.action-select')
189
- .should('have.value', '--Select a fruit--')
190
-
191
- // Select option(s) with matching text content
192
- cy.get('.action-select').select('apples')
193
- // confirm the apples were selected
194
- // note that each value starts with "fr-" in our HTML
195
- cy.get('.action-select').should('have.value', 'fr-apples')
196
-
197
- cy.get('.action-select-multiple')
198
- .select(['apples', 'oranges', 'bananas'])
199
- // when getting multiple values, invoke "val" method first
200
- .invoke('val')
201
- .should('deep.equal', ['fr-apples', 'fr-oranges', 'fr-bananas'])
202
-
203
- // Select option(s) with matching value
204
- cy.get('.action-select').select('fr-bananas')
205
- // can attach an assertion right away to the element
206
- .should('have.value', 'fr-bananas')
207
-
208
- cy.get('.action-select-multiple')
209
- .select(['fr-apples', 'fr-oranges', 'fr-bananas'])
210
- .invoke('val')
211
- .should('deep.equal', ['fr-apples', 'fr-oranges', 'fr-bananas'])
212
-
213
- // assert the selected values include oranges
214
- cy.get('.action-select-multiple')
215
- .invoke('val').should('include', 'fr-oranges')
216
- })
217
-
218
- it('.scrollIntoView() - scroll an element into view', () => {
219
- // https://on.cypress.io/scrollintoview
220
-
221
- // normally all of these buttons are hidden,
222
- // because they're not within
223
- // the viewable area of their parent
224
- // (we need to scroll to see them)
225
- cy.get('#scroll-horizontal button')
226
- .should('not.be.visible')
227
-
228
- // scroll the button into view, as if the user had scrolled
229
- cy.get('#scroll-horizontal button').scrollIntoView()
230
- .should('be.visible')
231
-
232
- cy.get('#scroll-vertical button')
233
- .should('not.be.visible')
234
-
235
- // Cypress handles the scroll direction needed
236
- cy.get('#scroll-vertical button').scrollIntoView()
237
- .should('be.visible')
238
-
239
- cy.get('#scroll-both button')
240
- .should('not.be.visible')
241
-
242
- // Cypress knows to scroll to the right and down
243
- cy.get('#scroll-both button').scrollIntoView()
244
- .should('be.visible')
245
- })
246
-
247
- it('.trigger() - trigger an event on a DOM element', () => {
248
- // https://on.cypress.io/trigger
249
-
250
- // To interact with a range input (slider)
251
- // we need to set its value & trigger the
252
- // event to signal it changed
253
-
254
- // Here, we invoke jQuery's val() method to set
255
- // the value and trigger the 'change' event
256
- cy.get('.trigger-input-range')
257
- .invoke('val', 25)
258
- .trigger('change')
259
- .get('input[type=range]').siblings('p')
260
- .should('have.text', '25')
261
- })
262
-
263
- it('cy.scrollTo() - scroll the window or element to a position', () => {
264
- // https://on.cypress.io/scrollto
265
-
266
- // You can scroll to 9 specific positions of an element:
267
- // -----------------------------------
268
- // | topLeft top topRight |
269
- // | |
270
- // | |
271
- // | |
272
- // | left center right |
273
- // | |
274
- // | |
275
- // | |
276
- // | bottomLeft bottom bottomRight |
277
- // -----------------------------------
278
-
279
- // if you chain .scrollTo() off of cy, we will
280
- // scroll the entire window
281
- cy.scrollTo('bottom')
282
-
283
- cy.get('#scrollable-horizontal').scrollTo('right')
284
-
285
- // or you can scroll to a specific coordinate:
286
- // (x axis, y axis) in pixels
287
- cy.get('#scrollable-vertical').scrollTo(250, 250)
288
-
289
- // or you can scroll to a specific percentage
290
- // of the (width, height) of the element
291
- cy.get('#scrollable-both').scrollTo('75%', '25%')
292
-
293
- // control the easing of the scroll (default is 'swing')
294
- cy.get('#scrollable-vertical').scrollTo('center', { easing: 'linear' })
295
-
296
- // control the duration of the scroll (in ms)
297
- cy.get('#scrollable-both').scrollTo('center', { duration: 2000 })
298
- })
299
- })
@@ -1,39 +0,0 @@
1
- /// <reference types="cypress" />
2
-
3
- context('Aliasing', () => {
4
- beforeEach(() => {
5
- cy.visit('https://example.cypress.io/commands/aliasing')
6
- })
7
-
8
- it('.as() - alias a DOM element for later use', () => {
9
- // https://on.cypress.io/as
10
-
11
- // Alias a DOM element for use later
12
- // We don't have to traverse to the element
13
- // later in our code, we reference it with @
14
-
15
- cy.get('.as-table').find('tbody>tr')
16
- .first().find('td').first()
17
- .find('button').as('firstBtn')
18
-
19
- // when we reference the alias, we place an
20
- // @ in front of its name
21
- cy.get('@firstBtn').click()
22
-
23
- cy.get('@firstBtn')
24
- .should('have.class', 'btn-success')
25
- .and('contain', 'Changed')
26
- })
27
-
28
- it('.as() - alias a route for later use', () => {
29
- // Alias the route to wait for its response
30
- cy.intercept('GET', '**/comments/*').as('getComment')
31
-
32
- // we have code that gets a comment when
33
- // the button is clicked in scripts.js
34
- cy.get('.network-btn').click()
35
-
36
- // https://on.cypress.io/wait
37
- cy.wait('@getComment').its('response.statusCode').should('eq', 200)
38
- })
39
- })
@@ -1,177 +0,0 @@
1
- /// <reference types="cypress" />
2
-
3
- context('Assertions', () => {
4
- beforeEach(() => {
5
- cy.visit('https://example.cypress.io/commands/assertions')
6
- })
7
-
8
- describe('Implicit Assertions', () => {
9
- it('.should() - make an assertion about the current subject', () => {
10
- // https://on.cypress.io/should
11
- cy.get('.assertion-table')
12
- .find('tbody tr:last')
13
- .should('have.class', 'success')
14
- .find('td')
15
- .first()
16
- // checking the text of the <td> element in various ways
17
- .should('have.text', 'Column content')
18
- .should('contain', 'Column content')
19
- .should('have.html', 'Column content')
20
- // chai-jquery uses "is()" to check if element matches selector
21
- .should('match', 'td')
22
- // to match text content against a regular expression
23
- // first need to invoke jQuery method text()
24
- // and then match using regular expression
25
- .invoke('text')
26
- .should('match', /column content/i)
27
-
28
- // a better way to check element's text content against a regular expression
29
- // is to use "cy.contains"
30
- // https://on.cypress.io/contains
31
- cy.get('.assertion-table')
32
- .find('tbody tr:last')
33
- // finds first <td> element with text content matching regular expression
34
- .contains('td', /column content/i)
35
- .should('be.visible')
36
-
37
- // for more information about asserting element's text
38
- // see https://on.cypress.io/using-cypress-faq#How-do-I-get-an-element’s-text-contents
39
- })
40
-
41
- it('.and() - chain multiple assertions together', () => {
42
- // https://on.cypress.io/and
43
- cy.get('.assertions-link')
44
- .should('have.class', 'active')
45
- .and('have.attr', 'href')
46
- .and('include', 'cypress.io')
47
- })
48
- })
49
-
50
- describe('Explicit Assertions', () => {
51
- // https://on.cypress.io/assertions
52
- it('expect - make an assertion about a specified subject', () => {
53
- // We can use Chai's BDD style assertions
54
- expect(true).to.be.true
55
- const o = { foo: 'bar' }
56
-
57
- expect(o).to.equal(o)
58
- expect(o).to.deep.equal({ foo: 'bar' })
59
- // matching text using regular expression
60
- expect('FooBar').to.match(/bar$/i)
61
- })
62
-
63
- it('pass your own callback function to should()', () => {
64
- // Pass a function to should that can have any number
65
- // of explicit assertions within it.
66
- // The ".should(cb)" function will be retried
67
- // automatically until it passes all your explicit assertions or times out.
68
- cy.get('.assertions-p')
69
- .find('p')
70
- .should(($p) => {
71
- // https://on.cypress.io/$
72
- // return an array of texts from all of the p's
73
- // @ts-ignore TS6133 unused variable
74
- const texts = $p.map((i, el) => Cypress.$(el).text())
75
-
76
- // jquery map returns jquery object
77
- // and .get() convert this to simple array
78
- const paragraphs = texts.get()
79
-
80
- // array should have length of 3
81
- expect(paragraphs, 'has 3 paragraphs').to.have.length(3)
82
-
83
- // use second argument to expect(...) to provide clear
84
- // message with each assertion
85
- expect(paragraphs, 'has expected text in each paragraph').to.deep.eq([
86
- 'Some text from first p',
87
- 'More text from second p',
88
- 'And even more text from third p',
89
- ])
90
- })
91
- })
92
-
93
- it('finds element by class name regex', () => {
94
- cy.get('.docs-header')
95
- .find('div')
96
- // .should(cb) callback function will be retried
97
- .should(($div) => {
98
- expect($div).to.have.length(1)
99
-
100
- const className = $div[0].className
101
-
102
- expect(className).to.match(/heading-/)
103
- })
104
- // .then(cb) callback is not retried,
105
- // it either passes or fails
106
- .then(($div) => {
107
- expect($div, 'text content').to.have.text('Introduction')
108
- })
109
- })
110
-
111
- it('can throw any error', () => {
112
- cy.get('.docs-header')
113
- .find('div')
114
- .should(($div) => {
115
- if ($div.length !== 1) {
116
- // you can throw your own errors
117
- throw new Error('Did not find 1 element')
118
- }
119
-
120
- const className = $div[0].className
121
-
122
- if (!className.match(/heading-/)) {
123
- throw new Error(`Could not find class "heading-" in ${className}`)
124
- }
125
- })
126
- })
127
-
128
- it('matches unknown text between two elements', () => {
129
- /**
130
- * Text from the first element.
131
- * @type {string}
132
- */
133
- let text
134
-
135
- /**
136
- * Normalizes passed text,
137
- * useful before comparing text with spaces and different capitalization.
138
- * @param {string} s Text to normalize
139
- */
140
- const normalizeText = (s) => s.replace(/\s/g, '').toLowerCase()
141
-
142
- cy.get('.two-elements')
143
- .find('.first')
144
- .then(($first) => {
145
- // save text from the first element
146
- text = normalizeText($first.text())
147
- })
148
-
149
- cy.get('.two-elements')
150
- .find('.second')
151
- .should(($div) => {
152
- // we can massage text before comparing
153
- const secondText = normalizeText($div.text())
154
-
155
- expect(secondText, 'second text').to.equal(text)
156
- })
157
- })
158
-
159
- it('assert - assert shape of an object', () => {
160
- const person = {
161
- name: 'Joe',
162
- age: 20,
163
- }
164
-
165
- assert.isObject(person, 'value is object')
166
- })
167
-
168
- it('retries the should callback until assertions pass', () => {
169
- cy.get('#random-number')
170
- .should(($div) => {
171
- const n = parseFloat($div.text())
172
-
173
- expect(n).to.be.gte(1).and.be.lte(10)
174
- })
175
- })
176
- })
177
- })
@@ -1,97 +0,0 @@
1
- /// <reference types="cypress" />
2
-
3
- context('Connectors', () => {
4
- beforeEach(() => {
5
- cy.visit('https://example.cypress.io/commands/connectors')
6
- })
7
-
8
- it('.each() - iterate over an array of elements', () => {
9
- // https://on.cypress.io/each
10
- cy.get('.connectors-each-ul>li')
11
- .each(($el, index, $list) => {
12
- console.log($el, index, $list)
13
- })
14
- })
15
-
16
- it('.its() - get properties on the current subject', () => {
17
- // https://on.cypress.io/its
18
- cy.get('.connectors-its-ul>li')
19
- // calls the 'length' property yielding that value
20
- .its('length')
21
- .should('be.gt', 2)
22
- })
23
-
24
- it('.invoke() - invoke a function on the current subject', () => {
25
- // our div is hidden in our script.js
26
- // $('.connectors-div').hide()
27
-
28
- // https://on.cypress.io/invoke
29
- cy.get('.connectors-div').should('be.hidden')
30
- // call the jquery method 'show' on the 'div.container'
31
- .invoke('show')
32
- .should('be.visible')
33
- })
34
-
35
- it('.spread() - spread an array as individual args to callback function', () => {
36
- // https://on.cypress.io/spread
37
- const arr = ['foo', 'bar', 'baz']
38
-
39
- cy.wrap(arr).spread((foo, bar, baz) => {
40
- expect(foo).to.eq('foo')
41
- expect(bar).to.eq('bar')
42
- expect(baz).to.eq('baz')
43
- })
44
- })
45
-
46
- describe('.then()', () => {
47
- it('invokes a callback function with the current subject', () => {
48
- // https://on.cypress.io/then
49
- cy.get('.connectors-list > li')
50
- .then(($lis) => {
51
- expect($lis, '3 items').to.have.length(3)
52
- expect($lis.eq(0), 'first item').to.contain('Walk the dog')
53
- expect($lis.eq(1), 'second item').to.contain('Feed the cat')
54
- expect($lis.eq(2), 'third item').to.contain('Write JavaScript')
55
- })
56
- })
57
-
58
- it('yields the returned value to the next command', () => {
59
- cy.wrap(1)
60
- .then((num) => {
61
- expect(num).to.equal(1)
62
-
63
- return 2
64
- })
65
- .then((num) => {
66
- expect(num).to.equal(2)
67
- })
68
- })
69
-
70
- it('yields the original subject without return', () => {
71
- cy.wrap(1)
72
- .then((num) => {
73
- expect(num).to.equal(1)
74
- // note that nothing is returned from this callback
75
- })
76
- .then((num) => {
77
- // this callback receives the original unchanged value 1
78
- expect(num).to.equal(1)
79
- })
80
- })
81
-
82
- it('yields the value yielded by the last Cypress command inside', () => {
83
- cy.wrap(1)
84
- .then((num) => {
85
- expect(num).to.equal(1)
86
- // note how we run a Cypress command
87
- // the result yielded by this Cypress command
88
- // will be passed to the second ".then"
89
- cy.wrap(2)
90
- })
91
- .then((num) => {
92
- // this callback receives the value yielded by "cy.wrap(2)"
93
- expect(num).to.equal(2)
94
- })
95
- })
96
- })
97
- })
@@ -1,77 +0,0 @@
1
- /// <reference types="cypress" />
2
-
3
- context('Cookies', () => {
4
- beforeEach(() => {
5
- Cypress.Cookies.debug(true)
6
-
7
- cy.visit('https://example.cypress.io/commands/cookies')
8
-
9
- // clear cookies again after visiting to remove
10
- // any 3rd party cookies picked up such as cloudflare
11
- cy.clearCookies()
12
- })
13
-
14
- it('cy.getCookie() - get a browser cookie', () => {
15
- // https://on.cypress.io/getcookie
16
- cy.get('#getCookie .set-a-cookie').click()
17
-
18
- // cy.getCookie() yields a cookie object
19
- cy.getCookie('token').should('have.property', 'value', '123ABC')
20
- })
21
-
22
- it('cy.getCookies() - get browser cookies', () => {
23
- // https://on.cypress.io/getcookies
24
- cy.getCookies().should('be.empty')
25
-
26
- cy.get('#getCookies .set-a-cookie').click()
27
-
28
- // cy.getCookies() yields an array of cookies
29
- cy.getCookies().should('have.length', 1).should((cookies) => {
30
- // each cookie has these properties
31
- expect(cookies[0]).to.have.property('name', 'token')
32
- expect(cookies[0]).to.have.property('value', '123ABC')
33
- expect(cookies[0]).to.have.property('httpOnly', false)
34
- expect(cookies[0]).to.have.property('secure', false)
35
- expect(cookies[0]).to.have.property('domain')
36
- expect(cookies[0]).to.have.property('path')
37
- })
38
- })
39
-
40
- it('cy.setCookie() - set a browser cookie', () => {
41
- // https://on.cypress.io/setcookie
42
- cy.getCookies().should('be.empty')
43
-
44
- cy.setCookie('foo', 'bar')
45
-
46
- // cy.getCookie() yields a cookie object
47
- cy.getCookie('foo').should('have.property', 'value', 'bar')
48
- })
49
-
50
- it('cy.clearCookie() - clear a browser cookie', () => {
51
- // https://on.cypress.io/clearcookie
52
- cy.getCookie('token').should('be.null')
53
-
54
- cy.get('#clearCookie .set-a-cookie').click()
55
-
56
- cy.getCookie('token').should('have.property', 'value', '123ABC')
57
-
58
- // cy.clearCookies() yields null
59
- cy.clearCookie('token').should('be.null')
60
-
61
- cy.getCookie('token').should('be.null')
62
- })
63
-
64
- it('cy.clearCookies() - clear browser cookies', () => {
65
- // https://on.cypress.io/clearcookies
66
- cy.getCookies().should('be.empty')
67
-
68
- cy.get('#clearCookies .set-a-cookie').click()
69
-
70
- cy.getCookies().should('have.length', 1)
71
-
72
- // cy.clearCookies() yields null
73
- cy.clearCookies()
74
-
75
- cy.getCookies().should('be.empty')
76
- })
77
- })