Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Remove npmTestUI task (#3230)

Koen86040c15f903
diff --git a/AGENTS.md b/AGENTS.md
index b8263c91d..d984addbd 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -101,7 +101,7 @@ Stories call `getORStorybookHelpers(tagName)` (from `ui/component/storybook-util
- **Location:** Define tests in `ui/component/<component-name>/test/`. Define fixtures in `ui/component/<component-name>/test/fixtures/`.
-Component tests use Playwright component testing (`@sand4rt/experimental-ct-web`). They live in each package's `test/*.test.ts`, import `{ ct, expect }` from `@openremote/test`, and `mount(ComponentClass, { props, slots, on })`. Run them with `npm test` in the package (which does `tsc -b && playwright test`). CI runs `./gradlew -p ui/component npmTest`, which only executes packages that register an `npmTest` task, so when adding the first test to a package also register `npmTest` (and `npmTestUI`) in its `build.gradle` file; copy the tasks from a sibling package. Prefer web-first, role-based assertions (`getByRole("checkbox", { name }).toBeChecked()`, `toHaveCount(...)`) over poking at JS properties (`toHaveJSProperty`) or internal locators. Some important quirks to know about:
+Component tests use Playwright component testing (`@sand4rt/experimental-ct-web`). They live in each package's `test/*.test.ts`, import `{ ct, expect }` from `@openremote/test`, and `mount(ComponentClass, { props, slots, on })`. Run them with `npm test` in the package (which does `tsc -b && playwright test`). CI runs `./gradlew -p ui/component npmTest`, which only executes packages that register an `npmTest` task, so when adding the first test to a package also register `npmTest` in its `build.gradle` file; copy the tasks from a sibling package. Prefer web-first, role-based assertions (`getByRole("checkbox", { name }).toBeChecked()`, `toHaveCount(...)`) over poking at JS properties (`toHaveJSProperty`) or internal locators. Some important quirks to know about:
- **Custom elements used as slotted/appended children must be eagerly registered.** Playwright CT turns each imported component into a _lazy_ dynamic import that only runs when that component is `mount()`ed, so a child element that is never mounted itself (e.g. `or-vaadin-toggle` slotted inside `or-vaadin-toggle-group`) never gets `customElements.define`d and stays an inert, unupgraded tag that appends to the DOM but does not render. Declare such components in the test itself via `mount(..., { hooksConfig: { components: [OrVaadinToggle] } })`; the `beforeMount` hook in `ui/test/playwright/index.js` resolves their import refs, which runs their modules and registers them before the mount.
- **Use only one `mount()` call per test.** Multiple mounts do not resolve to separate locator paths and can hang until the test times out on a strict mode violation.
diff --git a/ui/app/manager/build.gradle b/ui/app/manager/build.gradle
index bca28b186..6e424fecb 100644
--- a/ui/app/manager/build.gradle
+++ b/ui/app/manager/build.gradle
@@ -83,11 +83,6 @@ tasks.register('npmTest', Exec) {
args((findProperty('args')?.toString()?.tokenize()) ?: [])
}
-tasks.register('npmTestUI', Exec) {
- dependsOn ":ui:test:installTestDeps", ":ui:test:clean"
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
-
tasks.register('cleanDist') {
dependsOn npmClean
}
diff --git a/ui/app/storybook/build.gradle b/ui/app/storybook/build.gradle
index 4c3822d51..9b36fc50b 100644
--- a/ui/app/storybook/build.gradle
+++ b/ui/app/storybook/build.gradle
@@ -88,11 +88,6 @@ tasks.register('npmTest', Exec) {
args((findProperty('args')?.toString()?.tokenize()) ?: [])
}
-tasks.register('npmTestUI', Exec) {
- dependsOn ":ui:test:installTestDeps", ":ui:test:clean"
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
-
tasks.register('cleanDist') {
dependsOn npmClean
}
diff --git a/ui/component/or-asset-viewer/build.gradle b/ui/component/or-asset-viewer/build.gradle
index ac867cf98..dbdb02679 100644
--- a/ui/component/or-asset-viewer/build.gradle
+++ b/ui/component/or-asset-viewer/build.gradle
@@ -31,8 +31,3 @@ tasks.register('npmTest', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "test"
}
-
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
diff --git a/ui/component/or-attribute-input/build.gradle b/ui/component/or-attribute-input/build.gradle
index 6a458fef4..d61a9fa85 100644
--- a/ui/component/or-attribute-input/build.gradle
+++ b/ui/component/or-attribute-input/build.gradle
@@ -25,8 +25,3 @@ tasks.register('npmTest', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "test"
}
-
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
diff --git a/ui/component/or-components/build.gradle b/ui/component/or-components/build.gradle
index ac867cf98..dbdb02679 100644
--- a/ui/component/or-components/build.gradle
+++ b/ui/component/or-components/build.gradle
@@ -31,8 +31,3 @@ tasks.register('npmTest', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "test"
}
-
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
diff --git a/ui/component/or-json-forms/build.gradle b/ui/component/or-json-forms/build.gradle
index ac867cf98..dbdb02679 100644
--- a/ui/component/or-json-forms/build.gradle
+++ b/ui/component/or-json-forms/build.gradle
@@ -31,8 +31,3 @@ tasks.register('npmTest', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "test"
}
-
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
diff --git a/ui/component/or-log-viewer/build.gradle b/ui/component/or-log-viewer/build.gradle
index e8048e7c2..9f6ad1525 100644
--- a/ui/component/or-log-viewer/build.gradle
+++ b/ui/component/or-log-viewer/build.gradle
@@ -24,11 +24,6 @@ tasks.register('npmTest', Exec) {
commandLine npmCommand("yarn"), "run", "test"
}
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
-
tasks.register('prepareUi') {
dependsOn clean, npmAnalyze, npmPrepare
}
diff --git a/ui/component/or-map/build.gradle b/ui/component/or-map/build.gradle
index fb37fc978..2588fd1d0 100644
--- a/ui/component/or-map/build.gradle
+++ b/ui/component/or-map/build.gradle
@@ -31,8 +31,3 @@ tasks.register('npmTest', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "test"
}
-
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
diff --git a/ui/component/or-mwc-components/build.gradle b/ui/component/or-mwc-components/build.gradle
index ac867cf98..dbdb02679 100644
--- a/ui/component/or-mwc-components/build.gradle
+++ b/ui/component/or-mwc-components/build.gradle
@@ -31,8 +31,3 @@ tasks.register('npmTest', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "test"
}
-
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
diff --git a/ui/component/or-scheduler/build.gradle b/ui/component/or-scheduler/build.gradle
index fb37fc978..2588fd1d0 100644
--- a/ui/component/or-scheduler/build.gradle
+++ b/ui/component/or-scheduler/build.gradle
@@ -31,8 +31,3 @@ tasks.register('npmTest', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "test"
}
-
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
diff --git a/ui/component/or-translate/build.gradle b/ui/component/or-translate/build.gradle
index ac867cf98..dbdb02679 100644
--- a/ui/component/or-translate/build.gradle
+++ b/ui/component/or-translate/build.gradle
@@ -31,8 +31,3 @@ tasks.register('npmTest', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "test"
}
-
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}
diff --git a/ui/component/or-vaadin-components/build.gradle b/ui/component/or-vaadin-components/build.gradle
index 93991c4f5..fb803effc 100644
--- a/ui/component/or-vaadin-components/build.gradle
+++ b/ui/component/or-vaadin-components/build.gradle
@@ -32,8 +32,3 @@ tasks.register('npmTest', Exec) {
dependsOn getYarnInstallTask()
commandLine npmCommand("yarn"), "run", "test"
}
-
-tasks.register('npmTestUI', Exec) {
- dependsOn getYarnInstallTask()
- commandLine npmCommand("yarn"), "run", "test", "--ui"
-}