Skip to content

Commit

Permalink
e2e for selecting catalog versions
Browse files Browse the repository at this point in the history
  • Loading branch information
tplevko committed Jul 1, 2024
1 parent c1a0503 commit 6ee573f
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
describe('Tests for Quarkus catalog type', () => {
beforeEach(() => {
cy.openHomePage();
});

const runtime='Quarkus'

it('Camel Quarkus catalog type with CR', () => {
cy.selectRuntimeVersion(runtime);
cy.uploadFixture('flows/camelRoute/basic.yaml');
cy.openDesignPage();

cy.hoverOnRuntime(runtime);
cy.get(`[data-testid^="runtime-selector-Camel ${runtime}"]`).then(($element) => {
const dataTestidValue = $element.attr('data-testid');
let runtimeVersion = dataTestidValue!.substring(dataTestidValue!.lastIndexOf(' ')+1);
cy.selectAppendNode('setHeader');
cy.checkCatalogVersion(runtimeVersion);
});

cy.chooseFromCatalog('component', 'as2');
cy.checkNodeExist('as2', 1);

cy.selectPrependNode('setHeader');
cy.chooseFromCatalog('processor', 'log');
cy.checkNodeExist('log', 2);

cy.openSourceCode();
cy.checkCodeSpanLine('uri: as2', 1);
cy.checkCodeSpanLine('log', 1);
});

it('Camel Quarkus catalog type with Kamelet', () => {
cy.selectRuntimeVersion(runtime);
cy.uploadFixture('flows/kamelet/basic.yaml');
cy.openDesignPage();

cy.selectPrependNode('setBody');
cy.chooseFromCatalog('component', 'as2');
cy.checkNodeExist('as2', 1);

cy.selectAppendNode('setBody');
cy.chooseFromCatalog('processor', 'log');
cy.checkNodeExist('log', 1);

cy.openSourceCode();
cy.checkCodeSpanLine('uri: as2', 1);
cy.checkCodeSpanLine('log', 1);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
describe('Tests for SpringBoot catalog type', () => {
beforeEach(() => {
cy.openHomePage();
});

const runtime='SpringBoot'

it('Camel SpringBoot catalog type with CR', () => {

cy.selectRuntimeVersion(runtime);
cy.uploadFixture('flows/camelRoute/basic.yaml');
cy.openDesignPage();

cy.hoverOnRuntime(runtime);
cy.get(`[data-testid^="runtime-selector-Camel ${runtime}"]`).then(($element) => {
const dataTestidValue = $element.attr('data-testid');
let elementVersion = dataTestidValue!.substring(dataTestidValue!.lastIndexOf(' ')+1);
cy.selectAppendNode('setHeader');
cy.checkCatalogVersion(elementVersion);
});

cy.chooseFromCatalog('component', 'as2');
cy.checkNodeExist('as2', 1);

cy.selectPrependNode('setHeader');
cy.chooseFromCatalog('processor', 'log');
cy.checkNodeExist('log', 2);

cy.openSourceCode();
cy.checkCodeSpanLine('uri: as2', 1);
cy.checkCodeSpanLine('log', 1);
});

it('Camel SpringBoot catalog type with Kamelet', () => {
cy.selectRuntimeVersion(runtime);
cy.uploadFixture('flows/kamelet/basic.yaml');
cy.openDesignPage();

cy.selectPrependNode('setBody');
cy.chooseFromCatalog('component', 'as2');
cy.checkNodeExist('as2', 1);

cy.selectAppendNode('setBody');
cy.chooseFromCatalog('processor', 'log');
cy.checkNodeExist('log', 1);

cy.openSourceCode();
cy.checkCodeSpanLine('uri: as2', 1);
cy.checkCodeSpanLine('log', 1);
});
});
3 changes: 3 additions & 0 deletions packages/ui-tests/cypress/support/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ declare global {
checkEdgeExists(sourceName: string, targetName: string): Chainable<JQuery<Element>>;
deleteBranch(branchIndex: number): Chainable<JQuery<Element>>;
selectCamelRouteType(type: string, subType?: string): Chainable<JQuery<Element>>;
selectRuntimeVersion(type: string): Chainable<JQuery<Element>>;
hoverOnRuntime(type: string): Chainable<JQuery<Element>>;
checkCatalogVersion(version: string): Chainable<JQuery<Element>>;
chooseFromCatalog(nodeType: string, name: string): Chainable<JQuery<Element>>;
// nodeConfiguration
interactWithExpressinInputObject(inputName: string, value?: string): Chainable<JQuery<Element>>;
Expand Down
31 changes: 31 additions & 0 deletions packages/ui-tests/cypress/support/next-commands/design.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,34 @@ Cypress.Commands.add('selectCamelRouteType', (type: string, subType?: string) =>
subType = subType ?? type;
cy.get(`[data-testid="new-entity-${subType}"] button.pf-v5-c-menu__item`).click({ force: true });
});

Cypress.Commands.add('selectRuntimeVersion', (type: string) => {
cy.hoverOnRuntime(type);
cy.get(`[data-testid^="runtime-selector-Camel ${type}"] button.pf-v5-c-menu__item`).click({ force: true });
// Wait for the loading schemas to disappear
cy.get('[data-testid="loading-schemas"]').should('be.visible');
cy.get('[data-testid="loading-schemas"]').should('not.exist');
// Wait for the loading connectors to disappear
cy.get('[data-testid="loading-catalogs"]').should('be.visible');
cy.get('[data-testid="loading-catalogs"]').should('not.exist');
cy.get('[data-testid="visualization-empty-state"]').should('exist');
// Wait for the element to become visible
cy.get('[data-testid="visualization-empty-state"]').should('be.visible');
});

Cypress.Commands.add('hoverOnRuntime', (type: string) => {
cy.get('[data-testid="runtime-selector-list-dropdown"]').click({ force: true });
cy.get('ul.pf-v5-c-menu__list')
.should('exist')
.find(`[data-testid="runtime-selector-${type}"]`)
.should('exist')
.trigger('mouseover');
});

Cypress.Commands.add('checkCatalogVersion', (version?: string) => {
cy.get('.pf-v5-c-card__title-text')
.eq(0)
.within(() => {
cy.get('.pf-v5-c-label__text').should('have.text', version);
});
});

0 comments on commit 6ee573f

Please sign in to comment.