mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-20 12:03:11 -04:00
feat: delete and rename "Quincy's email tests" already convered by Playwright (#54941)
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
// TODO: DRY out the parts before clicking "Yes please" and "No thanks"
|
||||
describe('Privacy terms', () => {
|
||||
it('should accept update privacy terms if requests emails from Quincy', () => {
|
||||
// Flag used to identify if the `/update-privacy-terms` have been called
|
||||
let privacyTermsUpdated = false;
|
||||
cy.intercept('PUT', '/update-privacy-terms', () => {
|
||||
privacyTermsUpdated = true;
|
||||
}).as('updatePrivacyTerms');
|
||||
// Seed dev user with `acceptedPrivacyTerms` unset
|
||||
cy.task('seed', ['--unset-privacy-terms']);
|
||||
// Go to the homepage and log in manually so we can assert the following:
|
||||
// 1. Redirection to /email-sign-up works properly
|
||||
// 2. The /update-privacy-terms has not been requested
|
||||
cy.visit('/');
|
||||
cy.get('[data-test-label="landing-small-cta"]').click();
|
||||
// Since we're using the dev login, we do
|
||||
cy.wrap(privacyTermsUpdated).should('eq', false);
|
||||
cy.visit('/email-sign-up');
|
||||
// Assert email sign up elements and make sure we don't get redirected somewhere else
|
||||
cy.title().should('contain', 'Email Sign Up');
|
||||
cy.get('[data-cy="email-sign-up"]').should('exist');
|
||||
// Accept
|
||||
cy.get('button:contains("Yes please")').click();
|
||||
cy.wait('@updatePrivacyTerms').then(() => {
|
||||
expect(privacyTermsUpdated).to.eq(true);
|
||||
cy.contains('Welcome back');
|
||||
cy.location('pathname').should('contain', '/learn');
|
||||
});
|
||||
});
|
||||
|
||||
it('should accept update privacy terms if the user rejects emails from Quincy', () => {
|
||||
// Flag used to identify if the `/update-privacy-terms` have been called
|
||||
let privacyTermsUpdated = false;
|
||||
cy.intercept('PUT', '/update-privacy-terms', () => {
|
||||
privacyTermsUpdated = true;
|
||||
}).as('updatePrivacyTerms');
|
||||
// Seed dev user with `acceptedPrivacyTerms` unset
|
||||
cy.task('seed', ['--unset-privacy-terms']);
|
||||
// Go to the homepage and log in manually so we can assert the following:
|
||||
// 1. Redirection to /email-sign-up works properly
|
||||
// 2. The /update-privacy-terms has not been requested
|
||||
cy.visit('/');
|
||||
cy.get('[data-test-label="landing-small-cta"]').click();
|
||||
// Since we're using the dev login, we do
|
||||
cy.wrap(privacyTermsUpdated).should('eq', false);
|
||||
cy.visit('/email-sign-up');
|
||||
// Assert email sign up elements and make sure we don't get redirected somewhere else
|
||||
cy.title().should('contain', 'Email Sign Up');
|
||||
cy.get('[data-cy="email-sign-up"]').should('exist');
|
||||
// Accept
|
||||
cy.get('button:contains("No thanks")').click();
|
||||
cy.wait('@updatePrivacyTerms').then(() => {
|
||||
expect(privacyTermsUpdated).to.eq(true);
|
||||
cy.contains('Welcome back');
|
||||
cy.location('pathname').should('contain', '/learn');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -137,12 +137,12 @@ test.describe('Email sign-up page when user is signed in', () => {
|
||||
)
|
||||
).toBeVisible();
|
||||
|
||||
const signupButton = page.getByRole('button', {
|
||||
const noThanksButton = page.getByRole('button', {
|
||||
name: translations.buttons['no-thanks']
|
||||
});
|
||||
|
||||
await expect(signupButton).toBeVisible();
|
||||
await signupButton.click();
|
||||
await expect(noThanksButton).toBeVisible();
|
||||
await noThanksButton.click();
|
||||
|
||||
// The user is signed in and automatically redirected to /learn after clicking the button.
|
||||
// We wait for the navigation to complete.
|
||||
Reference in New Issue
Block a user