Add settings playwright test

This commit is contained in:
Matthias 2024-04-08 19:25:04 +02:00
parent 59578a434b
commit 47de346df9

33
e2e/settings.spec.ts Normal file
View File

@ -0,0 +1,33 @@
import { test, expect } from '@playwright/test';
import { setLoginInfo, defaultMocks } from './helpers';
test.describe('Settings', () => {
test('Settings stores', async ({ page }) => {
await setLoginInfo(page);
await defaultMocks(page);
await Promise.all([
page.goto('/'),
// page.waitForResponse('**/Ping'),
// page.waitForResponse('**/ShowConf'),
]);
// await expect(page.locator('li', { hasText: 'Online' })).toBeInViewport();
await expect(page.locator('h1', { hasText: 'Welcome to the Freqtrade UI' })).toBeInViewport({
timeout: 5000,
});
await page
.locator('[id=avatar-drop]')
.isVisible()
.then(() => page.locator('[id=avatar-drop]').click());
await page.locator('.dropdown-menu > * > [href="/settings"]').click();
await expect(page.locator(':text("FreqUI Settings")')).toBeVisible();
// Switch option in the settings.
await page.locator('select').first().selectOption('asTitle');
const settings = await page.evaluate(() =>
JSON.parse(window.localStorage.getItem('ftUISettings') || '{}'),
);
await expect(settings['openTradesInTitle']).toBe('asTitle');
});
});