Built merchant management, activity history, and the pipeline
This commit is contained in:
@@ -0,0 +1,239 @@
|
||||
import { test, expect, type Page } from '@playwright/test';
|
||||
import { createDatabase } from '../packages/database/dist/index.js';
|
||||
|
||||
if (!process.env.DATABASE_URL?.endsWith('/merchantflow_test'))
|
||||
throw new Error('Landing tests require the isolated test database');
|
||||
const db = createDatabase(process.env.DATABASE_URL);
|
||||
const submissionKeys = new Set<string>();
|
||||
test.beforeEach(({ page }) => {
|
||||
page.on('request', (request) => {
|
||||
if (request.url().endsWith('/api/public/leads')) {
|
||||
const key = request.headers()['idempotency-key'];
|
||||
if (key) submissionKeys.add(key);
|
||||
}
|
||||
});
|
||||
});
|
||||
test.afterEach(async () => {
|
||||
await db.merchant.deleteMany({ where: { publicSubmissionKey: { in: [...submissionKeys] } } });
|
||||
submissionKeys.clear();
|
||||
});
|
||||
test.afterAll(() => db.$disconnect());
|
||||
|
||||
const fields = [
|
||||
'name',
|
||||
'contactName',
|
||||
'contactEmail',
|
||||
'website',
|
||||
'country',
|
||||
'industry',
|
||||
'estimatedMonthlyVolumeUsd',
|
||||
] as const;
|
||||
async function fill(page: Page) {
|
||||
const email = `browser-${crypto.randomUUID()}@example.test`;
|
||||
await page.locator('#lead-name').fill('MerchantFlow browser fixture');
|
||||
await page.locator('#lead-contactName').fill('Test Contact');
|
||||
await page.locator('#lead-contactEmail').fill(email);
|
||||
await page.locator('#lead-website').fill('example.test');
|
||||
await page.locator('#lead-country').selectOption('GB');
|
||||
await page.locator('#lead-industry').selectOption('OTHER');
|
||||
await page.locator('#lead-estimatedMonthlyVolumeUsd').fill('12500,50');
|
||||
return email;
|
||||
}
|
||||
async function noOverflow(page: Page) {
|
||||
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
for (const language of ['en', 'ru'])
|
||||
for (const width of [375, 1440]) {
|
||||
test.describe(`landing ${language} ${width}px`, () => {
|
||||
test.use({ viewport: { width, height: 1000 } });
|
||||
test('accessible consultation, bilingual errors, retained values and real persistence', async ({
|
||||
page,
|
||||
}, info) => {
|
||||
const runtimeErrors: string[] = [];
|
||||
page.on('pageerror', (error) => runtimeErrors.push(error.message));
|
||||
await page.addInitScript(
|
||||
(lang) => localStorage.setItem('merchantflow.language', lang),
|
||||
language,
|
||||
);
|
||||
await page.goto('/');
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', language);
|
||||
await expect(
|
||||
page.getByRole('link', { name: /Staff login|Вход для команды/ }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByRole('heading', { level: 1 })).toBeVisible();
|
||||
await noOverflow(page);
|
||||
await page.screenshot({ path: info.outputPath('landing.png'), fullPage: true });
|
||||
await page.getByRole('link', { name: /Let’s talk payments|Обсудим платежи/ }).click();
|
||||
await expect(page.locator('#lead-name')).toBeFocused();
|
||||
const submit = page.locator('button[type="submit"]');
|
||||
await submit.click();
|
||||
for (const name of fields)
|
||||
await expect(page.locator(`#lead-${name}`)).toHaveAttribute('aria-invalid', 'true');
|
||||
await expect(page.locator('#lead-name')).toBeFocused();
|
||||
await expect(page.locator('#lead-name-error')).toHaveText(
|
||||
language === 'en' ? 'Please complete this field.' : 'Заполните это поле.',
|
||||
);
|
||||
await noOverflow(page);
|
||||
await page.screenshot({ path: info.outputPath('validation.png'), fullPage: true });
|
||||
const email = await fill(page);
|
||||
await page
|
||||
.getByRole('button', { name: language === 'en' ? 'Русский' : 'English', exact: true })
|
||||
.click();
|
||||
await expect(page.locator('#lead-name')).toHaveValue('MerchantFlow browser fixture');
|
||||
await expect(page.locator('#lead-estimatedMonthlyVolumeUsd')).toHaveValue('12500,50');
|
||||
await expect(page.locator('#lead-country')).toHaveValue('GB');
|
||||
await page
|
||||
.getByRole('button', { name: language === 'en' ? 'English' : 'Русский', exact: true })
|
||||
.click();
|
||||
|
||||
const trap = page.locator('input[name="companyFax"]');
|
||||
await expect(trap).toHaveAttribute('tabindex', '-1');
|
||||
await expect(trap.locator('..')).toHaveAttribute('aria-hidden', 'true');
|
||||
await page.locator('#lead-estimatedMonthlyVolumeUsd').focus();
|
||||
await page.keyboard.press('Tab');
|
||||
await expect(submit).toBeFocused();
|
||||
expect(await page.locator('form').ariaSnapshot()).not.toContain('companyFax');
|
||||
|
||||
await page.route('**/api/public/leads', (route) => route.abort('failed'));
|
||||
await submit.click();
|
||||
await expect(page.locator('.lead-feedback')).toContainText(
|
||||
language === 'en' ? 'couldn’t confirm' : 'Не удалось подтвердить',
|
||||
);
|
||||
await expect(page.locator('#lead-contactEmail')).toHaveValue(email);
|
||||
await page.unroute('**/api/public/leads');
|
||||
await page.route('**/api/public/leads', (route) =>
|
||||
route.fulfill({
|
||||
status: 400,
|
||||
json: {
|
||||
code: 'VALIDATION_ERROR',
|
||||
issues: [{ path: 'contactEmail', code: 'validation.email' }],
|
||||
},
|
||||
}),
|
||||
);
|
||||
await submit.click();
|
||||
await expect(page.locator('#lead-contactEmail-error')).toHaveText(
|
||||
language === 'en' ? 'Enter a valid email address.' : 'Введите корректный адрес почты.',
|
||||
);
|
||||
await expect(page.locator('#lead-contactEmail')).toBeFocused();
|
||||
await page.unroute('**/api/public/leads');
|
||||
await page.route('**/api/public/leads', (route) =>
|
||||
route.fulfill({
|
||||
status: 429,
|
||||
headers: { 'Retry-After': '1' },
|
||||
json: { code: 'TOO_MANY_REQUESTS' },
|
||||
}),
|
||||
);
|
||||
await submit.click();
|
||||
await expect(submit).toBeDisabled();
|
||||
await expect(page.locator('.lead-feedback')).toContainText(
|
||||
language === 'en' ? 'wait' : 'через',
|
||||
);
|
||||
await expect(submit).toBeEnabled();
|
||||
await expect(page.locator('#lead-estimatedMonthlyVolumeUsd')).toHaveValue('12500,50');
|
||||
await page.unroute('**/api/public/leads');
|
||||
await page.route('**/api/public/leads', (route) =>
|
||||
route.fulfill({ status: 503, json: { code: 'DATABASE_UNAVAILABLE' } }),
|
||||
);
|
||||
await submit.click();
|
||||
await expect(page.locator('.lead-feedback')).toContainText(
|
||||
language === 'en' ? 'couldn’t complete' : 'Не удалось отправить',
|
||||
);
|
||||
await page.unroute('**/api/public/leads');
|
||||
|
||||
let release = () => {};
|
||||
const held = new Promise<void>((resolve) => {
|
||||
release = resolve;
|
||||
});
|
||||
await page.route('**/api/public/leads', async (route) => {
|
||||
await held;
|
||||
await route.continue();
|
||||
});
|
||||
await submit.click();
|
||||
await expect(submit).toBeDisabled();
|
||||
await expect(page.locator('form')).toHaveAttribute('aria-busy', 'true');
|
||||
release();
|
||||
await expect(page.locator('.lead-success')).toBeVisible();
|
||||
await expect(page.locator('.lead-success')).toBeFocused();
|
||||
await noOverflow(page);
|
||||
await page.screenshot({ path: info.outputPath('success.png'), fullPage: true });
|
||||
expect(submissionKeys.size).toBe(1);
|
||||
const merchants = await db.merchant.findMany({
|
||||
where: { contactEmail: email },
|
||||
include: { activities: true, events: true, checklist: true },
|
||||
});
|
||||
expect(merchants).toHaveLength(1);
|
||||
expect(merchants[0]?.source).toBe('LANDING_PAGE');
|
||||
expect(merchants[0]?.ownerId).toBeNull();
|
||||
expect(merchants[0]?.activities).toHaveLength(1);
|
||||
expect(merchants[0]?.events).toHaveLength(1);
|
||||
expect(merchants[0]?.checklist).toHaveLength(4);
|
||||
expect(runtimeErrors).toEqual([]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
test('lost response retry reuses its key and system history renders in the CRM', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
const email = await fill(page);
|
||||
await page.route('**/api/public/leads', async (route) => {
|
||||
const response = await route.fetch();
|
||||
expect(response.status()).toBe(202);
|
||||
await route.abort('failed');
|
||||
});
|
||||
await page.locator('button[type="submit"]').click();
|
||||
await expect(page.locator('.lead-feedback')).toBeVisible();
|
||||
expect(await db.merchant.count({ where: { contactEmail: email } })).toBe(1);
|
||||
await page.unroute('**/api/public/leads');
|
||||
await page.locator('button[type="submit"]').click();
|
||||
await expect(page.locator('.lead-success')).toBeVisible();
|
||||
expect(submissionKeys.size).toBe(1);
|
||||
const records = await db.merchant.findMany({
|
||||
where: { contactEmail: email },
|
||||
include: { activities: true },
|
||||
});
|
||||
expect(records).toHaveLength(1);
|
||||
expect(records[0]?.activities).toHaveLength(1);
|
||||
await page.getByRole('link', { name: 'Staff login' }).click();
|
||||
await page.getByLabel('Email address').fill('[email protected]');
|
||||
await page.getByLabel('Password', { exact: true }).fill('MerchantFlow123!');
|
||||
await page.getByRole('button', { name: 'Sign in to workspace', exact: true }).click();
|
||||
await expect(page).toHaveURL(/\/app$/);
|
||||
await page.goto(`/app/merchants/${records[0]?.id}`);
|
||||
await expect(page.locator('h1')).toHaveText('MerchantFlow browser fixture');
|
||||
await expect(page.getByText('Landing page', { exact: true })).toBeVisible();
|
||||
await page.getByRole('tab', { name: 'Activity', exact: true }).click();
|
||||
await expect(page.getByText('Lead received from landing page', { exact: true })).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Русский', exact: true }).click();
|
||||
await expect(page.getByText('Заявка получена с сайта', { exact: true })).toBeVisible();
|
||||
await page.getByRole('tab', { name: 'Обзор', exact: true }).click();
|
||||
await expect(page.getByRole('definition').filter({ hasText: /^Сайт$/ })).toBeVisible();
|
||||
});
|
||||
|
||||
test('changing the normalized payload creates a new key; reduced motion and locale persist', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto('/');
|
||||
await fill(page);
|
||||
await page.route('**/api/public/leads', (route) => route.abort('failed'));
|
||||
await page.locator('button[type="submit"]').click();
|
||||
await expect(page.locator('.lead-feedback')).toBeVisible();
|
||||
await page.locator('#lead-name').fill('An edited request');
|
||||
await page.locator('button[type="submit"]').click();
|
||||
await expect(page.locator('.lead-feedback')).toBeVisible();
|
||||
await expect.poll(() => submissionKeys.size).toBe(2);
|
||||
await page.emulateMedia({ reducedMotion: 'reduce' });
|
||||
expect(
|
||||
await page
|
||||
.locator('.lead-submit')
|
||||
.evaluate((el) => parseFloat(getComputedStyle(el).transitionDuration)),
|
||||
).toBeLessThan(0.01);
|
||||
await page.getByRole('button', { name: 'Русский', exact: true }).click();
|
||||
await page.reload();
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'ru');
|
||||
await expect(page.locator('#lead-name')).toHaveValue('');
|
||||
});
|
||||
@@ -0,0 +1,239 @@
|
||||
import { test, expect, type Page } from '@playwright/test';
|
||||
import { createDatabase } from '../packages/database/dist/index.js';
|
||||
|
||||
if (!process.env.DATABASE_URL?.endsWith('/merchantflow_test'))
|
||||
throw new Error('Daily sales browser tests require the isolated database');
|
||||
const db = createDatabase(process.env.DATABASE_URL);
|
||||
const names = new Set<string>();
|
||||
test.afterEach(async () => {
|
||||
await db.merchant.deleteMany({ where: { name: { in: [...names] } } });
|
||||
names.clear();
|
||||
});
|
||||
test.afterAll(() => db.$disconnect());
|
||||
async function login(page: Page, account = 'head') {
|
||||
await page.goto('/login');
|
||||
await page.getByLabel(/Email address|Электронная почта/).fill(`${account}@merchantflow.test`);
|
||||
await page.getByLabel(/^Password$|^Пароль$/).fill('MerchantFlow123!');
|
||||
await page
|
||||
.getByRole('button', { name: /^Sign in to workspace$|^Войти в рабочее пространство$/ })
|
||||
.click();
|
||||
await expect(page).toHaveURL(/\/app$/);
|
||||
}
|
||||
async function save(page: Page) {
|
||||
await page
|
||||
.getByRole('dialog')
|
||||
.getByRole('button', { name: /^(Save changes|Сохранить изменения)$/ })
|
||||
.click();
|
||||
await expect(page.getByRole('dialog')).not.toBeVisible();
|
||||
}
|
||||
async function create(page: Page, name: string) {
|
||||
names.add(name);
|
||||
await page.goto('/app/merchants');
|
||||
await page.getByRole('button', { name: /^(Add merchant|Добавить мерчанта)$/ }).click();
|
||||
const dialog = page.getByRole('dialog');
|
||||
await dialog.getByLabel(/^(Company name|Название компании)$/).fill(name);
|
||||
await dialog.getByLabel(/^(Primary contact|Основной контакт)$/).fill(`Contact ${name}`);
|
||||
await dialog.getByLabel(/^(Contact email|Email контакта)$/).fill('[email protected]');
|
||||
await save(page);
|
||||
await expect(page.locator('h1')).toHaveText(name);
|
||||
return new URL(page.url()).pathname.split('/').at(-1)!;
|
||||
}
|
||||
async function noOverflow(page: Page) {
|
||||
expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth)).toBe(true);
|
||||
}
|
||||
|
||||
for (const language of ['en', 'ru'])
|
||||
for (const width of [390, 1440]) {
|
||||
test.describe(`daily sales ${language} ${width}`, () => {
|
||||
test.use({ viewport: { width, height: 1000 } });
|
||||
test('creation, filters, history, pipeline actions and rejection use persistent API data', async ({
|
||||
page,
|
||||
}, info) => {
|
||||
const errors: string[] = [];
|
||||
page.on('pageerror', (error) => errors.push(error.message));
|
||||
await page.addInitScript(
|
||||
(locale) => localStorage.setItem('merchantflow.language', locale),
|
||||
language,
|
||||
);
|
||||
await login(page);
|
||||
const name = `Daily workspace ${language} ${width}`;
|
||||
const id = await create(page, name);
|
||||
await expect(
|
||||
page.getByText(/Assign a manager before progressing|Назначьте менеджера для перехода/),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/Log a call or email before|Запишите звонок или письмо/),
|
||||
).toBeVisible();
|
||||
await page.getByRole('button', { name: /^(Assign manager|Назначить менеджера)$/ }).click();
|
||||
await page
|
||||
.getByRole('dialog')
|
||||
.getByLabel(/^(Account manager|Аккаунт-менеджер)$/)
|
||||
.selectOption('user-manager1');
|
||||
await save(page);
|
||||
await page.getByRole('tab', { name: /^(Activity|Активность)$/ }).click();
|
||||
await page
|
||||
.getByRole('button', { name: /^(Log interaction|Добавить взаимодействие)$/ })
|
||||
.click();
|
||||
await page
|
||||
.getByRole('dialog')
|
||||
.getByLabel(/^(Interaction type|Тип взаимодействия)$/)
|
||||
.selectOption('CALL');
|
||||
await page
|
||||
.getByRole('dialog')
|
||||
.getByLabel(/^(Details|Подробности)$/)
|
||||
.fill('A real discovery call recorded through the API.');
|
||||
await save(page);
|
||||
await expect(
|
||||
page.getByText('A real discovery call recorded through the API.', { exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(
|
||||
/Manager changed: Unassigned → Alex Morgan|Менеджер изменён: Не назначен → Alex Morgan/,
|
||||
),
|
||||
).toBeVisible();
|
||||
await page.reload();
|
||||
await expect(page.getByRole('tab', { name: /^(Activity|Активность)$/ })).toHaveAttribute(
|
||||
'aria-selected',
|
||||
'true',
|
||||
);
|
||||
const activityTab = page.getByRole('tab', { name: /^(Activity|Активность)$/ });
|
||||
await activityTab.focus();
|
||||
await activityTab.press('End');
|
||||
await expect(page.getByRole('tab', { name: /^(Tasks|Задачи)$/ })).toHaveAttribute(
|
||||
'aria-selected',
|
||||
'true',
|
||||
);
|
||||
await page.getByRole('tab', { name: /^(Tasks|Задачи)$/ }).press('Home');
|
||||
await expect(page.getByRole('tab', { name: /^(Overview|Обзор)$/ })).toHaveAttribute(
|
||||
'aria-selected',
|
||||
'true',
|
||||
);
|
||||
await page.getByRole('tab', { name: /^(Overview|Обзор)$/ }).press('ArrowRight');
|
||||
await expect(activityTab).toBeFocused();
|
||||
await page.getByRole('button', { name: /^(Edit merchant|Изменить мерчанта)$/ }).click();
|
||||
const dialog = page.getByRole('dialog');
|
||||
await dialog.getByLabel(/^(Website|Сайт)$/).fill('https://daily.example.test');
|
||||
await dialog.getByLabel(/^(Country code|Код страны)$/).fill('GB');
|
||||
await dialog.getByLabel(/^(Industry|Отрасль)$/).selectOption('OTHER');
|
||||
await dialog
|
||||
.getByLabel(/^(Estimated monthly processing \(USD\)|Месячный объём обработки \(USD\))$/)
|
||||
.fill('0');
|
||||
await save(page);
|
||||
await page.goto('/app/merchants');
|
||||
await page
|
||||
.getByRole('textbox', { name: /Search merchants|Название мерчанта/ })
|
||||
.fill(`Contact ${name}`);
|
||||
await page
|
||||
.getByRole('combobox', { name: /^(All countries|Все страны)$/ })
|
||||
.selectOption('GB');
|
||||
await page
|
||||
.getByRole('combobox', { name: /^(All industries|Все отрасли)$/ })
|
||||
.selectOption('OTHER');
|
||||
await page
|
||||
.getByRole('combobox', { name: /^(All managers|Все менеджеры)$/ })
|
||||
.selectOption('user-manager1');
|
||||
await expect(page).toHaveURL(/country=GB.*industry=OTHER.*ownerId=user-manager1/);
|
||||
await expect(page.getByRole('link', { name: new RegExp(name) }).first()).toBeVisible();
|
||||
await noOverflow(page);
|
||||
await page.screenshot({ path: info.outputPath('daily-directory.png'), fullPage: true });
|
||||
const directory = page.url();
|
||||
await page
|
||||
.getByRole('link', { name: new RegExp(name) })
|
||||
.first()
|
||||
.click();
|
||||
await page.getByRole('tab', { name: /^(Activity|Активность)$/ }).click();
|
||||
await page.getByRole('link', { name: /Back to merchants|К списку мерчантов/ }).click();
|
||||
await expect(page).toHaveURL(directory);
|
||||
await page.reload();
|
||||
await expect(
|
||||
page.getByRole('textbox', { name: /Search merchants|Название мерчанта/ }),
|
||||
).toHaveValue(`Contact ${name}`);
|
||||
await page.goto(`${directory}&page=9999`);
|
||||
await expect(page).not.toHaveURL(/page=/);
|
||||
await page.goto('/app/pipeline?stage=NEW_LEAD');
|
||||
const card = page
|
||||
.locator('article')
|
||||
.filter({ has: page.getByRole('link', { name: new RegExp(name) }) });
|
||||
await card.getByRole('button', { name: /Move to Contacted|Перевести: Контакт/ }).click();
|
||||
await expect
|
||||
.poll(async () => (await (await page.request.get(`/api/merchants/${id}`)).json()).status)
|
||||
.toBe('CONTACTED');
|
||||
if (width === 390) await page.getByRole('combobox').selectOption('CONTACTED');
|
||||
const contactedCard = page
|
||||
.getByRole('region', {
|
||||
name: language === 'en' ? 'Contacted' : 'Контакт установлен',
|
||||
exact: true,
|
||||
})
|
||||
.locator('article')
|
||||
.filter({ has: page.getByRole('link', { name: new RegExp(name) }) });
|
||||
await expect(contactedCard).toBeVisible();
|
||||
await contactedCard.getByRole('link', { name: new RegExp(name) }).click();
|
||||
await expect(page).toHaveURL(new RegExp(`/app/merchants/${id}$`));
|
||||
await expect(page.locator('h1')).toHaveText(name);
|
||||
await page
|
||||
.getByRole('button', { name: /Move to Qualified|Перевести: Квалифицирован/ })
|
||||
.click();
|
||||
await expect
|
||||
.poll(async () => (await (await page.request.get(`/api/merchants/${id}`)).json()).status)
|
||||
.toBe('QUALIFIED');
|
||||
await page.getByRole('button', { name: /^(Reject merchant|Отклонить мерчанта)$/ }).click();
|
||||
await page
|
||||
.getByRole('dialog')
|
||||
.getByRole('button', { name: /Save changes|Сохранить изменения/ })
|
||||
.click();
|
||||
await expect(
|
||||
page.getByRole('dialog').getByLabel(/Rejection reason|Причина отклонения/),
|
||||
).toHaveAttribute('aria-invalid', 'true');
|
||||
await page
|
||||
.getByRole('dialog')
|
||||
.getByLabel(/Rejection reason|Причина отклонения/)
|
||||
.fill('Commercial terms were declined.');
|
||||
await save(page);
|
||||
await expect(page.getByText(/This is a final stage|Это финальный этап/)).toBeVisible();
|
||||
await page.getByRole('tab', { name: /^(Activity|Активность)$/ }).click();
|
||||
await expect(
|
||||
page.getByText('Commercial terms were declined.', { exact: true }),
|
||||
).toBeVisible();
|
||||
await page.screenshot({ path: info.outputPath('daily-history.png'), fullPage: true });
|
||||
await page.goto('/app/pipeline?stage=REJECTED');
|
||||
await expect(card).toBeVisible();
|
||||
if (width === 390)
|
||||
expect(await page.locator('section[aria-label]:visible').count()).toBe(1);
|
||||
await noOverflow(page);
|
||||
await page.screenshot({ path: info.outputPath('daily-pipeline.png'), fullPage: true });
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
test('manager creation assigns self and stale edits keep unsaved form values', async ({ page }) => {
|
||||
await login(page, 'alex');
|
||||
const id = await create(page, 'Daily workspace manager');
|
||||
const merchant = await (await page.request.get(`/api/merchants/${id}`)).json();
|
||||
expect(merchant.owner.id).toBe('user-manager1');
|
||||
await expect(page.getByRole('button', { name: 'Assign manager', exact: true })).toHaveCount(0);
|
||||
await page.getByRole('button', { name: 'Edit merchant', exact: true }).click();
|
||||
await page.getByRole('dialog').getByLabel('Contact title', { exact: true }).fill('Unsaved title');
|
||||
const concurrent = await page.request.post(`/api/merchants/${id}/activities`, {
|
||||
headers: { origin: 'http://127.0.0.1:5174' },
|
||||
data: { version: merchant.version, kind: 'NOTE', text: 'Concurrent update' },
|
||||
});
|
||||
expect(concurrent.ok()).toBe(true);
|
||||
await page.getByRole('dialog').getByRole('button', { name: 'Save changes', exact: true }).click();
|
||||
await expect(page.getByRole('dialog').getByRole('alert')).toBeVisible();
|
||||
await expect(page.getByRole('dialog').getByLabel('Contact title', { exact: true })).toHaveValue(
|
||||
'Unsaved title',
|
||||
);
|
||||
await save(page);
|
||||
await expect(page.getByText('Unsaved title', { exact: true })).toBeVisible();
|
||||
await page.goto('/app/merchants?ownerId=user-manager2');
|
||||
await expect(page).not.toHaveURL(/ownerId/);
|
||||
await expect(page.getByRole('combobox', { name: 'All managers' })).toHaveCount(0);
|
||||
await page.getByRole('button', { name: 'Sign out', exact: true }).click();
|
||||
await login(page, 'sam');
|
||||
expect((await page.request.get(`/api/merchants/${id}`)).status()).toBe(404);
|
||||
await page.getByRole('button', { name: 'Sign out', exact: true }).click();
|
||||
await login(page, 'compliance');
|
||||
await page.goto('/app/merchants');
|
||||
await expect(page.getByRole('button', { name: 'Add merchant', exact: true })).toHaveCount(0);
|
||||
});
|
||||
+14
-6
@@ -64,6 +64,7 @@ for (const language of ['en', 'ru'])
|
||||
.first()
|
||||
.click();
|
||||
await expect(page.locator('h1')).toHaveText('Luma Labs');
|
||||
await page.getByRole('tab', { name: /^(Onboarding|Онбординг)$/ }).click();
|
||||
await expect(
|
||||
page.getByText(/Please clarify the beneficial ownership/).first(),
|
||||
).toBeVisible();
|
||||
@@ -82,7 +83,9 @@ for (const language of ['en', 'ru'])
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.getByRole('dialog')).not.toBeVisible();
|
||||
await page.goto('/app/merchants');
|
||||
await page.getByRole('combobox').selectOption('LIVE');
|
||||
await page
|
||||
.getByRole('combobox', { name: /Filter by stage|Фильтр по этапу/ })
|
||||
.selectOption('LIVE');
|
||||
await expect(page.getByRole('link', { name: /Sunday Market/ }).first()).toBeVisible();
|
||||
await page.getByRole('textbox').fill('no-such-merchant');
|
||||
await expect(page.getByText(/No merchants found|Мерчанты не найдены/)).toBeVisible();
|
||||
@@ -92,9 +95,8 @@ for (const language of ['en', 'ru'])
|
||||
await expect(page.locator('h1')).toHaveText(language === 'en' ? 'Pipeline' : 'Воронка');
|
||||
if (width === 390) await page.getByRole('combobox').selectOption('KYB');
|
||||
await expect(page.getByRole('link', { name: /Luma Labs/ })).toBeVisible();
|
||||
await expect(
|
||||
page.getByRole('heading', { name: /Closed · Rejected|Закрыто · Отклонён/ }),
|
||||
).toBeVisible();
|
||||
if (width === 390) await page.getByRole('combobox').selectOption('REJECTED');
|
||||
await expect(page.getByRole('heading', { name: /^(Rejected|Отклонён)$/ })).toBeVisible();
|
||||
await noOverflow(page);
|
||||
await page.screenshot({ path: info.outputPath('pipeline.png'), fullPage: true });
|
||||
await page.goto('/app/tasks');
|
||||
@@ -178,7 +180,7 @@ test('loading, retryable errors, empty states, session expiry and reduced motion
|
||||
).toBeVisible();
|
||||
await page.unroute('**/api/pipeline');
|
||||
await page.getByRole('button', { name: 'Try again' }).click();
|
||||
await expect(page.getByRole('heading', { name: 'Closed · Rejected' })).toBeVisible();
|
||||
await expect(page.getByRole('heading', { name: 'Rejected', exact: true })).toBeVisible();
|
||||
await page.route('**/api/tasks?**', (route) => route.fulfill({ json: [] }));
|
||||
await page.goto('/app/tasks');
|
||||
await expect(page.getByText('You’re all caught up here')).toBeVisible();
|
||||
@@ -237,6 +239,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
|
||||
.fill('246000.75');
|
||||
await save();
|
||||
await expect(page.getByText('Director of Partnerships', { exact: true })).toBeVisible();
|
||||
await page.getByRole('tab', { name: 'Activity', exact: true }).click();
|
||||
await page.getByRole('button', { name: 'Log interaction', exact: true }).click();
|
||||
await page.getByRole('dialog').getByLabel('Interaction type').selectOption('CALL');
|
||||
await page
|
||||
@@ -247,6 +250,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
|
||||
await expect(
|
||||
page.getByText('Confirmed the launch requirements in a discovery call.', { exact: true }),
|
||||
).toBeVisible();
|
||||
await page.getByRole('tab', { name: 'Tasks', exact: true }).click();
|
||||
await page.getByRole('button', { name: 'Add task', exact: true }).click();
|
||||
await page
|
||||
.getByRole('dialog')
|
||||
@@ -259,6 +263,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
|
||||
await advance('Contacted');
|
||||
await advance('Qualified');
|
||||
await advance('KYB');
|
||||
await page.getByRole('tab', { name: 'Onboarding', exact: true }).click();
|
||||
for (let i = 0; i < 4; i++) {
|
||||
await page.getByRole('button', { name: 'Update document', exact: true }).nth(i).click();
|
||||
await page
|
||||
@@ -268,8 +273,9 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
|
||||
await save();
|
||||
}
|
||||
await advance('Compliance Review');
|
||||
await expect(page.getByRole('button', { name: 'Record decision', exact: true })).toHaveCount(0);
|
||||
await expect(page.getByRole('button', { name: 'Record decision', exact: true })).toBeDisabled();
|
||||
await switchAccount('compliance');
|
||||
await page.getByRole('tab', { name: 'Onboarding', exact: true }).click();
|
||||
await page.getByRole('button', { name: 'Record decision', exact: true }).click();
|
||||
await page
|
||||
.getByRole('dialog')
|
||||
@@ -285,6 +291,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
|
||||
.fill('Please sign and date the declaration.');
|
||||
await save();
|
||||
await switchAccount('alex');
|
||||
await page.getByRole('tab', { name: 'Onboarding', exact: true }).click();
|
||||
const ownership = page
|
||||
.locator('#checklist > div > div')
|
||||
.filter({ hasText: 'Ownership structure' });
|
||||
@@ -300,6 +307,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
|
||||
await save();
|
||||
await advance('Compliance Review');
|
||||
await switchAccount('compliance');
|
||||
await page.getByRole('tab', { name: 'Onboarding', exact: true }).click();
|
||||
await page.getByRole('button', { name: 'Record decision', exact: true }).click();
|
||||
await page
|
||||
.getByRole('dialog')
|
||||
|
||||
Reference in New Issue
Block a user