Skip to content

Commit c43bad6

Browse files
author
Max Saperstone
committed
Updating to new structure
1 parent 8ee707b commit c43bad6

File tree

5 files changed

+27
-21
lines changed

5 files changed

+27
-21
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@
2121

2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
24+
25+
# build data
26+
**/target
27+
**/test-output
28+
**/lib
29+
**/.idea

selenified/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6-
<groupId>com.coveros.selenified</groupId>
7-
<artifactId>example</artifactId>
6+
<groupId>com.coveros</groupId>
7+
<artifactId>selenified-example</artifactId>
88
<version>0.0.1-SNAPSHOT</version>
99
<name>My Example Selenified Project</name>
1010

1111
<dependencies>
1212
<dependency>
1313
<groupId>com.coveros</groupId>
1414
<artifactId>selenified</artifactId>
15-
<version>3.0.2</version>
15+
<version>3.1.0</version>
1616
</dependency>
1717
</dependencies>
1818

selenified/src/test/java/GoogleIT.java renamed to selenified/src/test/java/CoverosIT.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,26 @@
66
import org.testng.annotations.BeforeClass;
77
import org.testng.annotations.Test;
88

9-
public class GoogleIT extends Selenified {
9+
public class CoverosIT extends Selenified {
1010

1111
@BeforeClass(alwaysRun = true)
1212
public void beforeClass(ITestContext test) {
1313
// set the base URL for the tests here
14-
setTestSite(this, test, "https://www.google.com");
14+
setTestSite(this, test, "https://www.coveros.com");
1515
}
1616

1717
@Test
18-
public void cheeseSearch() {
18+
public void seleniumSearch() {
1919
// use this object to manipulate the app
2020
App app = this.apps.get();
2121
// identify our elements
22-
Element search = app.newElement(Locator.NAME, "q");
23-
Element searchResults = app.newElement(Locator.ID, "ires");
22+
Element search = app.newElement(Locator.ID, "s");
2423
// perform the search
25-
search.type("cheese");
24+
search.type("selenium");
2625
search.submit();
2726
// wait for the search to run
28-
searchResults.waitFor().displayed();
29-
app.azzert().titleEquals("cheese - Google Search");
27+
app.waitFor().titleEquals("You searched for selenium - Coveros");
28+
app.azzert().titleEquals("You searched for selenium - Coveros");
3029
// close out the test
3130
finish();
3231
}

selenium/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6-
<groupId>com.coveros.selenium</groupId>
7-
<artifactId>example</artifactId>
6+
<groupId>com.coveros</groupId>
7+
<artifactId>selenium-example</artifactId>
88
<version>0.0.1-SNAPSHOT</version>
99
<name>My Example Selenium Project</name>
1010

selenium/src/test/java/GoogleIT.java renamed to selenium/src/test/java/CoverosIT.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import org.openqa.selenium.support.ui.WebDriverWait;
77
import org.testng.annotations.Test;
88

9-
public class GoogleIT {
9+
public class CoverosIT {
1010

1111
@Test
12-
public void cheeseSearch() {
12+
public void seleniumSearch() {
1313
//for linux/mac installations
1414
// System.setProperty("webdriver.gecko.driver", "lib/geckodriver");
1515
//for windows installations
@@ -20,33 +20,34 @@ public void cheeseSearch() {
2020
WebDriver driver = new FirefoxDriver();
2121

2222
// And now use this to visit Google
23-
driver.get("http://www.google.com");
23+
driver.get("https://www.coveros.com");
2424
// Alternatively the same thing can be done like this
25-
// driver.navigate().to("http://www.google.com");
25+
// driver.navigate().to("https://www.coveros.com");
2626

2727
// Find the text input element by its name
28-
WebElement element = driver.findElement(By.name("q"));
28+
WebElement element = driver.findElement(By.id("s"));
2929

3030
// Enter something to search for
31-
element.sendKeys("Cheese!");
31+
element.sendKeys("selenium");
3232

3333
// Now submit the form. WebDriver will find the form for us from the element
3434
element.submit();
3535

3636
// Check the title of the page
3737
System.out.println("Page title is: " + driver.getTitle());
3838

39-
// Google's search is rendered dynamically with JavaScript.
39+
// Coveros's search is rendered dynamically with JavaScript.
4040
// Wait for the page to load, timeout after 10 seconds
4141
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
4242
public Boolean apply(WebDriver d) {
43-
return d.getTitle().toLowerCase().startsWith("cheese!");
43+
return d.getTitle().startsWith("You searched for");
4444
}
4545
});
4646

4747
// Should see: "cheese! - Google Search"
4848
System.out.println("Page title is: " + driver.getTitle());
4949

50+
5051
//Close the browser
5152
driver.quit();
5253
}

0 commit comments

Comments
 (0)