forked from jhipster/generator-jhipster
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes jhipster#12686
- Loading branch information
Showing
12 changed files
with
102 additions
and
117 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
98 changes: 0 additions & 98 deletions
98
generators/cypress/templates/src/test/javascript/cypress/support/keycloak-oauth2.ts.ejs
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
generators/cypress/templates/src/test/javascript/cypress/support/oauth2.ts.ejs
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,47 @@ | ||
|
||
/* eslint-disable @typescript-eslint/camelcase */ | ||
/* eslint-disable @typescript-eslint/no-namespace */ | ||
/* eslint-disable @typescript-eslint/no-use-before-define */ | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference types="cypress" /> | ||
|
||
Cypress.Commands.add('oauthLogin', (username, password) => { | ||
cy.task('login', {baseUrl: Cypress.config().baseUrl, username: username, password: password}).then(cookies => { | ||
cookies.forEach(c => { | ||
const name = c.name; | ||
const value = c.value; | ||
const options = { | ||
...c | ||
} | ||
cy.setCookie(name, value, options); | ||
}); | ||
cy.visit('/'); | ||
}); | ||
}); | ||
|
||
Cypress.Commands.add('oauthLogout', (username, password) => { | ||
cy.task('logout', {baseUrl: Cypress.config().baseUrl}).then(() => { | ||
cy.clearCookies(); | ||
}); | ||
}); | ||
|
||
Cypress.Commands.add('clearCache', () => { | ||
cy.clearCookies(); | ||
cy.clearLocalStorage(); | ||
cy.window().then(win => { | ||
win.sessionStorage.clear(); | ||
}); | ||
}); | ||
|
||
declare global { | ||
namespace Cypress { | ||
interface Chainable<Subject> { | ||
oauthLogin(username: string, password: string): Cypress.Chainable; | ||
oauthLogout(): Cypress.Chainable; | ||
clearCache(): Cypress.Chainable; | ||
} | ||
} | ||
} | ||
|
||
// Convert this to a module instead of script (allows import/export) | ||
export {}; |
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