ソースを参照

Fix casing in E2E tests (Example project, Blank project, ...) (#25812)

* Fix casing in Tests (Example project, Blank project, Trashed projects, ...)

* Check "Blank Project" case insentively

* Fix git-bridge tests

GitOrigin-RevId: 52339258016c3a923c6207a65d058cb0d6e9d3a2
Antoine Clausse 1 年間 前
コミット
52f1e46343

+ 2 - 2
server-ce/test/admin.spec.ts

@@ -294,7 +294,7 @@ describe('admin panel', function () {
 
       cy.log('navigate to thrashed projects and delete the project')
       cy.get('.project-list-sidebar-scroll').within(() => {
-        cy.findByText('Trashed Projects').click()
+        cy.findByText('Trashed projects').click()
       })
       findProjectRow(deletedProjectName).within(() =>
         cy.findByRole('button', { name: 'Delete' }).click()
@@ -319,7 +319,7 @@ describe('admin panel', function () {
       login(user1)
       cy.visit('/project')
       cy.get('.project-list-sidebar-scroll').within(() => {
-        cy.findByText('Trashed Projects').click()
+        cy.findByText('Trashed projects').click()
       })
       cy.findByText(`${deletedProjectName} (Restored)`)
     })

+ 2 - 2
server-ce/test/create-and-compile-project.spec.ts

@@ -51,7 +51,7 @@ describe('Project creation and compilation', function () {
     login('user@example.com')
 
     createProject(sourceProjectName, {
-      type: 'Example Project',
+      type: 'Example project',
       open: false,
     }).as('sourceProjectId')
     createProject(targetProjectName)
@@ -79,7 +79,7 @@ describe('Project creation and compilation', function () {
     const targetProjectName = `${sourceProjectName}-target`
     login('user@example.com')
     createProject(sourceProjectName, {
-      type: 'Example Project',
+      type: 'Example project',
       open: false,
     }).as('sourceProjectId')
     createProject(targetProjectName).as('targetProjectId')

+ 2 - 2
server-ce/test/editor.spec.ts

@@ -22,7 +22,7 @@ describe('editor', () => {
   beforeWithReRunOnTestRetry(function () {
     projectName = `project-${uuid()}`
     login('user@example.com')
-    createProject(projectName, { type: 'Example Project', open: false }).then(
+    createProject(projectName, { type: 'Example project', open: false }).then(
       id => (projectId = id)
     )
     ;({ recompile, waitForCompileRateLimitCoolOff } =
@@ -62,7 +62,7 @@ describe('editor', () => {
 
       cy.log('add word to dictionary')
       cy.get('.ol-cm-spelling-error').contains(word).rightclick()
-      cy.findByText('Add to Dictionary').click()
+      cy.findByText('Add to dictionary').click()
       cy.get('.ol-cm-spelling-error').should('not.exist')
 
       cy.log('remove word from dictionary')

+ 4 - 4
server-ce/test/git-bridge.spec.ts

@@ -46,7 +46,7 @@ describe('git-bridge', function () {
 
     function maybeClearAllTokens() {
       cy.visit('/user/settings')
-      cy.findByText('Git Integration')
+      cy.findByText('Git integration')
       cy.get('button')
         .contains(/Generate token|Add another token/)
         .then(btn => {
@@ -63,7 +63,7 @@ describe('git-bridge', function () {
     it('should render the git-bridge UI in the settings', () => {
       maybeClearAllTokens()
       cy.visit('/user/settings')
-      cy.findByText('Git Integration')
+      cy.findByText('Git integration')
       cy.get('button').contains('Generate token').click()
       cy.get('code')
         .contains(/olp_[a-zA-Z0-9]{16}/)
@@ -107,7 +107,7 @@ describe('git-bridge', function () {
           cy.get('code').contains(`git clone ${gitURL(id.toString())}`)
         })
         cy.findByText('Generate token').should('not.exist')
-        cy.findByText(/generate a new one in Account Settings/)
+        cy.findByText(/generate a new one in Account settings/i)
         cy.findByText('Go to settings')
           .should('have.attr', 'target', '_blank')
           .and('have.attr', 'href', '/user/settings')
@@ -365,7 +365,7 @@ Hello world
     it('should not render the git-bridge UI in the settings', () => {
       login('user@example.com')
       cy.visit('/user/settings')
-      cy.findByText('Git Integration').should('not.exist')
+      cy.findByText('Git integration').should('not.exist')
     })
     it('should not render the git-bridge UI in the editor', function () {
       login('user@example.com')

+ 3 - 3
server-ce/test/helpers/project.ts

@@ -5,11 +5,11 @@ import { v4 as uuid } from 'uuid'
 export function createProject(
   name: string,
   {
-    type = 'Blank Project',
+    type = 'Blank project',
     newProjectButtonMatcher = /new project/i,
     open = true,
   }: {
-    type?: 'Blank Project' | 'Example Project'
+    type?: 'Blank project' | 'Example project'
     newProjectButtonMatcher?: RegExp
     open?: boolean
   } = {}
@@ -37,7 +37,7 @@ export function createProject(
   }
   cy.findAllByRole('button').contains(newProjectButtonMatcher).click()
   // FIXME: This should only look in the left menu
-  cy.findAllByText(type).first().click()
+  cy.findAllByText(new RegExp(type, 'i')).first().click()
   cy.findByRole('dialog').within(() => {
     cy.get('input').type(name)
     cy.findByText('Create').click()

+ 1 - 1
server-ce/test/project-list.spec.ts

@@ -32,7 +32,7 @@ describe('Project List', () => {
 
     before(() => {
       login(REGULAR_USER)
-      createProject(projectName, { type: 'Example Project', open: false })
+      createProject(projectName, { type: 'Example project', open: false })
     })
     beforeEach(function () {
       login(REGULAR_USER)