Skip to content

Commit 06e92fd

Browse files
authored
Update commands.js (#207)
1 parent ad3c66c commit 06e92fd

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

cypress/support/commands.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,18 @@ Cypress.Commands.add('loginViaDescopeUI', () => {
103103
.find('input')
104104
.type(loginID)
105105
cy.get('descope-wc')
106-
.find('button').contains('Continue').click()
106+
.find('descope-button').contains('Continue').click()
107107
cy.get('descope-wc').find('.descope-input-wrapper').find('input').should('exist') // Assertion added to wait for the OTP code input to appear
108108
let otpCodeArray = Array.from(otpCode); // Convert the OTP code string to an array
109-
for (var i = 0; i < otpCodeArray.length; i++) {
110-
cy.get('descope-wc').find('.descope-input-wrapper').find('input').eq(i + 1).type(otpCodeArray[i], { force: true })
111-
}
109+
otpCodeArray.forEach((digit, index) => {
110+
cy.get(`descope-text-field[data-id="${index}"]`).then($element => {
111+
const input = $element[0].shadowRoot.querySelector('input');
112+
input.value = digit;
113+
input.dispatchEvent(new Event('change', { bubbles: true }));
114+
});
115+
});
112116
cy.get('descope-wc')
113-
.find('button').contains('Submit').click()
117+
.find('descope-button').contains('Submit').click()
114118
})
115119
})
116120
})

0 commit comments

Comments
 (0)