forked from rancher/dashboard
-
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.
- banner should be visibile when test starts - banner is visible if v3 setting is not 'true' and there is a missing helm repo - previously confirmed the repo is missing, now confirm the v3 setting is correct - split rancher api commands out from base commands, added get/set commands
- Loading branch information
1 parent
3eb29b7
commit ff065e5
Showing
5 changed files
with
111 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Matcher } from '@/cypress/support/types'; | ||
|
||
/** | ||
* Get input field for given label | ||
*/ | ||
Cypress.Commands.add('byLabel', (label) => { | ||
return cy.get('.labeled-input').contains(label).siblings('input'); | ||
}); | ||
|
||
/** | ||
* Wrap the cy.find() command to simplify the selector declaration of the data-testid | ||
*/ | ||
Cypress.Commands.add('findId', (id: string, matcher?: Matcher = '') => { | ||
return cy.find(`[data-testid${ matcher }="${ id }"]`); | ||
}); | ||
|
||
/** | ||
* Wrap the cy.get() command to simplify the selector declaration of the data-testid | ||
*/ | ||
Cypress.Commands.add('getId', (id: string, matcher?: Matcher = '') => { | ||
return cy.get(`[data-testid${ matcher }="${ id }"]`); | ||
}); | ||
|
||
Cypress.Commands.add('keyboardControls', (triggerKeys: any = {}, count = 1) => { | ||
for (let i = 0; i < count; i++) { | ||
cy.get('body').trigger('keydown', triggerKeys); | ||
} | ||
}); | ||
|
||
/** | ||
* Intercept all requests and return | ||
* @param {array} intercepts - Array of intercepts to return | ||
* return {array} - Array of intercepted request strings | ||
* return {string} - Intercepted request string | ||
*/ | ||
Cypress.Commands.add('interceptAllRequests', (method = '/GET/POST/PUT/PATCH/', urls = ['/v1/*']) => { | ||
const interceptedUrls: string[] = urls.map((cUrl, i) => { | ||
cy.intercept(method, cUrl).as(`interceptAllRequests${ i }`); | ||
|
||
return `@interceptAllRequests${ i }`; | ||
}); | ||
|
||
return cy.wrap(interceptedUrls); | ||
}); | ||
|
||
Cypress.Commands.add('iFrame', () => { | ||
return cy | ||
.get('[data-testid="ember-iframe"]', { log: false }) | ||
.its('0.contentDocument.body', { log: false }) | ||
.should('not.be.empty') | ||
.then((body) => cy.wrap(body)); | ||
}); |
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