frequi_origin/e2e/dashboard.spec.ts

40 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-04-09 05:02:08 +00:00
import { test, expect } from '@playwright/test';
import { setLoginInfo, defaultMocks, tradeMocks } from './helpers';
test.describe('Dashboard', () => {
test.beforeEach(async ({ page }) => {
await defaultMocks(page);
await tradeMocks(page);
await setLoginInfo(page);
});
test('Dashboard Page', async ({ page }) => {
await Promise.all([
page.goto('/dashboard'),
page.waitForResponse('**/status'),
page.waitForResponse('**/profit'),
page.waitForResponse('**/balance'),
// page.waitForResponse('**/trades'),
page.waitForResponse('**/whitelist'),
page.waitForResponse('**/blacklist'),
page.waitForResponse('**/locks'),
]);
await expect(page.locator('.drag-header', { hasText: 'Bot comparison' })).toBeVisible();
await expect(page.locator('.drag-header', { hasText: 'Bot comparison' })).toBeInViewport();
await expect(page.locator('.drag-header', { hasText: 'Daily Profit' })).toBeVisible();
await expect(page.locator('.drag-header', { hasText: 'Daily Profit' })).toBeInViewport();
await expect(page.locator('.drag-header', { hasText: 'Open trades' })).toBeVisible();
await expect(page.locator('.drag-header', { hasText: 'Open trades' })).toBeInViewport();
await expect(page.locator('.drag-header', { hasText: 'Cumulative Profit' })).toBeVisible();
await expect(page.locator('.drag-header', { hasText: 'Cumulative Profit' })).toBeInViewport();
await expect(page.locator('span', { hasText: 'TestBot' })).toBeVisible();
await expect(page.locator('span', { hasText: 'Summary' })).toBeVisible();
// Scroll to bottom
await page.locator('.drag-header', { hasText: 'Trades Log' }).scrollIntoViewIfNeeded();
await expect(page.locator('.drag-header', { hasText: 'Closed Trades' })).toBeInViewport();
await expect(page.locator('.drag-header', { hasText: 'Profit Distribution' })).toBeInViewport();
await expect(page.locator('.drag-header', { hasText: 'Trades Log' })).toBeInViewport();
});
});