test(e2e): more settings tests (#42046)
This commit is contained in:
committed by
GitHub
parent
94788e2719
commit
de40fe86e9
5
.github/workflows/cypress.yml
vendored
5
.github/workflows/cypress.yml
vendored
@ -18,6 +18,11 @@ jobs:
|
|||||||
image: mongo:3.6.19
|
image: mongo:3.6.19
|
||||||
ports:
|
ports:
|
||||||
- 27017:27017
|
- 27017:27017
|
||||||
|
# We need mailhog to catch any emails the api tries to send.
|
||||||
|
mailhog:
|
||||||
|
image: mailhog/mailhog
|
||||||
|
ports:
|
||||||
|
- 1025:1025
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# We use .npmrc to set the default version to 0, and prevents download during development.
|
# We use .npmrc to set the default version to 0, and prevents download during development.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* global cy */
|
/* global cy */
|
||||||
describe('Email input field', () => {
|
describe('Email input field', () => {
|
||||||
before(() => {
|
beforeEach(() => {
|
||||||
|
cy.exec('npm run seed');
|
||||||
cy.login();
|
cy.login();
|
||||||
cy.visit('/settings');
|
cy.visit('/settings');
|
||||||
});
|
});
|
||||||
@ -17,10 +18,14 @@ describe('Email input field', () => {
|
|||||||
cy.get('[id=form-update-email]').within(() => {
|
cy.get('[id=form-update-email]').within(() => {
|
||||||
cy.contains('Save').click();
|
cy.contains('Save').click();
|
||||||
});
|
});
|
||||||
|
cy.contains(
|
||||||
|
'Check your email and click the link we sent you to confirm your new email address.'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Displays an error message when there are problems with the submitted emails', () => {
|
it('Displays an error message when there are problems with the submitted emails', () => {
|
||||||
cy.get('[id=confirm-email]').clear().type('foo@bar.com');
|
cy.get('[id=new-email]').type('bar@foo.com');
|
||||||
|
cy.get('[id=confirm-email]').type('foo@bar.com');
|
||||||
|
|
||||||
cy.get('[class=help-block]').contains(
|
cy.get('[class=help-block]').contains(
|
||||||
'Both new email addresses must be the same'
|
'Both new email addresses must be the same'
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
/* global cy */
|
/* global cy expect */
|
||||||
|
|
||||||
describe('Settings', () => {
|
describe('Settings', () => {
|
||||||
it('should be possible to visit the settings page', () => {
|
it('should be possible to reset your progress', () => {
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
cy.contains("Get started (it's free)").click({ force: true });
|
cy.contains("Get started (it's free)").click();
|
||||||
cy.visit('/settings');
|
cy.visit('/settings');
|
||||||
|
cy.contains('Reset all of my progress').click();
|
||||||
|
cy.contains('Reset everything. I want to start from the beginning').click();
|
||||||
|
cy.location().should(loc => {
|
||||||
|
expect(loc.pathname).to.eq('/');
|
||||||
|
});
|
||||||
|
cy.contains('Your progress has been reset');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
25
cypress/integration/user/report-user.js
Normal file
25
cypress/integration/user/report-user.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* global cy expect */
|
||||||
|
|
||||||
|
describe('Report User', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.exec('npm run seed');
|
||||||
|
cy.login();
|
||||||
|
});
|
||||||
|
it('should be possible to report a user from their profile page', () => {
|
||||||
|
// Since going to a user page intially generates a 404, we have to ignore
|
||||||
|
// status codes on that request
|
||||||
|
cy.visit('/twaha', { failOnStatusCode: false });
|
||||||
|
// The following line is only required if you want to test it in development
|
||||||
|
// cy.contains('Preview custom 404 page').click();
|
||||||
|
cy.contains("Flag This User's Account for Abuse").click();
|
||||||
|
cy.contains("Do you want to report twaha's portfolio for abuse?");
|
||||||
|
cy.get('[id=report-user-textarea]').type('Some details');
|
||||||
|
cy.contains('Submit the report').click();
|
||||||
|
cy.location().should(loc => {
|
||||||
|
expect(loc.pathname).to.eq('/learn');
|
||||||
|
});
|
||||||
|
cy.contains('A report was sent to the team with foo@bar.com in copy');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// A report was sent to the team with foo@bar.com in copy
|
Reference in New Issue
Block a user