|
| 1 | +describe('Signup advisor @demande-compte-conseiller', () => { |
| 2 | + const userToSignup = { |
| 3 | + '[name=first_name]': 'Signupuser', |
| 4 | + '[name=last_name]': 'Successful', |
| 5 | + '[name=organization]': 'Signup Corp', |
| 6 | + '[name=organization_position]': 'Tester', |
| 7 | + '[name=email]': 'signup4@success.test', |
| 8 | + '[name=phone_no]': '0102030405', |
| 9 | + '[name=password1]': 'derpderp', |
| 10 | + '[name=password2]': 'derpderp', |
| 11 | + }; |
| 12 | + |
| 13 | + it('signup a new advisor', function () { |
| 14 | + cy.visit('/acteurs-locaux'); |
| 15 | + cy.get('[data-test-id="button-advisor-access-request"]').click(); |
| 16 | + |
| 17 | + cy.url().should('include', '/advisor-access-request'); |
| 18 | + |
| 19 | + for (const key in userToSignup) { |
| 20 | + if (Object.prototype.hasOwnProperty.call(userToSignup, key)) { |
| 21 | + const element = userToSignup[key]; |
| 22 | + cy.get(key).type(element, { delay: 0 }); |
| 23 | + } |
| 24 | + } |
| 25 | + cy.document().then((doc) => { |
| 26 | + var iframe = doc.getElementById('id_captcha').querySelector('iframe'); |
| 27 | + var innerDoc = iframe.contentDocument || iframe.contentWindow.document; |
| 28 | + innerDoc.querySelector('.recaptcha-checkbox').click(); |
| 29 | + cy.wait(500); |
| 30 | + cy.get('[type=submit]').click(); |
| 31 | + |
| 32 | + cy.location().should((loc) => { |
| 33 | + expect(loc.pathname).to.eq('/advisor-access-request'); |
| 34 | + }); |
| 35 | + |
| 36 | + cy.get('[type=submit]').click(); |
| 37 | + cy.url().should('include', '/advisor-access-request'); |
| 38 | + |
| 39 | + cy.get('[name="comment"]').type("Tester c'est douter"); |
| 40 | + cy.get('[type=submit]').click(); |
| 41 | + |
| 42 | + cy.get('[data-test-id="pending-advisor-request-confirmation"]').should( |
| 43 | + 'be.visible' |
| 44 | + ); |
| 45 | + }); |
| 46 | + }); |
| 47 | +}); |
0 commit comments