Skip to content

Commit

Permalink
test on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem-Babich committed May 26, 2022
1 parent 7ef3b01 commit 43f3adf
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/functional/fixtures/regression/gh-5961/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Testcafe screenshot sizing issue</title>
<style>
.test-box {
width: 80px;
height: 80px;
margin: 8px;
display: inline-block;
border: 2px solid red;
}

body {
margin: 0;
background-color: #60A96E;
}
</style>
</head>
<body>
<div id="wrapper"></div>
<script>
var wrapper = document.getElementById("wrapper");

var myHTML = '';

for (var i = 0; i < 10; i++) {
myHTML += '<div>';
for (var j = 0; j < 10; j++) {
myHTML += '<div class="test-box">' + (i * 10 + j + 1) + '</div>';
}
myHTML += '</div>';
}
wrapper.innerHTML = myHTML

</script>
</body>
</html>
5 changes: 5 additions & 0 deletions test/functional/fixtures/regression/gh-5961/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('[Regression](GH-5961)', () => {
it('Screenshot', () => {
return runTests('./testcafe-fixtures/index.js', 'Take a full page screenshot');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {Selector} from "testcafe";

fixture`Getting Started`
.page`../pages/index.html`;

const getBrowserName = (alias) => alias.split(':').join('_');

test('Take a full page screenshot', async t => {
const path = `gh-5961/${ getBrowserName(t.browser.alias) }_full-page.png`;

await t.resizeWindow(2024, 768);
await t.takeScreenshot({
path,
fullPage: true
});
});

test.page('https://advancedinstaller.com/blog/page-1.html')('Take a full page screenshot2', async t => {
const path = `gh-5961/${ getBrowserName(t.browser.alias) }1_full-page.png`;
await t
.resizeWindow(768, 800)
.click(Selector('#cookies button'))
.takeScreenshot({ fullPage: true, path });
});

0 comments on commit 43f3adf

Please sign in to comment.