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 f694932
Showing
5 changed files
with
110 additions
and
1 deletion.
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
77 changes: 77 additions & 0 deletions
77
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,77 @@ | ||
<!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); | ||
} | ||
|
||
function onclick (e) { | ||
|
||
} | ||
|
||
function oncontextmenu (e) { | ||
|
||
} | ||
|
||
function ondblclick (e) { | ||
|
||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="el1" onclick="listenMouseMove()"></div> | ||
<div id="el2" onclick="listenMouseMoveWithLeftButtonPressed()"></div> | ||
<div id="el3"></div> | ||
<div id="el4" onclick="onclick()" oncontextmenu="oncontextmenu()" ondblclick="ondblclick()"></div> | ||
<br/> | ||
<br/> | ||
<br/> | ||
<br/> | ||
<br/> | ||
<div id="result"></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,5 @@ | ||
describe('[Regression](GH-2056)', function () { | ||
it('Move actions should provide correct button, buttons, which properties', function () { | ||
return runTests('testcafe-fixtures/index.js'); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
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,27 @@ | ||
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) | ||
.debug() | ||
.hover(el3) | ||
.click(el2) | ||
.dragToElement(el2, el3) | ||
.expect(result.innerText).eql(expected); | ||
}); |
Binary file not shown.