From c0bba88f029251be664e20e8350bee88251069ec Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Wed, 30 Jun 2021 23:33:46 +0200 Subject: [PATCH] Simplify text selection in "select event update the txt" This approach also make it more cross-platform resistant --- .../web/tests/integration/EventTests.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/web/integration-core/src/jvmTest/kotlin/org/jetbrains/compose/web/tests/integration/EventTests.kt b/web/integration-core/src/jvmTest/kotlin/org/jetbrains/compose/web/tests/integration/EventTests.kt index 1212e19302..a762156a0f 100644 --- a/web/integration-core/src/jvmTest/kotlin/org/jetbrains/compose/web/tests/integration/EventTests.kt +++ b/web/integration-core/src/jvmTest/kotlin/org/jetbrains/compose/web/tests/integration/EventTests.kt @@ -16,6 +16,15 @@ import org.openqa.selenium.WebDriver class EventTests : BaseIntegrationTests() { + companion object { + private val COMMAND_CROSS_PLATFORM = System.getProperty("os.name").lowercase().let { osName -> + when { + osName.contains("mac os") -> Keys.COMMAND + else -> Keys.CONTROL + } + } + } + @ResolveDrivers fun `double click updates text`(driver: WebDriver) { driver.openTestPage("doubleClickUpdatesText") @@ -105,14 +114,8 @@ class EventTests : BaseIntegrationTests() { val selectableText = driver.findElement(By.id("selectableText")) - val action = Actions(driver) - - action.moveToElement(selectableText,3,3) - .click().keyDown(Keys.SHIFT) - .moveToElement(selectableText,200, 0) - .click().keyUp(Keys.SHIFT) - .build() - .perform() + val selectAll = Keys.chord(COMMAND_CROSS_PLATFORM, "a") + selectableText.sendKeys(selectAll) driver.waitTextToBe(value = "Text Selected") }