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.
- Loading branch information
1 parent
be2206f
commit f13436a
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
test/functional/fixtures/regression/gh-2056/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,74 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
<style> | ||
|
||
#el1, #el2, #el3 { | ||
position: absolute; | ||
background-color: black; | ||
display: inline-block; | ||
height: 50px; | ||
width: 50px; | ||
top: 0; | ||
left: 0; | ||
} | ||
#el2 { | ||
top: 200px; | ||
left: 200px; | ||
} | ||
|
||
#el3 { | ||
top: 0; | ||
left: 200px; | ||
} | ||
</style> | ||
<script> | ||
function log (text) { | ||
document.getElementById('result').innerHTML += text; | ||
} | ||
|
||
function onMove (e) { | ||
window.removeEventListener('mousemove', onMove); | ||
|
||
log('onMove:' + e.button + e.buttons + e.which); | ||
} | ||
|
||
function onMoveWithLeftButtonPressed (e) { | ||
window.removeEventListener('mousemove', onMoveWithLeftButtonPressed); | ||
|
||
log('onMoveWithLeftButtonPressed:' + e.button + e.buttons + e.which); | ||
} | ||
|
||
function listenMouseMove(e) { | ||
window.addEventListener('mousemove', onMove); | ||
} | ||
|
||
function listenMouseMoveWithLeftButtonPressed(e) { | ||
window.addEventListener('mousemove', onMoveWithLeftButtonPressed); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="el1"></div> | ||
<div id="el2"></div> | ||
<div id="el3"></div> | ||
<br/> | ||
<br/> | ||
<br/> | ||
<br/> | ||
<br/> | ||
<div id="result"></div> | ||
|
||
<script type="text/javascript"> | ||
var el1 = document.getElementById('el1'); | ||
var el2 = document.getElementById('el2'); | ||
var el3 = document.getElementById('el3'); | ||
var el4 = document.getElementById('el4'); | ||
|
||
el1.addEventListener('click', listenMouseMove); | ||
el2.addEventListener('click', listenMouseMoveWithLeftButtonPressed); | ||
</script> | ||
</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,5 @@ | ||
describe('[Regression](GH-2056)', function () { | ||
it('Move actions should provide correct button, buttons, which properties', function () { | ||
return runTests('testcafe-fixtures/index.js'); | ||
}, { skip: ['iphone', 'ipad', 'android'] }); | ||
}); |
26 changes: 26 additions & 0 deletions
26
test/functional/fixtures/regression/gh-2056/testcafe-fixtures/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,26 @@ | ||
import { Selector, ClientFunction } from 'testcafe'; | ||
import userAgent from 'useragent'; | ||
|
||
fixture `GH-2056` | ||
.page `http://localhost:3000/fixtures/regression/gh-2056/pages/index.html`; | ||
|
||
const el1 = Selector('#el1'); | ||
const el2 = Selector('#el2'); | ||
const el3 = Selector('#el3'); | ||
const result = Selector('#result'); | ||
|
||
const getUserAgent = ClientFunction(() => navigator.userAgent.toString()); | ||
|
||
test('Move actions should provide correct button, buttons, which properties', async t => { | ||
var userAgentStr = await getUserAgent(); | ||
var isChrome = userAgent.is(userAgentStr).chrome; | ||
var expected = isChrome ? 'onMove:000onMoveWithLeftButtonPressed:011' : 'onMove:001onMoveWithLeftButtonPressed:011'; | ||
|
||
await t | ||
.setTestSpeed(0.1) | ||
.click(el1) | ||
.hover(el3) | ||
.click(el2) | ||
.dragToElement(el2, el3) | ||
.expect(result.innerText).eql(expected); | ||
}); |