diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index bdcbc8018..615970c49 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -51,13 +51,20 @@ jobs: - name: Build @kaoto/kaoto package in lib mode run: yarn workspace @kaoto/kaoto run build:lib - - name: 💾 Save build folder + - name: 💾 Save dist folder uses: actions/upload-artifact@v4 with: name: ui-dist if-no-files-found: error path: packages/ui/dist + - name: 💾 Save lib folder + uses: actions/upload-artifact@v4 + with: + name: ui-lib + if-no-files-found: error + path: packages/ui/lib + - name: 💾 Save catalog build folder uses: actions/upload-artifact@v4 with: @@ -88,6 +95,12 @@ jobs: name: ui-dist path: packages/ui/dist + - name: 🗄️ Download the UI lib folder + uses: actions/download-artifact@v4 + with: + name: ui-lib + path: packages/ui/lib + - name: 🗄️ Download the catalog build folder uses: actions/download-artifact@v4 with: @@ -147,6 +160,12 @@ jobs: name: ui-dist path: packages/ui/dist + - name: 🗄️ Download the UI lib folder + uses: actions/download-artifact@v4 + with: + name: ui-lib + path: packages/ui/lib + - name: 🗄️ Download the catalog build folder uses: actions/download-artifact@v4 with: @@ -206,6 +225,12 @@ jobs: name: ui-dist path: packages/ui/dist + - name: 🗄️ Download the UI lib folder + uses: actions/download-artifact@v4 + with: + name: ui-lib + path: packages/ui/lib + - name: 🗄️ Download the catalog build folder uses: actions/download-artifact@v4 with: diff --git a/packages/ui-tests/cypress.config.ts b/packages/ui-tests/cypress.config.ts index cbd9e37e2..5a656d2b9 100644 --- a/packages/ui-tests/cypress.config.ts +++ b/packages/ui-tests/cypress.config.ts @@ -1,10 +1,11 @@ import { defineConfig } from 'cypress'; +import vitePreprocessor from 'cypress-vite'; export default defineConfig({ - projectId: 'ui-test', - video: true, - e2e: { + setupNodeEvents(on) { + on('file:preprocessor', vitePreprocessor()); + }, baseUrl: 'http://localhost:5173', specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', viewportWidth: 1920, diff --git a/packages/ui-tests/cypress/e2e/beansConfig.cy.ts b/packages/ui-tests/cypress/e2e/beansConfig.cy.ts index 91340c245..cb0271e6c 100644 --- a/packages/ui-tests/cypress/e2e/beansConfig.cy.ts +++ b/packages/ui-tests/cypress/e2e/beansConfig.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test for Bean support', () => { beforeEach(() => { cy.openHomePage(); @@ -6,7 +8,7 @@ describe('Test for Bean support', () => { it('Beans - create a new bean using bean editor', () => { cy.uploadFixture('flows/camelRoute/basic.yaml'); cy.openBeans(); - cy.get('[data-testid="metadata-add-Beans-btn"]').eq(0).click(); + cy.get(selectors.METADATA_ADD_BEANS_BTN).eq(0).click(); cy.get(`input[name="name"]`).clear().type('test'); cy.get(`input[name="type"]`).clear().type('org.acme'); diff --git a/packages/ui-tests/cypress/e2e/codeEditor/malformedFlows.cy.ts b/packages/ui-tests/cypress/e2e/codeEditor/malformedFlows.cy.ts index b260b12e9..0590ecbc3 100644 --- a/packages/ui-tests/cypress/e2e/codeEditor/malformedFlows.cy.ts +++ b/packages/ui-tests/cypress/e2e/codeEditor/malformedFlows.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test for Multi route actions from the code editor', () => { beforeEach(() => { cy.openHomePage(); @@ -9,9 +11,9 @@ describe('Test for Multi route actions from the code editor', () => { cy.uploadFixture('flows/malformed/camelRoute/missingId.yaml'); cy.openDesignPage(); - cy.get('span[data-testid="flows-list-route-id"]').should('contain.text', 'route-'); - cy.get('span[data-testid="flows-list-route-id"]').should('contain.text', 'route-'); - cy.get('span[data-testid="flows-list-route-id"]') + cy.get(selectors.SPAN_FLOW_LIST_ROUTE_ID).should('contain.text', 'route-'); + cy.get(selectors.SPAN_FLOW_LIST_ROUTE_ID).should('contain.text', 'route-'); + cy.get(selectors.SPAN_FLOW_LIST_ROUTE_ID) .invoke('text') .then((text) => { const routeIdText = text.trim(); diff --git a/packages/ui-tests/cypress/e2e/codeEditor/multiFlowEditor.cy.ts b/packages/ui-tests/cypress/e2e/codeEditor/multiFlowEditor.cy.ts index 95f14d647..b871727e7 100644 --- a/packages/ui-tests/cypress/e2e/codeEditor/multiFlowEditor.cy.ts +++ b/packages/ui-tests/cypress/e2e/codeEditor/multiFlowEditor.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test for Multi route actions from the code editor', () => { beforeEach(() => { cy.openHomePage(); @@ -7,13 +9,13 @@ describe('Test for Multi route actions from the code editor', () => { cy.openSourceCode(); cy.uploadFixture('flows/camelRoute/multiflow.yaml'); cy.openDesignPage(); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '1/2'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '1/2'); cy.openSourceCode(); cy.editorDeleteLine(21, 12); cy.openDesignPage(); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '1/1'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '1/1'); }); it('User adds new route to Camel multi-route using code editor', () => { @@ -30,14 +32,14 @@ describe('Test for Multi route actions from the code editor', () => { cy.openDesignPage(); // CHECK that the route ID is shown in the - cy.get('[data-testid="flows-list-dropdown"]').click(); + cy.get(selectors.FLOWS_LIST_DROPDOWN).click(); cy.get('[data-testid="flows-list-table"] [data-testid="goto-btn-route-new"]').should('be.visible'); - cy.get('[data-testid="flows-list-dropdown"]').click(); + cy.get(selectors.FLOWS_LIST_DROPDOWN).click(); cy.showAllRoutes(); // CHECK the new empty route was added - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '3/3'); - cy.get('g[data-layer-id="default"]').should('exist').contains('from: Unknown'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '3/3'); + cy.get(selectors.DATA_LAYER_ID_DEFAULT).should('exist').contains('from: Unknown'); }); it('User deletes second route from multi-route using code editor', () => { @@ -47,7 +49,7 @@ describe('Test for Multi route actions from the code editor', () => { cy.openDesignPage(); cy.showAllRoutes(); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '1/1'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '1/1'); }); it('User deletes step from first route using code editor', () => { @@ -58,7 +60,7 @@ describe('Test for Multi route actions from the code editor', () => { cy.showAllRoutes(); /** We check how many nodes are remaining */ cy.checkNodeExist('log', 1); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '2/2'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '2/2'); }); it('User adds step to the first route using code editor', () => { diff --git a/packages/ui-tests/cypress/e2e/componentCatalog.cy.ts b/packages/ui-tests/cypress/e2e/componentCatalog.cy.ts index a33f323f5..2edb610f9 100644 --- a/packages/ui-tests/cypress/e2e/componentCatalog.cy.ts +++ b/packages/ui-tests/cypress/e2e/componentCatalog.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Catalog related tests', () => { beforeEach(() => { cy.openHomePage(); @@ -5,33 +7,33 @@ describe('Catalog related tests', () => { it('Catalog search', () => { cy.openCatalog(); - cy.get('[data-testid="processor-catalog-tab"]').click(); - cy.get('[data-testid="kamelet-catalog-tab"]').click(); - cy.get('.pf-v5-c-text-input-group__text-input').click(); - cy.get('.pf-v5-c-text-input-group__text-input').type('timer'); + cy.get(selectors.PROCESSOR_CATALOG_TAB).click(); + cy.get(selectors.KAMELET_CATALOG_TAB).click(); + cy.get(selectors.INPUT_GROUP_TEXT_INPUT).click(); + cy.get(selectors.INPUT_GROUP_TEXT_INPUT).type('timer'); cy.get('div[id="timer"]').should('be.visible'); cy.get('button[aria-label="Reset"]').click(); - cy.get('.pf-v5-c-text-input-group__text-input').should('have.value', ''); + cy.get(selectors.INPUT_GROUP_TEXT_INPUT).should('have.value', ''); - cy.get('[data-testid="component-catalog-tab"]').click(); - cy.get('[data-testid="processor-catalog-tab"]').click(); - cy.get('.pf-v5-c-text-input-group__text-input').type('choice'); + cy.get(selectors.COMPONENT_CATALOG_TAB).click(); + cy.get(selectors.PROCESSOR_CATALOG_TAB).click(); + cy.get(selectors.INPUT_GROUP_TEXT_INPUT).type('choice'); cy.get('div[id="choice"]').should('be.visible'); cy.get('button[aria-label="Reset"]').click(); - cy.get('.pf-v5-c-text-input-group__text-input').should('have.value', ''); + cy.get(selectors.INPUT_GROUP_TEXT_INPUT).should('have.value', ''); - cy.get('[data-testid="processor-catalog-tab"]').click(); - cy.get('[data-testid="kamelet-catalog-tab"]').click(); - cy.get('.pf-v5-c-text-input-group__text-input').type('aws secret'); + cy.get(selectors.PROCESSOR_CATALOG_TAB).click(); + cy.get(selectors.KAMELET_CATALOG_TAB).click(); + cy.get(selectors.INPUT_GROUP_TEXT_INPUT).type('aws secret'); cy.get('div[id="aws-secrets-manager-sink"]').should('be.visible'); cy.get('button[aria-label="Reset"]').click(); - cy.get('.pf-v5-c-text-input-group__text-input').should('have.value', ''); + cy.get(selectors.INPUT_GROUP_TEXT_INPUT).should('have.value', ''); }); it('Catalog filtering using tags', () => { cy.openCatalog(); - cy.get('[data-testid="processor-catalog-tab"]').click(); - cy.get('[data-testid="kamelet-catalog-tab"]').click(); + cy.get(selectors.PROCESSOR_CATALOG_TAB).click(); + cy.get(selectors.KAMELET_CATALOG_TAB).click(); cy.get('[data-testid="tag-cloud"]').first().click(); cy.get('[data-testid="tag-database"]').first().click(); cy.get('[data-testid="tag-serverless"]').first().click(); @@ -46,16 +48,16 @@ describe('Catalog related tests', () => { it('Catalog list view switch check', () => { cy.openCatalog(); - cy.get('#toggle-layout-button-List').click(); - cy.get('[data-testid="component-catalog-tab"]').click(); - cy.get('[data-testid="processor-catalog-tab"]').click(); - cy.get('#toggle-layout-button-Gallery').should('have.attr', 'aria-pressed', 'false'); + cy.get(selectors.TOGGLE_LAYOUT_BUTTON_LIST).click(); + cy.get(selectors.COMPONENT_CATALOG_TAB).click(); + cy.get(selectors.PROCESSOR_CATALOG_TAB).click(); + cy.get(selectors.TOGGLE_LAYOUT_BUTTON_GALLERY).should('have.attr', 'aria-pressed', 'false'); cy.openSourceCode(); cy.openCatalog(); - cy.get('#toggle-layout-button-Gallery').should('have.attr', 'aria-pressed', 'false'); - cy.get('#toggle-layout-button-Gallery').click(); - cy.get('[data-testid="processor-catalog-tab"]').click({ force: true }); - cy.get('[data-testid="kamelet-catalog-tab"]').click({ force: true }); - cy.get('#toggle-layout-button-Gallery').should('have.attr', 'aria-pressed', 'true'); + cy.get(selectors.TOGGLE_LAYOUT_BUTTON_GALLERY).should('have.attr', 'aria-pressed', 'false'); + cy.get(selectors.TOGGLE_LAYOUT_BUTTON_GALLERY).click(); + cy.get(selectors.PROCESSOR_CATALOG_TAB).click({ force: true }); + cy.get(selectors.KAMELET_CATALOG_TAB).click({ force: true }); + cy.get(selectors.TOGGLE_LAYOUT_BUTTON_GALLERY).should('have.attr', 'aria-pressed', 'true'); }); }); diff --git a/packages/ui-tests/cypress/e2e/designer/basicNodeActions/hoverToolbarActions.cy.ts b/packages/ui-tests/cypress/e2e/designer/basicNodeActions/hoverToolbarActions.cy.ts index 461994962..26b0ad59b 100644 --- a/packages/ui-tests/cypress/e2e/designer/basicNodeActions/hoverToolbarActions.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/basicNodeActions/hoverToolbarActions.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test toolbar on hover actions', () => { beforeEach(() => { cy.openHomePage(); @@ -9,7 +11,7 @@ describe('Test toolbar on hover actions', () => { cy.openStepConfigurationTab('timer'); - cy.get('[data-testid="step-toolbar-button-replace"]').click(); + cy.get(selectors.STEP_TOOLBAR_BUTTON_REPLACE).click(); cy.chooseFromCatalog('component', 'quartz'); cy.checkNodeExist('quartz', 1); @@ -21,7 +23,7 @@ describe('Test toolbar on hover actions', () => { cy.openStepConfigurationTab('setHeader'); - cy.get('[data-testid="step-toolbar-button-delete"]').click(); + cy.get(selectors.STEP_TOOLBAR_BUTTON_DELETE).click(); cy.checkNodeExist('setHeader', 0); }); @@ -31,14 +33,14 @@ describe('Test toolbar on hover actions', () => { cy.openDesignPage(); cy.openStepConfigurationTab('setHeader'); - cy.get('[data-testid="step-toolbar-button-disable"]').click(); + cy.get(selectors.STEP_TOOLBAR_BUTTON_DISABLE).click(); cy.openStepConfigurationTab('setHeader'); cy.selectFormTab('All'); cy.checkConfigCheckboxObject('disabled', true); cy.openStepConfigurationTab('setHeader'); - cy.get('[data-testid="step-toolbar-button-disable"]').click(); + cy.get(selectors.STEP_TOOLBAR_BUTTON_DISABLE).click(); cy.openStepConfigurationTab('setHeader'); cy.selectFormTab('All'); @@ -51,13 +53,13 @@ describe('Test toolbar on hover actions', () => { cy.openRootConfigurationTab('camel-route'); - cy.get('[data-testid="step-toolbar-button-delete-group"]').click(); - cy.get('[data-testid="action-confirmation-modal-btn-confirm"]').click(); + cy.get(selectors.STEP_TOOLBAR_BUTTON_DELETE_GROUP).click(); + cy.get(selectors.ACTION_CONFIRMATION_MODAL_BTN_CONFIRM).click(); cy.get('[data-testid^="rf__node-node_0"]').should('have.length', 0); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '0/0'); - cy.get('[data-testid="visualization-empty-state"]').should('be.visible'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '0/0'); + cy.get(selectors.VISUALIZATION_EMPTY_STATE).should('be.visible'); }); it('Add branch using hover toolbar', () => { @@ -66,7 +68,7 @@ describe('Test toolbar on hover actions', () => { cy.openRootConfigurationTab('choice'); - cy.get('[data-testid="step-toolbar-button-add-special"]').click(); + cy.get(selectors.STEP_TOOLBAR_BUTTON_ADD_SPECIAL).click(); cy.chooseFromCatalog('processor', 'when'); cy.checkNodeExist('when', 4); @@ -79,12 +81,12 @@ describe('Test toolbar on hover actions', () => { cy.openRootConfigurationTab('choice'); - cy.get(`[data-testid="step-toolbar-button-collapse"]`).click({ force: true }); + cy.get(selectors.STEP_TOOLBAR_BUTTON_COLLAPSE).click({ force: true }); cy.checkNodeExist('when', 0); cy.checkNodeExist('otherwise', 0); cy.checkNodeExist('log', 0); - cy.get(`[data-testid="step-toolbar-button-collapse"]`).click({ force: true }); + cy.get(selectors.STEP_TOOLBAR_BUTTON_COLLAPSE).click({ force: true }); cy.checkNodeExist('when', 3); cy.checkNodeExist('otherwise', 1); cy.checkNodeExist('log', 1); diff --git a/packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepRemoval.cy.ts b/packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepRemoval.cy.ts index d383d5dc0..a81104300 100644 --- a/packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepRemoval.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/basicNodeActions/stepRemoval.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Tests for Design page', () => { beforeEach(() => { cy.openHomePage(); @@ -43,7 +45,7 @@ describe('Tests for Design page', () => { // CHECK that delete menu does not exist for the from node cy.get(`[data-nodelabel="timer"]`).parent().eq(0).rightclick({ force: true }); - cy.get(`[data-testid="context-menu-item-delete"]`).should('not.exist'); + cy.get(selectors.CONTEXT_MENU_ITEM_DELETE).should('not.exist'); cy.checkNodeExist('timer', 1); @@ -57,9 +59,9 @@ describe('Tests for Design page', () => { cy.openDesignPage(); cy.openStepConfigurationTab('log'); - cy.get('.pf-topology-resizable-side-bar').should('be.visible'); + cy.get(selectors.RESIZABLE_SIDE_BAR).should('be.visible'); cy.removeNodeByName('log'); - cy.get('.pf-topology-resizable-side-bar').should('not.exist'); + cy.get(selectors.RESIZABLE_SIDE_BAR).should('not.exist'); // Blocked by https://github.com/KaotoIO/kaoto/issues/527 // cy.openStepConfigurationTab('timer'); diff --git a/packages/ui-tests/cypress/e2e/designer/catalogs/userSpecifiedCatalog.cy.ts b/packages/ui-tests/cypress/e2e/designer/catalogs/userSpecifiedCatalog.cy.ts index 105a8388c..0a1ade0ab 100644 --- a/packages/ui-tests/cypress/e2e/designer/catalogs/userSpecifiedCatalog.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/catalogs/userSpecifiedCatalog.cy.ts @@ -1,10 +1,12 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Tests for user specified Quarkus catalog type', () => { // Specify custom catalog URL before(() => { cy.openHomePage(); cy.openSettings(); cy.interactWithConfigInputObject('catalogUrl', Cypress.config().baseUrl + '/camel-catalog/index.json'); - cy.get('[data-testid="settings-form-save-btn"]').click(); + cy.get(selectors.SETTINGS_FORM_SAVE_BTN).click(); cy.waitSchemasLoading(); }); @@ -12,7 +14,7 @@ describe('Tests for user specified Quarkus catalog type', () => { after(() => { cy.openSettings(); cy.get('input[name="catalogUrl"]').clear(); - cy.get('[data-testid="settings-form-save-btn"]').click(); + cy.get(selectors.SETTINGS_FORM_SAVE_BTN).click(); cy.waitSchemasLoading(); }); diff --git a/packages/ui-tests/cypress/e2e/designer/multiflow/multiFlowDesigner.cy.ts b/packages/ui-tests/cypress/e2e/designer/multiflow/multiFlowDesigner.cy.ts index 712af04ea..a3c238f2b 100644 --- a/packages/ui-tests/cypress/e2e/designer/multiflow/multiFlowDesigner.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/multiflow/multiFlowDesigner.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test for Multi route actions from the canvas', () => { beforeEach(() => { cy.openHomePage(); @@ -5,11 +7,11 @@ describe('Test for Multi route actions from the canvas', () => { it('User changes route type in the canvas', () => { cy.switchIntegrationType('Kamelet'); - cy.get('[data-testid="dsl-list-dropdown"]').contains('Kamelet'); + cy.get(selectors.DSL_LIST_DROPDOWN).contains('Kamelet'); cy.switchIntegrationType('camelYamlDsl'); - cy.get('[data-testid="dsl-list-dropdown"]').contains('Camel Route'); + cy.get(selectors.DSL_LIST_DROPDOWN).contains('Camel Route'); cy.switchIntegrationType('Pipe'); - cy.get('[data-testid="dsl-list-dropdown"]').contains('Pipe'); + cy.get(selectors.DSL_LIST_DROPDOWN).contains('Pipe'); }); it('User shows and hides a route', () => { @@ -17,33 +19,33 @@ describe('Test for Multi route actions from the canvas', () => { cy.addNewRoute(); cy.addNewRoute(); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '1/3'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '1/3'); cy.toggleRouteVisibility(0); cy.toggleRouteVisibility(1); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '3/3'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '3/3'); cy.toggleRouteVisibility(0); cy.toggleRouteVisibility(1); cy.toggleRouteVisibility(2); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '0/3'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '0/3'); }); it('User renames routes', () => { cy.uploadFixture('flows/camelRoute/multiflow.yaml'); cy.openDesignPage(); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '1/2'); - cy.get('[data-testid="flows-list-dropdown"]').click(); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '1/2'); + cy.get(selectors.FLOWS_LIST_DROPDOWN).click(); cy.get('[data-testid=goto-btn-route-1234--edit]').click(); cy.get('[data-testid=goto-btn-route-1234--text-input]').dblclick(); cy.get('[data-testid=goto-btn-route-1234--text-input]').clear().type('route-4321'); - cy.get('.pf-v5-c-helper-text__item-text').should('have.text', 'Name must be unique'); + cy.get(selectors.HELPER_TEXT_ITEM_TEXT).should('have.text', 'Name must be unique'); cy.get('[data-testid="goto-btn-route-1234--text-input"]').dblclick(); cy.get('[data-testid="goto-btn-route-1234--text-input"]').clear().type('test 2'); - cy.get('.pf-v5-c-helper-text__item-text').should( + cy.get(selectors.HELPER_TEXT_ITEM_TEXT).should( 'have.text', 'Name should only contain lowercase letters, numbers, and dashes', ); @@ -63,7 +65,7 @@ describe('Test for Multi route actions from the canvas', () => { cy.addNewRoute(); cy.showAllRoutes(); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '3/3'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '3/3'); cy.deleteRoute(0); cy.deleteRoute(0); @@ -71,14 +73,14 @@ describe('Test for Multi route actions from the canvas', () => { cy.toggleFlowsList(); - cy.get('[data-testid^="rf__node-node_0"]').should('have.length', 0); + cy.get(selectors.RF_NODE_NODE).should('have.length', 0); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '0/0'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '0/0'); cy.get('#flows-list-select').within(() => { - cy.get('h4.pf-v5-c-empty-state__title-text').should('have.text', "There's no routes to show"); + cy.get(selectors.H4_EMPTY_STATE_TITLE_TEXT).should('have.text', "There's no routes to show"); }); - cy.get('[data-testid="visualization-empty-state"]').should('be.visible'); + cy.get(selectors.VISUALIZATION_EMPTY_STATE).should('be.visible'); }); const testData = ['Pipe', 'Kamelet']; @@ -86,11 +88,11 @@ describe('Test for Multi route actions from the canvas', () => { testData.forEach((data) => { it("User can't create multiple routes in canvas of type " + data, () => { cy.switchIntegrationType(data); - cy.get('[data-testid="dsl-list-dropdown"]').click({ force: true }); - cy.get('.pf-v5-c-menu__item-text').contains(data).closest('button').should('be.disabled'); - cy.get('[data-testid="new-entity-list-dropdown"]').should('not.exist'); + cy.get(selectors.DSL_LIST_DROPDOWN).click({ force: true }); + cy.get(selectors.MENU_ITEM_TEXT).contains(data).closest('button').should('be.disabled'); + cy.get(selectors.NEW_ENTITY_LIST_DROPDOWN).should('not.exist'); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '1/1'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '1/1'); }); }); @@ -103,6 +105,6 @@ describe('Test for Multi route actions from the canvas', () => { cy.showAllRoutes(); /** We check how many nodes are remaining */ cy.checkNodeExist('log', 3); - cy.get('[data-testid="flows-list-route-count"]').should('have.text', '3/3'); + cy.get(selectors.FLOWS_LIST_ROUTE_COUNT).should('have.text', '3/3'); }); }); diff --git a/packages/ui-tests/cypress/e2e/designer/propsWarnings/mandatoryPropsWarnings.cy.ts b/packages/ui-tests/cypress/e2e/designer/propsWarnings/mandatoryPropsWarnings.cy.ts index ed811e855..3dec97318 100644 --- a/packages/ui-tests/cypress/e2e/designer/propsWarnings/mandatoryPropsWarnings.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/propsWarnings/mandatoryPropsWarnings.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test for missing config props canvas warnings', () => { beforeEach(() => { cy.openHomePage(); @@ -12,7 +14,7 @@ describe('Test for missing config props canvas warnings', () => { cy.checkNodeExist('github', 1); cy.get('[data-id^="github"] g') - .find('span.pf-v5-c-icon') + .find(selectors.SPAN_ICON) .should('have.attr', 'title', '3 required parameters are not yet configured: [ type,repoName,repoOwner ]'); cy.openStepConfigurationTab('github'); @@ -21,7 +23,7 @@ describe('Test for missing config props canvas warnings', () => { cy.closeStepConfigurationTab(); cy.get('[data-id^="github"] g') - .find('span.pf-v5-c-icon') + .find(selectors.SPAN_ICON) .should('have.attr', 'title', '2 required parameters are not yet configured: [ type,repoOwner ]'); }); @@ -30,7 +32,7 @@ describe('Test for missing config props canvas warnings', () => { cy.openDesignPage(); cy.get('[data-id^="delay-action"] g') - .find('span.pf-v5-c-icon') + .find(selectors.SPAN_ICON) .should('have.attr', 'title', '1 required parameter is not yet configured: [ milliseconds ]'); cy.openStepConfigurationTab('delay-action'); @@ -38,6 +40,6 @@ describe('Test for missing config props canvas warnings', () => { cy.interactWithConfigInputObject('milliseconds', '1000'); cy.closeStepConfigurationTab(); - cy.get('[data-id^="delay-action"] g').find('span.pf-v5-c-icon').should('not.exist'); + cy.get('[data-id^="delay-action"] g').find(selectors.SPAN_ICON).should('not.exist'); }); }); diff --git a/packages/ui-tests/cypress/e2e/designer/settings/aboutPage.cy.ts b/packages/ui-tests/cypress/e2e/designer/settings/aboutPage.cy.ts index f4b6a1b23..16c1e6baf 100644 --- a/packages/ui-tests/cypress/e2e/designer/settings/aboutPage.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/settings/aboutPage.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Settings: About', () => { beforeEach(() => { cy.openHomePage(); @@ -5,15 +7,15 @@ describe('Settings: About', () => { it('Close and reopen about modal', () => { cy.openAboutModal(); - cy.get('[data-testid="about-modal"]').should('be.visible'); + cy.get(selectors.ABOUT_MODAL).should('be.visible'); cy.closeAboutModal(); - cy.get('[data-testid="about-modal"]').should('not.exist'); + cy.get(selectors.ABOUT_MODAL).should('not.exist'); }); it('Check that the about modal contains the correct information', () => { cy.openAboutModal(); - cy.get('[data-testid="about-modal"]').should('be.visible'); + cy.get(selectors.ABOUT_MODAL).should('be.visible'); cy.get('[alt="Kaoto Logo"]') .should('be.visible') @@ -23,7 +25,7 @@ describe('Settings: About', () => { // Check the version cy.readFile('package.json').then((Package) => { - cy.get('[data-testid="about-version"]').should('have.text', Package.version); + cy.get(selectors.ABOUT_VERSION).should('have.text', Package.version); }); // Check information Grid diff --git a/packages/ui-tests/cypress/e2e/designer/settings/switchDescriptionId.cy.ts b/packages/ui-tests/cypress/e2e/designer/settings/switchDescriptionId.cy.ts index be330c781..24581aa73 100644 --- a/packages/ui-tests/cypress/e2e/designer/settings/switchDescriptionId.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/settings/switchDescriptionId.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Tests for switching description and ID in settings page', () => { beforeEach(() => { cy.openHomePage(); @@ -7,7 +9,7 @@ describe('Tests for switching description and ID in settings page', () => { after(() => { cy.openSettings(); cy.selectInTypeaheadField('nodeLabel', 'description'); - cy.get('[data-testid="settings-form-save-btn"]').click(); + cy.get(selectors.SETTINGS_FORM_SAVE_BTN).click(); cy.waitSchemasLoading(); }); @@ -15,7 +17,7 @@ describe('Tests for switching description and ID in settings page', () => { cy.uploadFixture('flows/camelRoute/idDescriptionSettings.yaml'); cy.openSettings(); cy.selectInTypeaheadField('nodeLabel', 'id'); - cy.get('[data-testid="settings-form-save-btn"]').click(); + cy.get(selectors.SETTINGS_FORM_SAVE_BTN).click(); cy.waitSchemasLoading(); cy.openDesignPage(); @@ -26,7 +28,7 @@ describe('Tests for switching description and ID in settings page', () => { cy.openSettings(); cy.selectInTypeaheadField('nodeLabel', 'description'); - cy.get('[data-testid="settings-form-save-btn"]').click(); + cy.get(selectors.SETTINGS_FORM_SAVE_BTN).click(); cy.waitSchemasLoading(); cy.openDesignPage(); diff --git a/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/producerConsumerConf.cy.ts b/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/producerConsumerConf.cy.ts index c6da5283a..e9b9ad94b 100644 --- a/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/producerConsumerConf.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/producerConsumerConf.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Tests for producer/consumer sidebar config', () => { beforeEach(() => { cy.openHomePage(); @@ -9,12 +11,12 @@ describe('Tests for producer/consumer sidebar config', () => { cy.openStepConfigurationTab('amqp'); cy.selectFormTab('All'); - cy.get('.pf-v5-c-expandable-section__toggle-text').contains('Consumer (advanced) properties').should('exist'); - cy.get('.pf-v5-c-expandable-section__toggle-text').contains('Producer (advanced) properties').should('not.exist'); + cy.get(selectors.EXPANDABLE_SECTION_TOGGLE_TEXT).contains('Consumer (advanced) properties').should('exist'); + cy.get(selectors.EXPANDABLE_SECTION_TOGGLE_TEXT).contains('Producer (advanced) properties').should('not.exist'); cy.openStepConfigurationTab('activemq6'); cy.selectFormTab('All'); - cy.get('.pf-v5-c-expandable-section__toggle-text').contains('Producer (advanced) properties').should('exist'); - cy.get('.pf-v5-c-expandable-section__toggle-text').contains('Consumer (advanced) properties').should('not.exist'); + cy.get(selectors.EXPANDABLE_SECTION_TOGGLE_TEXT).contains('Producer (advanced) properties').should('exist'); + cy.get(selectors.EXPANDABLE_SECTION_TOGGLE_TEXT).contains('Consumer (advanced) properties').should('not.exist'); }); }); diff --git a/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/propertiesFilter.cy.ts b/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/propertiesFilter.cy.ts index 32ba8c828..d5118d144 100644 --- a/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/propertiesFilter.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/sidepanelConfig/propertiesFilter.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Tests for side panel step filtering', () => { beforeEach(() => { cy.openHomePage(); @@ -16,12 +18,12 @@ describe('Tests for side panel step filtering', () => { cy.get(`textarea[name="description"]`).should('exist'); cy.get(`input[name="name"]`).should('exist'); cy.get(`input[name="disabled"]`).should('exist'); - cy.get(`.expression-metadata-editor`).should('exist'); - cy.get('.pf-v5-c-card__header-toggle').click(); + cy.get(selectors.EXPRESSION_METADATA_EDITOR).should('exist'); + cy.get(selectors.CARD_HEADER_TOGGLE).click(); // filter fields cy.filterFields('name'); - cy.get(`.expression-metadata-editor`).should('exist'); + cy.get(selectors.EXPRESSION_METADATA_EDITOR).should('exist'); cy.get(`input[name="name"]`).should('exist'); cy.get(`input[name="id"]`).should('not.exist'); cy.get(`textarea[name="description"]`).should('not.exist'); @@ -42,12 +44,12 @@ describe('Tests for side panel step filtering', () => { cy.get(`textarea[name="description"]`).should('exist'); cy.get(`input[name="name"]`).should('exist'); cy.get(`input[name="disabled"]`).should('exist'); - cy.get(`.expression-metadata-editor`).should('exist'); - cy.get('.pf-v5-c-card__header-toggle').click(); + cy.get(selectors.EXPRESSION_METADATA_EDITOR).should('exist'); + cy.get(selectors.CARD_HEADER_TOGGLE).click(); // filter fields cy.filterFields('DISABLED'); - cy.get(`.expression-metadata-editor`).should('exist'); + cy.get(selectors.EXPRESSION_METADATA_EDITOR).should('exist'); cy.get(`input[name="disabled"]`).should('exist'); cy.get(`input[name="name"]`).should('not.exist'); cy.get(`input[name="id"]`).should('not.exist'); @@ -113,7 +115,7 @@ describe('Tests for side panel step filtering', () => { cy.selectFormTab('Required'); - cy.get('.pf-v5-c-alert__title').should('contain', 'No Required fields found'); + cy.get(selectors.ALERT_TITLE).should('contain', 'No Required fields found'); }); it('Side panel to retain user specified fields filter', () => { diff --git a/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/interceptSendToEndpoint.cy.ts b/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/interceptSendToEndpoint.cy.ts index 3d2307c86..dd927f832 100644 --- a/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/interceptSendToEndpoint.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/interceptSendToEndpoint.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test for interceptSendToEndpoint configuration container', () => { beforeEach(() => { cy.openHomePage(); @@ -6,7 +8,7 @@ describe('Test for interceptSendToEndpoint configuration container', () => { it('Root interceptSendToEndpoint configuration', () => { cy.selectCamelRouteType('Configuration', 'interceptSendToEndpoint'); - cy.get(`[data-testid^="custom-node__interceptSendToEndpoint"]`).click({ force: true }); + cy.get(selectors.CUSTOM_NODE_INTERCEPTSENDTOENDPOINT).click({ force: true }); cy.selectFormTab('All'); diff --git a/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onCompletion.cy.ts b/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onCompletion.cy.ts index dbbdf7f01..59bc9b02b 100644 --- a/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onCompletion.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onCompletion.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test for onCompletion configuration container', () => { beforeEach(() => { cy.openHomePage(); @@ -6,7 +8,7 @@ describe('Test for onCompletion configuration container', () => { it('Root onCompletion configuration', () => { cy.selectCamelRouteType('Configuration', 'onCompletion'); - cy.get(`[data-testid^="custom-node__onCompletion"]`).click({ force: true }); + cy.get(selectors.CUSTOM_NODE_ONCOMPLETION).click({ force: true }); cy.selectFormTab('All'); cy.interactWithConfigInputObject('description', 'testDescription'); diff --git a/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onException.cy.ts b/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onException.cy.ts index 01f909cc2..89929e733 100644 --- a/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onException.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/specialCamelRoutes/onException.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test for root on exception container', () => { beforeEach(() => { cy.openHomePage(); @@ -29,7 +31,7 @@ describe('Test for root on exception container', () => { cy.uploadFixture('flows/camelRoute/onException.yaml'); cy.openDesignPage(); - cy.get(`[data-testid^="custom-node__onException"]`).click({ force: true }); + cy.get(selectors.CUSTOM_NODE_ONEXCEPTION).click({ force: true }); cy.selectFormTab('All'); cy.selectInTypeaheadField('redeliveryPolicy.retriesExhaustedLogLevel', 'INFO'); diff --git a/packages/ui-tests/cypress/e2e/designer/specialStepConfiguration/setHeadersStepConfig.cy.ts b/packages/ui-tests/cypress/e2e/designer/specialStepConfiguration/setHeadersStepConfig.cy.ts index da6f3a6ed..04ec85933 100644 --- a/packages/ui-tests/cypress/e2e/designer/specialStepConfiguration/setHeadersStepConfig.cy.ts +++ b/packages/ui-tests/cypress/e2e/designer/specialStepConfiguration/setHeadersStepConfig.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Tests for sidebar setHeaders step configuration', () => { beforeEach(() => { cy.openHomePage(); @@ -12,14 +14,14 @@ describe('Tests for sidebar setHeaders step configuration', () => { cy.openStepConfigurationTab('setHeaders'); cy.selectFormTab('All'); - cy.get('[data-testid="list-add-field"]').click(); + cy.get(selectors.LIST_ADD_FIELD).click(); cy.selectExpression('Simple'); cy.interactWithExpressionInputObject('expression', `{{}random(1,100)}`); cy.interactWithExpressionInputObject('id', 'simpleExpressionId'); cy.addExpressionResultType('java.lang.String'); - cy.get('[data-testid="list-add-field"]').click(); + cy.get(selectors.LIST_ADD_FIELD).click(); cy.selectExpression('Constant', 1); cy.interactWithExpressionInputObject('expression', `constant`, 1); diff --git a/packages/ui-tests/cypress/e2e/pipeErrorHandler.cy.ts b/packages/ui-tests/cypress/e2e/pipeErrorHandler.cy.ts index 95265959f..120afa1c4 100644 --- a/packages/ui-tests/cypress/e2e/pipeErrorHandler.cy.ts +++ b/packages/ui-tests/cypress/e2e/pipeErrorHandler.cy.ts @@ -1,3 +1,5 @@ +import { selectors } from '@kaoto/kaoto/testing'; + describe('Test for Pipe Error handler support', () => { beforeEach(() => { cy.openHomePage(); @@ -6,7 +8,7 @@ describe('Test for Pipe Error handler support', () => { it('ErrorHandler - create a new errorHandler using errorHandler editor', () => { cy.uploadFixture('flows/kameletBinding/timerKafka.yaml'); cy.openPipeErrorHandler(); - cy.get('.pf-v5-c-menu-toggle__toggle-icon').click(); + cy.get(selectors.MENU_TOGGLE_TOGGLE_ICON).click(); cy.get('[data-testid="pipe-error-handler-select-option-log"]').click(); cy.get(`input[name="log.parameters.maximumRedeliveries"]`).clear().type('5'); cy.get(`input[name="log.parameters.redeliveryDelay"]`).clear().type('1000'); @@ -19,7 +21,7 @@ describe('Test for Pipe Error handler support', () => { cy.checkCodeSpanLine('redeliveryDelay: "1000"'); cy.openPipeErrorHandler(); - cy.get('.pf-v5-c-menu-toggle__toggle-icon').click(); + cy.get(selectors.MENU_TOGGLE_TOGGLE_ICON).click(); cy.get('[data-testid="pipe-error-handler-select-option-sink"]').click(); cy.get(`input[name="sink.endpoint.ref.kind"]`).clear().type('test-kind'); cy.get(`input[name="sink.endpoint.ref.apiVersion"]`).clear().type('0.1-SNAPSHOT'); @@ -70,7 +72,7 @@ describe('Test for Pipe Error handler support', () => { it('ErrorHandler - select "no error handlers" - delete errorHandler', () => { cy.uploadFixture('flows/pipe/errorHandler.yaml'); cy.openPipeErrorHandler(); - cy.get('.pf-v5-c-menu-toggle__toggle-icon').click(); + cy.get(selectors.MENU_TOGGLE_TOGGLE_ICON).click(); cy.get('[data-testid="pipe-error-handler-select-option-none"]').click(); // CHECK the first errorHandler was deleted in the code editor cy.openSourceCode(); diff --git a/packages/ui-tests/cypress/support/next-commands/default.ts b/packages/ui-tests/cypress/support/next-commands/default.ts index 30cd1c8e1..d560fabe4 100644 --- a/packages/ui-tests/cypress/support/next-commands/default.ts +++ b/packages/ui-tests/cypress/support/next-commands/default.ts @@ -1,24 +1,26 @@ +import { selectors } from '@kaoto/kaoto/testing'; + Cypress.Commands.add('openHomePage', () => { const url = Cypress.config().baseUrl; cy.visit(url!); cy.waitSchemasLoading(); - cy.get('[data-testid="visualization-empty-state"]').should('exist'); + cy.get(selectors.VISUALIZATION_EMPTY_STATE).should('exist'); // Wait for the element to become visible - cy.get('[data-testid="visualization-empty-state"]').should('be.visible'); + cy.get(selectors.VISUALIZATION_EMPTY_STATE).should('be.visible'); }); Cypress.Commands.add('waitSchemasLoading', () => { // 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'); + cy.get(selectors.LOADING_SCHEMAS).should('be.visible'); + cy.get(selectors.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(selectors.LOADING_CATALOGS).should('be.visible'); + cy.get(selectors.LOADING_CATALOGS).should('not.exist'); }); Cypress.Commands.add('expandVisualization', () => { - cy.get('#Visualization').each(($element) => { + cy.get(selectors.VISUALIZATION).each(($element) => { const attributeValue = $element.attr('aria-expanded'); if (attributeValue === 'false') { cy.wrap($element).click(); @@ -28,55 +30,55 @@ Cypress.Commands.add('expandVisualization', () => { Cypress.Commands.add('openDesignPage', () => { cy.expandVisualization(); - cy.get('[data-testid="Design"]').click(); - cy.get('.pf-topology-container').should('be.visible'); + cy.get(selectors.DESIGN).click(); + cy.get(selectors.TOPOLOGY_CONTAINER).should('be.visible'); }); Cypress.Commands.add('openSourceCode', () => { cy.expandVisualization(); - cy.get('[data-testid="Source Code"]').click(); - cy.get('.pf-v5-c-code-editor__code').should('be.visible'); + cy.get(selectors.SOURCE_CODE).click(); + cy.get(selectors.CODE_EDITOR_CODE).should('be.visible'); }); Cypress.Commands.add('openBeans', () => { - cy.get('[data-testid="Beans"]').click(); - cy.get('.metadata-editor-modal-details-view').should('be.visible'); + cy.get(selectors.BEANS).click(); + cy.get(selectors.METADATA_EDITOR_MODAL_DETAIL).should('be.visible'); }); Cypress.Commands.add('openMetadata', () => { - cy.get('[data-testid="Metadata"]').click(); - cy.get('[data-testid="metadata-editor-form-Metadata"]').should('be.visible'); + cy.get(selectors.METADATA).click(); + cy.get(selectors.METADATA_EDITOR_FORM).should('be.visible'); }); Cypress.Commands.add('openPipeErrorHandler', () => { - cy.get('[data-testid="Pipe ErrorHandler"]').click(); + cy.get(selectors.PIPE_ERRORHANDLER).click(); }); Cypress.Commands.add('openTopbarKebabMenu', () => { - cy.get('div.pf-v5-c-masthead__content').within(() => { - cy.get('button.pf-v5-c-menu-toggle').click(); + cy.get(selectors.TOPBAR).within(() => { + cy.get(selectors.SETTINGS_KEBAB_BUTTON).click(); }); }); Cypress.Commands.add('openSettings', () => { cy.openTopbarKebabMenu(); - cy.get('[data-testid="settings-link"]').click(); + cy.get(selectors.SETTINGS_LINK).click(); }); Cypress.Commands.add('openAboutModal', () => { cy.openTopbarKebabMenu(); - cy.get('button#about').click(); + cy.get(selectors.BUTTON_ABOUT).click(); }); Cypress.Commands.add('closeAboutModal', () => { - cy.get('.pf-v5-c-about-modal-box').within(() => { - cy.get('button.pf-v5-c-button.pf-m-plain').click(); + cy.get(selectors.ABOUT_MODAL_BOX).within(() => { + cy.get(selectors.BUTTON_PLAIN).click(); }); }); Cypress.Commands.add('openCatalog', () => { - cy.get('[data-testid="Catalog"]').click(); - cy.get('[data-testid="component-catalog-tab"]').should('be.visible'); + cy.get(selectors.CATALOG).click(); + cy.get(selectors.COMPONENT_CATALOG_TAB).should('be.visible'); }); /** @@ -84,32 +86,32 @@ Cypress.Commands.add('openCatalog', () => { * Possible values are - Integration, camelYamlDsl(Camel Route), Kamelet, KameletBinding */ Cypress.Commands.add('switchIntegrationType', (type: string) => { - cy.get('[data-testid="dsl-list-dropdown"]').click({ force: true }); - cy.get('#dsl-list-select').should('exist').find(`[data-testid="dsl-${type}"]`).should('exist').click(); - cy.get('[data-testid="confirmation-modal-confirm"]').click({ force: true }); + cy.get(selectors.DSL_LIST_DROPDOWN).click({ force: true }); + cy.get(selectors.DSL_LIST_SELECT).should('exist').find(`[data-testid="dsl-${type}"]`).should('exist').click(); + cy.get(selectors.CONFIRMATION_MODAL_CONFIRM).click({ force: true }); }); Cypress.Commands.add('addNewRoute', () => { - cy.get('[data-testid="new-entity-list-dropdown"]').click(); - cy.get('[data-testid="new-entity-route"]').click(); + cy.get(selectors.NEW_ENTITY_LIST_DROPDOWN).click(); + cy.get(selectors.NEW_ENTITY_ROUTE).click(); }); Cypress.Commands.add('toggleRouteVisibility', (index) => { cy.toggleFlowsList(); - cy.get('button[data-testid^="toggle-btn-route"]').then((buttons) => { + cy.get(selectors.TOGGLE_BUTTON_ROUTE).then((buttons) => { cy.wrap(buttons[index]).click(); }); cy.closeFlowsListIfVisible(); }); Cypress.Commands.add('toggleFlowsList', () => { - cy.get('[data-testid="flows-list-dropdown"]').click({ force: true }); + cy.get(selectors.FLOWS_LIST_DROPDOWN).click({ force: true }); }); Cypress.Commands.add('closeFlowsListIfVisible', () => { cy.get('body').then((body) => { - if (body.find('[data-testid="flows-list-table"]').length > 0) { - cy.get('[data-testid="flows-list-table"]').then(($element) => { + if (body.find(selectors.FLOWS_LIST_TABLE).length > 0) { + cy.get(selectors.FLOWS_LIST_TABLE).then(($element) => { if ($element.length > 0) { cy.toggleFlowsList(); } @@ -120,7 +122,7 @@ Cypress.Commands.add('closeFlowsListIfVisible', () => { Cypress.Commands.add('allignAllRoutesVisibility', (switchvisibility: string) => { cy.toggleFlowsList(); - cy.get('[data-testid="flows-list-table"]').then((body) => { + cy.get(selectors.FLOWS_LIST_TABLE).then((body) => { if (body.find(`svg[data-testid$="${switchvisibility}"]`).length > 0) { cy.get(`svg[data-testid$="${switchvisibility}"]`).then(($element) => { if ($element.attr('data-testid')?.endsWith(`${switchvisibility}`)) { @@ -144,13 +146,13 @@ Cypress.Commands.add('showAllRoutes', () => { Cypress.Commands.add('deleteRoute', (index: number) => { cy.toggleFlowsList(); - cy.get('button[data-testid^="delete-btn-route"]').then((buttons) => { + cy.get(selectors.DELETE_BUTTON_ROUTE).then((buttons) => { cy.wrap(buttons[index]).click(); }); cy.get('body').then(($body) => { - if ($body.find('.pf-m-danger').length) { + if ($body.find(selectors.DANGER).length) { // Delete Confirmation Modal appeared, click on the confirm button - cy.get('.pf-m-danger').click(); + cy.get(selectors.DANGER).click(); } }); cy.closeFlowsListIfVisible(); diff --git a/packages/ui-tests/cypress/support/next-commands/design.ts b/packages/ui-tests/cypress/support/next-commands/design.ts index c3ad8ccb2..60425fcfb 100644 --- a/packages/ui-tests/cypress/support/next-commands/design.ts +++ b/packages/ui-tests/cypress/support/next-commands/design.ts @@ -1,5 +1,7 @@ +import { selectors } from '@kaoto/kaoto/testing'; + Cypress.Commands.add('fitToScreen', () => { - cy.get('.fit-to-screen').click(); + cy.get(selectors.FIT_TO_SCREEN).click(); }); Cypress.Commands.add('openStepConfigurationTab', (step: string, stepIndex?: number) => { @@ -17,14 +19,14 @@ Cypress.Commands.add('toggleExpandGroup', (groupName: string) => { }); Cypress.Commands.add('closeStepConfigurationTab', () => { - cy.get('[data-testid="close-side-bar"]').click({ force: true }); - cy.get('.pf-topology-resizable-side-bar').should('not.exist'); + cy.get(selectors.CLOSE_SIDE_BAR).click({ force: true }); + cy.get(selectors.RESIZABLE_SIDE_BAR).should('not.exist'); }); Cypress.Commands.add('removeNodeByName', (nodeName: string, nodeIndex?: number) => { cy.performNodeAction(nodeName, 'delete', nodeIndex); cy.get('body').then(($body) => { - if ($body.find('.pf-m-danger').length) { + if ($body.find(selectors.DANGER).length) { // Delete Confirmation Modal appeared, click on the confirm button cy.get('[data-testid="action-confirmation-modal-btn-confirm"]').click(); } @@ -36,7 +38,7 @@ Cypress.Commands.add('removeNodeByName', (nodeName: string, nodeIndex?: number) Cypress.Commands.add('quickAppend', (nodeIndex?: number) => { nodeIndex = nodeIndex ?? 0; - cy.get('circle.pf-topology__node__decorator__bg').eq(nodeIndex).click({ force: true }); + cy.get(selectors.CIRCLE_TOPOLOGY_NODE_DECORATOR).eq(nodeIndex).click({ force: true }); }); Cypress.Commands.add('selectReplaceNode', (nodeName: string, nodeIndex?: number) => { @@ -72,8 +74,8 @@ Cypress.Commands.add('selectRemoveGroup', (groupName: string, groupIndex?: numbe }); Cypress.Commands.add('chooseFromCatalog', (_nodeType: string, name: string) => { - cy.get(`input[placeholder="Filter by name, description or tag"]`).click(); - cy.get(`input[placeholder="Filter by name, description or tag"]`).type(name); + cy.get(selectors.FILTER_BY_NAME_OR_TAG).click(); + cy.get(selectors.FILTER_BY_NAME_OR_TAG).type(name); cy.get(`#${name}`).should('be.visible').click(); // wait for the canvas rerender cy.wait(1000); @@ -120,14 +122,14 @@ Cypress.Commands.add('checkEdgeExists', (sourceName: string, targetName: string) Cypress.Commands.add('deleteBranch', (branchIndex) => { branchIndex = branchIndex ?? 0; - cy.get('[data-testid="stepNode__deleteBranch-btn"]').eq(branchIndex).click(); - cy.get('[data-testid="confirmDeleteBranchDialog__btn"]').click(); + cy.get(selectors.DELETE_BRANCH_BUTTON).eq(branchIndex).click(); + cy.get(selectors.CONFIRM_DELETE_BRANCH_BUTTON).click(); }); Cypress.Commands.add('selectCamelRouteType', (type: string, subType?: string) => { - cy.get('[data-testid="new-entity-list-dropdown"]').click({ force: true }); + cy.get(selectors.NEW_ENTITY_LIST_DROPDOWN).click({ force: true }); if (subType) { - cy.get('ul.pf-v5-c-menu__list') + cy.get(selectors.UL_MENU_LIST) .should('exist') .find(`[data-testid="new-entity-${type}"]`) .should('exist') @@ -142,13 +144,13 @@ Cypress.Commands.add('selectRuntimeVersion', (type: string) => { cy.get(`[data-testid^="runtime-selector-Camel ${type}"] button.pf-v5-c-menu__item`).first().click({ force: true }); cy.waitSchemasLoading(); - cy.get('[data-testid="visualization-empty-state"]').should('exist'); - cy.get('[data-testid="visualization-empty-state"]').should('be.visible'); + cy.get(selectors.VISUALIZATION_EMPTY_STATE).should('exist'); + cy.get(selectors.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') + cy.get(selectors.RUNTIME_SELECTOR_LIST_DROPDOWN).click({ force: true }); + cy.get(selectors.UL_MENU_LIST) .should('exist') .find(`[data-testid="runtime-selector-${type}"]`) .should('exist') @@ -156,7 +158,7 @@ Cypress.Commands.add('hoverOnRuntime', (type: string) => { }); Cypress.Commands.add('checkCatalogVersion', (version?: string) => { - cy.get('.pf-v5-c-card__title-text') + cy.get(selectors.TITLE_TEXT) .eq(0) .within(() => { cy.get('.pf-v5-c-label__text').should('contain', version); diff --git a/packages/ui-tests/cypress/support/next-commands/metadata.ts b/packages/ui-tests/cypress/support/next-commands/metadata.ts index 8d951d7fe..565b3c107 100644 --- a/packages/ui-tests/cypress/support/next-commands/metadata.ts +++ b/packages/ui-tests/cypress/support/next-commands/metadata.ts @@ -1,4 +1,5 @@ import 'cypress-file-upload'; +import { selectors } from '@kaoto/kaoto/testing'; Cypress.Commands.add('expandWrappedSection', (sectionName: string) => { cy.switchWrappedSection(sectionName, false); @@ -12,7 +13,7 @@ Cypress.Commands.add('switchWrappedSection', (sectionName: string, wrapped: bool cy.get(`[data-testid="expandable-section-${sectionName}"]`) .should('be.visible') .within(() => { - cy.get('.pf-v5-c-expandable-section__toggle').each(($button) => { + cy.get(selectors.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)); @@ -47,6 +48,6 @@ Cypress.Commands.add('addMetadataField', (fieldName: string) => { .parent() .parent() .within(() => { - cy.get('[data-testid="list-add-field"]').click(); + cy.get(selectors.LIST_ADD_FIELD).click(); }); }); diff --git a/packages/ui-tests/cypress/support/next-commands/nodeConfiguration.ts b/packages/ui-tests/cypress/support/next-commands/nodeConfiguration.ts index 23fd870a7..ee07adee7 100644 --- a/packages/ui-tests/cypress/support/next-commands/nodeConfiguration.ts +++ b/packages/ui-tests/cypress/support/next-commands/nodeConfiguration.ts @@ -1,6 +1,8 @@ +import { selectors } from '@kaoto/kaoto/testing'; + Cypress.Commands.add('interactWithExpressionInputObject', (inputName: string, value?: string, index?: number) => { index = index ?? 0; - cy.get('.expression-metadata-editor-card') + cy.get(selectors.EXPRESSION_EDITOR_CARD) .eq(index) .parent() .within(() => { @@ -10,25 +12,25 @@ Cypress.Commands.add('interactWithExpressionInputObject', (inputName: string, va Cypress.Commands.add('addExpressionResultType', (value: string, index?: number) => { index = index ?? 0; - cy.get('.expression-metadata-editor-card') + cy.get(selectors.EXPRESSION_EDITOR_CARD) .eq(index) .parent() .within(() => { - cy.get('[data-fieldname="resultType"]').within(() => { - cy.get(`input.pf-v5-c-text-input-group__text-input`).clear(); - cy.get(`input.pf-v5-c-text-input-group__text-input`).type(value).type('{enter}'); + cy.get(selectors.DF_RESULT_TYPE).within(() => { + cy.get(selectors.INPUT_TEXT_INPUT_GROUP).clear(); + cy.get(selectors.INPUT_TEXT_INPUT_GROUP).type(value).type('{enter}'); }); }); }); Cypress.Commands.add('checkExpressionResultType', (value: string) => { - cy.get('[data-fieldname="resultType"]').within(() => { - cy.get(`input.pf-v5-c-text-input-group__text-input`).should('have.value', value); + cy.get(selectors.DF_RESULT_TYPE).within(() => { + cy.get(selectors.INPUT_TEXT_INPUT_GROUP).should('have.value', value); }); }); Cypress.Commands.add('interactWithDataformatInputObject', (inputName: string, value?: string) => { - cy.get('[data-testid="dataformat-config-card"]').within(() => { + cy.get(selectors.DATA_CONFIG_CARD).within(() => { cy.interactWithConfigInputObject(inputName, value); }); }); @@ -53,25 +55,25 @@ Cypress.Commands.add('checkConfigInputObject', (inputName: string, value: string Cypress.Commands.add('selectExpression', (expression: string, index?: number) => { index = index ?? 0; - cy.get('[data-testid="expression-config-card"]') + cy.get(selectors.EXPRESSION_CONFIG_CARD) .eq(index) .scrollIntoView() .should('be.visible') .within(() => { - cy.get('div.pf-m-typeahead') + cy.get(selectors.DIV_TYPEAHEAD) .eq(0) .should('be.visible') .within(() => { - cy.get('button.pf-v5-c-menu-toggle__button').click(); + cy.get(selectors.BUTTON_TOGGLE).click(); }); }); const regex = new RegExp(`^${expression}$`); - cy.get('span.pf-v5-c-menu__item-text').contains(regex).should('exist').scrollIntoView().click(); + cy.get(selectors.SPAN_MENU_ITEM_TEXT).contains(regex).should('exist').scrollIntoView().click(); }); Cypress.Commands.add('selectInTypeaheadField', (inputGroup: string, value: string) => { cy.get(`[data-fieldname="${inputGroup}"]`).within(() => { - cy.get('button.pf-v5-c-menu-toggle__button').click(); + cy.get(selectors.BUTTON_TOGGLE).click(); }); cy.get(`#select-typeahead-${value}`).click(); }); @@ -86,7 +88,7 @@ Cypress.Commands.add('configureBeanReference', (inputName: string, value?: strin Cypress.Commands.add('configureNewBeanReference', (inputName: string) => { cy.get(`[data-fieldname="${inputName}"]`).scrollIntoView(); cy.get(`[data-fieldname="${inputName}"] input`).click(); - cy.get('#select-typeahead-kaoto-create-new').click(); + cy.get(selectors.SELECT_TYPEAHEAD_CREATE_NEW).click(); }); Cypress.Commands.add('selectDataformat', (dataformat: string) => { cy.selectCustomMetadataEditor('dataformat', dataformat); @@ -97,7 +99,7 @@ Cypress.Commands.add('selectCustomMetadataEditor', (type: string, format: string .should('be.visible') .click(); const regex = new RegExp(`^${format}$`); - cy.get('span.pf-v5-c-menu__item-text').contains(regex).should('exist').scrollIntoView().click(); + cy.get(selectors.SPAN_MENU_ITEM_TEXT).contains(regex).should('exist').scrollIntoView().click(); }); Cypress.Commands.add('configureDropdownValue', (inputName: string, value?: string) => { @@ -115,7 +117,7 @@ Cypress.Commands.add('addProperty', (propertyName: string) => { .parent() .parent() .within(() => { - cy.get('[data-testid="list-add-field"]').click(); + cy.get(selectors.LIST_ADD_FIELD).click(); }); }); @@ -126,7 +128,7 @@ Cypress.Commands.add('addSingleKVProperty', (propertyName: string, key: string, .parent() .parent() .within(() => { - cy.get('[data-testid="list-add-field"]').click(); + cy.get(selectors.LIST_ADD_FIELD).click(); cy.get('input[label="Key"]').click(); cy.get('input[label="Key"]').type(key); cy.get('input[label="Value"]').click(); @@ -135,27 +137,27 @@ Cypress.Commands.add('addSingleKVProperty', (propertyName: string, key: string, }); Cypress.Commands.add('filterFields', (filter: string) => { - cy.get('[data-testid="filter-fields"]').within(() => { - cy.get('input.pf-v5-c-text-input-group__text-input').clear(); - cy.get('input.pf-v5-c-text-input-group__text-input').type(filter); + cy.get(selectors.FILTER_FIELDS).within(() => { + cy.get(selectors.INPUT_TEXT_INPUT_GROUP).clear(); + cy.get(selectors.INPUT_TEXT_INPUT_GROUP).type(filter); }); }); Cypress.Commands.add('selectFormTab', (value: string) => { - cy.get('div.form-tabs').within(() => { + cy.get(selectors.FORM_TABS).within(() => { cy.get(`[id$="${value}"]`).click(); }); }); Cypress.Commands.add('specifiedFormTab', (value: string) => { - cy.get('div.form-tabs').within(() => { + cy.get(selectors.FORM_TABS).within(() => { 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(selectors.ADD_STRING_PROPERTY_BUTTON).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"]') diff --git a/packages/ui-tests/cypress/support/next-commands/sourceCode.ts b/packages/ui-tests/cypress/support/next-commands/sourceCode.ts index d931c82bb..4a03ab36e 100644 --- a/packages/ui-tests/cypress/support/next-commands/sourceCode.ts +++ b/packages/ui-tests/cypress/support/next-commands/sourceCode.ts @@ -1,18 +1,19 @@ import 'cypress-file-upload'; +import { selectors } from '@kaoto/kaoto/testing'; Cypress.Commands.add('waitForEditorToLoad', () => { - cy.get('.pf-v5-c-code-editor').should(($editor) => { - expect($editor.find('div:contains("Loading...")')).to.not.exist; + cy.get(selectors.CODE_EDITOR).should(($editor) => { + expect($editor.find(selectors.LOADING)).to.not.exist; }); }); Cypress.Commands.add('editorAddText', (line, text) => { cy.waitForEditorToLoad(); - cy.get('.pf-v5-c-code-editor') + cy.get(selectors.CODE_EDITOR) .click() .type('{ctrl}' + '{g}', { delay: 1 }); // Select the line number where to insert the new text - cy.get('input[aria-describedby="quickInput_message"]') + cy.get(selectors.QUICK_INPUT_MESSAGE) .click() .type(`${line}` + '{enter}'); // insert new line, so the new text can be added @@ -27,10 +28,10 @@ Cypress.Commands.add('editorAddText', (line, text) => { Cypress.Commands.add('uploadFixture', (fixture) => { cy.openSourceCode(); cy.waitForEditorToLoad(); - cy.get('.pf-v5-c-code-editor__main > input').attachFile(fixture); + cy.get(selectors.CODE_EDITOR_MAIN_INPUT).attachFile(fixture); - cy.get('.pf-v5-c-code-editor').should(($editor) => { - expect($editor.find('[data-uri^="inmemory://"]')).to.exist; + cy.get(selectors.CODE_EDITOR).should(($editor) => { + expect($editor.find(selectors.INMEMORY_URI)).to.exist; }); }); @@ -38,11 +39,11 @@ Cypress.Commands.add('editorDeleteLine', (line: number, repeatCount: number) => repeatCount = repeatCount ?? 1; cy.waitForEditorToLoad(); // Open the Go to Line dialog - cy.get('.pf-v5-c-code-editor') + cy.get(selectors.CODE_EDITOR) .click() .type('{ctrl}' + '{g}', { delay: 1 }); // Type the line number to delete - cy.get('input[aria-describedby="quickInput_message"]') + cy.get(selectors.QUICK_INPUT_MESSAGE) .click() .type(`${line + 1}` + '{enter}', { delay: 1 }); @@ -55,8 +56,8 @@ Cypress.Commands.add('editorDeleteLine', (line: number, repeatCount: number) => Cypress.Commands.add('checkCodeSpanLine', (spanText: string, linesCount?: number) => { linesCount = linesCount ?? 1; cy.waitForEditorToLoad(); - cy.get('.pf-v5-c-code-editor').within(() => { - cy.get('span:only-child').contains(spanText).should('have.length', linesCount); + cy.get(selectors.CODE_EDITOR).within(() => { + cy.get(selectors.SPAN_ONLY_CHILD).contains(spanText).should('have.length', linesCount); }); }); @@ -65,7 +66,7 @@ Cypress.Commands.add('checkMultiLineContent', (textContent: string[]) => { return line.replace(/\s/g, '\u00a0'); }); - cy.get('.monaco-editor') + cy.get(selectors.MONACO_EDITOR) .invoke('text') .then(($value) => { const linesArray = $value.split(/\s{4,}/).map((line) => line.trim()); @@ -75,20 +76,20 @@ Cypress.Commands.add('checkMultiLineContent', (textContent: string[]) => { Cypress.Commands.add('editorScrollToTop', () => { cy.waitForEditorToLoad(); - cy.get('.pf-v5-c-code-editor').click().type('{ctrl}{home}', { release: false }); + cy.get(selectors.CODE_EDITOR).click().type('{ctrl}{home}', { release: false }); }); Cypress.Commands.add('editorClickUndoXTimes', (repeatCount: number) => { repeatCount = repeatCount ?? 1; Array.from({ length: repeatCount }).forEach(() => { - return cy.get('[data-testid="sourceCode--undoButton"]').click(); + return cy.get(selectors.UNDO_BUTTON).click(); }); }); Cypress.Commands.add('editorClickRedoXTimes', (repeatCount: number) => { repeatCount = repeatCount ?? 1; Array.from({ length: repeatCount }).forEach(() => { - return cy.get('[data-testid="sourceCode--redoButton"]').click(); + return cy.get(selectors.REDO_BUTTON).click(); }); }); @@ -98,8 +99,8 @@ Cypress.Commands.add('compareFileWithMonacoEditor', (filePath: string) => { const fileLines = fileContent.split('\n').filter((line: string) => line.trim() !== ''); fileLines.forEach((line: string) => { - cy.get('.pf-v5-c-code-editor').within(() => { - cy.get('span:only-child').contains(line.trim()).should('have.length', 1); + cy.get(selectors.CODE_EDITOR).within(() => { + cy.get(selectors.SPAN_ONLY_CHILD).contains(line.trim()).should('have.length', 1); }); }); }); diff --git a/packages/ui-tests/package.json b/packages/ui-tests/package.json index 67db1ced1..e04362089 100644 --- a/packages/ui-tests/package.json +++ b/packages/ui-tests/package.json @@ -41,6 +41,7 @@ "chromatic": "^11.0.0", "cypress": "^13.11.0", "cypress-file-upload": "^5.0.8", + "cypress-vite": "^1.5.0", "eslint": "^9.10.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", diff --git a/packages/ui/src/stubs/index.ts b/packages/ui/src/stubs/index.ts index c6cbddca0..23a6811cb 100644 --- a/packages/ui/src/stubs/index.ts +++ b/packages/ui/src/stubs/index.ts @@ -5,3 +5,4 @@ export * from './pipe'; export * from './TestProvidersWrapper'; export * from './TestRuntimeProviderWrapper'; export * from './tiles'; +export * from './selectors'; diff --git a/packages/ui/src/stubs/selectors.ts b/packages/ui/src/stubs/selectors.ts new file mode 100644 index 000000000..9fd3f835c --- /dev/null +++ b/packages/ui/src/stubs/selectors.ts @@ -0,0 +1,111 @@ +export const selectors = { + // export declare const enum selectors { + CODE_EDITOR: '.pf-v5-c-code-editor', + CODE_EDITOR_MAIN_INPUT: '.pf-v5-c-code-editor__main > input', + SPAN_ONLY_CHILD: 'span:only-child', + MONACO_EDITOR: '.monaco-editor', + LOADING: 'div:contains("Loading...")', + REDO_BUTTON: '[data-testid="sourceCode--redoButton"]', + UNDO_BUTTON: '[data-testid="sourceCode--undoButton"]', + QUICK_INPUT_MESSAGE: 'input[aria-describedby="quickInput_message"]', + INMEMORY_URI: '[data-uri^="inmemory://"]', + + //METADATA + EXPANDABLE_SECTION_TOGGLE: '.pf-v5-c-expandable-section__toggle', + LIST_ADD_FIELD: '[data-testid="list-add-field"]', + + //NODE CONFIGURATION + EXPRESSION_EDITOR_CARD: '.expression-metadata-editor-card', + DF_RESULT_TYPE: '[data-fieldname="resultType"]', + INPUT_TEXT_INPUT_GROUP: 'input.pf-v5-c-text-input-group__text-input', + DATA_CONFIG_CARD: '[data-testid="dataformat-config-card"]', + EXPRESSION_CONFIG_CARD: '[data-testid="expression-config-card"]', + BUTTON_TOGGLE: 'button.pf-v5-c-menu-toggle__button', + SPAN_MENU_ITEM_TEXT: 'span.pf-v5-c-menu__item-text', + SELECT_TYPEAHEAD_CREATE_NEW: '#select-typeahead-kaoto-create-new', + FILTER_FIELDS: '[data-testid="filter-fields"]', + FORM_TABS: 'div.form-tabs', + DIV_TYPEAHEAD: 'div.pf-m-typeahead', + ADD_STRING_PROPERTY_BUTTON: '[data-testid="properties-add-string-property--btn"]', + + //DESIGN + FIT_TO_SCREEN: '.fit-to-screen', + CLOSE_SIDE_BAR: '[data-testid="close-side-bar"]', + RESIZABLE_SIDE_BAR: '.pf-topology-resizable-side-bar', + DANGER: '.pf-m-danger', + CIRCLE_TOPOLOGY_NODE_DECORATOR: 'circle.pf-topology__node__decorator__bg', + FILTER_BY_NAME_OR_TAG: 'input[placeholder="Filter by name, description or tag"]', + DELETE_BRANCH_BUTTON: '[data-testid="stepNode__deleteBranch-btn"]', + CONFIRM_DELETE_BRANCH_BUTTON: '[data-testid="confirmDeleteBranchDialog__btn"]', + NEW_ENTITY_LIST_DROPDOWN: '[data-testid="new-entity-list-dropdown"]', + UL_MENU_LIST: 'ul.pf-v5-c-menu__list', + VISUALIZATION_EMPTY_STATE: '[data-testid="visualization-empty-state"]', + RUNTIME_SELECTOR_LIST_DROPDOWN: '[data-testid="runtime-selector-list-dropdown"]', + TITLE_TEXT: '.pf-v5-c-card__title-text', + + //DEFAULT + LOADING_SCHEMAS: '[data-testid="loading-schemas"]', + LOADING_CATALOGS: '[data-testid="loading-catalogs"]', + VISUALIZATION: '#Visualization', + DESIGN: '[data-testid="Design"]', + TOPOLOGY_CONTAINER: '.pf-topology-container', + SOURCE_CODE: '[data-testid="Source Code"]', + CODE_EDITOR_CODE: '.pf-v5-c-code-editor__code', + BEANS: '[data-testid="Beans"]', + METADATA_EDITOR_MODAL_DETAIL: '.metadata-editor-modal-details-view', + METADATA: '[data-testid="Metadata"]', + METADATA_EDITOR_FORM: '[data-testid="metadata-editor-form-Metadata"]', + PIPE_ERRORHANDLER: '[data-testid="Pipe ErrorHandler"]', + TOPBAR: 'div.pf-v5-c-masthead__content', + SETTINGS_KEBAB_BUTTON: 'button.pf-v5-c-menu-toggle', + SETTINGS_LINK: '[data-testid="settings-link"]', + BUTTON_ABOUT: 'button#about', + ABOUT_MODAL_BOX: '.pf-v5-c-about-modal-box', + BUTTON_PLAIN: 'button.pf-v5-c-button.pf-m-plain', + CATALOG: '[data-testid="Catalog"]', + COMPONENT_CATALOG_TAB: '[data-testid="component-catalog-tab"]', + DSL_LIST_DROPDOWN: '[data-testid="dsl-list-dropdown"]', + DSL_LIST_SELECT: '#dsl-list-select', + CONFIRMATION_MODAL_CONFIRM: '[data-testid="confirmation-modal-confirm"]', + NEW_ENTITY_ROUTE: '[data-testid="new-entity-route"]', + TOGGLE_BUTTON_ROUTE: 'button[data-testid^="toggle-btn-route"]', + FLOWS_LIST_DROPDOWN: '[data-testid="flows-list-dropdown"]', + FLOWS_LIST_TABLE: '[data-testid="flows-list-table"]', + DELETE_BUTTON_ROUTE: 'button[data-testid^="delete-btn-route"]', + + SPAN_FLOW_LIST_ROUTE_ID: 'span[data-testid="flows-list-route-id"]', + DATA_LAYER_ID_DEFAULT: 'g[data-layer-id="default"]', + STEP_TOOLBAR_BUTTON_DELETE: '[data-testid="step-toolbar-button-delete"]', + STEP_TOOLBAR_BUTTON_REPLACE: '[data-testid="step-toolbar-button-replace"]', + STEP_TOOLBAR_BUTTON_DISABLE: '[data-testid="step-toolbar-button-disable"]', + STEP_TOOLBAR_BUTTON_DELETE_GROUP: '[data-testid="step-toolbar-button-delete-group"]', + ACTION_CONFIRMATION_MODAL_BTN_CONFIRM: '[data-testid="action-confirmation-modal-btn-confirm"]', + FLOWS_LIST_ROUTE_COUNT: '[data-testid="flows-list-route-count"]', + STEP_TOOLBAR_BUTTON_ADD_SPECIAL: '[data-testid="step-toolbar-button-add-special"]', + STEP_TOOLBAR_BUTTON_COLLAPSE: `[data-testid="step-toolbar-button-collapse"]`, + CONTEXT_MENU_ITEM_DELETE: `[data-testid="context-menu-item-delete"]`, + SETTINGS_FORM_SAVE_BTN: '[data-testid="settings-form-save-btn"]', + HELPER_TEXT_ITEM_TEXT: '.pf-v5-c-helper-text__item-text', + RF_NODE_NODE: '[data-testid^="rf__node-node_0"]', + H4_EMPTY_STATE_TITLE_TEXT: 'h4.pf-v5-c-empty-state__title-text', + MENU_ITEM_TEXT: '.pf-v5-c-menu__item-text', + SPAN_ICON: 'span.pf-v5-c-icon', + ABOUT_MODAL: '[data-testid="about-modal"]', + ABOUT_VERSION: '[data-testid="about-version"]', + EXPANDABLE_SECTION_TOGGLE_TEXT: '.pf-v5-c-expandable-section__toggle-text', + CARD_HEADER_TOGGLE: '.pf-v5-c-card__header-toggle', + EXPRESSION_METADATA_EDITOR: `.expression-metadata-editor`, + ALERT_TITLE: '.pf-v5-c-alert__title', + CUSTOM_NODE_INTERCEPTSENDTOENDPOINT: `[data-testid^="custom-node__interceptSendToEndpoint"]`, + CUSTOM_NODE_ONCOMPLETION: `[data-testid^="custom-node__onCompletion"]`, + CUSTOM_NODE_ONEXCEPTION: `[data-testid^="custom-node__onException"]`, + METADATA_ADD_BEANS_BTN: '[data-testid="metadata-add-Beans-btn"]', + PROCESSOR_CATALOG_TAB: '[data-testid="processor-catalog-tab"]', + KAMELET_CATALOG_TAB: '[data-testid="kamelet-catalog-tab"]', + INPUT_GROUP_TEXT_INPUT: '.pf-v5-c-text-input-group__text-input', + TOGGLE_LAYOUT_BUTTON_LIST: '#toggle-layout-button-List', + TOGGLE_LAYOUT_BUTTON_GALLERY: '#toggle-layout-button-Gallery', + MENU_TOGGLE_TOGGLE_ICON: '.pf-v5-c-menu-toggle__toggle-icon', +} as const; + +export type selectorsType = keyof typeof selectors; diff --git a/yarn.lock b/yarn.lock index a8dfb4dd3..f22f2df7a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2792,6 +2792,7 @@ __metadata: chromatic: "npm:^11.0.0" cypress: "npm:^13.11.0" cypress-file-upload: "npm:^5.0.8" + cypress-vite: "npm:^1.5.0" eslint: "npm:^9.10.0" eslint-config-prettier: "npm:^9.1.0" eslint-plugin-prettier: "npm:^5.2.1" @@ -8163,6 +8164,18 @@ __metadata: languageName: node linkType: hard +"cypress-vite@npm:^1.5.0": + version: 1.5.0 + resolution: "cypress-vite@npm:1.5.0" + dependencies: + chokidar: "npm:^3.5.3" + debug: "npm:^4.3.4" + peerDependencies: + vite: ^2.9.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 + checksum: 10/905f903ccdd00d12f1b5b91d75123a9dfc3b33e678a9fbe89be244ad802c8ec46c876ac389900b385d3ca421310d4ea15c77f802be794549e1975de1f04b5848 + languageName: node + linkType: hard + "cypress@npm:^13.11.0": version: 13.15.2 resolution: "cypress@npm:13.15.2"