Skip to content

Commit

Permalink
feature #177 Add cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
korel-san committed Jan 31, 2023
1 parent 8d63191 commit 589fe9e
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
42 changes: 42 additions & 0 deletions ui/cypress/e2e/main-tests-spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('', () => {})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class SplineSearchBoxWithFilterComponent<TRowData = undefined> extends Ba
this.autocompletedFilterFragments$.next([])
this.matAutocompleteTrigger?.openPanel()
const filterTokenFragment = this.lastFoundFilterTokenFragment$.getValue()
console.log(filterTokenFragment)
this.updateAutocompletedOptionList(filterTokenFragment)
}
})
Expand Down Expand Up @@ -167,6 +168,7 @@ export class SplineSearchBoxWithFilterComponent<TRowData = undefined> 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)
Expand Down

0 comments on commit 589fe9e

Please sign in to comment.