Skip to content

Commit

Permalink
Merge pull request #13 from robertgates55/develop
Browse files Browse the repository at this point in the history
Created a method for AngularJS requests in BasePage due to needing to…
  • Loading branch information
jleeh committed Aug 20, 2015
2 parents a1e85c5 + 614c1e1 commit e80dc66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.frameworkium</groupId>
<artifactId>Frameworkium-core</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>

<name>Frameworkium-core</name>
<description>Frameworkium core code. Referenced by the com.frameworkium project, with example tests.</description>
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/com/frameworkium/pages/internal/BasePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import java.util.concurrent.TimeUnit;

import com.paulhammant.ngwebdriver.WaitForAngularRequestsToFinish;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -25,8 +26,6 @@
import com.frameworkium.tests.internal.BaseTest;
import com.google.inject.Inject;

import static com.paulhammant.ngwebdriver.WaitForAngularRequestsToFinish.waitForAngularRequestsToFinish;

public abstract class BasePage<T extends BasePage<T>> {

@Inject
Expand Down Expand Up @@ -59,7 +58,7 @@ public T get() {
HtmlElementLoader.populatePageObject(this, driver);
try {
if(isPageAngularJS()) {
waitForAngularRequestsToFinish((JavascriptExecutor) driver);
waitForAngularRequestsToFinish();
}
waitForExpectedVisibleElements(this);
try {
Expand Down Expand Up @@ -204,6 +203,15 @@ public Object executeJS(String javascript) {
return returnObj;
}

/**
* Method to wait for AngularJS requests to finish on the page
*/
public void waitForAngularRequestsToFinish() {
driver.manage().timeouts().setScriptTimeout(10, TimeUnit.SECONDS);
WaitForAngularRequestsToFinish
.waitForAngularRequestsToFinish((JavascriptExecutor) driver);
}

/**
* Method which executes an async JS call
*
Expand Down

0 comments on commit e80dc66

Please sign in to comment.