Skip to content

Instantly share code, notes, and snippets.

@loranmutafov
Created April 3, 2020 20:38
Show Gist options
  • Save loranmutafov/404b0904be53d068c41b45029676f759 to your computer and use it in GitHub Desktop.
Save loranmutafov/404b0904be53d068c41b45029676f759 to your computer and use it in GitHub Desktop.
Test HelloSign contract signing with Cypress, depends on https://gist.github.com/loranmutafov/0aef48884f3ec05edeb95aa1e0d06a17
Cypress.Commands.add('signHellosignContract', () => {
cy.waitForHellosignContractIframe(contractFrames => {
cy.wrap(contractFrames[0])
.contains('button', 'OK')
.click();
cy.wrap(contractFrames[0])
.contains('button', 'Get Started')
.click();
cy.wrap(contractFrames[0])
.find('[data-qa-ref="signature-input"]')
.contains('Click to sign')
.click();
// :)
cy.wrap(contractFrames[0])
.find('#drawSignatureCanvas')
.click(20, 10)
.click(40, 10)
.click(10, 30)
.click(15, 34)
.click(20, 37)
.click(25, 39)
.click(30, 40)
.click(35, 39)
.click(40, 37)
.click(45, 34)
.click(50, 30);
cy.wrap(contractFrames[0])
.contains('button', 'Insert')
.click();
cy.wrap(contractFrames[0]).contains('You have completed all required fields.');
cy.wrap(contractFrames[0])
.contains('button', 'Continue')
.click();
cy.wrap(contractFrames[0]).contains('I agree to be legally bound by this document');
cy.wrap(contractFrames[0])
.contains('button', 'I agree')
.click();
});
});
Cypress.Commands.add('waitForHellosignContractIframe', callback => {
cy.get('iframe[src^="https://app.hellosign.com/editor/embeddedSign"]')
.should('be.visible');
cy.get('iframe[src^="https://app.hellosign.com/editor/embeddedSign"]')
.iframe()
.then(callback);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment