diff --git a/server-ce/test/learn-wiki.spec.ts b/server-ce/test/learn-wiki.spec.ts index 5e63266f5f..aff62c0250 100644 --- a/server-ce/test/learn-wiki.spec.ts +++ b/server-ce/test/learn-wiki.spec.ts @@ -9,6 +9,9 @@ describe('LearnWiki', function () { const WITHOUT_PROJECTS_USER = 'user-without-projects@example.com' const REGULAR_USER = 'user@example.com' + // Re-use value for "exists" and "does not exist" tests + const LABEL_LEARN_LATEX = 'Learn LaTeX with a tutorial' + ensureUserExists({ email: WITHOUT_PROJECTS_USER }) ensureUserExists({ email: REGULAR_USER }) @@ -29,7 +32,7 @@ describe('LearnWiki', function () { it('should display a tutorial link in the welcome page', () => { login(WITHOUT_PROJECTS_USER) cy.visit('/project') - cy.findByText('Learn LaTeX with a tutorial') + cy.findByText(LABEL_LEARN_LATEX) }) it('should render wiki page', () => { @@ -94,7 +97,7 @@ describe('LearnWiki', function () { it('should not display a tutorial link in the welcome page', () => { login(WITHOUT_PROJECTS_USER) cy.visit('/project') - cy.findByText('Learn LaTeX with a tutorial').should('not.exist') + cy.findByText(LABEL_LEARN_LATEX).should('not.exist') }) } }) diff --git a/server-ce/test/templates.spec.ts b/server-ce/test/templates.spec.ts index 7f0308542c..e04f07539e 100644 --- a/server-ce/test/templates.spec.ts +++ b/server-ce/test/templates.spec.ts @@ -7,6 +7,9 @@ const ADMIN_USER = 'admin@example.com' const REGULAR_USER = 'user@example.com' const TEMPLATES_USER = 'templates@example.com' +// Re-use value for "exists" and "does not exist" tests +const LABEL_BROWSE_TEMPLATES = 'Browse templates' + describe('Templates', () => { ensureUserExists({ email: TEMPLATES_USER }) ensureUserExists({ email: WITHOUT_PROJECTS_USER }) @@ -39,7 +42,7 @@ describe('Templates', () => { it('should show templates link on welcome page', () => { login(WITHOUT_PROJECTS_USER) cy.visit('/') - cy.findByText('Browse templates').click() + cy.findByText(LABEL_BROWSE_TEMPLATES).click() cy.url().should('match', /\/templates$/) }) @@ -230,7 +233,7 @@ describe('Templates', () => { login(WITHOUT_PROJECTS_USER) cy.visit('/') cy.findByText(/new project/i) // wait for lazy loading - cy.findByText('Browse templates').should('not.exist') + cy.findByText(LABEL_BROWSE_TEMPLATES).should('not.exist') }) }