mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Add e2e tests for contact form
This commit is contained in:
51
tests-e2e/cypress/integration/profile/feedback-popup.test.ts
Normal file
51
tests-e2e/cypress/integration/profile/feedback-popup.test.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { account1 } from '../../fixtures/accounts.json';
|
||||
|
||||
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 },
|
||||
});
|
||||
|
||||
cy.login({ accounts: ['default'] });
|
||||
|
||||
cy.visit('/');
|
||||
|
||||
cy.getByTestId('footer')
|
||||
.contains('Contact Us')
|
||||
.click();
|
||||
cy.getByTestId('feedbackPopup').should('be.visible');
|
||||
|
||||
cy.get('[name=subject]').type(subject);
|
||||
cy.get('[name=email]').should('have.value', account1.email);
|
||||
cy.get('[name=message]').type(message);
|
||||
|
||||
cy.get('[data-e2e-select-name=category]')
|
||||
.getByTestId('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]')
|
||||
.getByTestId('select-label')
|
||||
.should('contain', 'bug');
|
||||
|
||||
cy.getByTestId('feedbackPopup')
|
||||
.get('[type=submit]')
|
||||
.click();
|
||||
|
||||
cy.getByTestId('feedbackPopup').should(
|
||||
'contain',
|
||||
'Your message was received',
|
||||
);
|
||||
cy.getByTestId('feedbackPopup').should('contain', account1.email);
|
||||
|
||||
cy.getByTestId('feedback-popup-close-button').click();
|
||||
|
||||
cy.getByTestId('feedbackPopup').should('not.be.visible');
|
||||
});
|
Reference in New Issue
Block a user