mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-21 23:53:52 +00:00
chore: improve trade drag-drop test for webkit
This commit is contained in:
parent
32a473450f
commit
07f6daea6b
|
@ -100,7 +100,7 @@ test.describe('Trade', () => {
|
||||||
|
|
||||||
await expect(page.getByText('Config reloaded successfully.')).toBeInViewport();
|
await expect(page.getByText('Config reloaded successfully.')).toBeInViewport();
|
||||||
});
|
});
|
||||||
test('Trade page - drag and drop', async ({ page }) => {
|
test('Trade page - drag and drop', async ({ page, browserName }) => {
|
||||||
await page.goto('/trade');
|
await page.goto('/trade');
|
||||||
|
|
||||||
const multiPane = page.locator('.drag-header', { hasText: 'Multi Pane' });
|
const multiPane = page.locator('.drag-header', { hasText: 'Multi Pane' });
|
||||||
|
@ -111,6 +111,8 @@ test.describe('Trade', () => {
|
||||||
await page.getByText('Lock layout').uncheck();
|
await page.getByText('Lock layout').uncheck();
|
||||||
|
|
||||||
const chartHeader = await page.locator('.drag-header:has-text("Chart")');
|
const chartHeader = await page.locator('.drag-header:has-text("Chart")');
|
||||||
|
// Click outside of popup to ensure it's closed
|
||||||
|
await chartHeader.click();
|
||||||
await expect(multiPane).toBeInViewport();
|
await expect(multiPane).toBeInViewport();
|
||||||
await expect(chartHeader).toBeInViewport();
|
await expect(chartHeader).toBeInViewport();
|
||||||
|
|
||||||
|
@ -124,7 +126,28 @@ test.describe('Trade', () => {
|
||||||
await page.mouse.up();
|
await page.mouse.up();
|
||||||
await expect(multiPane).toBeInViewport();
|
await expect(multiPane).toBeInViewport();
|
||||||
// Multipane wasn't moved.
|
// Multipane wasn't moved.
|
||||||
await expect(multiPanebb).toEqual(await multiPane.boundingBox());
|
if (browserName !== 'webkit') {
|
||||||
|
await expect(multiPanebb).toEqual(await multiPane.boundingBox());
|
||||||
|
} else {
|
||||||
|
// allow offset of 2%
|
||||||
|
const newMultiPaneBB = await multiPane.boundingBox();
|
||||||
|
if (newMultiPaneBB && multiPanebb) {
|
||||||
|
const xDiff = Math.abs(newMultiPaneBB.x - multiPanebb.x);
|
||||||
|
const yDiff = Math.abs(newMultiPaneBB.y - multiPanebb.y);
|
||||||
|
const widthDiff = Math.abs(newMultiPaneBB.width - multiPanebb.width);
|
||||||
|
const heightDiff = Math.abs(newMultiPaneBB.height - multiPanebb.height);
|
||||||
|
|
||||||
|
const xDiffPercent = (xDiff / multiPanebb.width) * 100;
|
||||||
|
const yDiffPercent = (yDiff / multiPanebb.height) * 100;
|
||||||
|
const widthDiffPercent = (widthDiff / multiPanebb.width) * 100;
|
||||||
|
const heightDiffPercent = (heightDiff / multiPanebb.height) * 100;
|
||||||
|
|
||||||
|
expect(xDiffPercent).toBeLessThanOrEqual(2);
|
||||||
|
expect(yDiffPercent).toBeLessThanOrEqual(2);
|
||||||
|
expect(widthDiffPercent).toBeLessThanOrEqual(2);
|
||||||
|
expect(heightDiffPercent).toBeLessThanOrEqual(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await expect(chartHeader).toBeInViewport();
|
await expect(chartHeader).toBeInViewport();
|
||||||
// ChartHeader was moved down
|
// ChartHeader was moved down
|
||||||
|
|
Loading…
Reference in New Issue
Block a user