Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Commit

Permalink
chore: prettier/lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Bangsund ✨ committed Jun 8, 2023
1 parent 8a2b597 commit 9a679bf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/cypress-otp.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// in case of using TypeScript this needs to be defined to avoid error TS2307 in index.ts in plugins folder
declare module 'cypress-otp'
declare module 'cypress-otp';
10 changes: 8 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare namespace Cypress {
realm: string;
redirect_uri?: string;
path_prefix?: string;
post_logout_redirect_uri?: string,
post_logout_redirect_uri?: string;
id_token_hint?: string;
}
interface Login {
Expand Down Expand Up @@ -39,7 +39,13 @@ declare namespace Cypress {
additionalAttributes?: { [key: string]: any };
}
interface Chainable {
logout({ root, realm, redirect_uri, post_logout_redirect_uri, id_token_hint }: Logout): Chainable;
logout({
root,
realm,
redirect_uri,
post_logout_redirect_uri,
id_token_hint,
}: Logout): Chainable;
login({
root,
realm,
Expand Down
4 changes: 1 addition & 3 deletions src/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ Cypress.Commands.add(
.then((response) => {
const html = document.createElement('html');
html.innerHTML = response.body;
const contentArea = html.getElementsByClassName(
'content-area'
)[0];
const contentArea = html.getElementsByClassName('content-area')[0];

if (
contentArea === undefined ||
Expand Down
20 changes: 10 additions & 10 deletions src/register.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import createUUID from "./createUUID";
import createUUID from './createUUID';

Cypress.Commands.add(
"register",
'register',
({
root,
realm,
client_id,
path_prefix = "auth",
path_prefix = 'auth',
redirect_uri,
kc_idp_hint,
username,
Expand All @@ -20,24 +20,24 @@ Cypress.Commands.add(
cy
.request({
url: `${root}${
path_prefix ? `/${path_prefix}` : ""
path_prefix ? `/${path_prefix}` : ''
}/realms/${realm}/protocol/openid-connect/registrations`,
qs: {
client_id,
redirect_uri,
kc_idp_hint,
scope: "openid",
scope: 'openid',
state: createUUID(),
nonce: createUUID(),
response_type: "code",
response_mode: "fragment",
response_type: 'code',
response_mode: 'fragment',
},
})
.then((response) => {
const html = document.createElement("html");
const html = document.createElement('html');
html.innerHTML = response.body;

const form = html.getElementsByTagName("form");
const form = html.getElementsByTagName('form');
const isAuthorized = !form.length;

let body = {
Expand All @@ -59,7 +59,7 @@ Cypress.Commands.add(
if (!isAuthorized)
return cy.request({
form: true,
method: "POST",
method: 'POST',
url: form[0].action,
followRedirect: false,
body,
Expand Down

0 comments on commit 9a679bf

Please sign in to comment.