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: move cursor relative to the center of body when using "resetCursor" option #842

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

DudaGod
Copy link
Member

@DudaGod DudaGod commented Feb 12, 2024

Fix for - #841

@sipayRT
Copy link
Member

sipayRT commented Feb 13, 2024

а давай просто добавим новую команду типа moveCursorTo, чтобы пользователи могли просто заменить у себя использование команды. И при обновлении версии им нужно будет только команду поменять

@DudaGod DudaGod force-pushed the HERMIONE-1376.fix_reset_cursor branch 3 times, most recently from c71ee16 to d352f6e Compare February 14, 2024 13:44
};

// TODO: remove after next major version
export = async (browser: Browser): Promise<void> => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не стал добавлять тесты на эту временную команду и скорей всего ее трогать не придется до следующего мажора. Сам код основан на предыдущей реализации moveTo - https://github.com/webdriverio/webdriverio/blob/v8.20.0/packages/webdriverio/src/commands/element/moveTo.ts

Если считаете, что тесты в данном случае критичны, то могу написать конечно.

await session
.action("pointer", { parameters: { pointerType: "mouse" } })
.move({ x: 0, y: 0 })
.perform();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь переделал логику, чтобы не парится с этими подсчетами правильными относительно новой реализации moveTo. В случае если в move не передавать origin (т.е. сам элемент), то он передвигает курсор относительно вьюпорта.

@DudaGod DudaGod force-pushed the HERMIONE-1376.fix_reset_cursor branch from d352f6e to 36c4f36 Compare February 20, 2024 10:14
@DudaGod DudaGod merged commit 692ae5d into master Feb 20, 2024
2 checks passed
@DudaGod DudaGod deleted the HERMIONE-1376.fix_reset_cursor branch February 20, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants