Skip to content

Commit cc7f950

Browse files
feat(cypress-commands): support cypress v14 (#6828)
1 parent 10bf5ac commit cc7f950

File tree

8 files changed

+36
-19
lines changed

8 files changed

+36
-19
lines changed

cypress/support/commands.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { MountOptions, MountReturn } from 'cypress/react18';
2-
import { mount } from 'cypress/react18';
3-
import type { ReactNode } from 'react';
41
import type { ThemeProviderPropTypes } from '@ui5/webcomponents-react';
52
import { ThemeProvider } from '@ui5/webcomponents-react';
3+
import type { MountOptions, MountReturn } from 'cypress/react';
4+
import { mount } from 'cypress/react';
5+
import type { ReactNode } from 'react';
66

77
declare global {
88
namespace Cypress {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"@vitejs/plugin-react": "^4.2.0",
7171
"chromatic": "^11.0.0",
7272
"cssnano": "^7.0.0",
73-
"cypress": "13.17.0",
73+
"cypress": "14.0.0",
7474
"cypress-real-events": "^1.8.1",
7575
"dedent": "^1.0.0",
7676
"documentation": "14.0.3",

packages/base/src/hooks/useStylesheet.cy.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ describe('useStyleSheet', () => {
2525
</>
2626
);
2727
cy.findAllByText('Content').should('be.visible').and('have.length', 2);
28-
cy.findAllByText('Object Status').should('not.be.visible');
28+
cy.findAllByText('Object Status').should('have.css', 'font-size', '0px');
2929
cy.findAllByText('Object Status').should('have.length', 2);
3030

3131
cy.findByTestId('btn-1').click();
3232
cy.findAllByText('Content').should('be.visible').and('have.length', 1);
33-
cy.findAllByText('Object Status').should('not.be.visible');
33+
cy.findAllByText('Object Status').should('have.css', 'font-size', '0px');
3434
cy.findAllByText('Object Status').should('have.length', 1);
3535
});
3636
});

packages/cypress-commands/TestSetup.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ You can define the command for example in the `commands.ts/js` file:
5757
<summary>Example file</summary>
5858

