@ui5/webcomponents-tools 2.7.0-rc.2 → 2.8.0-rc.0
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.
- package/CHANGELOG.md +16 -0
- package/components-package/cypress/support/commands.js +28 -1
- package/components-package/cypress/support/component.d.ts +2 -3
- package/components-package/cypress/support/component.js +31 -20
- package/components-package/cypress/support/cypress-ct-preact.js +11 -0
- package/components-package/cypress.config.js +12 -3
- package/components-package/eslint.js +2 -1
- package/components-package/nps.js +2 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [2.8.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.7.0...v2.8.0-rc.0) (2025-02-06)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
# [2.7.0](https://github.com/SAP/ui5-webcomponents/compare/v2.7.0-rc.2...v2.7.0) (2025-02-03)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
6
22
|
# [2.7.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v2.7.0-rc.1...v2.7.0-rc.2) (2025-01-30)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @ui5/webcomponents-tools
|
@@ -36,4 +36,31 @@
|
|
36
36
|
// }
|
37
37
|
// }
|
38
38
|
|
39
|
-
import "cypress-real-events";
|
39
|
+
import "cypress-real-events";
|
40
|
+
|
41
|
+
const realEventCmdCallback = (originalFn, element, ...args) => {
|
42
|
+
cy.get(element)
|
43
|
+
.should($el => {
|
44
|
+
if ($el[0].tagName.includes("-") && $el[0].shadowRoot) {
|
45
|
+
expect($el[0].shadowRoot.hasChildNodes(), "Custom elements with shadow DOM have content in their shadow DOM").to.be.true;
|
46
|
+
}
|
47
|
+
})
|
48
|
+
.and("be.visible")
|
49
|
+
.then(() => {
|
50
|
+
return originalFn(element, ...args)
|
51
|
+
});
|
52
|
+
};
|
53
|
+
|
54
|
+
const commands = [
|
55
|
+
"realClick",
|
56
|
+
"realHover",
|
57
|
+
"realTouch",
|
58
|
+
"realSwipe",
|
59
|
+
"realMouseDown",
|
60
|
+
"realMouseUp",
|
61
|
+
"realMouseMove"
|
62
|
+
];
|
63
|
+
|
64
|
+
commands.forEach(cmd => {
|
65
|
+
Cypress.Commands.overwrite(cmd, realEventCmdCallback)
|
66
|
+
});
|
@@ -1,5 +1,4 @@
|
|
1
1
|
/// <reference types="cypress" />
|
2
|
-
import { RenderOptions, HTMLTemplateResult } from 'lit';
|
3
2
|
import "cypress-real-events";
|
4
3
|
|
5
4
|
export type Renderable = HTMLTemplateResult;
|
@@ -7,13 +6,13 @@ export interface MountUI5Options extends MountLitTemplateOptions {
|
|
7
6
|
ui5Configuration: object;
|
8
7
|
}
|
9
8
|
export type MountOptions = Partial<MountUI5Options>;
|
10
|
-
export declare function mount
|
9
|
+
export declare function mount(component: JSX.Element, options?: MountOptions): CypressChainable<JQuery<HTMLElement>>;
|
11
10
|
declare global {
|
12
11
|
namespace Cypress {
|
13
12
|
interface Chainable {
|
14
13
|
/**
|
15
14
|
* Mount your component into Cypress sandbox
|
16
|
-
* @param component content to render by
|
15
|
+
* @param component content to render by preact render function
|
17
16
|
* @param options render options for custom rendering
|
18
17
|
*/
|
19
18
|
mount: typeof mount;
|
@@ -1,35 +1,46 @@
|
|
1
|
-
import
|
2
|
-
import { setupHooks } from
|
3
|
-
import {
|
4
|
-
import { mount } from 'cypress-ct-lit'
|
1
|
+
import "@cypress/code-coverage/support";
|
2
|
+
import { setupHooks, getContainerEl } from "@cypress/mount-utils";
|
3
|
+
import { mount as preactMount } from "./cypress-ct-preact.js";
|
5
4
|
import "./commands.js";
|
6
5
|
|
7
|
-
|
6
|
+
function applyConfiguration(options) {
|
7
|
+
const configurationScript = document.head.querySelector("script[data-ui5-config]");
|
8
|
+
|
9
|
+
if (options.ui5Configuration) {
|
10
|
+
configurationScript.innerHTML = JSON.stringify(options.ui5Configuration);
|
11
|
+
}
|
12
|
+
}
|
8
13
|
|
9
14
|
function cleanup() {
|
10
|
-
|
15
|
+
preactMount(null, getContainerEl());
|
11
16
|
}
|
12
17
|
|
13
|
-
function
|
14
|
-
const
|
15
|
-
cleanup();
|
18
|
+
function mount(component, options = {}) {
|
19
|
+
const container = getContainerEl();
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
// Apply custom configuration
|
22
|
+
applyConfiguration(options);
|
19
23
|
|
20
|
-
|
24
|
+
// Mount JSX Element
|
25
|
+
preactMount(component, container);
|
21
26
|
|
22
|
-
|
23
|
-
|
24
|
-
|
27
|
+
cy.get(container)
|
28
|
+
.find("*")
|
29
|
+
.should($el => {
|
30
|
+
const shadowrootsExist = [...$el].every(el => {
|
31
|
+
if (el.tagName.includes("-") && el.shadowRoot) {
|
32
|
+
return el.shadowRoot.hasChildNodes();
|
33
|
+
}
|
25
34
|
|
26
|
-
|
27
|
-
|
28
|
-
|
35
|
+
return true;
|
36
|
+
})
|
37
|
+
|
38
|
+
expect(shadowrootsExist, "Custom elements with shadow DOM have content in their shadow DOM").to.be.true;
|
39
|
+
})
|
29
40
|
|
30
|
-
return
|
41
|
+
return cy.get(container);
|
31
42
|
}
|
32
43
|
|
33
44
|
setupHooks(cleanup);
|
34
45
|
|
35
|
-
Cypress.Commands.add('mount',
|
46
|
+
Cypress.Commands.add('mount', mount)
|
@@ -2,6 +2,16 @@ const { defineConfig } = require('cypress')
|
|
2
2
|
const path = require("path");
|
3
3
|
const coverageTask = require('@cypress/code-coverage/task');
|
4
4
|
|
5
|
+
const suites = {
|
6
|
+
SUITE1: [
|
7
|
+
"**/specs/base/*.cy.{jsx,tsx}",
|
8
|
+
"**/specs/[A-I]*.cy.{js,jsx,ts,tsx}",
|
9
|
+
],
|
10
|
+
SUITE2: [
|
11
|
+
"**/specs/[^A-I]*.cy.{js,jsx,ts,tsx}",
|
12
|
+
],
|
13
|
+
};
|
14
|
+
|
5
15
|
module.exports = defineConfig({
|
6
16
|
component: {
|
7
17
|
setupNodeEvents(on, config) {
|
@@ -10,9 +20,8 @@ module.exports = defineConfig({
|
|
10
20
|
},
|
11
21
|
supportFile: path.join(__dirname, "cypress/support/component.js"),
|
12
22
|
indexHtmlFile: path.join(__dirname, "cypress/support/component-index.html"),
|
13
|
-
specPattern: [
|
23
|
+
specPattern: suites[process.env.TEST_SUITE] || ["**/specs/**/*.cy.{js,ts,jsx,tsx}"],
|
14
24
|
devServer: {
|
15
|
-
framework: 'cypress-ct-lit',
|
16
25
|
bundler: 'vite',
|
17
26
|
}
|
18
27
|
},
|
@@ -21,4 +30,4 @@ module.exports = defineConfig({
|
|
21
30
|
scrollBehavior: false,
|
22
31
|
viewportHeight: 1080,
|
23
32
|
viewportWidth: 1440,
|
24
|
-
})
|
33
|
+
})
|
@@ -56,7 +56,7 @@ const getTsModeOverrides = () => {
|
|
56
56
|
};
|
57
57
|
|
58
58
|
const cypressConfiguration = {
|
59
|
-
"files": ["**/cypress/**/*.ts"],
|
59
|
+
"files": ["**/cypress/**/*.ts", "**/cypress/**/*.tsx"],
|
60
60
|
|
61
61
|
"plugins": [
|
62
62
|
"cypress"
|
@@ -69,6 +69,7 @@ const getTsModeOverrides = () => {
|
|
69
69
|
},
|
70
70
|
"rules": {
|
71
71
|
"max-nested-callbacks": 0,
|
72
|
+
"no-unused-expressions": 0,
|
72
73
|
"@typescript-eslint/no-namespace": "off",
|
73
74
|
"cypress/no-assigning-return-values": "error",
|
74
75
|
"cypress/no-unnecessary-waiting": "error",
|
@@ -123,6 +123,8 @@ const getScripts = (options) => {
|
|
123
123
|
start: "nps prepare watch.devServer",
|
124
124
|
test: `node "${LIB}/test-runner/test-runner.js"`,
|
125
125
|
"test-cy-ci": `cross-env CYPRESS_COVERAGE=true yarn cypress run --component --browser chrome`,
|
126
|
+
"test-cy-ci-suite-1": `cross-env CYPRESS_COVERAGE=true TEST_SUITE=SUITE1 yarn cypress run --component --browser chrome`,
|
127
|
+
"test-cy-ci-suite-2": `cross-env CYPRESS_COVERAGE=true TEST_SUITE=SUITE2 yarn cypress run --component --browser chrome`,
|
126
128
|
"test-cy-open": `cross-env CYPRESS_COVERAGE=true yarn cypress open --component --browser chrome`,
|
127
129
|
"test-suite-1": `node "${LIB}/test-runner/test-runner.js" --suite suite1`,
|
128
130
|
"test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.8.0-rc.0",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -64,6 +64,7 @@
|
|
64
64
|
"postcss": "^8.4.5",
|
65
65
|
"postcss-cli": "^9.1.0",
|
66
66
|
"postcss-selector-parser": "^6.0.10",
|
67
|
+
"preact": "^10.25.4",
|
67
68
|
"prompts": "^2.4.2",
|
68
69
|
"properties-reader": "^2.2.0",
|
69
70
|
"recursive-readdir": "^2.2.2",
|
@@ -84,10 +85,10 @@
|
|
84
85
|
}
|
85
86
|
},
|
86
87
|
"devDependencies": {
|
87
|
-
"cypress-
|
88
|
+
"@cypress/mount-utils": "^4.1.2",
|
88
89
|
"cypress-real-events": "^1.12.0",
|
89
90
|
"esbuild": "^0.19.9",
|
90
91
|
"yargs": "^17.5.1"
|
91
92
|
},
|
92
|
-
"gitHead": "
|
93
|
+
"gitHead": "8ec6a8928a1f691e8ca272f0f2c32f49e46c6992"
|
93
94
|
}
|