Skip to content

Commit

Permalink
e2e(1174): add coverage for parameters filter in canvas form
Browse files Browse the repository at this point in the history
  • Loading branch information
tplevko authored and lordrip committed Jun 26, 2024
1 parent 4c65a15 commit a2d569b
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
describe('Tests for side panel step filtering', () => {
beforeEach(() => {
cy.openHomePage();
});

it('Side panel step filtering lowercase', () => {
cy.uploadFixture('flows/camelRoute/basic.yaml');
cy.openDesignPage();
cy.openStepConfigurationTab('setHeader');

// expand wrapped section
cy.contains('button', 'Processor advanced properties').click();

// check all fields are present
cy.get(`input[name="id"]`).should('exist');
cy.get(`textarea[name="description"]`).should('exist');
cy.get(`input[name="name"]`).should('exist');
cy.get(`input[name="disabled"]`).should('exist');
cy.get(`input[data-testid="expression-preview-input"]`).should('exist');

// filter fields
cy.filterFields('name');
cy.get(`input[data-testid="expression-preview-input"]`).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');
cy.get(`input[name="disabled"]`).should('not.exist');
});

it('Side panel step filtering uppercase', () => {
cy.uploadFixture('flows/camelRoute/basic.yaml');
cy.openDesignPage();
cy.openStepConfigurationTab('setHeader');

// expand wrapped section
cy.contains('button', 'Processor advanced properties').click();

// check all fields are present
cy.get(`input[name="id"]`).should('exist');
cy.get(`textarea[name="description"]`).should('exist');
cy.get(`input[name="name"]`).should('exist');
cy.get(`input[name="disabled"]`).should('exist');
cy.get(`input[data-testid="expression-preview-input"]`).should('exist');

// filter fields
cy.filterFields('DISABLED');
cy.get(`input[data-testid="expression-preview-input"]`).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');
cy.get(`textarea[name="description"]`).should('not.exist');
});

// blocked by https://github.com/KaotoIO/kaoto/issues/1207
it.skip('Side panel step filtering multiple words', () => {
cy.uploadFixture('flows/camelRoute/basic.yaml');
cy.openDesignPage();
cy.openStepConfigurationTab('log');

// check all fields are present
cy.get(`input[name="id"]`).should('exist');
cy.get(`textarea[name="description"]`).should('exist');
cy.get(`input[name="name"]`).should('exist');
cy.get(`input[name="disabled"]`).should('exist');

// filter fields
cy.filterFields('show all');
cy.get(`input[name="showAll"]`).should('exist');
cy.get(`input[name="showAllProperties"]`).should('exist');
cy.get(`input[name="id"]`).should('not.exist');
cy.get(`textarea[name="description"]`).should('not.exist');
});
});
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 @@ -67,6 +67,7 @@ declare global {
deselectNodeBean(inputName: string): Chainable<JQuery<Element>>;
addProperty(propertyName: string): Chainable<JQuery<Element>>;
addSingleKVProperty(propertyName: string, key: string, value: string): Chainable<JQuery<Element>>;
filterFields(filter: 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 @@ -120,3 +120,9 @@ Cypress.Commands.add('addSingleKVProperty', (propertyName: string, key: string,
cy.get('input[label="Value"]').type(value);
});
});

Cypress.Commands.add('filterFields', (filter: string) => {
cy.get('[data-testid="filter-fields"]').within(() => {
cy.get('input.pf-v5-c-text-input-group__text-input').type(filter);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const CanvasForm: FunctionComponent<CanvasFormProps> = (props) => {
<SearchInput
className="filter-fields"
placeholder="Find properties by name"
data-testid="filter-fields"
value={filteredFieldText}
onChange={onFilterChange}
onClear={onFilterChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports[`CanvasForm should render 1`] = `
>
<div
class="pf-v5-c-text-input-group filter-fields"
data-testid="filter-fields"
>
<div
class="pf-v5-c-text-input-group__main pf-m-icon"
Expand Down Expand Up @@ -505,6 +506,7 @@ exports[`CanvasForm should render nothing if no schema and no definition is avai
>
<div
class="pf-v5-c-text-input-group filter-fields"
data-testid="filter-fields"
>
<div
class="pf-v5-c-text-input-group__main pf-m-icon"
Expand Down Expand Up @@ -703,6 +705,7 @@ exports[`CanvasForm should render nothing if no schema is available 1`] = `
>
<div
class="pf-v5-c-text-input-group filter-fields"
data-testid="filter-fields"
>
<div
class="pf-v5-c-text-input-group__main pf-m-icon"
Expand Down

0 comments on commit a2d569b

Please sign in to comment.