Skip to content

Commit

Permalink
Add pipe root container and delete group e2e coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tplevko committed Jun 10, 2024
1 parent ba55170 commit c7bd3f2
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,73 @@ describe('Test for camel route root containers configuration', () => {
cy.checkCodeSpanLine('streamCache: true');
cy.checkCodeSpanLine('trace: true');
});

it('Canvas pipe container config', () => {
cy.uploadFixture('flows/pipe/basic.yaml');
cy.openDesignPage();

cy.get('[data-id^="pipe"] .pf-topology__group__label .pf-topology__node__label__background').click({ force: true });

cy.get(`input[name="name"]`).clear().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.openSourceCode();

cy.checkCodeSpanLine('name: testName');
cy.checkCodeSpanLine('labels:');
cy.checkCodeSpanLine('labelsTest: labelsValue');
cy.checkCodeSpanLine('annotations:');
cy.checkCodeSpanLine('annotationsTest: annotationsValue');
});

it('Canvas route delete group button test', () => {
cy.uploadFixture('flows/camelRoute/multiflow.yaml');
cy.openDesignPage();
cy.toggleRouteVisibility(1);

cy.get('[data-id^="route-4321"]')
.find('.pf-topology__group__label')
.find('.pf-topology__node__action-icon')
.eq(1)
.click();
cy.get('[data-testid="context-menu-container-remove"]').click();
cy.contains('button', 'Cancel').click();

cy.checkNodeExist('timer', 2);
cy.checkNodeExist('log', 2);

cy.get('[data-id^="route-4321"]')
.find('.pf-topology__group__label')
.find('.pf-topology__node__action-icon')
.eq(1)
.click();
cy.get('[data-testid="context-menu-container-remove"]').click();
cy.contains('button', 'Confirm').click();

cy.checkNodeExist('timer', 1);
cy.checkNodeExist('log', 1);
});
});
17 changes: 17 additions & 0 deletions packages/ui-tests/cypress/fixtures/flows/pipe/basic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: pipe
spec:
source:
properties:
message: hello
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: timer-source
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: log-sink
16 changes: 9 additions & 7 deletions packages/ui-tests/cypress/support/next-commands/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ Cypress.Commands.add('closeWrappedSection', (sectionName: string) => {
});

Cypress.Commands.add('switchWrappedSection', (sectionName: string, wrapped: boolean) => {
cy.get(`[data-testid="expandable-section-${sectionName}"]`).within(() => {
cy.get('.pf-v5-c-expandable-section__toggle').each(($button) => {
if ($button.attr('aria-expanded') === String(wrapped)) {
cy.wrap($button).click();
cy.wrap($button).should('have.attr', 'aria-expanded', String(!wrapped));
}
cy.get(`[data-testid="expandable-section-${sectionName}"]`)
.should('be.visible')
.within(() => {
cy.get('.pf-v5-c-expandable-section__toggle').each(($button) => {
if ($button.attr('aria-expanded') === String(wrapped)) {
cy.wrap($button).click();
cy.wrap($button).should('have.attr', 'aria-expanded', String(!wrapped));
}
});
});
});
});

Cypress.Commands.add('forceSelectMetadataRow', (rowIndex: number) => {
Expand Down

0 comments on commit c7bd3f2

Please sign in to comment.