-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* initial * fix linting * small refactoring * fix lint * fix review issues * add lost option name * try to fix tests
- Loading branch information
1 parent
0e2f80f
commit 62bf5a2
Showing
20 changed files
with
163 additions
and
39 deletions.
There are no files selected for viewing
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 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 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 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 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 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 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 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 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
23 changes: 23 additions & 0 deletions
23
test/functional/fixtures/run-options/disable-page-caching/common/index.js
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,23 @@ | ||
import { ClientFunction, Role, Selector, t } from 'testcafe'; | ||
|
||
const getPageLocation = ClientFunction(() => window.location.toString()); | ||
|
||
const url = 'http://localhost:3000/fixtures/run-options/disable-page-caching/pages/index.html'; | ||
|
||
const expectedRoleLastPageLocation = 'http://localhost:3000/fixtures/run-options/disable-page-caching/pages/third.html'; | ||
|
||
const role = Role(url, async () => { | ||
await t | ||
.click(Selector('#first')) | ||
.click(Selector('#second')) | ||
.click(Selector('#third')); | ||
|
||
role.lastPageLocation = await getPageLocation(); | ||
}); | ||
|
||
export { | ||
role, | ||
url, | ||
expectedRoleLastPageLocation | ||
}; | ||
|
26 changes: 26 additions & 0 deletions
26
test/functional/fixtures/run-options/disable-page-caching/pages/index.html
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,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<button id="first">1. Set value in local storage</button> | ||
<button id="second">2. Open link in a new window.</button> | ||
<script> | ||
var firstBtn = document.getElementById("first"); | ||
var secondBtn = document.getElementById("second"); | ||
|
||
firstBtn.addEventListener('click', function () { | ||
window.localStorage.setItem( | ||
'testItem', | ||
JSON.stringify({ link: './third.html' }) | ||
); | ||
}); | ||
|
||
secondBtn.addEventListener('click', function () { | ||
window.open('./second.html', '_blank'); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
17 changes: 17 additions & 0 deletions
17
test/functional/fixtures/run-options/disable-page-caching/pages/second.html
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,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<a id="third">3. Link to the third page</a> | ||
<script> | ||
var data = JSON.parse(localStorage.getItem('testItem')); | ||
var link = document.getElementById('third'); | ||
|
||
if (data) | ||
link.href = data.link; | ||
</script> | ||
</body> | ||
</html> |
10 changes: 10 additions & 0 deletions
10
test/functional/fixtures/run-options/disable-page-caching/pages/third.html
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,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<h1>Third page</h1> | ||
</body> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
test/functional/fixtures/run-options/disable-page-caching/test.js
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,13 @@ | ||
describe('Disable page caching', () => { | ||
it('Test run', () => { | ||
return runTests('testcafe-fixtures/test-run.js', null, { disablePageCaching: true }); | ||
}); | ||
|
||
it('Fixture', () => { | ||
return runTests('testcafe-fixtures/fixture.js'); | ||
}); | ||
|
||
it('Single test', () => { | ||
return runTests('testcafe-fixtures/single-test.js'); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
test/functional/fixtures/run-options/disable-page-caching/testcafe-fixtures/fixture.js
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,12 @@ | ||
import { role, url, expectedRoleLastPageLocation } from '../common/index'; | ||
|
||
fixture | ||
.disablePageCaching `Fixture` | ||
.page(url) | ||
.beforeEach( async t => { | ||
await t.useRole(role); | ||
}); | ||
|
||
test('test', async t => { | ||
await t.expect(role.lastPageLocation).eql(expectedRoleLastPageLocation); | ||
}); |
14 changes: 14 additions & 0 deletions
14
test/functional/fixtures/run-options/disable-page-caching/testcafe-fixtures/single-test.js
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,14 @@ | ||
import { role, url, expectedRoleLastPageLocation } from '../common/index'; | ||
|
||
fixture `Fixture`; | ||
|
||
test | ||
.disablePageCaching | ||
.page(url) | ||
.before(async t => { | ||
await t.useRole(role); | ||
}) | ||
('test', async t => { | ||
await t.expect(role.lastPageLocation).eql(expectedRoleLastPageLocation); | ||
}); | ||
|
11 changes: 11 additions & 0 deletions
11
test/functional/fixtures/run-options/disable-page-caching/testcafe-fixtures/test-run.js
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,11 @@ | ||
import { role, url, expectedRoleLastPageLocation } from '../common/index'; | ||
|
||
fixture `Fixture` | ||
.page(url) | ||
.beforeEach( async t => { | ||
await t.useRole(role); | ||
}); | ||
|
||
test('test', async t => { | ||
await t.expect(role.lastPageLocation).eql(expectedRoleLastPageLocation); | ||
}); |
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 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 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