@ui5/webcomponents-tools 0.0.0-9261ac932 → 0.0.0-95afb1087
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 +737 -0
- package/LICENSE.txt +201 -0
- package/README.md +7 -7
- package/assets-meta.js +1 -5
- package/bin/dev.js +3 -2
- package/bin/ui5nps.js +265 -0
- package/components-package/eslint.js +29 -39
- package/components-package/nps.js +98 -75
- package/components-package/vite.config.js +7 -11
- package/components-package/wdio.js +9 -3
- package/icons-collection/nps.js +30 -21
- package/lib/amd-to-es6/index.js +15 -10
- package/lib/cem/cem.js +12 -0
- package/lib/cem/custom-elements-manifest.config.mjs +58 -39
- package/lib/cem/event.mjs +51 -31
- package/lib/cem/patch/@custom-elements-manifest/analyzer/cli.js +128 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/package.json +59 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/browser-entrypoint.js +23 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/create.js +117 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/arrow-function.js +26 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/class-jsdoc.js +157 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/classes.js +20 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createArrowFunction.js +17 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createAttribute.js +24 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createClass.js +301 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createClassField.js +26 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createFunctionLike.js +73 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createMixin.js +33 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/createVariable.js +22 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/creators/handlers.js +338 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/custom-elements-define-calls.js +90 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/exports.js +156 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/function-like.js +24 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/mixins.js +29 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/reexported-wrapped-mixin-exports.js +84 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/analyse-phase/variables.js +34 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/collect-phase/collect-imports.js +101 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst/catalyst.js +11 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst/controller.js +34 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst-major-2/catalyst.js +11 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/catalyst-major-2/controller.js +34 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/decorators/attr.js +53 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/decorators/custom-element-decorator.js +36 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/fast/fast.js +7 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/lit.js +13 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/member-denylist.js +21 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/method-denylist.js +20 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/property-decorator.js +94 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/static-properties.js +121 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/lit/utils.js +66 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/framework-plugins/stencil/stencil.js +129 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/index.js +80 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/link-phase/cleanup-classes.js +25 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/link-phase/field-denylist.js +22 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/link-phase/method-denylist.js +25 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/apply-inheritance.js +78 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/is-custom-element.js +34 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/link-class-to-tagname.js +27 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/remove-unexported-declarations.js +23 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/features/post-processing/resolve-initializers.js +52 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/ast-helpers.js +186 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/cli-helpers.js +164 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/exports.js +44 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/find-external-manifests.js +67 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/imports.js +25 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/index.js +71 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/jsdoc.js +19 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/manifest-helpers.js +194 -0
- package/lib/cem/patch/@custom-elements-manifest/analyzer/src/utils/mixins.js +112 -0
- package/lib/cem/schema-internal.json +9 -0
- package/lib/cem/utils.mjs +50 -25
- package/lib/cem/validate.js +61 -55
- package/lib/chokidar/chokidar.js +29 -0
- package/lib/copy-and-watch/index.js +105 -97
- package/lib/copy-list/index.js +16 -10
- package/lib/create-icons/index.js +24 -19
- package/lib/create-illustrations/index.js +51 -28
- package/lib/create-new-component/{tsFileContentTemplate.js → Component.js} +11 -8
- package/lib/create-new-component/ComponentTemplate.js +12 -0
- package/lib/create-new-component/index.js +13 -10
- package/lib/css-processors/css-processor-components.mjs +75 -60
- package/lib/css-processors/css-processor-themes.mjs +101 -62
- package/lib/css-processors/scope-variables.mjs +17 -9
- package/lib/css-processors/shared.mjs +5 -35
- package/lib/dev-server/dev-server.mjs +24 -12
- package/lib/dev-server/virtual-index-html-plugin.js +24 -20
- package/lib/eslint/eslint.js +44 -0
- package/lib/generate-js-imports/illustrations.js +53 -54
- package/lib/generate-json-imports/i18n.js +20 -11
- package/lib/generate-json-imports/themes.js +20 -12
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +8 -3
- package/lib/i18n/defaults.js +12 -7
- package/lib/i18n/toJSON.js +15 -12
- package/lib/icons-hash/icons-hash.mjs +149 -0
- package/lib/remove-dev-mode/remove-dev-mode.mjs +38 -24
- package/lib/rimraf/rimraf.js +31 -0
- package/lib/test-runner/test-runner.js +56 -48
- package/lib/vite-bundler/vite-bundler.mjs +35 -0
- package/package.json +19 -22
- package/tsconfig.json +2 -0
- package/components-package/cypress/support/commands.js +0 -39
- package/components-package/cypress/support/component-index.html +0 -17
- package/components-package/cypress/support/component.d.ts +0 -23
- package/components-package/cypress/support/component.js +0 -34
- package/components-package/cypress.config.js +0 -19
- package/types/index.d.ts +0 -1
|
@@ -3,69 +3,77 @@ const { readFileSync } = require("fs");
|
|
|
3
3
|
const path = require("path");
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function testFn() {
|
|
7
|
+
// search for dev-server port
|
|
7
8
|
// start in current folder
|
|
8
9
|
// traversing upwards in case of mono repo tests and dev-server running in root folder of repository
|
|
9
|
-
let devServerFolder = process.cwd();
|
|
10
|
-
let devServerPort;
|
|
11
|
-
while (true) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
10
|
+
let devServerFolder = process.cwd();
|
|
11
|
+
let devServerPort;
|
|
12
|
+
while (true) {
|
|
13
|
+
try {
|
|
14
|
+
devServerPort = readFileSync(path.join(devServerFolder, ".dev-server-port")).toString();
|
|
15
|
+
break; // found
|
|
16
|
+
} catch (e) {
|
|
17
|
+
// file not found
|
|
18
|
+
if (devServerFolder === path.dirname(devServerFolder)) {
|
|
19
|
+
break; // reached root folder "/"
|
|
20
|
+
}
|
|
21
|
+
devServerFolder = path.dirname(devServerFolder);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
23
24
|
|
|
24
25
|
// check if we are in a monorepo and extract path from package.json
|
|
25
|
-
let packageRepositoryPath = "";
|
|
26
|
-
const pkg = require(path.join(process.cwd(), "package.json"));
|
|
27
|
-
packageRepositoryPath = pkg.repository ? pkg.repository.directory : "";
|
|
26
|
+
let packageRepositoryPath = "";
|
|
27
|
+
const pkg = require(path.join(process.cwd(), "package.json"));
|
|
28
|
+
packageRepositoryPath = pkg.repository ? pkg.repository.directory : "";
|
|
28
29
|
|
|
29
30
|
// construct base url
|
|
30
31
|
// use devServerPort if a dev server is running, otherwise let the baseUrl in the wdio config be used
|
|
31
32
|
// if a dev server is running in the root of a mono repo, append tha package path like this
|
|
32
33
|
// http://localhost:${devServerPort}/packages/main/
|
|
33
|
-
let baseUrl = "";
|
|
34
|
-
if (devServerPort) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
34
|
+
let baseUrl = "";
|
|
35
|
+
if (devServerPort) {
|
|
36
|
+
console.log(`Found port ${devServerPort} from '${path.join(devServerFolder, ".dev-server-port")}'`);
|
|
37
|
+
const devServerInRoot = !devServerFolder.includes(packageRepositoryPath);
|
|
38
|
+
if (devServerInRoot) {
|
|
39
|
+
baseUrl = `--base-url http://localhost:${devServerPort}/${packageRepositoryPath}/`;
|
|
40
|
+
} else {
|
|
41
|
+
baseUrl = `--base-url http://localhost:${devServerPort}/`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
43
44
|
|
|
44
|
-
if (!baseUrl) {
|
|
45
|
-
|
|
46
|
-
}
|
|
45
|
+
if (!baseUrl) {
|
|
46
|
+
console.log("No dev server running, running tests served from `dist`, make sure it is up to date");
|
|
47
|
+
}
|
|
47
48
|
|
|
48
49
|
// add single spec parameter if passed
|
|
49
|
-
let spec = "";
|
|
50
|
-
if (process.argv.length === 3) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
50
|
+
let spec = "";
|
|
51
|
+
if (process.argv.length === 3) {
|
|
52
|
+
const specFile = process.argv[2];
|
|
53
|
+
spec = `--spec ${specFile}`;
|
|
54
|
+
}
|
|
54
55
|
|
|
55
56
|
// more parameters - pass them to wdio
|
|
56
|
-
let restParams = "";
|
|
57
|
-
if (process.argv.length > 3) {
|
|
58
|
-
|
|
57
|
+
let restParams = "";
|
|
58
|
+
if (process.argv.length > 3) {
|
|
59
|
+
restParams = process.argv.slice(2).join(" ");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let wdioConfig = "";
|
|
63
|
+
if (fs.existsSync("config/wdio.conf.cjs")) {
|
|
64
|
+
wdioConfig = "config/wdio.conf.cjs";
|
|
65
|
+
} else if (fs.existsSync("config/wdio.conf.js")) {
|
|
66
|
+
wdioConfig = "config/wdio.conf.js";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// run wdio with calculated parameters
|
|
70
|
+
const cmd = `yarn cross-env WDIO_LOG_LEVEL=error wdio ${wdioConfig} ${spec} ${baseUrl} ${restParams}`;
|
|
71
|
+
console.log(`executing: ${cmd}`);
|
|
72
|
+
child_process.execSync(cmd, {stdio: 'inherit'});
|
|
59
73
|
}
|
|
60
74
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
wdioConfig = "config/wdio.conf.cjs";
|
|
64
|
-
} else if (fs.existsSync("config/wdio.conf.js")) {
|
|
65
|
-
wdioConfig = "config/wdio.conf.js";
|
|
75
|
+
if (require.main === module) {
|
|
76
|
+
testFn(process.argv)
|
|
66
77
|
}
|
|
67
78
|
|
|
68
|
-
|
|
69
|
-
const cmd = `yarn cross-env WDIO_LOG_LEVEL=error wdio ${wdioConfig} ${spec} ${baseUrl} ${restParams}`;
|
|
70
|
-
console.log(`executing: ${cmd}`);
|
|
71
|
-
child_process.execSync(cmd, {stdio: 'inherit'});
|
|
79
|
+
exports._ui5mainFn = testFn;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { build } from 'vite';
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { hideBin } from 'yargs/helpers';
|
|
4
|
+
import { pathToFileURL } from "url";
|
|
5
|
+
|
|
6
|
+
async function start(outArgv) {
|
|
7
|
+
const argv = yargs(hideBin(outArgv))
|
|
8
|
+
.alias("c", "config")
|
|
9
|
+
.alias("mode", "mode")
|
|
10
|
+
.alias("base", "base")
|
|
11
|
+
.argv;
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
await build({
|
|
15
|
+
configFile: argv.config || undefined,
|
|
16
|
+
mode: argv.mode || undefined,
|
|
17
|
+
base: argv.base || undefined,
|
|
18
|
+
logLevel: 'info',
|
|
19
|
+
});
|
|
20
|
+
} catch (e) {
|
|
21
|
+
console.error(e)
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const filePath = process.argv[1];
|
|
27
|
+
const fileUrl = pathToFileURL(filePath).href;
|
|
28
|
+
|
|
29
|
+
if (import.meta.url === fileUrl) {
|
|
30
|
+
start(process.argv)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
_ui5mainFn: start
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-95afb1087",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
-
"private": false,
|
|
8
7
|
"keywords": [
|
|
9
8
|
"openui5",
|
|
10
9
|
"sapui5",
|
|
11
10
|
"ui5"
|
|
12
11
|
],
|
|
13
|
-
"types": "./types/index.d.ts",
|
|
14
|
-
"scripts": {},
|
|
15
12
|
"bin": {
|
|
16
|
-
"
|
|
17
|
-
"wc-create-ui5-element": "bin/create-ui5-element.js"
|
|
13
|
+
"ui5nps": "bin/ui5nps.js",
|
|
14
|
+
"wc-create-ui5-element": "bin/create-ui5-element.js",
|
|
15
|
+
"wc-dev": "bin/dev.js"
|
|
18
16
|
},
|
|
19
17
|
"repository": {
|
|
20
18
|
"type": "git",
|
|
21
|
-
"url": "https://github.com/
|
|
19
|
+
"url": "https://github.com/UI5/webcomponents.git",
|
|
22
20
|
"directory": "packages/tools"
|
|
23
21
|
},
|
|
24
22
|
"dependencies": {
|
|
25
|
-
"@custom-elements-manifest/analyzer": "^0.
|
|
23
|
+
"@custom-elements-manifest/analyzer": "^0.10.10",
|
|
26
24
|
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
|
27
25
|
"@typescript-eslint/parser": "^6.9.0",
|
|
28
26
|
"@wdio/cli": "^7.19.7",
|
|
@@ -36,29 +34,25 @@
|
|
|
36
34
|
"chai": "^4.3.4",
|
|
37
35
|
"child_process": "^1.0.2",
|
|
38
36
|
"chokidar": "^3.6.0",
|
|
39
|
-
"chokidar-cli": "^3.0.0",
|
|
40
37
|
"command-line-args": "^5.1.1",
|
|
41
38
|
"comment-parser": "^1.4.0",
|
|
42
|
-
"concurrently": "^6.0.0",
|
|
43
39
|
"cross-env": "^7.0.3",
|
|
44
40
|
"custom-element-jet-brains-integration": "^1.4.4",
|
|
45
|
-
"
|
|
46
|
-
"cypress-real-events": "^1.12.0",
|
|
41
|
+
"dotenv": "^16.5.0",
|
|
47
42
|
"escodegen": "^2.0.0",
|
|
48
43
|
"eslint": "^7.22.0",
|
|
49
44
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
50
|
-
"eslint-plugin-
|
|
51
|
-
"eslint-plugin-
|
|
45
|
+
"eslint-plugin-import": "^2.31.0",
|
|
46
|
+
"eslint-plugin-jsx-no-leaked-values": "^0.1.24",
|
|
52
47
|
"esprima": "^4.0.1",
|
|
53
48
|
"getopts": "^2.3.0",
|
|
54
49
|
"glob": "^7.1.6",
|
|
55
50
|
"glob-parent": "^6.0.2",
|
|
56
51
|
"globby": "^13.1.1",
|
|
57
52
|
"handlebars": "^4.7.7",
|
|
53
|
+
"ignore": "^7.0.5",
|
|
58
54
|
"is-port-reachable": "^3.1.0",
|
|
59
55
|
"json-beautify": "^1.1.1",
|
|
60
|
-
"mkdirp": "^1.0.4",
|
|
61
|
-
"nps": "^5.10.0",
|
|
62
56
|
"postcss": "^8.4.5",
|
|
63
57
|
"postcss-cli": "^9.1.0",
|
|
64
58
|
"postcss-selector-parser": "^6.0.10",
|
|
@@ -66,9 +60,10 @@
|
|
|
66
60
|
"properties-reader": "^2.2.0",
|
|
67
61
|
"recursive-readdir": "^2.2.2",
|
|
68
62
|
"resolve": "^1.20.0",
|
|
69
|
-
"rimraf": "^3.0.2",
|
|
70
63
|
"slash": "3.0.0",
|
|
64
|
+
"string-argv": "^0.3.2",
|
|
71
65
|
"vite": "^5.4.8",
|
|
66
|
+
"vite-plugin-istanbul": "^6.0.2",
|
|
72
67
|
"wdio-chromedriver-service": "^7.3.2"
|
|
73
68
|
},
|
|
74
69
|
"peerDependencies": {
|
|
@@ -80,10 +75,12 @@
|
|
|
80
75
|
"optional": true
|
|
81
76
|
}
|
|
82
77
|
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
80
|
+
},
|
|
83
81
|
"devDependencies": {
|
|
84
|
-
"
|
|
85
|
-
"cypress-real-events": "^1.12.0",
|
|
86
|
-
"esbuild": "^0.19.9",
|
|
82
|
+
"esbuild": "^0.25.0",
|
|
87
83
|
"yargs": "^17.5.1"
|
|
88
|
-
}
|
|
89
|
-
|
|
84
|
+
},
|
|
85
|
+
"gitHead": "1b7f451f1e43ae13626dfc69b3c2bfa8b0d32219"
|
|
86
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/// <reference types="cypress" />
|
|
2
|
-
// ***********************************************
|
|
3
|
-
// This example commands.ts shows you how to
|
|
4
|
-
// create various custom commands and overwrite
|
|
5
|
-
// existing commands.
|
|
6
|
-
//
|
|
7
|
-
// For more comprehensive examples of custom
|
|
8
|
-
// commands please read more here:
|
|
9
|
-
// https://on.cypress.io/custom-commands
|
|
10
|
-
// ***********************************************
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// -- This is a parent command --
|
|
14
|
-
// Cypress.Commands.add('login', (email, password) => { ... })
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
// -- This is a child command --
|
|
18
|
-
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// -- This is a dual command --
|
|
22
|
-
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
// -- This will overwrite an existing command --
|
|
26
|
-
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
|
27
|
-
//
|
|
28
|
-
// declare global {
|
|
29
|
-
// namespace Cypress {
|
|
30
|
-
// interface Chainable {
|
|
31
|
-
// login(email: string, password: string): Chainable<void>
|
|
32
|
-
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
|
33
|
-
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
|
34
|
-
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
|
|
35
|
-
// }
|
|
36
|
-
// }
|
|
37
|
-
// }
|
|
38
|
-
|
|
39
|
-
import "cypress-real-events";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
7
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
8
|
-
<meta name="sap-allowedThemeOrigins" content="https://example.com">
|
|
9
|
-
<title>Components App</title>
|
|
10
|
-
<script data-ui5-config type="application/json">{}</script>
|
|
11
|
-
</head>
|
|
12
|
-
|
|
13
|
-
<body>
|
|
14
|
-
<div data-cy-root></div>
|
|
15
|
-
</body>
|
|
16
|
-
|
|
17
|
-
</html>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="cypress" />
|
|
2
|
-
import { RenderOptions, HTMLTemplateResult } from 'lit';
|
|
3
|
-
import "cypress-real-events";
|
|
4
|
-
|
|
5
|
-
export type Renderable = HTMLTemplateResult;
|
|
6
|
-
export interface MountUI5Options extends MountLitTemplateOptions {
|
|
7
|
-
ui5Configuration: object;
|
|
8
|
-
}
|
|
9
|
-
export type MountOptions = Partial<MountUI5Options>;
|
|
10
|
-
export declare function mount<T extends keyof HTMLElementTagNameMap = any>(component: string | Renderable, options?: MountOptions): Cypress.Chainable<JQuery<HTMLElementTagNameMap[T]>>;
|
|
11
|
-
declare global {
|
|
12
|
-
namespace Cypress {
|
|
13
|
-
interface Chainable {
|
|
14
|
-
/**
|
|
15
|
-
* Mount your component into Cypress sandbox
|
|
16
|
-
* @param component content to render by lit-html render function
|
|
17
|
-
* @param options render options for custom rendering
|
|
18
|
-
*/
|
|
19
|
-
mount: typeof mount;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { setupHooks } from '@cypress/mount-utils';
|
|
2
|
-
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
3
|
-
import { mount } from 'cypress-ct-lit'
|
|
4
|
-
import "./commands.js";
|
|
5
|
-
|
|
6
|
-
let dispose;
|
|
7
|
-
|
|
8
|
-
function cleanup() {
|
|
9
|
-
dispose?.();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function ui5Mount(component, options = {}) {
|
|
13
|
-
const configurationScript = document.head.querySelector("script[data-ui5-config]")
|
|
14
|
-
cleanup();
|
|
15
|
-
|
|
16
|
-
if (options.ui5Configuration) {
|
|
17
|
-
configurationScript.innerHTML = JSON.stringify(options.ui5Configuration);
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
dispose = () => {
|
|
22
|
-
configurationScript.innerHTML = "{}";
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (typeof component === "string") {
|
|
26
|
-
return mount(unsafeHTML(component), options)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return mount(component, options)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
setupHooks(cleanup);
|
|
33
|
-
|
|
34
|
-
Cypress.Commands.add('mount', ui5Mount)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const { defineConfig } = require('cypress')
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
module.exports = defineConfig({
|
|
5
|
-
component: {
|
|
6
|
-
supportFile: path.join(__dirname, "cypress/support/component.js"),
|
|
7
|
-
indexHtmlFile: path.join(__dirname, "cypress/support/component-index.html"),
|
|
8
|
-
specPattern: ["**/specs/*.cy.{js,ts}", "**/specs/**/*.cy.{js,ts}"],
|
|
9
|
-
devServer: {
|
|
10
|
-
framework: 'cypress-ct-lit',
|
|
11
|
-
bundler: 'vite',
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
video: false,
|
|
15
|
-
screenshotOnRunFailure: false,
|
|
16
|
-
scrollBehavior: false,
|
|
17
|
-
viewportHeight: 1080,
|
|
18
|
-
viewportWidth: 1440,
|
|
19
|
-
})
|
package/types/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "../components-package/cypress/support/component"
|