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 2025/01/09 17:11:18 UTC
(streampipes) 02/02: refactor: Update labels.spec.ts
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch hotfix-minor-test-improvements
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 9137dd81bd81654a4f4a3e47e8330537fc4ab358
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Thu Jan 9 18:11:01 2025 +0100
refactor: Update labels.spec.ts
---
.../utils/configuration/ConfigurationUtils.ts | 24 ++++++++++++++++++++++
.../tests/configuration/labels/labels.spec.ts | 20 ++++++++----------
2 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/ui/cypress/support/utils/configuration/ConfigurationUtils.ts b/ui/cypress/support/utils/configuration/ConfigurationUtils.ts
index f8148033e5..62a0ad65e3 100644
--- a/ui/cypress/support/utils/configuration/ConfigurationUtils.ts
+++ b/ui/cypress/support/utils/configuration/ConfigurationUtils.ts
@@ -28,4 +28,28 @@ export class ConfigurationUtils {
public static goToGeneralConfiguration() {
cy.visit('#/configuration/general');
}
+
+ public static goToLabelConfiguration() {
+ cy.visit('#/configuration/labels');
+ }
+
+ public static addNewLabel(name: string, description: string) {
+ cy.dataCy('new-label-button').click();
+ cy.dataCy('label-name').type(name);
+ cy.dataCy('label-description').type(description);
+ cy.dataCy('save-label-button').click();
+ }
+
+ public static checkLabel(labelName: string) {
+ cy.dataCy('available-labels-list').should('have.length', 1);
+ cy.dataCy('label-text').should($el => {
+ const text = $el.text().trim();
+ expect(text).to.equal(labelName);
+ });
+ }
+
+ public static deleteLabel() {
+ cy.dataCy('delete-label-button').click();
+ cy.dataCy('available-labels-list').should('have.length', 0);
+ }
}
diff --git a/ui/cypress/tests/configuration/labels/labels.spec.ts b/ui/cypress/tests/configuration/labels/labels.spec.ts
index 703085ef7e..aececff1ac 100644
--- a/ui/cypress/tests/configuration/labels/labels.spec.ts
+++ b/ui/cypress/tests/configuration/labels/labels.spec.ts
@@ -16,26 +16,22 @@
*
*/
+import { ConfigurationUtils } from '../../../support/utils/configuration/ConfigurationUtils';
+
describe('Add and Delete Label', () => {
beforeEach('Setup Test', () => {
cy.initStreamPipesTest();
});
it('Perform Test', () => {
- cy.visit('#/configuration/labels');
+ const labelName = 'test';
+
+ ConfigurationUtils.goToLabelConfiguration();
- // 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();
+ ConfigurationUtils.addNewLabel(labelName, 'test test');
- // Check label
- cy.dataCy('available-labels-list').should('have.length', 1);
- cy.dataCy('label-text').should('have.text', ' test\n');
+ ConfigurationUtils.checkLabel(labelName);
- // Delete label
- cy.dataCy('delete-label-button').click();
- cy.dataCy('available-labels-list').should('have.length', 0);
+ ConfigurationUtils.deleteLabel();
});
});