Skip to content

Commit

Permalink
#41 remove unwanted files and added test
Browse files Browse the repository at this point in the history
  • Loading branch information
sukgu committed Feb 6, 2022
1 parent 40109e9 commit 5e3a57f
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 102 deletions.
102 changes: 0 additions & 102 deletions src/main/java/io/github/sukgu/elements/Element.java

This file was deleted.

122 changes: 122 additions & 0 deletions src/test/java/io/github/sukgu/LocalFileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,135 @@ public void test4() {
assertThat(element, notNullValue());
}

@Test
public void testImpicitWaitCSS() {
driver.navigate().to(getPageContent("button.html"));
WebElement element = shadow.findElement("button");
shadow.scrollTo(element);
assertThat(element, notNullValue());
element.click();
shadow.setImplicitWait(2);
WebElement p_element = shadow.findElement("div#divid>div#node>p");
err.println("outerHTML: " + shadow.getAttribute(p_element, "outerHTML"));
List<WebElement> elements = shadow.getChildElements(element);
assertThat(elements, notNullValue());
err.println(elements);
shadow.setImplicitWait(0);
}

@Test
public void testExplicitWaitCSS() throws Exception {
driver.navigate().to(getPageContent("button.html"));
WebElement element = shadow.findElement("button");
shadow.scrollTo(element);
assertThat(element, notNullValue());
element.click();
shadow.setExplicitWait(5, 1);
WebElement p_element = shadow.findElement("div#divid>div#node>p");
err.println("outerHTML: " + shadow.getAttribute(p_element, "outerHTML"));
List<WebElement> elements = shadow.getChildElements(element);
assertThat(elements, notNullValue());
err.println(elements);
shadow.setExplicitWait(0, 0);
}

@Test
public void testImplicitAndExplicitWaitCSS() throws Exception {
driver.navigate().to(getPageContent("button.html"));
shadow.setImplicitWait(2);
WebElement element = shadow.findElement("button");
shadow.scrollTo(element);
assertThat(element, notNullValue());
element.click();
shadow.setExplicitWait(5, 1);
WebElement p_element = shadow.findElement("div#divid>div#node>p");
err.println("outerHTML: " + shadow.getAttribute(p_element, "outerHTML"));
List<WebElement> elements = shadow.getChildElements(element);
assertThat(elements, notNullValue());
err.println(elements);
shadow.setImplicitWait(0);
shadow.setExplicitWait(0, 0);
}

@Test
public void testImpicitWaitXPath() {
driver.navigate().to(getPageContent("button.html"));
WebElement element = shadow.findElementByXPath("//button");
shadow.scrollTo(element);
assertThat(element, notNullValue());
element.click();
shadow.setImplicitWait(2);
WebElement p_element = shadow.findElementByXPath("//div[@id='divid']//div[@id='node']//p");
err.println("outerHTML: " + shadow.getAttribute(p_element, "outerHTML"));
List<WebElement> elements = shadow.getChildElements(element);
assertThat(elements, notNullValue());
err.println(elements);
shadow.setImplicitWait(0);
}

@Test
public void testExplicitWaitXPath() throws Exception {
driver.navigate().to(getPageContent("button.html"));
WebElement element = shadow.findElementByXPath("//button");
shadow.scrollTo(element);
assertThat(element, notNullValue());
element.click();
shadow.setExplicitWait(5, 1);
WebElement p_element = shadow.findElementByXPath("//div[@id='divid']//div[@id='node']//p");
err.println("outerHTML: " + shadow.getAttribute(p_element, "outerHTML"));
List<WebElement> elements = shadow.getChildElements(element);
assertThat(elements, notNullValue());
err.println(elements);
shadow.setExplicitWait(0, 0);
}

@Test
public void testImplicitAndExplicitWaitXPath() throws Exception {
driver.navigate().to(getPageContent("button.html"));
shadow.setImplicitWait(2);
WebElement element = shadow.findElementByXPath("//button");
shadow.scrollTo(element);
assertThat(element, notNullValue());
element.click();
shadow.setExplicitWait(5, 1);
WebElement p_element = shadow.findElementByXPath("//div[@id='divid']//div[@id='node']//p");
err.println("outerHTML: " + shadow.getAttribute(p_element, "outerHTML"));
List<WebElement> elements = shadow.getChildElements(element);
assertThat(elements, notNullValue());
err.println(elements);
shadow.setImplicitWait(0);
shadow.setExplicitWait(0, 0);
}

@Test
public void testXPath() {
driver.navigate().to(getPageContent("index.html"));
WebElement element = shadow.findElementByXPath("//body");
assertThat(element, notNullValue());
}

@Test
public void testXPathElementWithParent() {
driver.navigate().to(getPageContent("button.html"));
WebElement element = shadow.findElementByXPath("//button");
shadow.scrollTo(element);
element.click();
WebElement element1 = shadow.findElementByXPath("//div[@id='divid']");
WebElement p_element = shadow.findElementByXPath(element1, "//div[@id='node']//p");
assertThat(p_element, notNullValue());
}

@Test
public void testXPathElementsWithParent() {
driver.navigate().to(getPageContent("button.html"));
WebElement element = shadow.findElementByXPath("//button");
shadow.scrollTo(element);
element.click();
WebElement element1 = shadow.findElementByXPath("//div[@id='divid']");
List<WebElement> p_element = shadow.findElementsByXPath(element1, "//div[@id='node']//p");
assertThat(p_element.get(0), notNullValue());
}

@Test
public void testXPathWithIndex() {
driver.navigate().to(getPageContent("index.html"));
Expand Down

0 comments on commit 5e3a57f

Please sign in to comment.