|
| 1 | +describe('EngageSphere - Customer Management UI', () => { |
| 2 | + beforeEach(() => { |
| 3 | + cy.visit('/'); |
| 4 | + //cy.setCookie('cookieConsent', 'accepted') |
| 5 | + cy.contains('button', 'Accep').click(); |
| 6 | + }); |
| 7 | + |
| 8 | + it('Maintains selected filter after returning from customer details', () => { |
| 9 | + cy.get('[data-testid="size-filter"]').as('sizeFilter'); |
| 10 | + cy.get('@sizeFilter').select('Small'); |
| 11 | + cy.contains('button', 'View').click(); |
| 12 | + cy.contains('button', 'Back').click(); |
| 13 | + cy.get('@sizeFilter').should('have.value', 'Small'); |
| 14 | + }); |
| 15 | + |
| 16 | + it('Verify footer links', () => { |
| 17 | + cy.contains('p', 'Copyright 2025 - Talking About Testing').should( |
| 18 | + 'be.visible' |
| 19 | + ); |
| 20 | + cy.contains('a', 'Podcast') |
| 21 | + .should('be.visible') |
| 22 | + .and( |
| 23 | + 'have.attr', |
| 24 | + 'href', |
| 25 | + 'https://open.spotify.com/show/5HFlqWkk6qtgJquUixyuKo' |
| 26 | + ) |
| 27 | + .and('have.attr', 'target', '_blank') |
| 28 | + .and('have.attr', 'rel', 'noopener noreferrer'); |
| 29 | + cy.contains('a', 'Courses') |
| 30 | + .should('be.visible') |
| 31 | + .and('have.attr', 'href', 'https://talking-about-testing.vercel.app/') |
| 32 | + .and('have.attr', 'target', '_blank') |
| 33 | + .and('have.attr', 'rel', 'noopener noreferrer'); |
| 34 | + cy.contains('a', 'Blog') |
| 35 | + .should('be.visible') |
| 36 | + .and('have.attr', 'href', 'https://talkingabouttesting.com') |
| 37 | + .and('have.attr', 'target', '_blank') |
| 38 | + .and('have.attr', 'rel', 'noopener noreferrer'); |
| 39 | + cy.contains('a', 'YouTube') |
| 40 | + .should('be.visible') |
| 41 | + .and('have.attr', 'href', 'https://youtube.com/@talkingabouttesting') |
| 42 | + .and('have.attr', 'target', '_blank') |
| 43 | + .and('have.attr', 'rel', 'noopener noreferrer'); |
| 44 | + }); |
| 45 | + |
| 46 | + it('Empty Hi there', () => { |
| 47 | + cy.get('[data-testid="name"]').should('have.value', ''); |
| 48 | + cy.contains('h2', 'Hi there').should('be.visible'); |
| 49 | + }); |
| 50 | + |
| 51 | + it('Hi Joe there', () => { |
| 52 | + cy.get('[data-testid="name"]').type('Joe'); |
| 53 | + cy.contains('h2', 'Hi Joe').should('be.visible'); |
| 54 | + }); |
| 55 | + |
| 56 | + it('Exibe o cabeçalho com um título, alternador de tema e um campo de entrada de texto', () => { |
| 57 | + cy.contains('h1', 'EngageSphere').should('be.visible'); |
| 58 | + cy.get('[class^="ThemeToggle_button"]').should('be.visible'); |
| 59 | + cy.get('[data-testid="name"]').should('be.visible'); |
| 60 | + }); |
| 61 | + |
| 62 | + it('Verificar que o preenchimento do campo nome é obrigatório', () => { |
| 63 | + cy.get('[class^="Messenger_openCloseButton"]').click(); |
| 64 | + cy.get('#messenger-name').should('have.attr', 'required'); |
| 65 | + }); |
| 66 | + |
| 67 | + it('Garante que todos os campos do messenger são obrigatórios e que o primeiro está focado', () => { |
| 68 | + cy.get('[class^="Messenger_openCloseButton"]').click(); |
| 69 | + cy.get('#messenger-name').should('be.focused'); |
| 70 | + cy.get('#messenger-name').should('have.attr', 'required'); |
| 71 | + cy.get('#email').should('have.attr', 'required'); |
| 72 | + cy.get('#message').should('have.attr', 'required'); |
| 73 | + }); |
| 74 | + |
| 75 | + it('Mostra e oculta uma mensagem de sucesso ao enviar o formulário do messenger', () => { |
| 76 | + cy.clock(); |
| 77 | + cy.get('[class^="Messenger_openCloseButton"]').click(); |
| 78 | + cy.get('#messenger-name').should('be.visible'); |
| 79 | + cy.get('#messenger-name').type('John Doe'); |
| 80 | + cy.get('#email').type('john.doe@example.com'); |
| 81 | + cy.get('#message').type('Hello, I need support!'); |
| 82 | + cy.get('[class^="Messenger_sendButton"]').click(); |
| 83 | + cy.get('[class^="Messenger_success"]') |
| 84 | + .should('be.visible') |
| 85 | + .and('contain', 'Your message has been sent.'); |
| 86 | + cy.tick(3000); |
| 87 | + cy.get('[class^="Messenger_success"]').should('not.exist'); |
| 88 | + }); |
| 89 | + |
| 90 | + it('Limpa todos os campos do formulário ao fechar e reabrir o messenger', () => { |
| 91 | + cy.get('[class^="Messenger_openCloseButton"]').click(); |
| 92 | + cy.get('#messenger-name').should('be.visible'); |
| 93 | + cy.get('#messenger-name').type('John Doe'); |
| 94 | + cy.get('#email').type('john.doe@example.com'); |
| 95 | + cy.get('#message').type('Hello, I need support!'); |
| 96 | + cy.get('[class^="Messenger_openCloseButton"]').click(); |
| 97 | + cy.get('[class^="Messenger_openCloseButton"]').click(); |
| 98 | + cy.get('#messenger-name').should('have.value', ''); |
| 99 | + cy.get('#email').should('have.value', ''); |
| 100 | + cy.get('#message').should('have.value', ''); |
| 101 | + }); |
| 102 | + |
| 103 | + it('Mostra as colunas Nome da Empresa e Ação, e oculta as outras em viewport móvel', () => { |
| 104 | + cy.viewport(375, 667); |
| 105 | + cy.get('[data-testid="table"]').should('be.visible'); |
| 106 | + cy.contains('th', 'Company name').should('be.visible'); |
| 107 | + cy.contains('th', 'Action').should('be.visible'); |
| 108 | + cy.contains('th', 'ID').should('not.be.visible'); |
| 109 | + cy.contains('th', 'Industry').should('not.be.visible'); |
| 110 | + cy.contains('th', 'Number of employees').should('not.be.visible'); |
| 111 | + cy.contains('th', 'Size').should('not.be.visible'); |
| 112 | + }); |
| 113 | +}); |
0 commit comments