5959
```tsx
60-
import { mount } from 'cypress/react18';
60+
import { mount } from 'cypress/react';
61+
// if you are using Cypress v12 or v13, you need to import the mount command from 'cypress/react18'
62+
// import { mount } from 'cypress/react18';
6163
import { ThemeProvider } from '@ui5/webcomponents-react';
6264

6365
declare global {

packages/cypress-commands/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"peerDependencies": {
2626
"@ui5/webcomponents": "~2.6.0",
2727
"@ui5/webcomponents-base": "~2.6.0",
28-
"cypress": "^12.0.0 || ^13.0.0"
28+
"cypress": "^12 || ^13 || ^14"
2929
},
3030
"peerDependenciesMeta": {
3131
"@ui5/webcomponents": {

packages/main/src/components/AnalyticalTable/AnalyticalTable.cy.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1938,8 +1938,23 @@ describe('AnalyticalTable', () => {
19381938
subComponentsBehavior={AnalyticalTableSubComponentsBehavior.Visible}
19391939
/>
19401940
);
1941+
cy.wait(300);
1942+
1943+
// ToDo: with Cypress 14 the "not.be.visible" assertion is false here, check if this is still the case for next updates
1944+
// cy.findByText('SubComponent 1').should('exist').and('not.be.visible');
1945+
cy.findByText('SubComponent 1')
1946+
.should('exist')
1947+
.then(($sub) => {
1948+
if (!$sub.is(':visible')) {
1949+
throw new Error('Remove workaround for visibility check in "AnalyticalTable - render subcomponents" test!');
1950+
}
1951+
const [sub] = $sub;
1952+
const container = document.querySelector('[data-component-name="AnalyticalTableBody"]');
1953+
const isNotVisible = container.getBoundingClientRect().bottom < sub.getBoundingClientRect().top;
1954+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
1955+
expect(isNotVisible).to.be.true;
1956+
});
19411957

1942-
cy.findByText('SubComponent 1').should('exist').and('not.be.visible');
19431958
cy.findByTitle('Expand Node').should('not.exist');
19441959
cy.findByTitle('Collapse Node').should('not.exist');
19451960

packages/main/src/components/ObjectStatus/ObjectStatus.cy.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ describe('ObjectStatus', () => {
210210
</ObjectStatus>
211211
);
212212
if (stateObj.hiddenText) {
213-
cy.findByText(stateObj.hiddenText).should('exist').and('not.be.visible');
213+
cy.findByText(stateObj.hiddenText).should('exist').and('have.css', 'font-size', '0px');
214214
}
215215
if (!item.inverted) {
216216
cy.findByText('Content').should('have.css', 'color', rgbValColorString);
@@ -235,7 +235,7 @@ describe('ObjectStatus', () => {
235235
cy.findByText('Content').click();
236236
cy.get('@clickSpy').should('not.be.called');
237237
cy.findByRole('button').should('not.exist');
238-
cy.findByText('Object Status').should('exist').and('not.be.visible');
238+
cy.findByText('Object Status').should('exist').and('have.css', 'font-size', '0px');
239239

240240
cy.mount(
241241
<ObjectStatus onClick={click} interactive>
@@ -249,7 +249,7 @@ describe('ObjectStatus', () => {
249249
cy.get('@clickSpy').should('have.been.calledTwice');
250250
cy.findByText('Content').realPress('Space');
251251
cy.get('@clickSpy').should('have.been.calledThrice');
252-
cy.findByText('Object Status Button').should('exist').and('not.be.visible');
252+
cy.findByText('Object Status Button').should('exist').and('have.css', 'font-size', '0px');
253253
});
254254

255255
it('emptyIndicator', () => {
@@ -267,7 +267,7 @@ describe('ObjectStatus', () => {
267267
</ObjectStatus>
268268
);
269269
cy.findByText(VALUE_STATE_ERROR.defaultText).should('not.exist');
270-
cy.findByText('Custom Text').should('exist').and('not.be.visible');
270+
cy.findByText('Custom Text').should('exist').and('have.css', 'font-size', '0px');
271271
});
272272

273273
it('large', () => {

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6109,7 +6109,7 @@ __metadata:
61096109
peerDependencies:
61106110
"@ui5/webcomponents": ~2.6.0
61116111
"@ui5/webcomponents-base": ~2.6.0
6112-
cypress: ^12.0.0 || ^13.0.0
6112+
cypress: ^12 || ^13 || ^14
61136113
peerDependenciesMeta:
61146114
"@ui5/webcomponents":
61156115
optional: true
@@ -9308,9 +9308,9 @@ __metadata:
93089308
languageName: node
93099309
linkType: hard
93109310

9311-
"cypress@npm:13.17.0":
9312-
version: 13.17.0
9313-
resolution: "cypress@npm:13.17.0"
9311+
"cypress@npm:14.0.0":
9312+
version: 14.0.0
9313+
resolution: "cypress@npm:14.0.0"
93149314
dependencies:
93159315
"@cypress/request": "npm:^3.0.6"
93169316
"@cypress/xvfb": "npm:^1.2.4"
@@ -9357,7 +9357,7 @@ __metadata:
93579357
yauzl: "npm:^2.10.0"
93589358
bin:
93599359
cypress: bin/cypress
9360-
checksum: 10c0/159ce620e32d2785082aaa1f4f30f203dcec466df4a8e80dfa299035358772fd513c35820070ba8db52e2bf58078a372ff7009068e26967f993656e7da62e221
9360+
checksum: 10c0/231af826d394b9a9f35200ab56e531e911f774b86b2ecb17a3183685982ac93d534e7c80cfe24ca36f74c99525025472fe28a3ccf2f246c8e67f85ecb768086b
93619361
languageName: node
93629362
linkType: hard
93639363

@@ -23492,7 +23492,7 @@ __metadata:
2349223492
"@vitejs/plugin-react": "npm:^4.2.0"
2349323493
chromatic: "npm:^11.0.0"
2349423494
cssnano: "npm:^7.0.0"
23495-
cypress: "npm:13.17.0"
23495+
cypress: "npm:14.0.0"
2349623496
cypress-real-events: "npm:^1.8.1"
2349723497
dedent: "npm:^1.0.0"
2349823498
documentation: "npm:14.0.3"

0 commit comments

Comments
 (0)