29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
/// <reference types="cypress" />
|
|
import makeFakeUser from '../../factories/user';
|
|
describe('Change Email Confirm Page', () => {
|
|
beforeEach(() => {
|
|
// Log in to the application or navigate to the account page
|
|
// where the change email feature is available
|
|
const currentUser = makeFakeUser({
|
|
email: 'sam@example.com'
|
|
});
|
|
cy.stubAuthenticate({ ...currentUser });
|
|
cy.intercept('POST', /\S+\/update_email/, { statusCode: 200, body: { ok: true } });
|
|
});
|
|
|
|
it('should display the confirm page when visiting the confirm URL', () => {
|
|
// Replace with a realistic token for your app if needed
|
|
const token = 'dummy-confirm-token';
|
|
|
|
// Visit the confirm URL
|
|
cy.visit(`/confirm-email-change?token=${token}`);
|
|
|
|
// Assert that the JKChangeEmailConfirm page is rendered
|
|
// Adjust selectors/texts as per your actual component
|
|
cy.contains('Change Email Confirmation').should('be.visible');
|
|
cy.contains('Loading...').should('be.visible');
|
|
// Optionally, check for the success message after the email update
|
|
cy.wait(1000); // Wait for the email update to complete
|
|
cy.contains('Your email has been successfully updated.').should('be.visible');
|
|
});
|
|
}); |