Skip to content

Commit

Permalink
add a test for #7983 (part 1) (#8007)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKamaev committed Sep 14, 2023
1 parent dca80ff commit 0ff6d05
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 16 deletions.
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -142,7 +142,7 @@
"source-map-support": "^0.5.16",
"strip-bom": "^2.0.0",
"testcafe-browser-tools": "2.0.26",
"testcafe-hammerhead": "31.6.1",
"testcafe-hammerhead": "31.6.2",
"testcafe-legacy-api": "5.1.6",
"testcafe-reporter-json": "^2.1.0",
"testcafe-reporter-list": "^2.2.0",
Expand Down
25 changes: 25 additions & 0 deletions test/functional/fixtures/regression/gh-7983/pages/iframe.html
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>This should be in an iframe</title>
<style>
html,
body {
margin: 0;
padding: 0;
height: 100%;
}

body {
background-color: bisque;
}
</style>
</head>

<body>
<div>content</div>
</body>

</html>
23 changes: 23 additions & 0 deletions test/functional/fixtures/regression/gh-7983/pages/index.html
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8" />
<title>Test Framework</title>
</head>

<body>
Host content
<script>
function createIframe(container, iframeSource) {
const iframe = document.createElement('iframe');
container.appendChild(iframe);
iframe.src = iframeSource;
return iframe;
}

createIframe(document.body, './iframe.html');
</script>
</body>

</html>
23 changes: 23 additions & 0 deletions test/functional/fixtures/regression/gh-7983/test.js
@@ -0,0 +1,23 @@
const path = require('path');
const createTestCafe = require('../../../../../lib');
const { onlyInNativeAutomation } = require('../../../utils/skip-in');

let testcafe = null;

describe('[Regression](GH-7983)', function () {
onlyInNativeAutomation('File protocol iframe in Native Automation', function () {
return createTestCafe('127.0.0.1', 1335, 1336)
.then(tc => {
testcafe = tc;
})
.then(() => {
return testcafe.createRunner()
.browsers('chrome:headless --allow-file-access-from-files')
.src(path.join(__dirname, './testcafe-fixtures/index.js'))
.run();
})
.then(() => {
return testcafe.close();
});
});
});
@@ -0,0 +1,13 @@
import { Selector } from 'testcafe';

fixture `File protocol iframe`
.page('../pages/index.html');

for (let i = 0; i < 10; i++) {
test(`File protocol iframe ${i}`, async t => {
await t.switchToIframe('iframe');

await t.expect(Selector('div').innerText).eql('content');
});

}

0 comments on commit 0ff6d05

Please sign in to comment.