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

test(#2017): Add cypress test for configuration #2018

Merged
merged 3 commits into from Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 43 additions & 0 deletions ui/cypress/tests/configuration/labels/general.spec.ts
@@ -0,0 +1,43 @@
/*
* 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.
*
*/

describe('Change basic settings', () => {
beforeEach('Setup Test', () => {
cy.initStreamPipesTest();
});

it('Perform Test', () => {
cy.visit('#/configuration/general');

// Rename app, change localhost and port
cy.dataCy('general-config-app-name').clear();
cy.dataCy('general-config-app-name').type('TEST APP');
cy.dataCy('general-config-hostname').clear();
cy.dataCy('general-config-hostname').type('testhost');
cy.dataCy('general-config-port').clear();
cy.dataCy('general-config-port').type('123');
cy.dataCy('sp-element-general-config-save').click();

// Leave, Re-visit configuration and check values
cy.visit('#/dashboard');
cy.visit('#/configuration/general');
cy.dataCy('general-config-app-name').should('have.value', 'TEST APP');
cy.dataCy('general-config-hostname').should('have.value', 'testhost');
cy.dataCy('general-config-port').should('have.value', '123');
});
});
41 changes: 41 additions & 0 deletions ui/cypress/tests/configuration/labels/labels.spec.ts
@@ -0,0 +1,41 @@
/*
* 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.
*
*/

describe('Add and Delete Label', () => {
beforeEach('Setup Test', () => {
cy.initStreamPipesTest();
});

it('Perform Test', () => {
cy.visit('#/configuration/labels');

// Add new label
cy.dataCy('new-label-button').click();
cy.dataCy('label-name').type('test');
cy.dataCy('label-description').type('test test');
cy.dataCy('save-label-button').click();

// Check label
cy.dataCy('available-labels-list').should('have.length', 1);
cy.dataCy('label-text').should('have.text', ' test\n');

// Delete label
cy.dataCy('delete-label-button').click();
cy.dataCy('available-labels-list').should('have.length', 0);
});
});
Expand Up @@ -36,6 +36,7 @@
fxFlex
matInput
required
data-cy="general-config-app-name"
/>
</mat-form-field>
<div class="subsection-title">Host and Port</div>
Expand All @@ -62,6 +63,7 @@
fxFlex
matInput
required
data-cy="general-config-hostname"
/>
</mat-form-field>
<mat-form-field color="accent" class="ml-10">
Expand All @@ -72,6 +74,7 @@
matInput
type="number"
required
data-cy="general-config-port"
/>
</mat-form-field>
</div>
Expand Down
Expand Up @@ -34,11 +34,15 @@
></sp-label>
<mat-form-field color="accent" appearance="outline">
<mat-label>Label</mat-label>
<input matInput [(ngModel)]="label.label" />
<input matInput [(ngModel)]="label.label" data-cy="label-name" />
</mat-form-field>
<mat-form-field color="accent" appearance="outline">
<mat-label>Desription</mat-label>
<input matInput [(ngModel)]="label.description" />
<input
matInput
[(ngModel)]="label.description"
data-cy="label-description"
/>
</mat-form-field>
<input
[(colorPicker)]="label.color"
Expand All @@ -58,6 +62,7 @@
mat-button
mat-raised-button
color="accent"
data-cy="save-label-button"
(click)="saveEmitter.emit(label)"
>
Save
Expand Down
Expand Up @@ -26,6 +26,7 @@
mat-button
mat-raised-button
color="accent"
data-cy="new-label-button"
(click)="createLabelMode = true"
>
<i class="material-icons">add</i><span>&nbsp;New label</span>
Expand All @@ -43,6 +44,7 @@
fxLayout="column"
*ngFor="let label of allLabels"
class="label-item"
data-cy="available-labels-list"
>
<div
fxLayout="row"
Expand All @@ -53,6 +55,7 @@
fxFlex="20"
[labelText]="label.label"
[labelBackground]="label.color"
data-cy="label-text"
>
</sp-label>
<span fxFlex="50" *ngIf="!isEditMode(label._id)">{{
Expand All @@ -71,6 +74,7 @@
mat-icon-button
color="warn"
(click)="deleteLabel(label)"
data-cy="delete-label-button"
>
<i class="material-icons">delete</i>
</button>
Expand Down