Added some small enchances

This commit is contained in:
Oleksandr Prokhorenko
2026-09-24 22:41:06 +03:00
parent 9ccbac4aca
commit 7f3a56a4ca
21 changed files with 441 additions and 211 deletions
+24 -22
View File
@@ -1,3 +1,4 @@
import { selectOption } from './helpers/select';
import { test, expect, type Page } from '@playwright/test';
async function signIn(page: Page, account = 'head') {
await page.goto('/login');
@@ -94,9 +95,10 @@ 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', { name: /Filter by stage|Фильтр по этапу/ })
.selectOption('LIVE');
await selectOption(
page.getByRole('combobox', { name: /Filter by stage|Фильтр по этапу/ }),
'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();
@@ -104,9 +106,9 @@ for (const language of ['en', 'ru'])
await expect(page.getByRole('textbox')).toHaveValue('');
await page.goto('/app/pipeline');
await expect(page.locator('h1')).toHaveText(language === 'en' ? 'Pipeline' : 'Воронка');
if (width === 390) await page.getByRole('combobox').selectOption('KYB');
if (width === 390) await selectOption(page.getByRole('combobox'), 'KYB');
await expect(page.getByRole('link', { name: /Luma Labs/ })).toBeVisible();
if (width === 390) await page.getByRole('combobox').selectOption('REJECTED');
if (width === 390) await selectOption(page.getByRole('combobox'), 'REJECTED');
await expect(page.getByRole('heading', { name: /^(Rejected|Отклонён)$/ })).toBeVisible();
await noOverflow(page);
await page.screenshot({ path: info.outputPath('pipeline.png'), fullPage: true });
@@ -238,7 +240,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
await page.goto(merchantPath);
await expect(page.getByText('Unassigned', { exact: true })).toBeVisible();
await page.getByRole('button', { name: 'Assign manager', exact: true }).click();
await page.getByRole('dialog').getByLabel('Account manager').selectOption('user-manager1');
await selectOption(page.getByRole('dialog').getByLabel('Account manager'), 'user-manager1');
await save();
await switchAccount('alex');
await expect(page.getByRole('button', { name: 'Assign manager', exact: true })).toHaveCount(0);
@@ -255,7 +257,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
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 selectOption(page.getByRole('dialog').getByLabel('Interaction type'), 'CALL');
await page
.getByRole('dialog')
.getByLabel('Details', { exact: true })
@@ -280,10 +282,10 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
await page.getByRole('tab', { name: 'Onboarding', exact: true }).click();
for (let i = 0; i < 3; i++) {
await page.getByRole('button', { name: 'Update collection', exact: true }).nth(i).click();
await page
.getByRole('dialog')
.getByLabel('Collection status', { exact: true })
.selectOption('RECEIVED');
await selectOption(
page.getByRole('dialog').getByLabel('Collection status', { exact: true }),
'RECEIVED',
);
await save();
}
await advance('Compliance Review');
@@ -291,10 +293,10 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
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')
.getByLabel('Decision', { exact: true })
.selectOption('CORRECTIONS');
await selectOption(
page.getByRole('dialog').getByLabel('Decision', { exact: true }),
'CORRECTIONS',
);
await page
.getByRole('dialog')
.getByLabel('Required changes (required)', { exact: true })
@@ -314,10 +316,10 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
.locator('#checklist > div > div')
.filter({ hasText: 'Ownership structure' });
await ownership.getByRole('button', { name: 'Update collection', exact: true }).click();
await page
.getByRole('dialog')
.getByLabel('Collection status', { exact: true })
.selectOption('RECEIVED');
await selectOption(
page.getByRole('dialog').getByLabel('Collection status', { exact: true }),
'RECEIVED',
);
await page
.getByRole('dialog')
.getByLabel('Collection notes', { exact: true })
@@ -331,7 +333,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
.getByRole('dialog')
.getByLabel('Approval rationale (required)', { exact: true })
.fill('All evidence checked and approved.');
await page.getByRole('dialog').getByLabel('Risk level', { exact: true }).selectOption('LOW');
await selectOption(page.getByRole('dialog').getByLabel('Risk level', { exact: true }), 'LOW');
await page.getByRole('dialog').getByRole('button', { name: 'Approve', exact: true }).click();
await expect(page.getByRole('dialog')).not.toBeVisible();
await expect(page.getByRole('button', { name: 'Edit merchant', exact: true })).toHaveCount(0);
@@ -347,7 +349,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
.locator('article')
.filter({ has: page.getByRole('heading', { name, exact: true }) });
await row.getByRole('button', { name: 'Update demo check' }).click();
await page.getByRole('dialog').getByLabel('Result', { exact: true }).selectOption(result);
await selectOption(page.getByRole('dialog').getByLabel('Result', { exact: true }), result);
await save();
};
await expect(page.getByRole('button', { name: 'Move to Testing', exact: true })).toBeDisabled();
@@ -364,7 +366,7 @@ test('Head assignment, manager editing, Compliance decisions and manager activat
await page.screenshot({ path: info.outputPath('approved-live-merchant.png'), fullPage: true });
await switchAccount('head');
await page.getByRole('button', { name: 'Assign manager', exact: true }).click();
await page.getByRole('dialog').getByLabel('Account manager').selectOption('user-manager2');
await selectOption(page.getByRole('dialog').getByLabel('Account manager'), 'user-manager2');
await save();
await switchAccount('sam');
await expect(page.getByText('Director of Partnerships', { exact: true })).toBeVisible();