Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
import { expect, test } from '@playwright/test';
const fixture = '/src/features/crm/browser-test/pipelines.html';
test('create a generic pipeline that tracks no company or contact', async ({
page,
}) => {
await page.routeWebSocket('**', (socket) => socket.close());
await page.route('https://**', (route) => route.abort());
await page.route('**/__macro_dev/**', (route) => route.abort());
await page.goto(fixture, { waitUntil: 'domcontentloaded' });
await page.getByRole('button', { name: 'New pipeline', exact: true }).click();
const dialog = page.getByRole('dialog');
await dialog.getByRole('textbox', { name: 'Pipeline name' }).fill('Launch');
await dialog.getByRole('button', { name: 'Track Companies' }).click();
await page.getByRole('menuitemradio', { name: 'Generic' }).click();
await expect(
dialog.getByRole('button', { name: 'Track Generic' })
).toBeVisible();
await dialog.getByRole('button', { name: 'Create pipeline' }).click();
await expect(dialog).not.toBeVisible();
await expect(
page.getByRole('columnheader', { name: 'Name', exact: true })
).toBeVisible();
await expect(
page.getByRole('columnheader', { name: 'Company', exact: true })
).toHaveCount(0);
await page.getByRole('button', { name: 'Pipeline actions' }).click();
await expect(
page.getByRole('menuitem', { name: 'Export CSV' })
).toBeVisible();
await expect(page.getByRole('menuitem', { name: 'Import CSV' })).toHaveCount(
0
);
});
test('create a private company pipeline and customize a column', async ({
page,
}) => {
await page.routeWebSocket('**', (socket) => socket.close());
await page.route('https://**', (route) => route.abort());
await page.route('**/__macro_dev/**', (route) => route.abort());
await page.goto(fixture, { waitUntil: 'domcontentloaded' });
await page.getByRole('button', { name: 'New pipeline', exact: true }).click();
const dialog = page.getByRole('dialog');
await expect(
dialog.getByRole('checkbox', { name: 'Share with my team' })
).not.toBeChecked();
await dialog.getByRole('textbox', { name: 'Pipeline name' }).fill('Renewals');
await dialog.getByRole('button', { name: 'Create pipeline' }).click();
await expect(dialog).not.toBeVisible();
await expect(
page.getByRole('textbox', { name: 'Pipeline name' })
).toHaveValue('Renewals');
await expect(
page.getByRole('navigation', { name: 'CRM pipelines' })
).toContainText('Private');
await page
.getByRole('columnheader', { name: 'Company', exact: true })
.press('Shift+F10');
await expect(
page.getByRole('menuitem', { name: 'Delete column' })
).toBeDisabled();
await page.keyboard.press('Escape');
await expect(
page.getByRole('columnheader', { name: 'Company', exact: true })
).toBeFocused();
await page
.getByRole('columnheader', { name: 'Stage', exact: true })
.press('F2');
await page.getByRole('textbox', { name: 'Column name' }).fill('Status');
await page.keyboard.press('Tab');
await expect(
page.getByRole('columnheader', { name: 'Status', exact: true })
).toBeVisible();
await expect(page.getByLabel('Create requests')).toHaveText('1');
await page.screenshot({ path: '/tmp/pipeline-ui.png' });
});
test('contact pipeline preserves choices after a failed create', async ({
page,
}) => {
await page.routeWebSocket('**', (socket) => socket.close());
await page.route('https://**', (route) => route.abort());
await page.route('**/__macro_dev/**', (route) => route.abort());
await page.goto(fixture, { waitUntil: 'domcontentloaded' });
await page.getByRole('button', { name: 'Fail next create' }).click();
await page.getByRole('button', { name: 'New pipeline', exact: true }).click();
const dialog = page.getByRole('dialog');
await dialog
.getByRole('textbox', { name: 'Pipeline name' })
.fill('Recruiting');
await dialog.getByRole('button', { name: 'Track Companies' }).click();
await page.getByRole('menuitemradio', { name: 'Contacts' }).click();
await dialog.getByText('Share with my team').click();
await expect(
dialog.getByRole('checkbox', { name: 'Share with my team' })
).toBeChecked();
await dialog.getByRole('button', { name: 'Create pipeline' }).click();
await expect(dialog.getByRole('alert')).toBeVisible();
await expect(
dialog.getByRole('textbox', { name: 'Pipeline name' })
).toHaveValue('Recruiting');
await expect(
dialog.getByRole('button', { name: 'Track Contacts' })
).toBeVisible();
await dialog.getByRole('button', { name: 'Create pipeline' }).click();
await expect(dialog).not.toBeVisible();
await expect(
page.getByRole('columnheader', { name: 'Contact', exact: true })
).toBeVisible();
await expect(
page.getByRole('navigation', { name: 'CRM pipelines' })
).toContainText('Team');
});
test('export a pipeline and import a CSV into it', async ({ page }) => {
await page.routeWebSocket('**', (socket) => socket.close());
await page.route('https://**', (route) => route.abort());
await page.route('**/__macro_dev/**', (route) => route.abort());
await page.goto(fixture, { waitUntil: 'domcontentloaded' });
await page.getByRole('button', { name: 'New pipeline', exact: true }).click();
const dialog = page.getByRole('dialog');
await dialog.getByRole('textbox', { name: 'Pipeline name' }).fill('Q4 Deals');
await dialog.getByRole('button', { name: 'Create pipeline' }).click();
await expect(dialog).not.toBeVisible();
await page.getByRole('button', { name: 'Pipeline actions' }).click();
const downloaded = page.waitForEvent('download');
await page.getByRole('menuitem', { name: 'Export CSV' }).click();
const download = await downloaded;
expect(download.suggestedFilename()).toMatch(
/^macro-q4-deals-\d{4}-\d{2}-\d{2}\.csv$/
);
const path = await download.path();
const { readFile } = await import('node:fs/promises');
expect((await readFile(path, 'utf8')).replace(/^\uFEFF/, '')).toBe(
'Company,Domain,Stage\nacme.com,acme.com,Lead'
);
await page.getByRole('button', { name: 'Pipeline actions' }).click();
await page.getByRole('menuitem', { name: 'Import CSV' }).click();
const importDialog = page.getByRole('dialog');
await importDialog.getByLabel('Pipeline CSV').setInputFiles({
name: 'deals.csv',
mimeType: 'text/csv',
buffer: Buffer.from(
'Company,Domain,Stage,Notes\nAcme,acme.com,Lead,\nBeta,https://beta.io,Won,hi\n'
),
});
await expect(importDialog).toContainText('2 entries ready to import.');
await expect(importDialog).toContainText('Fills Stage.');
await expect(importDialog).toContainText(
"Skips columns this pipeline can't fill: Notes."
);
await importDialog
.getByRole('button', { name: 'Import', exact: true })
.click();
await expect(importDialog.getByRole('status')).toHaveText(
'1 entry added, 1 already in this pipeline.'
);
await expect(page.getByLabel('Pipeline entries')).toHaveText('2');
});