Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13494 from The-Anton/quick-start-access-code-snip…
…pet-automation ODC-7477: automation of quick-start-access-code-snippet.feature
- Loading branch information
Showing
3 changed files
with
126 additions
and
25 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
93 changes: 93 additions & 0 deletions
93
...integration-tests/support/step-definitions/quck-starts/quick-start-access-code-snippet.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 { operators } from '../../constants'; | ||
import { devNavigationMenuPO, quickStartCard, quickStartSidebarPO } from '../../pageObjects'; | ||
import { app, verifyAndInstallOperator } from '../../pages'; | ||
|
||
Given('user has installed Web Terminal Operator', () => { | ||
verifyAndInstallOperator(operators.WebTerminalOperator); | ||
}); | ||
|
||
Given('user has applied {string}', (yamlFileName: string) => { | ||
cy.exec(`oc apply -f testData/quick-start/${yamlFileName} -n ${Cypress.env('NAMESPACE')} `, { | ||
failOnNonZeroExit: false, | ||
}).then(function (result) { | ||
cy.log(result.stdout); | ||
}); | ||
}); | ||
|
||
Given('user is at Quick Starts catalog page', () => { | ||
cy.get(devNavigationMenuPO.add).click(); | ||
cy.reload(); | ||
cy.byTestID('item all-quick-starts').click(); | ||
}); | ||
|
||
When('user clicks on the {string} Quick Starts card', (tourName: string) => { | ||
cy.get(quickStartCard(tourName)).click(); | ||
}); | ||
|
||
When('user clicks on Step 1', () => { | ||
cy.get(quickStartSidebarPO.quickStartSidebarBody).find('h3').click(); | ||
}); | ||
|
||
When('user clicks on the Start button', () => { | ||
cy.get(quickStartSidebarPO.quickStartSidebar).byTestID('Start button').click(); | ||
}); | ||
|
||
When('user sees that {string} step has started', (stepName: string) => { | ||
cy.get(quickStartSidebarPO.quickStartSidebarBody).get('h3').contains(stepName); | ||
cy.byLegacyTestID('quick-start-task-subtitle').contains('1 of 1'); | ||
}); | ||
|
||
When('user hovers on the copy icon in the code snippet', () => { | ||
cy.get(quickStartSidebarPO.clipboardAction).first().trigger('mouseenter').invoke('focus'); | ||
}); | ||
|
||
Then('user can see {string} tooltip appears after click', (tooltip: string) => { | ||
cy.get(quickStartSidebarPO.clipboardAction) | ||
.first() | ||
.invoke('focus') | ||
.trigger('mouseenter') | ||
.wait(1000) | ||
.then(() => { | ||
cy.get(quickStartSidebarPO.tooltip).contains(tooltip); | ||
}) | ||
.trigger('mouseleave'); | ||
}); | ||
|
||
Then('user can see {string} tooltip appears after hover', (tooltip: string) => { | ||
cy.get(quickStartSidebarPO.tooltip).contains(tooltip); | ||
}); | ||
|
||
Then('user clicks on the copy icon in the code snippet', () => { | ||
cy.get(quickStartSidebarPO.clipboardAction).first().click(); | ||
}); | ||
|
||
Then('user clicks on the Restart button', () => { | ||
cy.get(quickStartSidebarPO.restartSideNoteAction).click(); | ||
}); | ||
|
||
Given('user has the {string} Quick Starts side panel open', (tour: string) => { | ||
cy.get(quickStartSidebarPO.quickStartSidebar).should('be.visible'); | ||
cy.get(quickStartSidebarPO.quickStartSidebar).find('h2').contains(tour); | ||
}); | ||
|
||
When('user has copied the code snippet', () => { | ||
cy.get(quickStartSidebarPO.clipboardAction).first().click(); | ||
}); | ||
|
||
When('user hovers on the play icon in the code snippet', () => { | ||
cy.reload(); | ||
app.waitForDocumentLoad(); | ||
cy.get(quickStartSidebarPO.executeAction).first().trigger('mouseenter').invoke('focus'); | ||
}); | ||
|
||
Then('user clicks on the play icon in the code snippet', () => { | ||
cy.get(quickStartSidebarPO.executeAction).first().click(); | ||
}); | ||
|
||
Then( | ||
'user can see {string} tooltip appears for executing the code in terminal', | ||
(tooltip: string) => { | ||
cy.get('[class="ocs-tooltip"]').contains(tooltip); | ||
}, | ||
); |