Skip to content

Commit

Permalink
upgraded graphene + selenium
Browse files Browse the repository at this point in the history
  • Loading branch information
tandraschko committed Feb 28, 2024
1 parent b150f0a commit 645c0ca
Show file tree
Hide file tree
Showing 22 changed files with 76 additions and 51 deletions.
2 changes: 1 addition & 1 deletion deltaspike/modules/jsf/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>graphene-webdriver</artifactId>
<version>2.5.4</version>
<version>3.0.0-alpha.3</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void testNavigation() throws MalformedURLException
{
driver.get(new URL(contextPath, "simplePageConfig.xhtml").toString());

Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("pageBean001Called"), "true").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("pageBean001Called")), "true").apply(driver));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void testNavigation() throws MalformedURLException
{
driver.get(new URL(contextPath, "simplePageConfig.xhtml").toString());

Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("pageBean002Called"), "true").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("pageBean002Called")), "true").apply(driver));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void testNavigation() throws MalformedURLException
{
driver.get(new URL(contextPath, "simplePageConfig.xhtml").toString());

Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("pageBean003Called"), "true").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("pageBean003Called")), "true").apply(driver));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testNavigationActionMethod() throws MalformedURLException

WebElement button = driver.findElement(By.id("destination:pb001ActionMethod"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("indexPage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("indexPage")),
"You arrived at index page").apply(driver));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void testNavigationActionWithoutError() throws MalformedURLException

WebElement button = driver.findElement(By.id("destination:pb002ActionWithoutError"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("overviewPage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("overviewPage")),
"You arrived at overview page").apply(driver));
// Was redirected ?
Assert.assertTrue(driver.getCurrentUrl().contains("overview.xhtml"));
Expand All @@ -94,7 +94,7 @@ public void testNavigationActionWithError() throws MalformedURLException

WebElement button = driver.findElement(By.id("destination:pb002ActionWithError"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("customErrorPage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("customErrorPage")),
"This is a custom error page").apply(driver));
}

Expand All @@ -107,7 +107,8 @@ public void testNavigationRestrictedToPages() throws MalformedURLException

WebElement button = driver.findElement(By.id("destination:pb002RestrictedToPages"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("homePage"), "You arrived at home page")
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("homePage")), "You arrived at home page")
.apply(driver));
// Was fowarded ?
Assert.assertTrue(driver.getCurrentUrl().contains("origin.xhtml"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testNavigationActionMethod() throws MalformedURLException

WebElement button = driver.findElement(By.id("destination:pb003ActionMethod"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("indexPage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("indexPage")),
"You arrived at index page").apply(driver));
}

Expand All @@ -90,7 +90,7 @@ public void testNavigationActionMethod2() throws MalformedURLException

WebElement button = driver.findElement(By.id("destination:pb003ActionMethod2"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("homePage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("homePage")),
"You arrived at home page").apply(driver));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void testNavigationActionMethod() throws MalformedURLException

WebElement button = driver.findElement(By.id("destination:pb004ActionMethod"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("indexPage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("indexPage")),
"You arrived at index page").apply(driver));
}

Expand All @@ -89,7 +89,7 @@ public void testNavigationActionMethod2() throws MalformedURLException

WebElement button = driver.findElement(By.id("destination:pb004ActionMethod2"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("overviewPage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("overviewPage")),
"You arrived at overview page").apply(driver));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void testNavigationActionMethod() throws MalformedURLException

WebElement button = driver.findElement(By.id("destination:pb006ActionMethod"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("step1"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("step1")),
"You arrived at step1 page").apply(driver));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public void testNavigationActionWithError() throws MalformedURLException
Assert.assertNotNull(button);
button.click();
// Index Page is shown instead of DefaultErrorView because PreViewConfigNavigateEvent changed the navigation
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("indexPage"), "You arrived at index page")
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("indexPage")), "You arrived at index page")
.apply(driver));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public void testNavigationActionWithParameter() throws MalformedURLException
WebElement button = driver.findElement(By.id("parameter:pb003ActionMethod"));
button.click();

Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("simplePageConfig"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("simplePageConfig")),
"You arrived at simplePageConfig page")
.apply(driver));
System.out.println(driver.getCurrentUrl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void testNavigationActionWithParameter() throws MalformedURLException
button = driver.findElement(By.id("parameter:pb004ActionMethod"));
button.click();

Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("simplePageConfig"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("simplePageConfig")),
"You arrived at simplePageConfig page")
.apply(driver));
Assert.assertTrue(driver.getCurrentUrl().contains("cv="));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testNavigationActionOverview() throws MalformedURLException

