Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ODC-6006:Automate quick starts - filter-quick-starts-catalog.feature
- Loading branch information
1 parent
f7b4300
commit 4964528
Showing
13 changed files
with
229 additions
and
20 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
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
37 changes: 37 additions & 0 deletions
37
frontend/packages/dev-console/integration-tests/support/pageObjects/quickStarts-po.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,37 @@ | ||
export const quickStartsPO = { | ||
quickStartTitle: '[data-test="page-title"]', | ||
filterKeyword: 'input.pf-c-search-input__text-input', | ||
statusFilter: 'button.pf-c-select__toggle', | ||
statusDropdown: '[aria-label="Select filter"]', | ||
statusComplete: '[data-key="Complete"]', | ||
emptyState: 'div.pf-c-empty-state__content', | ||
clearFilter: '[data-test="clear-filter button"]', | ||
cardStatus: '[data-test~="tile"] [data-test~="status"]', | ||
}; | ||
|
||
export const quickStartSidebarPO = { | ||
quickStartSidebarBody: '[data-test~="drawer"] [data-test~="content"]', | ||
startButton: `[data-test="Start button"]`, | ||
nextButton: '[data-test="Next button"]', | ||
closeButton: '[data-test="Close button"]', | ||
}; | ||
|
||
export const quickStartTile = (tile: string) => { | ||
switch (tile) { | ||
case 'Getting started with a sample application': { | ||
return 'sample-application'; | ||
} | ||
case 'Install the OpenShift Pipelines Operator': { | ||
return 'explore-pipelines'; | ||
} | ||
default: { | ||
throw new Error('Option is not available'); | ||
} | ||
} | ||
}; | ||
|
||
export function quickStartCard(quickStartName: string) { | ||
const tile = quickStartTile(quickStartName); | ||
const card = `[data-test~="tile"][data-test~="${tile}"]`; | ||
return card; | ||
} |
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
65 changes: 65 additions & 0 deletions
65
frontend/packages/dev-console/integration-tests/support/pages/quickStartsPage.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,65 @@ | ||
import { devNavigationMenu } from '../constants/global'; | ||
import { addPagePO, quickStartSidebarPO, quickStartsPO } from '../pageObjects'; | ||
import { catalogPage } from './add-flow/catalog-page'; | ||
import { app, navigateTo } from './app'; | ||
|
||
function clickVisibleButton(el: string) { | ||
cy.get(quickStartSidebarPO.quickStartSidebarBody).then(($button) => { | ||
const isVisible = $button.find(el).is(':visible'); | ||
if (isVisible) { | ||
cy.get(el).click(); | ||
clickVisibleButton(el); | ||
} else { | ||
cy.log('quick start is complete'); | ||
} | ||
}); | ||
} | ||
|
||
export const quickStartsPage = { | ||
quickStartsCatalog: () => { | ||
navigateTo(devNavigationMenu.Add); | ||
app.waitForDocumentLoad(); | ||
cy.get(addPagePO.viewAllQuickStarts).click(); | ||
cy.get(quickStartsPO.quickStartTitle) | ||
.scrollIntoView() | ||
.should('be.visible'); | ||
catalogPage.isCardsDisplayed(); | ||
}, | ||
filterByKeyword: (filterName: string) => { | ||
cy.get(quickStartsPO.filterKeyword) | ||
.scrollIntoView() | ||
.click(); | ||
cy.get(quickStartsPO.filterKeyword).type(filterName); | ||
}, | ||
cardPresent: (cardName: string) => { | ||
cy.get(cardName) | ||
.scrollIntoView() | ||
.should('be.visible'); | ||
}, | ||
status: () => { | ||
cy.get(quickStartsPO.statusFilter) | ||
.scrollIntoView() | ||
.click(); | ||
app.waitForLoad(); | ||
cy.get(quickStartsPO.statusDropdown).should('be.visible'); | ||
}, | ||
executeQuickStart: (quickStart: string) => { | ||
cy.get(quickStart) | ||
.scrollIntoView() | ||
.click(); | ||
app.waitForDocumentLoad(); | ||
cy.get(quickStartSidebarPO.quickStartSidebarBody).should('be.visible'); | ||
cy.get(quickStartSidebarPO.quickStartSidebarBody) | ||
.find(quickStartSidebarPO.startButton) | ||
.click(); | ||
clickVisibleButton(quickStartSidebarPO.nextButton); | ||
cy.get(quickStartSidebarPO.quickStartSidebarBody) | ||
.find(quickStartSidebarPO.closeButton) | ||
.click(); | ||
cy.get(quickStart) | ||
.parent() | ||
.find(quickStartsPO.cardStatus) | ||
.should('be.visible') | ||
.contains('Complete'); | ||
}, | ||
}; |
93 changes: 93 additions & 0 deletions
93
...ole/integration-tests/support/step-definitions/quck-starts/filter-quick-starts-catalog.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,93 @@ | ||
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'; | ||
import { quickStartCard, quickStartsPO } from '../../pageObjects'; | ||
import { quickStartsPage } from '../../pages'; | ||
|
||
When('user clicks on "View all quick starts" on Build with guided documentation card', () => { | ||
quickStartsPage.quickStartsCatalog(); | ||
}); | ||
|
||
Then('user can see Quick Starts catalog page', () => { | ||
cy.get(quickStartsPO.quickStartTitle).should('be.visible'); | ||
}); | ||
|
||
Then('user can see filter by keyword search bar', () => { | ||
cy.get(quickStartsPO.filterKeyword).should('be.visible'); | ||
}); | ||
|
||
Then('user can see Status filter dropdown', () => { | ||
cy.get(quickStartsPO.statusFilter).should('be.visible'); | ||
}); | ||
|
||
Given('user is at Quick Starts catalog page', () => { | ||
quickStartsPage.quickStartsCatalog(); | ||
}); | ||
|
||
When('user clicks on filter by keyword search bar', () => { | ||
cy.get(quickStartsPO.filterKeyword).click(); | ||
}); | ||
|
||
When('user enters {string}', (filterName: string) => { | ||
quickStartsPage.filterByKeyword(filterName); | ||
}); | ||
|
||
Then('user can see {string} Quick Start', (quickStartName: string) => { | ||
quickStartsPage.cardPresent(quickStartCard(quickStartName)); | ||
}); | ||
|
||
Given('user is at Quick Starts catalog page', () => { | ||
quickStartsPage.quickStartsCatalog(); | ||
}); | ||
|
||
When('user clicks on Status filter menu', () => { | ||
quickStartsPage.status(); | ||
}); | ||
|
||
Then('user can see Complete, In progress and Not started categories', () => { | ||
cy.get(quickStartsPO.statusDropdown).contains('Complete'); | ||
cy.get(quickStartsPO.statusDropdown).contains('In progress'); | ||
cy.get(quickStartsPO.statusDropdown).contains('Not started'); | ||
}); | ||
|
||
Given('user is at Quick Starts catalog page', () => { | ||
quickStartsPage.quickStartsCatalog(); | ||
}); | ||
|
||
Given('user has completed {string} Quick Start', (quickStartName: string) => { | ||
quickStartsPage.executeQuickStart(quickStartCard(quickStartName)); | ||
}); | ||
|
||
When('user clicks on Status filter menu', () => { | ||
quickStartsPage.status(); | ||
}); | ||
|
||
When('user clicks on completed', () => { | ||
cy.get(quickStartsPO.statusComplete) | ||
.should('be.visible') | ||
.click(); | ||
}); | ||
|
||
Then('user can see {string} Quick Start is present', (quickStartName: string) => { | ||
cy.get(quickStartCard(quickStartName)).should('be.visible'); | ||
}); | ||
|
||
Given('user is at Quick Starts catalog page', () => { | ||
quickStartsPage.quickStartsCatalog(); | ||
}); | ||
|
||
When('user clicks on filter by keyword search bar', () => { | ||
cy.get(quickStartsPO.filterKeyword).click(); | ||
}); | ||
|
||
When('user enters {string}', (filterKeyword: string) => { | ||
quickStartsPage.filterByKeyword(filterKeyword); | ||
}); | ||
|
||
Then('user can see "No results found" message', () => { | ||
cy.get(quickStartsPO.emptyState).should('be.visible'); | ||
cy.get(quickStartsPO.emptyState).contains('No results found'); | ||
}); | ||
|
||
Then('user can see Clear all filters option', () => { | ||
cy.get(quickStartsPO.clearFilter).should('be.visible'); | ||
cy.get(quickStartsPO.clearFilter).contains('Clear all filters'); | ||
}); |