DEV: Add select_range to composer page object (#28539)

Covers the use case of doing this in composer:

```javascript
page.execute_script("document.querySelector('.d-editor-input').setSelectionRange(6, 12);")
```
This commit is contained in:
Martin Brennan 2024-08-26 14:50:14 +10:00 committed by GitHub
parent e25578d702
commit 0803e2d237
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -237,6 +237,14 @@ module PageObjects
JS
end
def select_range(start_index, length)
execute_script(<<~JS, text)
const composer = document.querySelector("#{COMPOSER_ID} .d-editor-input");
composer.focus();
composer.setSelectionRange(#{start_index}, #{length});
JS
end
def submit
find("#{COMPOSER_ID} .save-or-cancel .create").click
end