|
| 1 | +describe('GX3-798 | TS: ToolsQA | Elements | Text Box', () => { |
| 2 | + // ARRANGE |
| 3 | + beforeEach('', () => { |
| 4 | + cy.visit('https://demoqa.com/text-box'); |
| 5 | + cy.url().should('contain', 'text-box'); |
| 6 | + }); |
| 7 | + |
| 8 | + //casos |
| 9 | + it('799|TC1: Validar que se realiza el envio exitoso cuando los datos son ingresados correctamente', () => { |
| 10 | + //constantes |
| 11 | + const jUserName = 'Janetzi'; |
| 12 | + const jUserEmails = '[email protected]'; |
| 13 | + const jCurrentAddress = 'Direccion principal'; |
| 14 | + const jPermanentAddress = 'Direccion secundaria'; |
| 15 | + //steps |
| 16 | + cy.get('input#userName').type(jUserName); |
| 17 | + cy.get('input#userEmail').type(jUserEmails); |
| 18 | + cy.get('textarea#currentAddress').type(jCurrentAddress); |
| 19 | + cy.get('textarea#permanentAddress').type(jPermanentAddress); |
| 20 | + cy.get('#submit').click(); |
| 21 | + |
| 22 | + //Assertion |
| 23 | + cy.get('p#name').should('contains.text', jUserName); |
| 24 | + cy.get('p#email').should('contains.text', jUserEmails); |
| 25 | + cy.get('p#currentAddress').should('contains.text', jCurrentAddress); |
| 26 | + cy.get('p#permanentAddress').should('contains.text', jPermanentAddress); |
| 27 | + }); |
| 28 | + |
| 29 | + it('799|TC2: Validar que se realiza el envio exitoso cuando solo el campo emails tiene un valor valido el resto de los campos es vacio', () => { |
| 30 | + const jEmail02 = '[email protected]'; |
| 31 | + |
| 32 | + cy.get('input#userName').should('be.empty'); |
| 33 | + cy.get('input#userEmail').type(jEmail02); |
| 34 | + cy.get('textarea#currentAddress').should('be.empty'); |
| 35 | + cy.get('textarea#permanentAddress').should('be.empty'); |
| 36 | + cy.get('#submit').click(); |
| 37 | + |
| 38 | + //Assertion |
| 39 | + cy.get('p#email').should('contains.text', jEmail02); |
| 40 | + }); |
| 41 | + |
| 42 | + it('799|TC3: Validar que el envio es fallido cuando el campo email no contiene @.', () => { |
| 43 | + //const |
| 44 | + const jEmail03 = 'janetzigmail.com'; |
| 45 | + //steps |
| 46 | + cy.get('input#userEmail').type(jEmail03); |
| 47 | + cy.get('#submit').click(); |
| 48 | + |
| 49 | + //Assertion |
| 50 | + cy.get('input.mr-sm-2.field-error').should('be.enabled'); |
| 51 | + }); |
| 52 | + |
| 53 | + it('799|TC4: Validar que el envio es fallido cuando el campo email No contiene (mínimo) 1 carácter alfanumérico antes de @', () => { |
| 54 | + const jEmail04 = 'janetzi@'; |
| 55 | + //steps |
| 56 | + cy.get('input#userEmail').type(jEmail04); |
| 57 | + cy.get('#submit').click(); |
| 58 | + |
| 59 | + //Assertion |
| 60 | + cy.get('input.mr-sm-2.field-error').should('be.enabled'); |
| 61 | + }); |
| 62 | + |
| 63 | + it('799|TC5: Validar que el envio es fallido cuando el campo email No contiene (mínimo) 1 carácter alfanumérico después de @', () => { |
| 64 | + const jEmail05 = '@gmail.com'; |
| 65 | + //steps |
| 66 | + cy.get('input#userEmail').type(jEmail05); |
| 67 | + cy.get('#submit').click(); |
| 68 | + |
| 69 | + //Assertion |
| 70 | + cy.get('input.mr-sm-2.field-error').should('be.enabled'); |
| 71 | + }); |
| 72 | + |
| 73 | + it('799|TC6: Validar que el envio es fallido cuando el campo email No contiene "." después: 1 carácter alfanumérico después de @', () => { |
| 74 | + const jEmail06 = '@gmailcom'; |
| 75 | + //steps |
| 76 | + cy.get('input#userEmail').type(jEmail06); |
| 77 | + cy.get('#submit').click(); |
| 78 | + |
| 79 | + //Assertion |
| 80 | + cy.get('input.mr-sm-2.field-error').should('be.enabled'); |
| 81 | + }); |
| 82 | + |
| 83 | + it('799|TC7: Validar que el envio es fallido cuando el campo email No contiene (mínimo) 2 caracteres alfanuméricos después de .', () => { |
| 84 | + const jEmail07 = '.com'; |
| 85 | + //steps |
| 86 | + cy.get('input#userEmail').type(jEmail07); |
| 87 | + cy.get('#submit').click(); |
| 88 | + |
| 89 | + //Assertion |
| 90 | + cy.get('input.mr-sm-2.field-error').should('be.enabled'); |
| 91 | + }); |
| 92 | +}); |
0 commit comments