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

Incorrect initialization of mouse cursor position between tests #8357

Open
mfortik opened this issue Jan 8, 2025 · 1 comment
Open

Incorrect initialization of mouse cursor position between tests #8357

mfortik opened this issue Jan 8, 2025 · 1 comment
Labels
STATE: Need clarification An issue lacks information for further research. TYPE: bug The described behavior is considered as wrong (bug).

Comments

@mfortik
Copy link

mfortik commented Jan 8, 2025

What is your Scenario?

Run test with hover action. Continue with the next test in the fixture section. Test mouse position.

What is the Current behavior?

The mouse position will remain the same as in the previous test.

What is the Expected behavior?

The mouse position will be reset.

What is the public URL of the test page? (attach your complete example)

N/A any URL

What is your TestCafe test code?

import { Selector, t } from 'testcafe';

fixture Demonstration of the Issue
.page https://github.com/DevExpress/testcafe;

test('Hover a tab affects the next test', async t => {
const codeTab = Selector('#code-tab');

let backgroundColor = await codeTab.getStyleProperty('background-color');
await t.expect(backgroundColor).eql('rgba(0, 0, 0, 0)');
await t.hover(codeTab);
backgroundColor = await codeTab.getStyleProperty('background-color');

// Background color is changed by hover
await t.expect(backgroundColor).eql('rgba(129, 139, 152, 0.1)');
});

fixture Demonstration of the Issue
.page https://github.com/DevExpress/testcafe;

test('Mouse position affects background color in tab', async t => {
const codeTab = Selector('#code-tab');
const backgroundColor = await codeTab.getStyleProperty('background-color');

// Background color should be same as on previous test
await t.expect(backgroundColor).eql('rgba(0, 0, 0, 0)');
});

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

  1. Run test with hover action.
  2. Continue with the next test in the fixture section.
  3. Test mouse position.

TestCafe version

3.5.0

Node.js version

18.19.0

Command-line arguments

testcafe chrome mytest.js

Browser name(s) and version(s)

Chrome 131.0.0.0

Platform(s) and version(s)

Windows 10

Other

No response

@mfortik mfortik added the TYPE: bug The described behavior is considered as wrong (bug). label Jan 8, 2025
@testcafe-need-response-bot testcafe-need-response-bot bot added the STATE: Need response An issue that requires a response or attention from the team. label Jan 8, 2025
@mfortik mfortik changed the title Not properly initialize mouse cursor position between tests Incorrect initialization of mouse cursor position between tests Jan 8, 2025
@Bayheck
Copy link
Collaborator

Bayheck commented Jan 13, 2025

Hello,

I managed to reproduce the issue.

As a workaround, you can use the following line after assertions to reset the state:

await t.hover('body', { offsetX: 0, offsetY: 0 });

test('Hover a tab affects the next test', async t => {
const codeTab = Selector('#code-tab');
const issuesTab = Selector('#issues-tab');

let backgroundColor = await codeTab.getStyleProperty('background-color');
await t.expect(backgroundColor).eql('rgba(0, 0, 0, 0)');
await t.hover(codeTab);
backgroundColor = await codeTab.getStyleProperty('background-color');

// Background color is changed by hover
await t.expect(backgroundColor).eql('rgba(101, 108, 118, 0.18)');
await t.debug();

await t.hover('body', { offsetX: 0, offsetY: 0 });
});

Please let us know your results.

@Bayheck Bayheck added STATE: Need clarification An issue lacks information for further research. and removed STATE: Need response An issue that requires a response or attention from the team. labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATE: Need clarification An issue lacks information for further research. TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

No branches or pull requests

2 participants