Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: drag and click #8331

Merged
merged 9 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/client/automation/playback/drag/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default class DragAutomationBase extends VisibleElementAutomation {
});
}

_mouseup () {
_mouseup (draggedElement) {
return cursor
.buttonUp()
.then(() => {
Expand Down Expand Up @@ -126,7 +126,7 @@ export default class DragAutomationBase extends VisibleElementAutomation {
})
.then(element => {
//B231323
if (topElement && element === topElement && !this.dragAndDropState.enabled)
if (topElement && element === topElement && !this.dragAndDropState.enabled && element === draggedElement)
eventSimulator.click(topElement, options);
});
});
Expand All @@ -152,6 +152,6 @@ export default class DragAutomationBase extends VisibleElementAutomation {
return Promise.all([delay(this.automationSettings.mouseActionStepDelay), this._mousedown(eventArgs)]);
})
.then(() => this._drag())
.then(() => this._mouseup());
.then(() => this._mouseup(eventArgs.element));
}
}
11 changes: 11 additions & 0 deletions test/functional/fixtures/regression/gh-8250/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>gh-8250</title>
</head>
<body>
<h1>Example</h1>
<input id="example" type="radio" />
</body>
</html>
5 changes: 5 additions & 0 deletions test/functional/fixtures/regression/gh-8250/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('[Regression](GH-8250)', function () {
it('Click should not be called after dragToElement', function () {
return runTests('testcafe-fixtures/index.js', 'Click should not be called', { only: 'chrome' });
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Selector } from 'testcafe';

fixture('GH-8250- Click should not be called after dragToElement')
.page`http://localhost:3000/fixtures/regression/gh-8250/pages/index.html`;

test('Click should not be called', async t => {
const h1Label = Selector('h1').withText('Example');
const radioInput = Selector('#example');

await t.dragToElement(h1Label, radioInput);
await t.expect(radioInput.checked).eql(false);
});
Loading