The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
ci: unbreak CI E2E Main (same-origin front + fix the specs behind the login gate) (#24115)
Charles Bochet2c9f808f7d47
diff --git a/.github/workflows/ci-e2e-main.yaml b/.github/workflows/ci-e2e-main.yamlindex 0ad1209f160..cf5d7dbe656 100644--- a/.github/workflows/ci-e2e-main.yaml+++ b/.github/workflows/ci-e2e-main.yaml@@ -98,17 +98,16 @@ jobs:PGPASSWORD=postgres psql -h localhost -p 5432 -U postgres -d postgres -c 'CREATE DATABASE "test";'npx nx run twenty-server:database:reset+ # Cookie sessions are credentialed, so the front only authenticates from+ # the API's own origin, workspace subdomains included.+ - name: Serve the frontend from the server+ run: cp -r packages/twenty-front/build packages/twenty-server/dist/front+- name: Start serverrun: |- npx nx start twenty-server &+ npx nx run twenty-server:start:ci &echo "Waiting for server to be ready..."- timeout 60 bash -c 'until curl -s http://localhost:3000/health; do sleep 2; done'-- - name: Start frontend- run: |- npm_config_yes=true npx serve -s packages/twenty-front/build -l 3001 &- echo "Waiting for frontend to be ready..."- timeout 60 bash -c 'until curl -s http://localhost:3001; do sleep 2; done'+ timeout 120 bash -c 'until curl -sf http://localhost:3000/healthz > /dev/null; do sleep 2; done'- name: Start workerrun: |@@ -116,6 +115,8 @@ jobs:echo "Worker started"- name: Run Playwright tests+ env:+ FRONTEND_BASE_URL: http://localhost:3000run: npx nx test twenty-e2e-testing- name: Upload Playwright resultsdiff --git a/packages/twenty-e2e-testing/tests/authentication/onboarding.spec.ts b/packages/twenty-e2e-testing/tests/authentication/onboarding.spec.tsindex 1c17a4b02f0..d90496a0b5f 100644--- a/packages/twenty-e2e-testing/tests/authentication/onboarding.spec.ts+++ b/packages/twenty-e2e-testing/tests/authentication/onboarding.spec.ts@@ -1,7 +1,12 @@import { randomUUID } from 'crypto';import { expect, test } from './fixture';-test.use({ storageState: { cookies: [], origins: [] } });+// Signing up on the workspace subdomain the shared fixture points at is+// refused, so create the workspace from the base domain instead.+test.use({+ storageState: { cookies: [], origins: [] },+ baseURL: process.env.FRONTEND_BASE_URL ?? 'http://localhost:3001',+});test('New workspace signup goes through every onboarding stage', async ({page,@@ -34,41 +39,44 @@ test('New workspace signup goes through every onboarding stage', async ({await page.waitForURL('**/workspace-activation', { timeout: 90000 });});- let hasSkippedSyncEmailStage = false;-- await test.step('Sync-email stage (skip when shown)', async () => {- const syncEmailsHeading = page.getByText('Import your contacts');- const installAppsHeading = page.getByText('Install your first apps');+ const syncEmailsHeading = page.getByText('Import your contacts');+ const installAppsHeading = page.getByText('Install your first apps');+ const createProfileHeading = page.getByText('Create profile');- await expect(syncEmailsHeading.or(installAppsHeading)).toBeVisible({+ // Both stages auto-skip when the instance has no connected-account provider+ // and no vetted marketplace app, which is how the e2e server is configured.+ await test.step('Sync-email stage (when shown)', async () => {+ await expect(+ syncEmailsHeading.or(installAppsHeading).or(createProfileHeading),+ ).toBeVisible({timeout: 90000,});- if (await syncEmailsHeading.isVisible()) {- await loginPage.clickSkipOnboardingStep();- hasSkippedSyncEmailStage = true;+ if (!(await syncEmailsHeading.isVisible())) {+ return;}- });- await test.step('Install-apps stage', async () => {- await expect(page.getByText('Install your first apps')).toBeVisible();-- if (hasSkippedSyncEmailStage) {- await test.step('Goes back to the skipped sync-email stage', async () => {- await page.getByRole('button', { name: 'Go back' }).click();- await expect(page.getByText('Import your contacts')).toBeVisible();+ await loginPage.clickSkipOnboardingStep();+ await expect(installAppsHeading).toBeVisible();- await page.reload();- await expect(page.getByText('Import your contacts')).toBeVisible({- timeout: 30000,- });+ await test.step('Goes back to the skipped sync-email stage', async () => {+ await page.getByRole('button', { name: 'Go back' }).click();+ await expect(syncEmailsHeading).toBeVisible();- await loginPage.clickSkipOnboardingStep();- await expect(page.getByText('Install your first apps')).toBeVisible();+ await page.reload();+ await expect(syncEmailsHeading).toBeVisible({+ timeout: 30000,});- }- await loginPage.clickSkipOnboardingStep();+ await loginPage.clickSkipOnboardingStep();+ await expect(installAppsHeading).toBeVisible();+ });+ });++ await test.step('Install-apps stage (when shown)', async () => {+ if (await installAppsHeading.isVisible()) {+ await loginPage.clickSkipOnboardingStep();+ }});await test.step('Create-profile stage', async () => {diff --git a/packages/twenty-e2e-testing/tests/create-record.spec.ts b/packages/twenty-e2e-testing/tests/create-record.spec.tsindex 26bf6c833d3..8a88c4053dd 100644--- a/packages/twenty-e2e-testing/tests/create-record.spec.ts+++ b/packages/twenty-e2e-testing/tests/create-record.spec.ts@@ -114,7 +114,7 @@ test('Create and update record', async ({ page }) => {recordFieldList.getByText('Work Preference').first().click({force: true});// Open full record page to get person ID- await page.getByRole('button', { name: /^Open/ }).click();+ await page.getByRole('button', { name: 'Expand record' }).click();await page.waitForURL(/\/object\/person\//);const newPersonId = page.url().match(/\/object\/person\/([a-f0-9-]+)/)?.[1];diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsxindex 78a947497ab..194593e120c 100644--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/select/components/SettingsDataModelFieldSelectForm.tsx@@ -443,7 +443,6 @@ export const SettingsDataModelFieldSelectForm = ({key={option.id}draggableId={option.id}index={index}- isDragDisabled={options.length === 1}itemComponent={<SettingsDataModelFieldSelectFormOptionRowkey={option.id}diff --git a/packages/twenty-server/.env.e2e-testing-server b/packages/twenty-server/.env.e2e-testing-serverindex ef27252276c..fd568f11864 100644--- a/packages/twenty-server/.env.e2e-testing-server+++ b/packages/twenty-server/.env.e2e-testing-server@@ -4,5 +4,8 @@ REDIS_URL=redis://localhost:6379APP_SECRET=replace_me_with_a_random_stringSIGN_IN_PREFILLED=trueIS_MULTIWORKSPACE_ENABLED=true+# The onboarding e2e creates a workspace, which the default rejects.+IS_WORKSPACE_CREATION_LIMITED_TO_SERVER_ADMINS=false-FRONTEND_URL=http://localhost:3001+# This server serves the front build, so both share one origin.+FRONTEND_URL=http://localhost:3000