The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { randomUUID } from 'crypto';
import { expect, test } from './fixture';
// 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,
loginPage,
}) => {
test.setTimeout(180000);
const suffix = randomUUID().replaceAll('-', '').slice(0, 12);
const email = `test${suffix}@apple.dev`;
const workspaceName = `Test ${suffix}`;
const subdomain = `test-${suffix}`;
await test.step('Create a new account', async () => {
await page.goto('/welcome');
await loginPage.clickLoginWithEmailIfVisible();
await loginPage.typeEmail(email);
await loginPage.clickContinueButton();
await loginPage.typePassword(process.env.DEFAULT_PASSWORD);
await loginPage.clickSignUpButton();
});
await test.step('Create the workspace', async () => {
await expect(page.getByText('Create your workspace')).toBeVisible();
await loginPage.typeWorkspaceName(workspaceName);
await loginPage.typeSubdomain(subdomain);
await loginPage.clickCreateWorkspaceButton();
});
await test.step('Workspace activation stage', async () => {
await page.waitForURL('**/workspace-activation', { timeout: 90000 });
});
const syncEmailsStep = page.getByTestId('onboarding-sync-emails-step');
const createProfileStep = page.getByTestId('onboarding-create-profile-step');
const inviteTeamStep = page.getByTestId('onboarding-invite-team-step');
// The sync-email stage auto-skips when the instance has no connected-account
// provider, which is how the e2e server is configured.
await test.step('Sync-email stage (when shown)', async () => {
await expect(syncEmailsStep.or(createProfileStep)).toBeVisible({
timeout: 90000,
});
if (!(await syncEmailsStep.isVisible())) {
return;
}
await loginPage.clickSkipOnboardingStep();
await expect(createProfileStep).toBeVisible();
await test.step('Goes back to the skipped sync-email stage', async () => {
await page.getByRole('button', { name: 'Go back' }).click();
await expect(syncEmailsStep).toBeVisible();
await page.reload();
await expect(syncEmailsStep).toBeVisible({
timeout: 30000,
});
await loginPage.clickSkipOnboardingStep();
await expect(createProfileStep).toBeVisible();
});
});
await test.step('Create-profile stage', async () => {
await expect(createProfileStep).toBeVisible();
await loginPage.typeFirstName('Ada');
await loginPage.typeLastName('Lovelace');
await loginPage.clickContinueButton();
});
await test.step('Invite-team stage', async () => {
await expect(inviteTeamStep).toBeVisible();
await loginPage.clickSkipOnboardingStep();
});
await test.step('Lands in the app', async () => {
await expect(page.getByTestId('workspace-dropdown')).toBeVisible();
});
});