From 585d72f1a6cf190efb744099921b1af3c36076ef Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 11 Jun 2024 14:02:25 +0200 Subject: [PATCH] Merge pull request #18745 from overleaf/jpa-active-uses-correct-email [server-pro] add test for rendering of user activate page GitOrigin-RevId: 3f0b8f7fa39698b739c9c5259da29fdd88b9caf6 --- server-ce/test/accounts.spec.ts | 22 +++++++++++++++++++++- server-ce/test/helpers/login.ts | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/server-ce/test/accounts.spec.ts b/server-ce/test/accounts.spec.ts index adc12170ed..6e96af3a5f 100644 --- a/server-ce/test/accounts.spec.ts +++ b/server-ce/test/accounts.spec.ts @@ -1,4 +1,4 @@ -import { ensureUserExists, login } from './helpers/login' +import { createMongoUser, ensureUserExists, login } from './helpers/login' import { startWith } from './helpers/config' describe('Accounts', function () { @@ -11,4 +11,24 @@ describe('Accounts', function () { cy.findByText('Account').click() cy.findByText('Log Out').click() }) + + it('should render the email on the user activate screen', () => { + const email = 'not-activated-user@example.com' + cy.then(async () => { + const { url } = await createMongoUser({ email }) + return url + }).as('url') + cy.get('@url').then(url => { + cy.visit(`${url}`) + cy.url().should('contain', '/user/activate') + cy.findByText('Please set a password') + cy.get('input[autocomplete="username"]').should( + 'have.attr', + 'value', + email + ) + cy.get('input[name="password"]') + cy.findByRole('button', { name: 'Activate' }) + }) + }) }) diff --git a/server-ce/test/helpers/login.ts b/server-ce/test/helpers/login.ts index 0420d3173a..8396a92425 100644 --- a/server-ce/test/helpers/login.ts +++ b/server-ce/test/helpers/login.ts @@ -8,7 +8,7 @@ export function resetCreatedUsersCache() { createdUsers.clear() } -async function createMongoUser({ +export async function createMongoUser({ email, isAdmin = false, }: {