Add chart spec

This commit is contained in:
Matthias 2024-04-09 06:28:43 +02:00
parent a622ab6c57
commit 95df87c293
3 changed files with 39 additions and 2 deletions

36
e2e/chart.spec.ts Normal file
View File

@ -0,0 +1,36 @@
import { test, expect } from '@playwright/test';
import { setLoginInfo, defaultMocks } from './helpers';
test.describe('Chart', () => {
test.beforeEach(async ({ page }) => {
await defaultMocks(page);
await setLoginInfo(page);
});
test('Chart page', async ({ page }) => {
await page.goto('/graph');
// await page.waitForResponse('**/pair_candles');
await page.locator('input[title="AutoRefresh"]').click();
// await page.click('input[title="AutoRefresh"]');
await page.waitForSelector('span:has-text("NoActionStrategyFut | 1m")');
await page.click('.form-check:has-text("Heikin Ashi")');
// Reload triggers a new request
await Promise.all([
page.getByRole('button', { name: 'Refresh chart' }).click(),
page.waitForResponse('**/pair_candles?*'),
]);
// Disable Heikin Ashi
await page.locator('.form-check:has-text("Heikin Ashi")').click();
// Default plotconfig exists
await expect(
page
.locator('div')
.filter({ hasText: /^Heikin Ashidefault$/ })
.locator('#plotConfigSelect'),
).toHaveValue('default');
});
});

View File

@ -46,6 +46,8 @@ export async function defaultMocks(page: Page) {
{ name: '@Ping', url: '**/api/v1/ping', fixture: 'ping.json' },
{ name: '@Ping', url: '**/api/v1/show_config', fixture: 'show_config.json' },
{ name: '@Ping', url: '**/api/v1/pair_candles?*', fixture: 'pair_candles_btc_1m.json' },
{ name: '@Whitelist', url: '**/api/v1/whitelist', fixture: 'whitelist.json' },
{ name: '@Blacklist', url: '**/api/v1/blacklist', fixture: 'blacklist.json' },
];
mockRequests(page, mapping);
@ -57,8 +59,6 @@ export function tradeMocks(page) {
{ name: '@Profit', url: '**/api/v1/profit', fixture: 'profit.json' },
{ name: '@Trades', url: '**/api/v1/trades*', fixture: 'trades.json' },
{ name: '@Balance', url: '**/api/v1/balance', fixture: 'balance.json' },
{ name: '@Whitelist', url: '**/api/v1/whitelist', fixture: 'whitelist.json' },
{ name: '@Blacklist', url: '**/api/v1/blacklist', fixture: 'blacklist.json' },
{ name: '@Locks', url: '**/api/v1/locks', fixture: 'locks_empty.json' },
{ name: '@Performance', url: '**/api/v1/performance', fixture: 'performance.json' },
{

View File

@ -11,6 +11,7 @@
@duplicate="plotStore.duplicatePlotConfig"
>
<b-form-select
id="plotConfigSelect"
v-model="plotStore.plotConfigName"
:options="plotStore.availablePlotConfigNames"
size="sm"