This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testEditMenuShadowRootElement() { | |
getDriver().get("https://www.htmlelements.com/demos/menu/shadow-dom/index.htm"); | |
final HomePage homePage = new HomePage(); | |
assertEquals(homePage.getEditMenuText(), "Edit"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public SearchContext expandRootElement(final WebElement element) { | |
return (SearchContext) ((JavascriptExecutor) getDriver()).executeScript( | |
"return arguments[0].shadowRoot", element); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testNewMenuShadowRootElement() { | |
getDriver().get("https://www.htmlelements.com/demos/menu/shadow-dom/index.htm"); | |
final HomePage homePage = new HomePage(); | |
assertEquals(homePage.getNewMenuText(), "New"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String getNewMenuText() { | |
openFileMenu(); | |
return fileMenu().findElement(By.cssSelector(".smart-menu-drop-down div smart-menu-item.smart-element")) | |
.getAttribute("label"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testFileMenuShadowRootElement() { | |
getDriver().get("https://www.htmlelements.com/demos/menu/shadow-dom/index.htm"); | |
final HomePage homePage = new HomePage(); | |
assertEquals(homePage.getFileMenuText(), "File"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public WebElement fileMenu() { | |
final WebElement shadowHost = getDriver().findElement(By.cssSelector(".smart-ui-component")); | |
final SearchContext shadowRoot = shadowHost.getShadowRoot(); | |
return shadowRoot.findElement(By.cssSelector(".smart-element .smart-menu-main-container .smart-element")); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<!-- https://mvnrepository.com/artifact/org.testng/testng --> | |
<dependency> | |
<groupId>org.testng</groupId> | |
<artifactId>testng</artifactId> | |
<version>${testng-version}</version> | |
<scope>test</scope> | |
</dependency> | |
<!-- https://mvnrepository.com/artifact/io.Appium/java-client --> | |
<dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseTest { | |
protected AndroidDriverManager androidDriverManager; | |
@Parameters({"buildName", "testName", "app", "platformName", "platformVersion", "deviceName"}) | |
@BeforeClass | |
public void setupTest(final String buildName, final String testName, @Optional("app") final String app, final String platformName, final String platformVersion, | |
final String deviceName) { | |
this.androidDriverManager = AndroidDriverManager.builder() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<properties> | |
<testng-version>9.2.2</testng-version> | |
<Appium-java-client-version>7.9.0</Appium-java-client-version> | |
<lombok-version>1.18.32</lombok-version> | |
</properties> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<!-- https://mvnrepository.com/artifact/org.testng/testng --> | |
<dependency> | |
<groupId>org.testng</groupId> | |
<artifactId>testng</artifactId> | |
<version>${testng-version}</version> | |
<scope>test</scope> | |
</dependency> | |
<!-- https://mvnrepository.com/artifact/io.Appium/java-client --> | |
<dependency> |