WebElement button = driver.findElement(By.id("parameter:pb005Overview"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("overviewPage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("overviewPage")),
"You arrived at overview page")
.apply(driver));
System.out.println(driver.getCurrentUrl());
Expand All @@ -95,7 +95,7 @@ public void testNavigationActionIndex() throws MalformedURLException

WebElement button = driver.findElement(By.id("parameter:pb005Index"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("indexPage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("indexPage")),
"You arrived at index page")
.apply(driver));
System.out.println(driver.getCurrentUrl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testNavigationActionWithParameter() throws MalformedURLException

WebElement button = driver.findElement(By.id("parameter:pb006AnyMethod"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("customErrorPage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("customErrorPage")),
"This is a custom error page")
.apply(driver));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public void testConverter() throws MalformedURLException
convertedValue.sendKeys("123");
WebElement testConverterButton = driver.findElement(By.id("converter:testConverterButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("messages")), "Worked").apply(driver));
}

@Test
Expand All @@ -88,7 +89,8 @@ public void testConverterWithError() throws MalformedURLException
convertedValue.sendKeys("String Value");
WebElement testConverterButton = driver.findElement(By.id("converter:testConverterButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("converter:errorMessage"), "Value is not an Integer").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("converter:errorMessage")), "Value is not an Integer").apply(driver));
}

@Test
Expand All @@ -100,7 +102,8 @@ public void testValidator() throws MalformedURLException
convertedValue.sendKeys("DeltaSpike");
WebElement testConverterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("messages")), "Worked").apply(driver));
}

@Test
Expand All @@ -112,6 +115,7 @@ public void testValidatorWithError() throws MalformedURLException
convertedValue.sendKeys("Wrong Value");
WebElement testConverterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("validator:errorMessage"), "Not a valid value").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("validator:errorMessage")), "Not a valid value").apply(driver));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ public void testConverter() throws MalformedURLException
convertedValue.sendKeys("123");
WebElement testConverterButton = driver.findElement(By.id("converter:testConverterButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("messages")), "Worked").apply(driver));
}

@Test
Expand All @@ -87,7 +88,8 @@ public void testConverterWithError() throws MalformedURLException
convertedValue.sendKeys("String Value");
WebElement testConverterButton = driver.findElement(By.id("converter:testConverterButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("converter:errorMessage"), "Value is not an Integer").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("converter:errorMessage")), "Value is not an Integer").apply(driver));
}

@Test
Expand All @@ -99,7 +101,8 @@ public void testValidator() throws MalformedURLException
convertedValue.sendKeys("DeltaSpike");
WebElement testConverterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("messages")), "Worked").apply(driver));
}

@Test
Expand All @@ -111,6 +114,7 @@ public void testValidatorWithError() throws MalformedURLException
convertedValue.sendKeys("Wrong Value");
WebElement testConverterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("validator:errorMessage"), "Not a valid value").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("validator:errorMessage")), "Not a valid value").apply(driver));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void testConverter() throws MalformedURLException
convertedValue.sendKeys("123");
WebElement testConverterButton = driver.findElement(By.id("converter:testConverterButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("messages")), "Worked").apply(driver));
}

@Test
Expand All @@ -89,7 +90,8 @@ public void testConverterWithError() throws MalformedURLException
convertedValue.sendKeys("String Value");
WebElement testConverterButton = driver.findElement(By.id("converter:testConverterButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("converter:errorMessage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("converter:errorMessage")),
"Value is not an Integer").apply(driver));
}

Expand All @@ -102,7 +104,8 @@ public void testValidator() throws MalformedURLException
convertedValue.sendKeys("DeltaSpike");
WebElement testConverterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("messages")), "Worked").apply(driver));
}

@Test
Expand All @@ -114,7 +117,8 @@ public void testValidatorWithError() throws MalformedURLException
convertedValue.sendKeys("Wrong Value");
WebElement testConverterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("validator:errorMessage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("validator:errorMessage")),
"Not a valid value").apply(driver));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void testValidator() throws MalformedURLException
convertedValue.sendKeys("DeltaSpike");
WebElement testConverterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver));
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(
driver.findElement(By.id("messages")), "Worked").apply(driver));
}

@Test
Expand All @@ -89,7 +90,7 @@ public void testValidatorWithError() throws MalformedURLException
convertedValue.sendKeys("Wrong Value");
WebElement testConverterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConverterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("validator:errorMessage"),
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(driver.findElement(By.id("validator:errorMessage")),
"The valid value should be DeltaSpike").apply(driver));
}
}
Loading

0 comments on commit 645c0ca

Please sign in to comment.