51 lines
2.4 KiB
TypeScript
51 lines
2.4 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Scenario 06: Commercial Order Fulfillment (Confirm -> Payment -> Shipment)', () => {
|
|
test('executes end-to-end order lifecycle and verifies finance and inventory sync', async ({ page }) => {
|
|
await page.goto('/sales');
|
|
await page.waitForLoadState('domcontentloaded');
|
|
|
|
// 1. Select an order from the list
|
|
const orderRows = page.locator('tbody tr');
|
|
await expect(orderRows.first()).toBeVisible({ timeout: 15000 });
|
|
await orderRows.first().click();
|
|
|
|
// 2. Drawer opened: Confirm Order (Stock Reservation)
|
|
const confirmBtn = page.locator('[data-testid="confirm-order-btn"]');
|
|
if (await confirmBtn.isVisible({ timeout: 2000 }).catch(() => false)) {
|
|
await confirmBtn.click();
|
|
await page.waitForTimeout(300);
|
|
}
|
|
|
|
// 3. Record Payment (DDS Inflow)
|
|
const paymentBtn = page.locator('[data-testid="record-payment-btn"]');
|
|
if (await paymentBtn.isVisible({ timeout: 2000 }).catch(() => false)) {
|
|
await paymentBtn.click();
|
|
const submitPaymentBtn = page.locator('[data-testid="submit-payment-btn"]');
|
|
await expect(submitPaymentBtn).toBeVisible({ timeout: 5000 });
|
|
await submitPaymentBtn.click();
|
|
await page.waitForTimeout(300);
|
|
}
|
|
|
|
// 4. Create Shipment (Warehouse Deduction)
|
|
const shipmentBtn = page.locator('[data-testid="create-shipment-btn"]');
|
|
if (await shipmentBtn.isVisible({ timeout: 3000 }).catch(() => false)) {
|
|
await shipmentBtn.click();
|
|
const submitShipmentBtn = page.locator('[data-testid="submit-shipment-btn"]');
|
|
await expect(submitShipmentBtn).toBeVisible({ timeout: 5000 });
|
|
await submitShipmentBtn.click();
|
|
await page.waitForTimeout(300);
|
|
}
|
|
|
|
// 5. Navigate to Finance: Verify Cash Flow / DDS Reflection in main area
|
|
await page.goto('/finance');
|
|
await page.waitForLoadState('domcontentloaded');
|
|
await expect(page.locator('main').locator('text=Финансы').or(page.locator('main').locator('text=ДДС')).first()).toBeVisible({ timeout: 15000 });
|
|
await expect(page.locator('tbody tr').first()).toBeVisible({ timeout: 10000 });
|
|
|
|
// 6. Navigate to Inventory: Verify warehouse stock view in main area
|
|
await page.goto('/inventory');
|
|
await page.waitForLoadState('domcontentloaded');
|
|
await expect(page.locator('main').locator('text=Склад').or(page.locator('main').locator('text=Остатки')).first()).toBeVisible({ timeout: 15000 });
|
|
});
|
|
});
|