Skip to content

Commit

Permalink
chore(e2e) - add addStringProperty function
Browse files Browse the repository at this point in the history
  • Loading branch information
tplevko authored and lordrip committed Sep 19, 2024
1 parent a308793 commit 6b0dc30
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 90 deletions.
12 changes: 1 addition & 11 deletions packages/ui-tests/cypress/e2e/beansConfig.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,7 @@ describe('Test for Bean support', () => {

cy.openBeans();
cy.forceSelectMetadataRow(0);
cy.expandWrappedSection('properties');
cy.get('[data-testid="properties-add-string-property--btn"]').not(':hidden').first().click({ force: true });
cy.get('[data-testid="properties--placeholder-name-input"]').should('not.be.disabled');
cy.get('[data-testid="properties--placeholder-name-input"]').click({ force: true });
cy.get('[data-testid="properties--placeholder-name-input"]').clear().type('test');

cy.get('[data-testid="properties--placeholder-value-input"]').should('not.be.disabled');
cy.get('[data-testid="properties--placeholder-value-input"]').click({ force: true });
cy.get('[data-testid="properties--placeholder-value-input"]').clear().type('value');

cy.get('[data-testid="properties--placeholder-property-edit-confirm--btn"]').click({ force: true });
cy.addStringProperty('properties', 'test', 'value');
cy.openSourceCode();

// CHECK the bean was created in the code editor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,29 +136,8 @@ describe('Test for camel route root containers configuration', () => {
cy.get(`input[name="name"]`).clear();
cy.get(`input[name="name"]`).type('testName');

cy.expandWrappedSection('labels');
cy.get('[data-testid="properties-add-string-property--btn"]').not(':hidden').first().click({ force: true });
cy.get('[data-testid="labels--placeholder-name-input"]').should('not.be.disabled');
cy.get('[data-testid="labels--placeholder-name-input"]').click({ force: true });
cy.get('[data-testid="labels--placeholder-name-input"]').clear().type('labelsTest');

cy.get('[data-testid="labels--placeholder-value-input"]').should('not.be.disabled');
cy.get('[data-testid="labels--placeholder-value-input"]').click({ force: true });
cy.get('[data-testid="labels--placeholder-value-input"]').clear().type('labelsValue');
cy.get('[data-testid="labels--placeholder-property-edit-confirm--btn"]').click({ force: true });
cy.closeWrappedSection('labels');

cy.expandWrappedSection('annotations');
cy.get('[data-testid="properties-add-string-property--btn"]').not(':hidden').first().click({ force: true });
cy.get('[data-testid="annotations--placeholder-name-input"]').should('not.be.disabled');
cy.get('[data-testid="annotations--placeholder-name-input"]').click({ force: true });
cy.get('[data-testid="annotations--placeholder-name-input"]').clear().type('annotationsTest');

cy.get('[data-testid="annotations--placeholder-value-input"]').should('not.be.disabled');
cy.get('[data-testid="annotations--placeholder-value-input"]').click({ force: true });
cy.get('[data-testid="annotations--placeholder-value-input"]').clear().type('annotationsValue');
cy.get('[data-testid="annotations--placeholder-property-edit-confirm--btn"]').click({ force: true });
cy.closeWrappedSection('annotations');
cy.addStringProperty('labels', 'labelsTest', 'labelsValue');
cy.addStringProperty('annotations', 'annotationsTest', 'annotationsValue');

cy.openSourceCode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,9 @@ describe('Tests for Multi Value serialization', () => {
cy.selectFormTab('All');

cy.filterFields('Job Parameters');
cy.expandWrappedSection('parameters.jobParameters');
cy.get('[data-testid="properties-add-string-property--btn"]').not(':hidden').first().click({ force: true });
cy.get('[data-testid="parameters.jobParameters--placeholder-name-input"]').should('not.be.disabled');
cy.get('[data-testid="parameters.jobParameters--placeholder-name-input"]').click({ force: true });
cy.get('[data-testid="parameters.jobParameters--placeholder-name-input"]').clear().type('jobParametersTest');

cy.get('[data-testid="parameters.jobParameters--placeholder-value-input"]').should('not.be.disabled');
cy.get('[data-testid="parameters.jobParameters--placeholder-value-input"]').click({ force: true });
cy.get('[data-testid="parameters.jobParameters--placeholder-value-input"]').clear().type('jobParametersValue');
cy.get('[data-testid="parameters.jobParameters--placeholder-property-edit-confirm--btn"]').click({ force: true });
cy.closeWrappedSection('parameters.jobParameters');

cy.addStringProperty('parameters.jobParameters', 'jobParametersTest', 'jobParametersValue');
cy.filterFields('Trigger Parameters');
cy.expandWrappedSection('parameters.triggerParameters');
cy.get('[data-testid="properties-add-string-property--btn"]').not(':hidden').first().click({ force: true });
cy.get('[data-testid="parameters.triggerParameters--placeholder-name-input"]').should('not.be.disabled');
cy.get('[data-testid="parameters.triggerParameters--placeholder-name-input"]').click({ force: true });
cy.get('[data-testid="parameters.triggerParameters--placeholder-name-input"]')
.clear()
.type('triggerParametersTest');

cy.get('[data-testid="parameters.triggerParameters--placeholder-value-input"]').should('not.be.disabled');
cy.get('[data-testid="parameters.triggerParameters--placeholder-value-input"]').click({ force: true });
cy.get('[data-testid="parameters.triggerParameters--placeholder-value-input"]')
.clear()
.type('triggerParametersValue');
cy.get('[data-testid="parameters.triggerParameters--placeholder-property-edit-confirm--btn"]').click({
force: true,
});
cy.closeWrappedSection('parameters.triggerParameters');
cy.addStringProperty('parameters.triggerParameters', 'triggerParametersTest', 'triggerParametersValue');

// CHECK changes are reflected in the code editor
cy.openSourceCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@ describe('Test for node bean reference and configuration support', () => {
cy.get(`input[name="name"]`).clear().type('test');
cy.get(`input[name="type"]`).clear().type('org.acme');

cy.expandWrappedSection('properties');
cy.get('[data-testid="properties-add-string-property--btn"]').not(':hidden').first().click({ force: true });
cy.get('[data-testid="properties--placeholder-name-input"]').should('not.be.disabled');
cy.get('[data-testid="properties--placeholder-name-input"]').click({ force: true });
cy.get('[data-testid="properties--placeholder-name-input"]').clear().type('test');

cy.get('[data-testid="properties--placeholder-value-input"]').should('not.be.disabled');
cy.get('[data-testid="properties--placeholder-value-input"]').click({ force: true });
cy.get('[data-testid="properties--placeholder-value-input"]').clear().type('value');

cy.get('[data-testid="properties--placeholder-property-edit-confirm--btn"]').click({ force: true });
cy.addStringProperty('properties', 'test', 'value');

cy.get('[data-testid="create-bean-btn"').click();
cy.closeStepConfigurationTab();
Expand Down
18 changes: 2 additions & 16 deletions packages/ui-tests/cypress/e2e/metadata.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,8 @@ describe('Test for Metadata Editor support', () => {
cy.uploadFixture('flows/kameletBinding/kafkaSourceSink.yaml');
cy.openMetadata();

cy.expandWrappedSection('annotations');
cy.get('[data-testid="properties-add-string-property--btn"]').not(':hidden').first().click({ force: true });
cy.get('[data-testid="annotations--placeholder-name-input"]').click({ force: true });
cy.get('[data-testid="annotations--placeholder-name-input"]').clear().type('test-annotations');
cy.get('[data-testid="annotations--placeholder-value-input"]').click({ force: true });
cy.get('[data-testid="annotations--placeholder-value-input"]').clear().type('value-annotations');
cy.get('[data-testid="annotations--placeholder-property-edit-confirm--btn"]').click({ force: true });
cy.closeWrappedSection('annotations');
cy.expandWrappedSection('labels');
cy.get('[data-testid="properties-add-string-property--btn"]').not(':hidden').first().click({ force: true });
cy.get('[data-testid="labels--placeholder-name-input"]').click({ force: true });
cy.get('[data-testid="labels--placeholder-name-input"]').clear().type('test-labels');
cy.get('[data-testid="labels--placeholder-value-input"]').click({ force: true });
cy.get('[data-testid="labels--placeholder-value-input"]').clear().type('value-labels');
cy.get('[data-testid="labels--placeholder-property-edit-confirm--btn"]').click({ force: true });
cy.closeWrappedSection('labels');
cy.addStringProperty('annotations', 'test-annotations', 'value-annotations');
cy.addStringProperty('labels', 'test-labels', 'value-labels');

cy.get(`input[name="creationTimestamp"]`).clear().type('testCreationTimestamp');
cy.get(`input[name="deletionGracePeriodSeconds"]`).clear().type('1000');
Expand Down
1 change: 1 addition & 0 deletions packages/ui-tests/cypress/support/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ declare global {
filterFields(filter: string): Chainable<JQuery<Element>>;
selectFormTab(tab: string): Chainable<JQuery<Element>>;
specifiedFormTab(tab: string): Chainable<JQuery<Element>>;
addStringProperty(selector: string, key: string, value: string): Chainable<JQuery<Element>>;
// metadata
expandWrappedSection(sectionName: string): Chainable<JQuery<Element>>;
closeWrappedSection(sectionName: string): Chainable<JQuery<Element>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,21 @@ Cypress.Commands.add('specifiedFormTab', (value: string) => {
cy.get(`[id$="${value}"]`).should('have.attr', 'aria-pressed', 'true');
});
});

Cypress.Commands.add('addStringProperty', (selector: string, key: string, value: string) => {
cy.expandWrappedSection(selector);
cy.get('[data-testid="properties-add-string-property--btn"]').not(':hidden').first().click({ force: true });
cy.get('[data-testid="' + selector + '--placeholder-name-input"]').should('not.be.disabled');
cy.get('[data-testid="' + selector + '--placeholder-name-input"]').click({ force: true });
cy.get('[data-testid="' + selector + '--placeholder-name-input"]')
.clear()
.type(key);

cy.get('[data-testid="' + selector + '--placeholder-value-input"]').should('not.be.disabled');
cy.get('[data-testid="' + selector + '--placeholder-value-input"]').click({ force: true });
cy.get('[data-testid="' + selector + '--placeholder-value-input"]')
.clear()
.type(value);
cy.get('[data-testid="' + selector + '--placeholder-property-edit-confirm--btn"]').click({ force: true });
cy.closeWrappedSection(selector);
});

0 comments on commit 6b0dc30

Please sign in to comment.