-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'beta' of github.com:SoftwareBrothers/admin-bro into beta
- Loading branch information
Showing
21 changed files
with
155 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/// <reference types="cypress" /> | ||
|
||
/** | ||
* @method abGetProperty | ||
* @param {string} propertyPath | ||
* @param {string} [selector=null] | ||
*/ | ||
Cypress.Commands.add('abGetProperty', (propertyPath, selector = null) => { | ||
let propertySelector = `[data-testid$="-${propertyPath}"]` | ||
if (selector) { | ||
propertySelector = [propertySelector, selector].join(' ') | ||
} | ||
return cy.get(propertySelector) | ||
}) |
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,19 @@ | ||
/// <reference types="cypress" /> | ||
|
||
/** | ||
* @method abKeepLoggedIn | ||
* @param {object} [options] | ||
* @param {object} [options.cookie] session cookie name: default to Cypress.env('AB_COOKIE_NAME') | ||
* @example | ||
* before(() => { | ||
* cy.abLogin() | ||
* }) | ||
* | ||
* beforeAll(() => { | ||
* cy.abKeepLoggedIn({ cookie: 'my-session-cookie' }) | ||
* cy.visit('your/path') | ||
* }) | ||
*/ | ||
Cypress.Commands.add('abKeepLoggedIn', ({ cookie }) => { | ||
Cypress.Cookies.preserveOnce(cookie || Cypress.env('AB_COOKIE_NAME')) | ||
}) |
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,15 @@ | ||
/// <reference types="cypress" /> | ||
|
||
/** | ||
* @method abLogin | ||
* @param {object} [options] | ||
* @param {object} [options.email] login email: default to Cypress.env('AB_EMAIL') | ||
* @param {object} [options.password] login password: default to Cypress.env('AB_PASSWORD') | ||
* @param {object} [options.loginPath] default to '/login' | ||
*/ | ||
Cypress.Commands.add('abLoginAPI', ({ email, password, loginPath } = {}) => ( | ||
cy.request('POST', loginPath || '/login', { | ||
email: email || Cypress.env('AB_EMAIL'), | ||
password: password || Cypress.env('AB_PASSWORD'), | ||
}) | ||
)) |
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,15 @@ | ||
/// <reference types="cypress" /> | ||
|
||
/** | ||
* @method abLogin | ||
* @param {object} [options] | ||
* @param {object} [options.email] login email: default to Cypress.env('AB_EMAIL') | ||
* @param {object} [options.password] login password: default to Cypress.env('AB_PASSWORD') | ||
* @param {object} [options.loginPath] default to '/login' | ||
*/ | ||
Cypress.Commands.add('abLogin', ({ email, password, loginPath } = {}) => { | ||
cy.visit(loginPath || '/login') | ||
cy.get('[name=email]').type(email || Cypress.env('AB_EMAIL')) | ||
cy.get('[name=password]').type(password || Cypress.env('AB_PASSWORD')) | ||
cy.get('button').click() | ||
}) |
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,20 @@ | ||
/// <reference types="cypress" /> | ||
|
||
declare namespace Cypress { | ||
type AbLoginParams = { | ||
email?: string; | ||
password?: string; | ||
loginPath?: string; | ||
} | ||
|
||
type AbKeepLoggedInParams = { | ||
cookie?: string; | ||
} | ||
|
||
interface Chainable<Subject> { | ||
abLogin(params?: AbLoginParams): Chainable<any>; | ||
abLoginAPI(params?: AbLoginParams): Chainable<any>; | ||
abGetProperty(propertyPath: string, selector?: string): Chainable<any>; | ||
abKeepLoggedIn(params?: AbKeepLoggedInParams): Chainable<any>; | ||
} | ||
} |
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,4 @@ | ||
require('./commands/ab-login') | ||
require('./commands/ab-login-api') | ||
require('./commands/ab-keep-logged-in') | ||
require('./commands/ab-get-property') |
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
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
Oops, something went wrong.