From 9833d1d3af4406c052ae113064a2b52f0049a3e6 Mon Sep 17 00:00:00 2001 From: Stef3st Date: Wed, 10 May 2023 10:30:03 +0200 Subject: [PATCH 1/3] fix: disable dublicate tests compas openscd --- .../autogen-substation.ts | 2 +- .../autogen-substation.test.ts | 8 ++++---- web-test-runner.config.mjs | 15 +++++++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) rename src/{editors/substation/autogen-substation => compas-editors}/autogen-substation.ts (99%) rename test/integration/{editors/substation/autogen-substation => compas-editors}/autogen-substation.test.ts (92%) diff --git a/src/editors/substation/autogen-substation/autogen-substation.ts b/src/compas-editors/autogen-substation.ts similarity index 99% rename from src/editors/substation/autogen-substation/autogen-substation.ts rename to src/compas-editors/autogen-substation.ts index d3583767d..e2d497d63 100644 --- a/src/editors/substation/autogen-substation/autogen-substation.ts +++ b/src/compas-editors/autogen-substation.ts @@ -1,5 +1,5 @@ import { LitElement, property } from 'lit-element'; -import { createElement, newActionEvent } from '../../../foundation.js'; +import { createElement, newActionEvent } from '../foundation.js'; let cbNum = 1; let dsNum = 1; diff --git a/test/integration/editors/substation/autogen-substation/autogen-substation.test.ts b/test/integration/compas-editors/autogen-substation.test.ts similarity index 92% rename from test/integration/editors/substation/autogen-substation/autogen-substation.test.ts rename to test/integration/compas-editors/autogen-substation.test.ts index 8f1fa0552..1d78ed4a5 100644 --- a/test/integration/editors/substation/autogen-substation/autogen-substation.test.ts +++ b/test/integration/compas-editors/autogen-substation.test.ts @@ -1,9 +1,9 @@ import { expect, fixture, html } from '@open-wc/testing'; -import '../../../../unit/mock-editor.js'; -import { MockEditor } from '../../../../unit/mock-editor.js'; -import '../../../../../src/editors/substation/autogen-substation/autogen-substation.js'; -import CompasAutogenerateSubstation from '../../../../../src/editors/substation/autogen-substation/autogen-substation.js'; +import '../../unit/mock-editor.js'; +import { MockEditor } from '../../unit/mock-editor.js'; +import '../../../src/compas-editors/autogen-substation.js'; +import CompasAutogenerateSubstation from '../../../src/compas-editors/autogen-substation.js'; describe('autogen-substation-integration', () => { if (customElements.get('') === undefined) diff --git a/web-test-runner.config.mjs b/web-test-runner.config.mjs index 522833713..3675ff7ed 100644 --- a/web-test-runner.config.mjs +++ b/web-test-runner.config.mjs @@ -11,20 +11,27 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({ /** filter browser logs * Plugins have a fix URL and do not fit to the file structure in test environment. * Creating open-scd in the tests leads to error in the browser log - we had to disable the browser log - */ + */ browserLogs: false, /** specify groups for unit and integrations tests * hint: no --group definition runs all groups - */ + */ groups: [ { name: 'unit', - files: 'test/unit/**/*.test.ts', + files: [ + 'test/unit/compas/*.test.ts', + 'test/unit/compas-services/*.test.ts', + 'test/unit/compas-wizards/*.test.ts', + ], }, { name: 'integration', - files: 'test/integration/**/*.test.ts', + files: [ + 'test/integration/compas/*.test.ts', + 'test/integration/compas-editors/*.test.ts', + ], }, ], From b7c0e1b07800057806e3348844acefdc5de333f1 Mon Sep 17 00:00:00 2001 From: Stef3st Date: Wed, 10 May 2023 10:35:39 +0200 Subject: [PATCH 2/3] chore: correct path for autogen substation --- public/js/plugins.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/plugins.js b/public/js/plugins.js index 3ca809952..149a90246 100644 --- a/public/js/plugins.js +++ b/public/js/plugins.js @@ -329,7 +329,7 @@ export const officialPlugins = [ }, { name: 'Autogen Substation', - src: '/src/editors/substation/autogen-substation/autogen-substation.js', + src: '/src/compas-editors/autogen-substation.js', icon: 'playlist_add_circle', default: true, kind: 'menu', From d5d218128dfc5c577bb45fbe44a3b1f41908b520 Mon Sep 17 00:00:00 2001 From: Stef3st Date: Wed, 10 May 2023 15:50:51 +0200 Subject: [PATCH 3/3] chore: added sitipe and pluggin tests --- src/{editors => compas-editors}/Sitipe.ts | 0 .../sitipe/foundation.ts | 0 .../sitipe/sitipe-bay.ts | 0 .../sitipe/sitipe-service.ts | 0 .../sitipe/sitipe-substation.ts | 0 .../Sitipe.test.ts | 2 +- .../__snapshots__/Sitipe.test.snap.js | 24 +++++++++++++++++++ .../sitipe-substation.test.snap.js | 0 .../sitipe/sitipe-substation.test.ts | 4 ++-- web-test-runner.config.mjs | 2 ++ 10 files changed, 29 insertions(+), 3 deletions(-) rename src/{editors => compas-editors}/Sitipe.ts (100%) rename src/{editors => compas-editors}/sitipe/foundation.ts (100%) rename src/{editors => compas-editors}/sitipe/sitipe-bay.ts (100%) rename src/{editors => compas-editors}/sitipe/sitipe-service.ts (100%) rename src/{editors => compas-editors}/sitipe/sitipe-substation.ts (100%) rename test/unit/{editors => compas-editors}/Sitipe.test.ts (94%) create mode 100644 test/unit/compas-editors/__snapshots__/Sitipe.test.snap.js rename test/unit/{editors => compas-editors}/sitipe/__snapshots__/sitipe-substation.test.snap.js (100%) rename test/unit/{editors => compas-editors}/sitipe/sitipe-substation.test.ts (81%) diff --git a/src/editors/Sitipe.ts b/src/compas-editors/Sitipe.ts similarity index 100% rename from src/editors/Sitipe.ts rename to src/compas-editors/Sitipe.ts diff --git a/src/editors/sitipe/foundation.ts b/src/compas-editors/sitipe/foundation.ts similarity index 100% rename from src/editors/sitipe/foundation.ts rename to src/compas-editors/sitipe/foundation.ts diff --git a/src/editors/sitipe/sitipe-bay.ts b/src/compas-editors/sitipe/sitipe-bay.ts similarity index 100% rename from src/editors/sitipe/sitipe-bay.ts rename to src/compas-editors/sitipe/sitipe-bay.ts diff --git a/src/editors/sitipe/sitipe-service.ts b/src/compas-editors/sitipe/sitipe-service.ts similarity index 100% rename from src/editors/sitipe/sitipe-service.ts rename to src/compas-editors/sitipe/sitipe-service.ts diff --git a/src/editors/sitipe/sitipe-substation.ts b/src/compas-editors/sitipe/sitipe-substation.ts similarity index 100% rename from src/editors/sitipe/sitipe-substation.ts rename to src/compas-editors/sitipe/sitipe-substation.ts diff --git a/test/unit/editors/Sitipe.test.ts b/test/unit/compas-editors/Sitipe.test.ts similarity index 94% rename from test/unit/editors/Sitipe.test.ts rename to test/unit/compas-editors/Sitipe.test.ts index d0da45d0e..543bb5325 100644 --- a/test/unit/editors/Sitipe.test.ts +++ b/test/unit/compas-editors/Sitipe.test.ts @@ -1,6 +1,6 @@ import { expect, fixture, html } from '@open-wc/testing'; -import Sitipe from '../../../src/editors/Sitipe.js'; +import Sitipe from '../../../src/compas-editors/Sitipe.js'; describe('Sitipe plugin', () => { customElements.define('sitipe-plugin', Sitipe); diff --git a/test/unit/compas-editors/__snapshots__/Sitipe.test.snap.js b/test/unit/compas-editors/__snapshots__/Sitipe.test.snap.js new file mode 100644 index 000000000..784a260fc --- /dev/null +++ b/test/unit/compas-editors/__snapshots__/Sitipe.test.snap.js @@ -0,0 +1,24 @@ +/* @web/test-runner snapshot v1 */ +export const snapshots = {}; + +snapshots["Sitipe plugin No doc loaded Should look like latest snapshot"] = +`
+

+ + [substation.missing] + +

+
+`; +/* end snapshot Sitipe plugin No doc loaded Should look like latest snapshot */ + +snapshots["Sitipe plugin With Doc loaded Should look like latest snapshot"] = +`
+
+ + +
+
+`; +/* end snapshot Sitipe plugin With Doc loaded Should look like latest snapshot */ + diff --git a/test/unit/editors/sitipe/__snapshots__/sitipe-substation.test.snap.js b/test/unit/compas-editors/sitipe/__snapshots__/sitipe-substation.test.snap.js similarity index 100% rename from test/unit/editors/sitipe/__snapshots__/sitipe-substation.test.snap.js rename to test/unit/compas-editors/sitipe/__snapshots__/sitipe-substation.test.snap.js diff --git a/test/unit/editors/sitipe/sitipe-substation.test.ts b/test/unit/compas-editors/sitipe/sitipe-substation.test.ts similarity index 81% rename from test/unit/editors/sitipe/sitipe-substation.test.ts rename to test/unit/compas-editors/sitipe/sitipe-substation.test.ts index 62d65de25..46eff45f2 100644 --- a/test/unit/editors/sitipe/sitipe-substation.test.ts +++ b/test/unit/compas-editors/sitipe/sitipe-substation.test.ts @@ -1,7 +1,7 @@ import { fixture, html, expect } from '@open-wc/testing'; -import '../../../../src/editors/sitipe/sitipe-substation.js'; -import { SitipeSubstation } from '../../../../src/editors/sitipe/sitipe-substation.js'; +import '../../../../src/compas-editors/sitipe/sitipe-substation.js'; +import { SitipeSubstation } from '../../../../src/compas-editors/sitipe/sitipe-substation.js'; describe('sitipe-substation', () => { let element: SitipeSubstation; diff --git a/web-test-runner.config.mjs b/web-test-runner.config.mjs index 3675ff7ed..30fc5a90b 100644 --- a/web-test-runner.config.mjs +++ b/web-test-runner.config.mjs @@ -22,8 +22,10 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({ name: 'unit', files: [ 'test/unit/compas/*.test.ts', + 'test/unit/compas-editors/**/*.test.ts', 'test/unit/compas-services/*.test.ts', 'test/unit/compas-wizards/*.test.ts', + 'test/unit/Plugging.test.ts', ], }, {