Skip to content

Commit b33d0da

Browse files
m4x3dbabangsund
authored andcommitted
Changes by prettier
1 parent 89ca737 commit b33d0da

File tree

2 files changed

+31
-37
lines changed

2 files changed

+31
-37
lines changed

src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ declare namespace Cypress {
3636
password,
3737
client_id,
3838
redirect_uri,
39-
otp_secret
39+
otp_secret,
4040
}: LoginOTP): Chainable;
4141
}
4242
}

src/loginOTP.ts

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import createUUID from './createUUID';
22

3-
Cypress.Commands.add('loginOTP',
3+
Cypress.Commands.add(
4+
'loginOTP',
45
({
56
root,
67
realm,
@@ -10,7 +11,7 @@ Cypress.Commands.add('loginOTP',
1011
redirect_uri,
1112
path_prefix = 'auth',
1213
otp_secret,
13-
otp_credential_id = null
14+
otp_credential_id = null,
1415
}) =>
1516
cy
1617
.request({
@@ -33,43 +34,36 @@ Cypress.Commands.add('loginOTP',
3334
const isAuthorized = !form.length;
3435

3536
if (!isAuthorized) {
36-
return cy.request({
37-
form: true,
38-
method: 'POST',
39-
url: form[0].action,
40-
followRedirect: false,
41-
body: {
42-
username,
43-
password,
44-
},
45-
})
46-
.then((otpResponse) => {
47-
const html = document.createElement('html');
48-
html.innerHTML = otpResponse.body;
37+
return cy
38+
.request({
39+
form: true,
40+
method: 'POST',
41+
url: form[0].action,
42+
followRedirect: false,
43+
body: {
44+
username,
45+
password,
46+
},
47+
})
48+
.then((otpResponse) => {
49+
const html = document.createElement('html');
50+
html.innerHTML = otpResponse.body;
4951

50-
const form = html.getElementsByTagName('form');
52+
const form = html.getElementsByTagName('form');
5153

52-
cy.task("generateOTP", otp_secret, { log: false }).then((otp) => {
53-
cy.request({
54-
form: true,
55-
method: 'POST',
56-
url: form[0].action,
57-
followRedirect: false,
58-
body: {
59-
selectedCredentialId: otp_credential_id,
60-
otp,
61-
},
54+
cy.task('generateOTP', otp_secret, { log: false }).then((otp) => {
55+
cy.request({
56+
form: true,
57+
method: 'POST',
58+
url: form[0].action,
59+
followRedirect: false,
60+
body: {
61+
selectedCredentialId: otp_credential_id,
62+
otp,
63+
},
64+
});
6265
});
63-
})
64-
})
66+
});
6567
}
6668
})
6769
);
68-
69-
70-
71-
72-
73-
74-
75-

0 commit comments

Comments
 (0)