Explorar el Código

[saas-e2e] adjust project name for new SpamSafe limits (#27875)

* [saas-e2e] adjust project name for new SpamSafe limits

* [saas-e2e] stay below 6 digits for spam safe project name

Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com>

---------

Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com>
GitOrigin-RevId: 77c039312c01b33aeb3b57661ec6ca5b88a0a36b
Jakob Ackermann hace 1 año
padre
commit
df383265c3
Se han modificado 2 ficheros con 13 adiciones y 1 borrados
  1. 11 0
      server-ce/test/helpers/project.ts
  2. 2 1
      server-ce/test/project-sharing.spec.ts

+ 11 - 0
server-ce/test/helpers/project.ts

@@ -132,6 +132,17 @@ export function shareProjectByEmailAndAcceptInviteViaDash(
   openProjectViaInviteNotification(projectName)
 }
 
+export function getSpamSafeProjectName() {
+  while (true) {
+    // Move from hex/16 to base64/64 possible characters per char in string
+    const name = Buffer.from(uuid().replaceAll('-', ''), 'hex')
+      .toString('base64')
+      .slice(0, 10)
+    const nDigits = (name.match(/\d/g) || []).length
+    if (nDigits < 6) return name
+  }
+}
+
 export function shareProjectByEmailAndAcceptInviteViaEmail(
   projectName: string,
   email: string,

+ 2 - 1
server-ce/test/project-sharing.spec.ts

@@ -4,6 +4,7 @@ import { ensureUserExists, login } from './helpers/login'
 import {
   createProject,
   enableLinkSharing,
+  getSpamSafeProjectName,
   openProjectByName,
   openProjectViaLinkSharingAsAnon,
   openProjectViaLinkSharingAsUser,
@@ -20,7 +21,7 @@ describe('Project Sharing', function () {
 
   let projectName: string
   beforeWithReRunOnTestRetry(function () {
-    projectName = `Project ${uuid()}`
+    projectName = getSpamSafeProjectName()
     setupTestProject()
   })