mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Revert "Use desktopCapturer instead of capturePage for e2e"
This reverts commit a0126c4f44.
This commit is contained in:
parent
e79b0eb0c9
commit
bc37efdc23
1 changed files with 5 additions and 9 deletions
|
|
@ -37,15 +37,11 @@ test.before(async () => {
|
||||||
|
|
||||||
test.after(async () => {
|
test.after(async () => {
|
||||||
await app
|
await app
|
||||||
.evaluate(async ({BrowserWindow, desktopCapturer, screen}) => {
|
.evaluate(({BrowserWindow}) =>
|
||||||
// eslint-disable-next-line prefer-const
|
BrowserWindow.getFocusedWindow()
|
||||||
let {width, height, ...position} = BrowserWindow.getFocusedWindow()!.getBounds();
|
?.capturePage()
|
||||||
const {scaleFactor} = screen.getDisplayNearestPoint(position);
|
.then((img) => img.toPNG().toString('base64'))
|
||||||
width *= scaleFactor;
|
)
|
||||||
height *= scaleFactor;
|
|
||||||
const sources = await desktopCapturer.getSources({types: ['window'], thumbnailSize: {width, height}});
|
|
||||||
return sources[0].thumbnail.toPNG().toString('base64');
|
|
||||||
})
|
|
||||||
.then((img) => Buffer.from(img || '', 'base64'))
|
.then((img) => Buffer.from(img || '', 'base64'))
|
||||||
.then(async (imageBuffer) => {
|
.then(async (imageBuffer) => {
|
||||||
await fs.writeFile(`dist/tmp/${process.platform}_test.png`, imageBuffer);
|
await fs.writeFile(`dist/tmp/${process.platform}_test.png`, imageBuffer);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue