Skip to content

Commit

Permalink
add path prefix optional parameter for login url
Browse files Browse the repository at this point in the history
  • Loading branch information
neryams authored and babangsund committed Jul 15, 2020
1 parent 5f66d11 commit 57dad36
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Two `cy` commands have been added:
- `password`: string
- `client_id`: string
- `redirect_uri`: string
- `path_prefix`?: string = "auth"

### Example:

Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare namespace Cypress {
username: string;
password: string;
client_id: string;
path_prefix?: string;
redirect_uri: string;
}
interface Chainable {
Expand Down
4 changes: 2 additions & 2 deletions src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import createUUID from './createUUID';

Cypress.Commands.add(
'login',
({ root, realm, username, password, client_id, redirect_uri }) =>
({ root, realm, username, password, client_id, redirect_uri, path_prefix = "auth" }) =>
cy
.request({
url: `${root}/auth/realms/${realm}/protocol/openid-connect/auth`,
url: `${root}/${path_prefix}/realms/${realm}/protocol/openid-connect/auth`,
qs: {
client_id,
redirect_uri,
Expand Down

0 comments on commit 57dad36

Please sign in to comment.