forked from DevExpress/testcafe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…vExpress#988) * Fixed extra distance in scroll automation (closes DevExpress#987) * Test names fixed
- Loading branch information
1 parent
7469962
commit 58d01ce
Showing
4 changed files
with
123 additions
and
6 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
50 changes: 50 additions & 0 deletions
50
test/functional/fixtures/regression/gh-987/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,50 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>GH-987</title> | ||
<style> | ||
.row { | ||
height: 24px; | ||
width: 75px; | ||
background: grey; | ||
border: 1px solid black; | ||
} | ||
|
||
.column { | ||
display: inline-block; | ||
color: white; | ||
width: 20px; | ||
height: 70px; | ||
border: 1px solid black; | ||
background: grey; | ||
} | ||
|
||
.verticalContainer { | ||
overflow-y: scroll; | ||
left: 100px; | ||
position: absolute; | ||
height: 70px; | ||
width: 100px; | ||
} | ||
|
||
.horizontalConatainer { | ||
overflow-x: scroll; | ||
white-space: nowrap; | ||
height: 100px; | ||
width: 70px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div id="verticalContainer" class="verticalContainer"> | ||
<div id="targetTop" class="row"></div> | ||
<div class="row"></div> | ||
<div id="targetBottom" class="row"></div> | ||
</div> | ||
<div id="horizontalContainer" class="horizontalConatainer"> | ||
<div id="targetLeft" class="column"></div> | ||
<div class="column"></div> | ||
<div id="targetRight" class="column"></div> | ||
</div> | ||
</body> | ||
</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,19 @@ | ||
describe('[Regression](GH-987)', function () { | ||
describe('Should fully show the target element on performing an action', function () { | ||
it('Click on the bottom element in the vertical container', function () { | ||
return runTests('./testcafe-fixtures/index.test.js', 'Scroll the vertical container to the bottom element'); | ||
}); | ||
|
||
it('Click on the top element in the vertical container', function () { | ||
return runTests('./testcafe-fixtures/index.test.js', 'Scroll the vertical container to the top element'); | ||
}); | ||
|
||
it('Click on the left element in the horizontal container', function () { | ||
return runTests('./testcafe-fixtures/index.test.js', 'Scroll the horizontal container to the left element'); | ||
}); | ||
|
||
it('Click on the right element in the horizontal container', function () { | ||
return runTests('./testcafe-fixtures/index.test.js', 'Scroll the horizontal container to the right element'); | ||
}); | ||
}); | ||
}); |
42 changes: 42 additions & 0 deletions
42
test/functional/fixtures/regression/gh-987/testcafe-fixtures/index.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,42 @@ | ||
import { Selector } from 'testcafe'; | ||
import { expect } from 'chai'; | ||
|
||
|
||
fixture `Scroll a div container` | ||
.page `http://localhost:3000/fixtures/regression/gh-987/pages/index.html`; | ||
|
||
|
||
const horizontalContainer = Selector('#horizontalContainer'); | ||
const verticalContainer = Selector('#verticalContainer'); | ||
|
||
test('Scroll the vertical container to the bottom element', async t => { | ||
await t.click('#targetBottom'); | ||
|
||
expect(await verticalContainer.scrollTop).to.be.least(8); | ||
}); | ||
|
||
test('Scroll the vertical container to the top element', async t => { | ||
await t.eval(() => { | ||
document.querySelector('#verticalContainer').scrollTop = 8; | ||
}); | ||
|
||
await t.click('#targetTop'); | ||
|
||
expect(await verticalContainer.scrollTop).eql(0); | ||
}); | ||
|
||
test('Scroll the horizontal container to the left element', async t => { | ||
await t.eval(() => { | ||
document.querySelector('#horizontalContainer').scrollLeft = 8; | ||
}); | ||
|
||
await t.click('#targetLeft'); | ||
|
||
expect(await horizontalContainer.scrollLeft).eql(0); | ||
}); | ||
|
||
test('Scroll the horizontal container to the right element', async t => { | ||
await t.click('#targetRight'); | ||
|
||
expect(await horizontalContainer.scrollLeft).to.be.least(3); | ||
}); |