2019-12-28 15:35:41 +05:30
|
|
|
import { account1 } from '../../fixtures/accounts.json';
|
|
|
|
|
2019-12-28 15:55:44 +05:30
|
|
|
describe('feedback popup', () => {
|
2020-05-24 04:38:24 +05:30
|
|
|
it('should send feedback', () => {
|
|
|
|
const subject = 'Hello world';
|
|
|
|
const message = 'This is a feedback message';
|
|
|
|
|
|
|
|
cy.server();
|
|
|
|
cy.route({
|
|
|
|
url: '/api/feedback',
|
|
|
|
method: 'POST',
|
|
|
|
response: { success: true },
|
|
|
|
});
|
2019-12-28 15:55:44 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
cy.login({ accounts: ['default'] });
|
2019-12-28 15:55:44 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
cy.visit('/');
|
2019-12-28 15:55:44 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
cy.findByTestId('footer').contains('Contact Us').click();
|
|
|
|
cy.findByTestId('feedbackPopup').should('be.visible');
|
2019-12-28 15:55:44 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
cy.get('[name=subject]').type(subject);
|
|
|
|
cy.get('[name=email]').should('have.value', account1.email);
|
|
|
|
cy.get('[name=message]').type(message);
|
2019-12-28 15:55:44 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
cy.get('[data-e2e-select-name=category]')
|
|
|
|
.findByTestId('select-label')
|
|
|
|
.should('contain', 'What are you interested');
|
|
|
|
cy.get('[data-e2e-select-name=category]').click();
|
|
|
|
cy.get('[data-e2e-select-name=category]').contains('bug').click();
|
|
|
|
cy.get('[data-e2e-select-name=category]').findByTestId('select-label').should('contain', 'bug');
|
2019-12-28 15:55:44 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
cy.findByTestId('feedbackPopup').get('[type=submit]').click();
|
2019-12-28 15:55:44 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
cy.findByTestId('feedbackPopup').should('contain', 'Your message was received');
|
|
|
|
cy.findByTestId('feedbackPopup').should('contain', account1.email);
|
2019-12-28 15:55:44 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
cy.findByTestId('feedback-popup-close-button').click();
|
2019-12-28 15:55:44 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
cy.findByTestId('feedbackPopup').should('not.be.visible');
|
|
|
|
});
|
2019-12-28 15:35:41 +05:30
|
|
|
});
|