From 589fe9e39970725a92e390298b24b57098f2eab2 Mon Sep 17 00:00:00 2001 From: Oleksandra Kalinina <946369+korel-san@users.noreply.github.com> Date: Mon, 30 Jan 2023 10:04:16 +0200 Subject: [PATCH] feature #177 Add cypress tests --- package-lock.json | 6 +++ package.json | 1 + ui/cypress/e2e/main-tests-spec.cy.ts | 42 +++++++++++++++++++ ...spline-search-box-with-filter.component.ts | 2 + 4 files changed, 51 insertions(+) create mode 100644 package-lock.json create mode 100644 package.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..b0946bd5 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "spline-ui", + "lockfileVersion": 2, + "requires": true, + "packages": {} +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/package.json @@ -0,0 +1 @@ +{} diff --git a/ui/cypress/e2e/main-tests-spec.cy.ts b/ui/cypress/e2e/main-tests-spec.cy.ts index cd79892b..0a14ac0c 100644 --- a/ui/cypress/e2e/main-tests-spec.cy.ts +++ b/ui/cypress/e2e/main-tests-spec.cy.ts @@ -38,4 +38,46 @@ describe('Main Tests', () => { }) }) + describe('Feature #177 Filter plans and events by labels', () => { + it('search text `a` that is matched by autocomplete, but no option was chosen', () => { + cy.visit('/') + cy.get('spline-search-box-with-filter input').click() + cy.wait(1000).get('.mat-autocomplete-panel spline-loader mat-spinner', { timeout: 10000 }) + .should('not.exist') + cy.get('.mat-autocomplete-panel mat-option') + .should('have.length.at.least', 3) + + cy.get('spline-search-box-with-filter input').type('a') + cy.wait(1000).get('.mat-autocomplete-panel spline-loader mat-spinner', { timeout: 10000 }) + .should('not.exist') + cy.get('.mat-autocomplete-panel mat-option') + .should('have.length.at.least', 2) + cy.get('.mat-autocomplete-panel mat-option') + .contains('.spline-search-attribute__option-name', 'appName').click() + cy.wait(1000).get(`spline-search-box-with-filter input`) + .should('have.value', 'appName:') + cy.get('.mat-autocomplete-panel mat-option') + .should('have.length.greaterThan', 5) + cy.get('.mat-autocomplete-panel mat-option') + .contains('.spline-search-attribute__option-name', 'Other Job C') + + cy.get('spline-search-box-with-filter input') + .type('"Excel') + cy.get('.mat-autocomplete-panel mat-option') + .contains('.spline-search-attribute__option-name', 'Excel') + cy.get('spline-search-box-with-filter input') + .type('{backspace}{backspace}{backspace}{backspace}{backspace}Other ') + + cy.get('.mat-autocomplete-panel mat-option') + .contains('.spline-search-attribute__option-name', 'Other Job C') + .click() + cy.wait(1000).get(`spline-search-box-with-filter input`) + .should('have.value', 'appName:"Other Job C" ') + cy.get('mat-table mat-row') + .should('have.length.at.least', 2) + }) + it('', () => {}) + it('', () => {}) + it('', () => {}) + }) }) diff --git a/ui/projects/spline-common/main/src/common/component/search-box-with-filter/spline-search-box-with-filter.component.ts b/ui/projects/spline-common/main/src/common/component/search-box-with-filter/spline-search-box-with-filter.component.ts index 15fc70ee..3a98b515 100644 --- a/ui/projects/spline-common/main/src/common/component/search-box-with-filter/spline-search-box-with-filter.component.ts +++ b/ui/projects/spline-common/main/src/common/component/search-box-with-filter/spline-search-box-with-filter.component.ts @@ -112,6 +112,7 @@ export class SplineSearchBoxWithFilterComponent extends Ba this.autocompletedFilterFragments$.next([]) this.matAutocompleteTrigger?.openPanel() const filterTokenFragment = this.lastFoundFilterTokenFragment$.getValue() + console.log(filterTokenFragment) this.updateAutocompletedOptionList(filterTokenFragment) } }) @@ -167,6 +168,7 @@ export class SplineSearchBoxWithFilterComponent extends Ba private updateAutocompletedOptionList({ fragmentString, filterTokenKey }: FilterTokenFragment) { // Adapter LabelData to LabelQuery const queryParams = ExecutionEventsQuery.toLabelQueryParams(fragmentString, filterTokenKey) + console.log(queryParams) this.labelApiService?.fetchList(queryParams) .pipe(tap((result: string[]) => { this.autocompletedFilterFragments$.next(result)