You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2022/10/18 07:21:50 UTC
[incubator-streampipes] branch STREAMPIPES-597 updated (649b118aa -> b47c15c68)
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a change to branch STREAMPIPES-597
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
from 649b118aa [STREAMPIPES-597] Very first version of adapter edit is complete
new 3bbfead4b [STREAMPIPES-597] Add component for event schema error hints
new b47c15c68 [STREAMPIPES-597] Integrate cypress component testing
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
ui/cypress.config.ts | 33 ++++++++
ui/cypress/support/commands.ts | 55 ++++++++++++
.../cypress/support/component-index.html | 18 ++--
ui/cypress/support/component.ts | 58 +++++++++++++
ui/cypress/support/utils/connect/ConnectBtns.ts | 4 +
ui/cypress/tests/adapter/editAdapter.smoke.spec.ts | 16 +++-
.../event-schema-error-hints.component.cy.ts | 97 ++++++++++++++++++++++
.../event-schema-error-hints.component.html | 53 ++++++++++++
.../event-schema-error-hints.component.scss} | 36 +++++---
.../event-schema-error-hints.component.ts} | 19 +++--
.../event-schema/event-schema.component.html | 32 ++-----
.../event-schema/event-schema.component.scss | 32 -------
.../schema-editor-header.component.html | 1 +
ui/src/app/connect/connect.module.ts | 4 +-
14 files changed, 371 insertions(+), 87 deletions(-)
create mode 100644 ui/cypress/support/commands.ts
copy streampipes-backend/src/main/resources/static/index.html => ui/cypress/support/component-index.html (74%)
create mode 100644 ui/cypress/support/component.ts
create mode 100644 ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.cy.ts
create mode 100644 ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.html
copy ui/src/app/{core-ui/data-download-dialog/components/select-data/select-data.component.scss => connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.scss} (63%)
copy ui/src/app/{core-ui/data-download-dialog/components/select-format/select-format.component.ts => connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.ts} (67%)
[incubator-streampipes] 02/02: [STREAMPIPES-597] Integrate cypress component testing
Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-597
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit b47c15c68a7d0a0d66dff81718c67f13e2a5fc83
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Oct 18 09:21:37 2022 +0200
[STREAMPIPES-597] Integrate cypress component testing
---
ui/cypress.config.ts | 33 ++++++++
ui/cypress/support/commands.ts | 55 ++++++++++++
ui/cypress/support/component-index.html | 29 +++++++
ui/cypress/support/component.ts | 58 +++++++++++++
ui/cypress/tests/adapter/editAdapter.smoke.spec.ts | 19 ++---
.../event-schema-error-hints.component.cy.ts | 97 ++++++++++++++++++++++
.../event-schema-error-hints.component.html | 4 +-
.../event-schema-error-hints.component.spec.ts | 43 ----------
8 files changed, 284 insertions(+), 54 deletions(-)
diff --git a/ui/cypress.config.ts b/ui/cypress.config.ts
index 989f2658c..6f71f8cca 100644
--- a/ui/cypress.config.ts
+++ b/ui/cypress.config.ts
@@ -1,20 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
// tslint:disable-next-line:no-implicit-dependencies
import { defineConfig } from 'cypress';
export default defineConfig({
projectId: 'q1jdu2',
downloadsFolder: 'cypress/downloads',
+
env: {
TAKE_SCREENSHOT: 'false',
},
+
retries: {
runMode: 1,
openMode: 0,
},
+
trashAssetsBeforeRuns: true,
videoCompression: false,
viewportWidth: 1920,
viewportHeight: 1080,
+
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
@@ -24,4 +46,15 @@ export default defineConfig({
specPattern: 'cypress/tests/**/*.{js,jsx,ts,tsx}',
baseUrl: 'http://localhost:80',
},
+
+ component: {
+ devServer: {
+ framework: 'angular',
+ bundler: 'webpack',
+ },
+ setupNodeEvents(on, config) {
+ return require('./cypress/plugins/index.ts')(on, config);
+ },
+ specPattern: '**/*.cy.ts',
+ },
});
diff --git a/ui/cypress/support/commands.ts b/ui/cypress/support/commands.ts
new file mode 100644
index 000000000..648a6e0f2
--- /dev/null
+++ b/ui/cypress/support/commands.ts
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/// <reference types="cypress" />
+// ***********************************************
+// This example commands.ts shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add('login', (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
+//
+//
+// -- This will overwrite an existing command --
+// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
+//
+// declare global {
+// namespace Cypress {
+// interface Chainable {
+// login(email: string, password: string): Chainable<void>
+// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
+// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
+// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
+// }
+// }
+// }
diff --git a/ui/cypress/support/component-index.html b/ui/cypress/support/component-index.html
new file mode 100644
index 000000000..e5c966f4e
--- /dev/null
+++ b/ui/cypress/support/component-index.html
@@ -0,0 +1,29 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
+ <title>Components App</title>
+ </head>
+ <body>
+ <div data-cy-root></div>
+ </body>
+</html>
diff --git a/ui/cypress/support/component.ts b/ui/cypress/support/component.ts
new file mode 100644
index 000000000..06b7f0e34
--- /dev/null
+++ b/ui/cypress/support/component.ts
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// ***********************************************************
+// This example support/component.ts is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import './commands';
+
+// Alternatively you can use CommonJS syntax:
+// require('./commands')
+import { mount } from 'cypress/angular';
+import { dataCy } from './general/dataCy';
+
+// Augment the Cypress namespace to include type definitions for
+// your custom command.
+// Alternatively, can be defined in cypress/support/component.d.ts
+// with a <reference path="./component" /> at the top of your spec.
+declare global {
+ namespace Cypress {
+ interface Chainable {
+ mount: typeof mount;
+ }
+ }
+}
+
+Cypress.Commands.add('mount', mount);
+Cypress.Commands.add('dataCy', dataCy);
+
+// Example use:
+// cy.mount(MyComponent)
diff --git a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
index a9518dd12..6c9924e18 100644
--- a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
+++ b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
@@ -23,16 +23,15 @@ import { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
describe('Test Edit Adapter', () => {
beforeEach('Setup Test', () => {
- // // To set up test add a stream adapter that can be configured
- // cy.initStreamPipesTest();
- // const adapterInput = SpecificAdapterBuilder
- // .create('Machine_Data_Simulator')
- // .setName('Machine Data Simulator Test')
- // .addInput('input', 'wait-time-ms', '1000')
- // .build();
- //
- // ConnectUtils.testSpecificStreamAdapter(adapterInput);
- cy.login();
+ // To set up test add a stream adapter that can be configured
+ cy.initStreamPipesTest();
+ const adapterInput = SpecificAdapterBuilder
+ .create('Machine_Data_Simulator')
+ .setName('Machine Data Simulator Test')
+ .addInput('input', 'wait-time-ms', '1000')
+ .build();
+
+ ConnectUtils.testSpecificStreamAdapter(adapterInput);
});
it('Perform Test', () => {
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.cy.ts b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.cy.ts
new file mode 100644
index 000000000..4251117e7
--- /dev/null
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.cy.ts
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { EventSchemaErrorHintsComponent } from './event-schema-error-hints.component';
+import { UserErrorMessage } from '../../../../../core-model/base/UserErrorMessage';
+
+describe('EventSchemaErrorHints', () => {
+
+ it('schema ok', () => {
+ mount(`<sp-event-schema-error-hints
+ [isError]="false"
+ [isLoading]="false"
+ [schemaErrorHints]=[]>
+ </sp-event-schema-error-hints>`);
+
+ cy.dataCy('schema-validation-ok').should('be.visible');
+ cy.get('.schema-validation-text-ok').contains('Schema ok');
+ cy.get('.material-icons').contains('check_circle');
+ });
+
+ it('loading is true', () => {
+ mount(`<sp-event-schema-error-hints
+ [isError]="false"
+ [isLoading]="true"
+ [schemaErrorHints]=[]>
+ </sp-event-schema-error-hints>`);
+
+ cy.dataCy('schema-validation-ok').should('not.exist');
+ cy.dataCy('schema-validation-error').should('not.exist');
+ });
+
+ it('error is true', () => {
+ mount(`<sp-event-schema-error-hints
+ [isError]="true"
+ [isLoading]="false"
+ [schemaErrorHints]=[]>
+ </sp-event-schema-error-hints>`);
+
+ cy.dataCy('schema-validation-ok').should('not.exist');
+ cy.dataCy('schema-validation-error').should('not.exist');
+ });
+
+ const sampleHint = new UserErrorMessage('sample error', 'This is a test error');
+
+ it('display one error', () => {
+
+ mount(`<sp-event-schema-error-hints
+ [isError]="false"
+ [isLoading]="false"
+ [schemaErrorHints]="schemaErrorHints">
+ </sp-event-schema-error-hints>`,
+ {'schemaErrorHints': [sampleHint]});
+
+ cy.dataCy('schema-validation-ok').should('not.exist');
+ cy.dataCy('schema-validation-error').should('be.visible').should('have.length', 1);
+ cy.get('.schema-validation-text-error').contains(sampleHint.title);
+ cy.dataCy('schema-validation-error-content').contains(sampleHint.content);
+ cy.get('.material-icons').contains('warning');
+ });
+
+ it('display multiple errors', () => {
+
+ mount(`<sp-event-schema-error-hints
+ [isError]="false"
+ [isLoading]="false"
+ [schemaErrorHints]="schemaErrorHints">
+ </sp-event-schema-error-hints>`,
+ {'schemaErrorHints': [sampleHint, sampleHint, sampleHint]});
+
+ cy.dataCy('schema-validation-ok').should('not.exist');
+ cy.dataCy('schema-validation-error').should('be.visible').should('have.length', 3);
+ });
+
+
+ const mount = (template: string, cp?) => {
+ cy.mount(template, {
+ declarations: [EventSchemaErrorHintsComponent],
+ componentProperties: cp
+ });
+ };
+});
+
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.html b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.html
index a8529eef8..16d54b903 100644
--- a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.html
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.html
@@ -19,6 +19,7 @@
<div fxLayout="column"
fxFlex="100"
fxLayoutAlign="start center"
+ data-cy="schema-validation-ok"
*ngIf="!isLoading && !isError && schemaErrorHints.length === 0"
class="schema-validation schema-validation-ok">
<div fxFlex="100"
@@ -35,6 +36,7 @@
fxLayout="column"
[ngClass]="schemaErrorHint.level === 'error' ? 'schema-validation schema-validation-error' : 'schema-validation schema-validation-warning'"
fxLayoutAlign="start center"
+ data-cy="schema-validation-error"
*ngFor="let schemaErrorHint of schemaErrorHints">
<div fxFlex="100"
fxLayout="row"
@@ -43,7 +45,7 @@
<i class="material-icons">warning</i>
<b>{{schemaErrorHint.title}}</b>
</div>
- <div>
+ <div data-cy="schema-validation-error-content">
<span>{{schemaErrorHint.content}}</span>
</div>
</div>
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.spec.ts b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.spec.ts
deleted file mode 100644
index ec18c3965..000000000
--- a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.spec.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { EventSchemaErrorHintsComponent } from './event-schema-error-hints.component';
-
-describe('EventSchemaErrorHintsComponent', () => {
- let component: EventSchemaErrorHintsComponent;
- let fixture: ComponentFixture<EventSchemaErrorHintsComponent>;
-
- beforeEach(async () => {
- await TestBed.configureTestingModule({
- declarations: [ EventSchemaErrorHintsComponent ]
- })
- .compileComponents();
- });
-
- beforeEach(() => {
- fixture = TestBed.createComponent(EventSchemaErrorHintsComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
[incubator-streampipes] 01/02: [STREAMPIPES-597] Add component for event schema error hints
Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-597
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 3bbfead4bf133bbad1e631ca09bf268fca2050b0
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Mon Oct 17 21:42:33 2022 +0200
[STREAMPIPES-597] Add component for event schema error hints
---
ui/cypress/support/utils/connect/ConnectBtns.ts | 4 ++
ui/cypress/tests/adapter/editAdapter.smoke.spec.ts | 35 ++++++++++-----
.../event-schema-error-hints.component.html | 51 ++++++++++++++++++++++
.../event-schema-error-hints.component.scss} | 45 +++++++++++--------
.../event-schema-error-hints.component.spec.ts} | 38 ++++++++--------
.../event-schema-error-hints.component.ts} | 31 ++++++-------
.../event-schema/event-schema.component.html | 32 +++-----------
.../event-schema/event-schema.component.scss | 32 --------------
.../schema-editor-header.component.html | 1 +
ui/src/app/connect/connect.module.ts | 4 +-
10 files changed, 154 insertions(+), 119 deletions(-)
diff --git a/ui/cypress/support/utils/connect/ConnectBtns.ts b/ui/cypress/support/utils/connect/ConnectBtns.ts
index ef05a7691..15b10882d 100644
--- a/ui/cypress/support/utils/connect/ConnectBtns.ts
+++ b/ui/cypress/support/utils/connect/ConnectBtns.ts
@@ -32,6 +32,10 @@ export class ConnectBtns {
return cy.dataCy('start-adapter');
}
+ public static refreshSchema() {
+ return cy.dataCy('refresh-schema');
+ }
+
public static storeEditAdapter() {
return cy.dataCy('store-edit-adapter');
}
diff --git a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
index b9b80c956..a9518dd12 100644
--- a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
+++ b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
@@ -23,15 +23,16 @@ import { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
describe('Test Edit Adapter', () => {
beforeEach('Setup Test', () => {
- // To set up test add a stream adapter that can be configured
- cy.initStreamPipesTest();
- const adapterInput = SpecificAdapterBuilder
- .create('Machine_Data_Simulator')
- .setName('Machine Data Simulator Test')
- .addInput('input', 'wait-time-ms', '1000')
- .build();
-
- ConnectUtils.testSpecificStreamAdapter(adapterInput);
+ // // To set up test add a stream adapter that can be configured
+ // cy.initStreamPipesTest();
+ // const adapterInput = SpecificAdapterBuilder
+ // .create('Machine_Data_Simulator')
+ // .setName('Machine Data Simulator Test')
+ // .addInput('input', 'wait-time-ms', '1000')
+ // .build();
+ //
+ // ConnectUtils.testSpecificStreamAdapter(adapterInput);
+ cy.login();
});
it('Perform Test', () => {
@@ -47,13 +48,22 @@ describe('Test Edit Adapter', () => {
ConnectBtns.editAdapter().should('not.be.disabled');
ConnectBtns.editAdapter().click();
- // Change config 'wait-time-ms' to 2000 and save adapter
+ // Change adapter configurations
const newUserConfiguration = UserInputBuilder
.create()
.add('input', 'wait-time-ms', '2000')
+ .add('radio', 'selected', 'simulator-option-pressure')
.build();
ConnectUtils.configureAdapter(newUserConfiguration);
+ // check warning that event schema might have changed
+ cy.dataCy('sp-connect-adapter-warning-event-schema-change', {timeout: 10000}).should('be.visible');
+
+ // Update event schema
+ ConnectBtns.refreshSchema().click();
+
+ cy.dataCy('sp-connect-adapter-warning-event-schema-change', {timeout: 10000}).should('not.be.visible');
+
ConnectUtils.finishEventSchemaConfiguration();
ConnectBtns.storeEditAdapter().click();
@@ -70,7 +80,12 @@ describe('Test Edit Adapter', () => {
ConnectBtns.infoAdapter().click();
cy.get('div').contains('Values').parent().click();
+ // Validate resulting event
cy.dataCy('sp-connect-adapter-live-preview', {timeout: 10000}).should('be.visible');
+
+ // validate that three event properties
+ cy.get('.preview-row', {timeout: 10000}).its('length').should('eq', 3);
+
});
});
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.html b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.html
new file mode 100644
index 000000000..a8529eef8
--- /dev/null
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.html
@@ -0,0 +1,51 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+<div>
+ <div fxLayout="column"
+ fxFlex="100"
+ fxLayoutAlign="start center"
+ *ngIf="!isLoading && !isError && schemaErrorHints.length === 0"
+ class="schema-validation schema-validation-ok">
+ <div fxFlex="100"
+ fxLayout="row"
+ fxLayoutAlign="start center"
+ class="schema-validation-text-ok">
+ <i class="material-icons">check_circle</i> <b>Schema ok</b>
+ </div>
+ </div>
+ <div fxLayout="column"
+ fxFlex="100"
+ *ngIf="!isLoading && !isError && schemaErrorHints.length > 0">
+ <div fxFlex="100"
+ fxLayout="column"
+ [ngClass]="schemaErrorHint.level === 'error' ? 'schema-validation schema-validation-error' : 'schema-validation schema-validation-warning'"
+ fxLayoutAlign="start center"
+ *ngFor="let schemaErrorHint of schemaErrorHints">
+ <div fxFlex="100"
+ fxLayout="row"
+ fxLayoutAlign="center start"
+ [ngClass]="schemaErrorHint.level === 'error' ? 'schema-validation-text-error' : 'schema-validation-text-warning'">
+ <i class="material-icons">warning</i>
+ <b>{{schemaErrorHint.title}}</b>
+ </div>
+ <div>
+ <span>{{schemaErrorHint.content}}</span>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/ui/cypress/support/utils/connect/ConnectBtns.ts b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.scss
similarity index 63%
copy from ui/cypress/support/utils/connect/ConnectBtns.ts
copy to ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.scss
index ef05a7691..ec5781c63 100644
--- a/ui/cypress/support/utils/connect/ConnectBtns.ts
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.scss
@@ -1,4 +1,4 @@
-/*
+/*!
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -15,25 +15,36 @@
* limitations under the License.
*
*/
-export class ConnectBtns {
- public static infoAdapter() {
- return cy.dataCy('info-adapter');
- }
- public static editAdapter() {
- return cy.dataCy('edit-adapter');
- }
+.schema-validation {
+ margin-bottom: 10px;
+ border: 2px solid var(--color-bg-3);
+ padding: 10px;
+ min-height: 50px;
+ text-align: center;
+}
- public static stopAdapter() {
- return cy.dataCy('stop-adapter');
- }
+.schema-validation-ok {
+ border: 2px solid #629f62;
+}
- public static startAdapter() {
- return cy.dataCy('start-adapter');
- }
+.schema-validation-error {
+ border: 2px solid #963e3e;
+}
- public static storeEditAdapter() {
- return cy.dataCy('store-edit-adapter');
- }
+.schema-validation-warning {
+ border: 2px solid #d09836;
+}
+.schema-validation-text-ok {
+ color: #629f62;
}
+
+.schema-validation-text-error {
+ color: #963e3e;
+}
+
+.schema-validation-text-warning {
+ color: #d09836;
+}
+
diff --git a/ui/cypress/support/utils/connect/ConnectBtns.ts b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.spec.ts
similarity index 52%
copy from ui/cypress/support/utils/connect/ConnectBtns.ts
copy to ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.spec.ts
index ef05a7691..ec18c3965 100644
--- a/ui/cypress/support/utils/connect/ConnectBtns.ts
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.spec.ts
@@ -15,25 +15,29 @@
* limitations under the License.
*
*/
-export class ConnectBtns {
- public static infoAdapter() {
- return cy.dataCy('info-adapter');
- }
- public static editAdapter() {
- return cy.dataCy('edit-adapter');
- }
+import { ComponentFixture, TestBed } from '@angular/core/testing';
- public static stopAdapter() {
- return cy.dataCy('stop-adapter');
- }
+import { EventSchemaErrorHintsComponent } from './event-schema-error-hints.component';
- public static startAdapter() {
- return cy.dataCy('start-adapter');
- }
+describe('EventSchemaErrorHintsComponent', () => {
+ let component: EventSchemaErrorHintsComponent;
+ let fixture: ComponentFixture<EventSchemaErrorHintsComponent>;
- public static storeEditAdapter() {
- return cy.dataCy('store-edit-adapter');
- }
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ EventSchemaErrorHintsComponent ]
+ })
+ .compileComponents();
+ });
-}
+ beforeEach(() => {
+ fixture = TestBed.createComponent(EventSchemaErrorHintsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/ui/cypress/support/utils/connect/ConnectBtns.ts b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.ts
similarity index 60%
copy from ui/cypress/support/utils/connect/ConnectBtns.ts
copy to ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.ts
index ef05a7691..8b61fe59f 100644
--- a/ui/cypress/support/utils/connect/ConnectBtns.ts
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component.ts
@@ -15,25 +15,26 @@
* limitations under the License.
*
*/
-export class ConnectBtns {
- public static infoAdapter() {
- return cy.dataCy('info-adapter');
- }
- public static editAdapter() {
- return cy.dataCy('edit-adapter');
- }
+import { Component, Input, OnInit } from '@angular/core';
+import { UserErrorMessage } from '../../../../../core-model/base/UserErrorMessage';
- public static stopAdapter() {
- return cy.dataCy('stop-adapter');
- }
+@Component({
+ selector: 'sp-event-schema-error-hints',
+ templateUrl: './event-schema-error-hints.component.html',
+ styleUrls: ['./event-schema-error-hints.component.scss']
+})
+export class EventSchemaErrorHintsComponent implements OnInit {
- public static startAdapter() {
- return cy.dataCy('start-adapter');
- }
+ @Input() schemaErrorHints: UserErrorMessage[];
+
+ @Input() isLoading: boolean;
+
+ @Input() isError: boolean;
+
+ constructor() { }
- public static storeEditAdapter() {
- return cy.dataCy('store-edit-adapter');
+ ngOnInit(): void {
}
}
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.html b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.html
index 5990ea8ba..456847635 100644
--- a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.html
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.html
@@ -19,34 +19,12 @@
<div fxLayout="column" fxLayoutAlign="center" class="mt-20">
<div fxFlex="90" fxLayout="column">
- <div fxLayout="column"
- fxFlex="100"
- fxLayoutAlign="start center"
- *ngIf="!isLoading && !isError && schemaErrorHints.length === 0"
- class="schema-validation schema-validation-ok">
- <div fxFlex="100"
- fxLayout="row"
- fxLayoutAlign="start center"
- class="schema-validation-text-ok">
- <i class="material-icons">check_circle</i> <b>Schema ok</b>
- </div>
- </div>
- <div fxLayout="column" fxFlex="100" *ngIf="!isLoading && !isError && schemaErrorHints.length > 0">
- <div fxFlex="100"
- fxLayout="column"
- [ngClass]="schemaErrorHint.level === 'error' ? 'schema-validation schema-validation-error' : 'schema-validation schema-validation-warning'"
- fxLayoutAlign="start center" *ngFor="let schemaErrorHint of schemaErrorHints">
- <div fxFlex="100" fxLayout="row" fxLayoutAlign="center start"
- [ngClass]="schemaErrorHint.level === 'error' ? 'schema-validation-text-error' : 'schema-validation-text-warning'">
- <i class="material-icons">warning</i>
- <b>{{schemaErrorHint.title}}</b>
- </div>
- <div>
- <span>{{schemaErrorHint.content}}</span>
- </div>
- </div>
- </div>
+ <sp-event-schema-error-hints [schemaErrorHints]="schemaErrorHints"
+ [isError]="isError"
+ [isLoading]="isLoading">
+ </sp-event-schema-error-hints>
+
<sp-basic-inner-panel [showTitle]="false" outerMargin="0px 0px 20px 0px">
<div header *ngIf="!isLoading && !isError" fxFlex="100">
<sp-schema-editor-header fxFlex="100"
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.scss b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.scss
index 228a3ae77..8def70745 100644
--- a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.scss
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.scss
@@ -175,35 +175,3 @@ opacity:0.5;
.mt-20 {
margin-top: 20px;
}
-
-.schema-validation {
- margin-bottom: 10px;
- border: 2px solid var(--color-bg-3);
- padding: 10px;
- min-height: 50px;
- text-align: center;
-}
-
-.schema-validation-ok {
- border: 2px solid #629f62;
-}
-
-.schema-validation-error {
- border: 2px solid #963e3e;
-}
-
-.schema-validation-warning {
- border: 2px solid #d09836;
-}
-
-.schema-validation-text-ok {
- color: #629f62;
-}
-
-.schema-validation-text-error {
- color: #963e3e;
-}
-
-.schema-validation-text-warning {
- color: #d09836;
-}
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/schema-editor-header/schema-editor-header.component.html b/ui/src/app/connect/components/adapter-configuration/schema-editor/schema-editor-header/schema-editor-header.component.html
index 841820167..06e109de5 100644
--- a/ui/src/app/connect/components/adapter-configuration/schema-editor/schema-editor-header/schema-editor-header.component.html
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/schema-editor-header/schema-editor-header.component.html
@@ -48,6 +48,7 @@
mat-button
mat-icon-button
matTooltip="Refresh Schema"
+ data-cy="refresh-schema"
(click)="guessSchema()">
<mat-icon>refresh</mat-icon>
</button>
diff --git a/ui/src/app/connect/connect.module.ts b/ui/src/app/connect/connect.module.ts
index f7d7f3374..a568b12dc 100644
--- a/ui/src/app/connect/connect.module.ts
+++ b/ui/src/app/connect/connect.module.ts
@@ -114,6 +114,7 @@ import {
} from './components/adapter-configuration/adapter-configuration-header/adapter-configuration-header.component';
import { NewAdapterComponent } from './components/new-adapter/new-adapter.component';
import { EditAdapterComponent } from './components/edit-adapter/edit-adapter.component';
+import { EventSchemaErrorHintsComponent } from './components/adapter-configuration/schema-editor/event-schema-error-hints/event-schema-error-hints.component';
@NgModule({
imports: [
@@ -199,7 +200,8 @@ import { EditAdapterComponent } from './components/edit-adapter/edit-adapter.com
SpAdapterOptionsPanelComponent,
AdapterConfigurationHeaderComponent,
NewAdapterComponent,
- EditAdapterComponent
+ EditAdapterComponent,
+ EventSchemaErrorHintsComponent
],
providers: [
RestService,