forked from kubeflow/model-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update code with conditional rendering
Signed-off-by: lucferbux <[email protected]>
- Loading branch information
Showing
173 changed files
with
7,992 additions
and
1,686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...i/frontend/src/__tests__/cypress/cypress/pages/components/subComponents/SearchSelector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { SubComponentBase } from '~/__tests__/cypress/cypress/pages/components/subComponents/SubComponentBase'; | ||
|
||
export class SearchSelector extends SubComponentBase { | ||
constructor( | ||
private selectorId: string, | ||
contextSelectorId?: string, | ||
) { | ||
super(contextSelectorId); | ||
} | ||
|
||
private findContextualItem(suffix: string): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.findScope().document().findByTestId(`${this.selectorId}-${suffix}`); | ||
} | ||
|
||
findItem(name: string, useMenuList: boolean): Cypress.Chainable<JQuery<HTMLElement>> { | ||
const list = useMenuList ? this.findMenuList() : this.findResultTableList(); | ||
return list.contains(name).should('exist'); | ||
} | ||
|
||
selectItem(name: string, useMenuList = false): void { | ||
this.findItem(name, useMenuList).click(); | ||
} | ||
|
||
findSearchInput(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.findContextualItem('search'); | ||
} | ||
|
||
findToggleButton(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.findContextualItem('toggle'); | ||
} | ||
|
||
findResultTableList(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.findContextualItem('table-list'); | ||
} | ||
|
||
findSearchHelpText(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.findContextualItem('searchHelpText'); | ||
} | ||
|
||
findMenu(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.findContextualItem('menu'); | ||
} | ||
|
||
findMenuList(): Cypress.Chainable<JQuery<HTMLElement>> { | ||
return this.findContextualItem('menuList'); | ||
} | ||
|
||
// Search for an item by typing into the search input | ||
searchItem(name: string): void { | ||
this.findSearchInput().clear().type(name); | ||
} | ||
|
||
// Perform the entire process: open, search, and select | ||
openAndSelectItem(name: string, useMenuList = false): void { | ||
this.findToggleButton().click(); | ||
this.searchItem(name); | ||
this.selectItem(name, useMenuList); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...frontend/src/__tests__/cypress/cypress/pages/components/subComponents/SubComponentBase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* A SubComponent is a component that doesn't make up a full page and will be consumed in other page | ||
* objects. This could be a complex field, a group of fields, or some section. Typically not large | ||
* enough to warrant its own standalone page object. | ||
* | ||
* Primary use-case example: | ||
* class Foo extends SubComponentBase { | ||
* constructor(private myTestId: string, scopedTestId?: string) { | ||
* super(scopedTestId); | ||
* } | ||
* | ||
* private find(suffix: string) { | ||
* return this.findScope().getByTestId(`${this.myTestId}-${suffix}`); | ||
* } | ||
* | ||
* selectItem(name: string) { | ||
* // "list" would be an internal suffix for your component to know where the "items" are | ||
* return this.find('list').findDropdownItem(name); | ||
* } | ||
* } | ||
* | ||
* Search uses of this component to see further examples | ||
*/ | ||
export class SubComponentBase { | ||
constructor(private scopedBaseTestId?: string) {} | ||
|
||
/** Allows for extended classes to make use of a simple one-check for their `find()` calls */ | ||
protected findScope(): (Cypress.cy & CyEventEmitter) | Cypress.Chainable<JQuery<HTMLElement>> { | ||
if (this.scopedBaseTestId) { | ||
return cy.findByTestId(this.scopedBaseTestId); | ||
} | ||
|
||
return cy; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.