Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add testing package #10065

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"packages/main",
"packages/compat",
"packages/ai",
"packages/testing",
"packages/fiori",
"packages/icons",
"packages/icons-business-suite",
Expand Down
5 changes: 5 additions & 0 deletions packages/base/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const config = require("@ui5/webcomponents-tools/components-package/eslint.js");
const testEslint = require("@ui5/webcomponents-testing/eslint.cjs");

testEslint.forEach(override => {
config.overrides?.push(override);
});

module.exports = config;
11 changes: 9 additions & 2 deletions packages/base/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import cypressConfig from "@ui5/webcomponents-tools/components-package/cypress.config.js";
import { defineCypressConfig } from "@ui5/webcomponents-testing/cypress/config.js";
import viteConfig from "../../vite.config";

export default cypressConfig;
export default defineCypressConfig({
component: {
devServer: {
viteConfig: viteConfig
}
}
});
1 change: 1 addition & 0 deletions packages/base/cypress/support/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "@ui5/webcomponents-testing/cypress/support/component.js";
2 changes: 1 addition & 1 deletion packages/base/cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"./**/*"
],
"compilerOptions": {
"types": ["@ui5/webcomponents-tools"],
"types": ["@ui5/webcomponents-testing"],
"outDir": "dist",
"composite": true,
"tsBuildInfoFile": "dist/.tsbuildinfobuild",
Expand Down
1 change: 1 addition & 0 deletions packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"devDependencies": {
"@openui5/sap.ui.core": "1.120.17",
"@ui5/webcomponents-tools": "2.4.0-rc.3",
"@ui5/webcomponents-testing": "0.0.0",
"chromedriver": "^129.0.0",
"clean-css": "^5.2.2",
"copy-and-watch": "^0.1.5",
Expand Down
1 change: 0 additions & 1 deletion packages/base/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"src/global.d.ts",
],
"compilerOptions": {
"types": ["@ui5/webcomponents-tools"],
"outDir": "dist",
"composite": true,
"rootDir": "src",
Expand Down
5 changes: 5 additions & 0 deletions packages/fiori/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const config = require("@ui5/webcomponents-tools/components-package/eslint.js");
const testEslint = require("@ui5/webcomponents-testing/eslint.cjs");

testEslint.forEach(override => {
config.overrides?.push(override);
});

module.exports = config;
18 changes: 9 additions & 9 deletions packages/fiori/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import cypressConfig from "@ui5/webcomponents-tools/components-package/cypress.config.js";
import path from "path";
import { fileURLToPath } from "node:url";
import { defineCypressConfig } from "@ui5/webcomponents-testing";
import viteConfig from "../../vite.config";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

cypressConfig.component.supportFile = path.join(__dirname, "cypress/support/component.ts");

export default cypressConfig;
export default defineCypressConfig({
component: {
devServer: {
viteConfig: viteConfig
}
}
});
2 changes: 1 addition & 1 deletion packages/fiori/cypress/specs/BarcodeScannerDialog.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "@ui5/webcomponents-icons/dist/camera.js";
import "../../src/BarcodeScannerDialog.js";
import type BarcodeScannerDialog from "../../src/BarcodeScannerDialog.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/fiori/cypress/specs/FCL.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import { setAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js";
import "../../src/FlexibleColumnLayout.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/fiori/cypress/specs/Page.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/Page.js";
import "@ui5/webcomponents/dist/Bar.js";
import "@ui5/webcomponents/dist/Button.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/fiori/cypress/support/component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import "@ui5/webcomponents-tools/components-package/cypress/support/component.js";
import "@ui5/webcomponents-testing/cypress/support/component.js";

import "./commands.js";
2 changes: 1 addition & 1 deletion packages/fiori/cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"./**/*"
],
"compilerOptions": {
"types": ["@ui5/webcomponents-tools"],
"types": ["@ui5/webcomponents-testing"],
"composite": true,
"tsBuildInfoFile": "dist/.tsbuildinfobuild",
"paths": {
Expand Down
3 changes: 2 additions & 1 deletion packages/fiori/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
},
"devDependencies": {
"@ui5/webcomponents-tools": "2.4.0-rc.3",
"@ui5/webcomponents-testing": "0.0.0",
"chromedriver": "^129.0.0",
"lit": "^2.0.0"
"lit-html": "^2.0.0"
}
}
5 changes: 5 additions & 0 deletions packages/main/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const config = require("@ui5/webcomponents-tools/components-package/eslint.js");
const testEslint = require("@ui5/webcomponents-testing/eslint.cjs");

testEslint.forEach(override => {
config.overrides?.push(override);
});

module.exports = config;
18 changes: 9 additions & 9 deletions packages/main/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import cypressConfig from "@ui5/webcomponents-tools/components-package/cypress.config.js";
import path from "path";
import { fileURLToPath } from "node:url";
import { defineCypressConfig } from "@ui5/webcomponents-testing";
import viteConfig from "../../vite.config";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

cypressConfig.component.supportFile = path.join(__dirname, "cypress/support/component.ts");

export default cypressConfig;
export default defineCypressConfig({
component: {
devServer: {
viteConfig: viteConfig
}
}
});
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/Button.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/Button.js";
import type Button from "../../src/Button.js";
import "@ui5/webcomponents-icons/dist/download.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/Eventing.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import { html } from "lit";
// import { html } from "lit-html";
import "../../src/Button.js";

describe("Eventing", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/F6.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "@ui5/webcomponents-base/dist/features/F6Navigation.js";
import "../../src/Button.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/Form.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/Form.js";
import "../../src/FormItem.js";
import "../../src/FormGroup.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/FormSupport.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/Button.js";
import "../../src/CheckBox.js";
import "../../src/ColorPicker.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/List.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/List.js";
import type List from "../../src/List.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/LitKeyFunction.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/MultiComboBox.js";
import "../../src/MultiComboBoxItem.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/Menu.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/Button.js";
import "../../src/Menu.js";
import "../../src/MenuItem.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/RTL.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/CheckBox.js";

describe("RTL", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/ResponsivePopover.mobile.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/ResponsivePopover.js";
import "../../src/Button.js";
import "../../src/Input.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/Select.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/Select.js";
import "../../src/Option.js";
import "../../src/OptionCustom.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/TableLoading.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/Table.js";
import "../../src/TableHeaderRow.js";
import "../../src/TableCell.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/TextArea.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../src/TextArea.js";
import "../../src/Label.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/base/AriaLabelHelper.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../../src/Label.js";
import "../../../src/Input.js";

Expand Down
6 changes: 3 additions & 3 deletions packages/main/cypress/specs/base/Events.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../../src/Dialog.js";
import "../../../src/Select.js";
import "../../../src/Option.js";
Expand Down Expand Up @@ -126,8 +126,8 @@ describe("Event bubbling", () => {
<ui5-option>Hello</ui5-option>
<ui5-option>World</ui5-option>
<ui5-option>Hello</ui5-option>
</ui5-select>
</ui5-select>

<ui5-multi-combobox id="myMCB">
<ui5-mcb-item text="Cosy"></ui5-mcb-item>
<ui5-mcb-item selected text="Compact"></ui5-mcb-item>
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/base/IconCollection.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "./css/redfish.custom.theme.css";
import getEffectiveIconCollection from "@ui5/webcomponents-base/dist/asset-registries/util/getIconCollectionByTheme.js";
import { setTheme, isLegacyThemeFamily } from "@ui5/webcomponents-base/dist/config/Theme.js";
import { html } from "lit";
import { html } from "lit-html";
import "../../../src/Assets.js";
import "../../../src/Icon.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html } from "lit";
import { html } from "lit-html";
import "../../../src/Card.js";
import "../../../src/CardHeader.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/specs/base/Tooltips.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { setEnableDefaultTooltips } from "@ui5/webcomponents-base/dist/config/Tooltips.js";
import { html } from "lit";
import { html } from "lit-html";
import "../../../src/Icon.js";
import "../../../src/Button.js";
import "../../../src/ToggleButton.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/main/cypress/support/component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import "@ui5/webcomponents-tools/components-package/cypress/support/component.js";
import "@ui5/webcomponents-testing/cypress/support/component.js";

import "./commands.js";
2 changes: 1 addition & 1 deletion packages/main/cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"./**/*"
],
"compilerOptions": {
"types": ["@ui5/webcomponents-tools"],
"types": ["@ui5/webcomponents-testing"],
"composite": true,
"tsBuildInfoFile": "dist/.tsbuildinfobuild",
"paths": {
Expand Down
3 changes: 2 additions & 1 deletion packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
},
"devDependencies": {
"@ui5/webcomponents-tools": "2.4.0-rc.3",
"@ui5/webcomponents-testing": "0.0.0",
"chromedriver": "^129.0.0",
"lit": "^2.0.0"
"lit-html": "^2.0.0"
}
}
9 changes: 9 additions & 0 deletions packages/testing/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { config } from "@ui5/webcomponents-tools/components-package/eslint.js";

import testEslint from "./src/eslint.cjs";

testEslint.forEach(override => {
config.overrides?.push(override);
});

export default config;
4 changes: 4 additions & 0 deletions packages/testing/cypress/config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { defineConfig } from "cypress"

declare const defineCypressConfig: typeof defineConfig;
export { defineCypressConfig };
47 changes: 47 additions & 0 deletions packages/testing/cypress/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { defineConfig } from 'cypress';
import path from 'path';
import { fileURLToPath } from 'url';
import { existsSync } from 'fs';
import merge from "deepmerge";

const __processDir = process.cwd();
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const indexHtmlFilePath = "./support/component-index.html"; // relative to the config file

const intialConfig = () => ({
component: {
specPattern: ["**/specs/*.cy.{js,ts}", "**/specs/**/*.cy.{js,ts}"],
devServer: {
framework: 'cypress-ct-lit',
bundler: 'vite',
}
},
video: false,
screenshotOnRunFailure: false,
scrollBehavior: false,
viewportHeight: 1080,
viewportWidth: 1440,
})

const defineCypressConfig = (externalConrfig = {}) => {
let indexHtmlFile;
const config = intialConfig();

if (externalConrfig.component?.indexHtmlFile) {
indexHtmlFile = path.join(__processDir, externalConrfig.component.indexHtmlFile)
} else if (!existsSync(path.join(__processDir, "cypress", indexHtmlFilePath))) {
indexHtmlFile = path.join(__dirname, indexHtmlFilePath);
}

if (!existsSync(path.join(__processDir, "vite.config.js")) && !externalConrfig.component?.devServer?.viteConfig) {
config.component.devServer.viteConfig = import.meta.resolve("@ui5/webcomponents-tools/components-package/vite.config.js");
}

config.component.indexHtmlFile = indexHtmlFile;

return defineConfig(merge(config, externalConrfig));
};

export { defineCypressConfig }
1 change: 1 addition & 0 deletions packages/testing/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "cypress-real-events";
Loading