-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(KTL-1189); fix: editor screens cropped (no margin in viewport)
- Loading branch information
Showing
16 changed files
with
44 additions
and
14 deletions.
There are no files selected for viewing
Binary file modified
BIN
+3.63 KB
(150%)
tests/__screenshots__/dev/Desktop-Chrome/basics.e2e.ts-basics-simple-usage-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.62 KB
(180%)
tests/__screenshots__/dev/Desktop-Chrome/basics.e2e.ts-basics-simple-usage-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.63 KB
(160%)
tests/__screenshots__/dev/Desktop-Chrome/basics.e2e.ts-basics-simple-usage-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.09 KB
(150%)
...reenshots__/github_linux/Desktop-Chrome/basics.e2e.ts-basics-simple-usage-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.09 KB
(170%)
...reenshots__/github_linux/Desktop-Chrome/basics.e2e.ts-basics-simple-usage-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.1 KB
(150%)
...reenshots__/github_linux/Desktop-Chrome/basics.e2e.ts-basics-simple-usage-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.13 KB
(140%)
...eenshots__/github_linux/Desktop-Firefox/basics.e2e.ts-basics-simple-usage-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.13 KB
(170%)
...eenshots__/github_linux/Desktop-Firefox/basics.e2e.ts-basics-simple-usage-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.18 KB
(150%)
...eenshots__/github_linux/Desktop-Firefox/basics.e2e.ts-basics-simple-usage-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.11 KB
(140%)
...screenshots__/github_mac/Desktop-Safari/basics.e2e.ts-basics-simple-usage-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.1 KB
(160%)
...screenshots__/github_mac/Desktop-Safari/basics.e2e.ts-basics-simple-usage-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.14 KB
(150%)
...screenshots__/github_mac/Desktop-Safari/basics.e2e.ts-basics-simple-usage-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { expect, Locator } from '@playwright/test'; | ||
import { WIDGET_WRAPPER_SELECTOR } from './selectors'; | ||
|
||
export async function hideCursor(node: Locator, callback: () => Promise<void>) { | ||
const cursor = node.locator('.CodeMirror-cursors'); | ||
// Cursor blinks all the time, it's failed test from time to time | ||
await cursor.evaluate((element) => (element.style.display = 'none')); | ||
await callback(); | ||
await cursor.evaluate((element) => (element.style.display = null)); | ||
} | ||
|
||
export function checkScreenshot(node: Locator, message: string) { | ||
return hideCursor(node, () => expect(node, message).toHaveScreenshot()); | ||
} | ||
|
||
export function checkEditorView(editor: Locator, message: string) { | ||
return hideCursor(editor, async () => { | ||
/* Add top/bottom margins for wrapper node */ | ||
const [boundingBox, margins] = await Promise.all([ | ||
editor.boundingBox(), | ||
editor.locator(`> ${WIDGET_WRAPPER_SELECTOR}`).evaluate((el) => ({ | ||
top: parseFloat( | ||
window.getComputedStyle(el).getPropertyValue('margin-top'), | ||
), | ||
bottom: parseFloat( | ||
window.getComputedStyle(el).getPropertyValue('margin-bottom'), | ||
), | ||
})), | ||
]); | ||
|
||
const clip = { | ||
...boundingBox, | ||
y: boundingBox.y - margins.top, | ||
height: boundingBox.height + margins.bottom, | ||
}; | ||
|
||
await expect(editor.page(), message).toHaveScreenshot({ clip }); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters