Skip to content

Commit

Permalink
Merge pull request #164 from dimuthud/master
Browse files Browse the repository at this point in the history
Fixing the UI test cases.
  • Loading branch information
irham0019 committed May 14, 2015
2 parents ab71f76 + 0e9ea01 commit 149a963
Show file tree
Hide file tree
Showing 34 changed files with 1,106 additions and 712 deletions.
2 changes: 1 addition & 1 deletion modules/integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<modules>
<module>tests-common</module>
<module>tests-integration</module>
<!--<module>tests-ui-integration</module>-->
<module>tests-ui-integration</module>
<!--<module>tests-platform</module>-->
</modules>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import org.json.JSONObject;
import org.wso2.carbon.automation.test.utils.http.client.HttpResponse;

//Todo - class comment
/**
* verify json object received in http response
*/
public class VerificationUtil {
public static void checkErrors(HttpResponse response) throws Exception {
JSONObject jsonObject = new JSONObject(response.getData());
Expand Down
9 changes: 9 additions & 0 deletions modules/integration/tests-ui-integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ under the License.
<inherited>false</inherited>
<configuration>
<argLine>-Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m</argLine>
<!--<argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=128m -Xmx1024m -XX:PermSize=256m
-XX:MaxPermSize=512m -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006
</argLine>-->
<skipTests>${skipUiTests}</skipTests>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng-server-mgt.xml</suiteXmlFile>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
Expand Down Expand Up @@ -284,4 +289,8 @@ under the License.
</dependency>
</dependencies>

<properties>
<skipUiTests>true</skipUiTests>
</properties>

</project>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.am.integration.ui.tests.util.TestUtil;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;

public class APIMANAGER2604ApplicationPaginationTestCase extends AMIntegrationUiTestBase {
public class APIMANAGER2604ApplicationPaginationTestCase extends APIMIntegrationUiTestBase {

private WebDriver driver;
private final String TEST_DATA_USERNAME = "admin";
Expand All @@ -49,6 +50,9 @@ public void setUp() throws Exception {

@Test(groups = "wso2.am", description = "verify pagination in application creation page")
public void appCreationPaginationTest() throws Exception {

WebDriverWait wait = new WebDriverWait(driver, 60);

driver.get(getStoreURL() + "/?tenant=" + MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);

log.info("Started to Login to Store");
Expand All @@ -58,8 +62,8 @@ public void appCreationPaginationTest() throws Exception {

userNameField.sendKeys(TEST_DATA_USERNAME);
passwordField.sendKeys(TEST_DATA_PASSWORD);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("loginBtn")));
driver.findElement(By.id("loginBtn")).click();
WebDriverWait wait = new WebDriverWait(driver, 10);

//check the presence of admin name in store home page to verify the user has logged to store.
wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText(TEST_DATA_USERNAME)));
Expand All @@ -84,6 +88,8 @@ public void appCreationPaginationTest() throws Exception {
create application for the given application name
*/
private void createApplication(String appName) {
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("application-name")));
WebElement name = driver.findElement(By.id("application-name"));
name.sendKeys(appName);
WebElement tier = driver.findElement(By.id("appTier"));
Expand All @@ -102,6 +108,9 @@ private void createApplication(String appName) {

@AfterClass(alwaysRun = true)
public void tearDown() throws Exception {
TestUtil.cleanUp(gatewayContext.getContextTenant().getContextUser().getUserName(),
gatewayContext.getContextTenant().getContextUser().getPassword(),
storeUrls.getWebAppURLHttp(), publisherUrls.getWebAppURLHttp());
driver.quit();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.am.integration.test.utils.bean.APIRequest;
import org.wso2.am.integration.test.utils.clients.APIPublisherRestClient;
import org.wso2.am.integration.ui.tests.util.TestUtil;
import org.wso2.carbon.automation.extensions.selenium.BrowserManager;

import java.net.URL;
Expand All @@ -38,7 +41,7 @@
* and when we try to edit description of created API, the description was not found.
* This was fixed and will test by this test case.
*/
public class APIMANAGER3026DescriptionFieldTestCase extends AMIntegrationUiTestBase {
public class APIMANAGER3026DescriptionFieldTestCase extends APIMIntegrationUiTestBase {

private WebDriver driver;
private APIPublisherRestClient apiPublisher;
Expand All @@ -50,7 +53,7 @@ public class APIMANAGER3026DescriptionFieldTestCase extends AMIntegrationUiTestB
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
super.init();
apiPublisher = new APIPublisherRestClient(contextUrls.getWebAppURL());
apiPublisher = new APIPublisherRestClient(publisherUrls.getWebAppURLHttp());
driver = BrowserManager.getWebDriver();
}

Expand All @@ -72,6 +75,8 @@ public void testDescriptionField() throws Exception {
apiRequest.setSandbox(url);
apiPublisher.addAPI(apiRequest);

WebDriverWait wait = new WebDriverWait(driver, 30);

driver.get(getPublisherURL());

driver.findElement(By.id("username")).clear();
Expand All @@ -86,6 +91,7 @@ public void testDescriptionField() throws Exception {
driver.get(getPublisherURL() + "/design?name=" + APIName + "&version=" + APIVersion +
"&provider=" + userName);

wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("description")));
WebElement descriptionElement = driver.findElement(By.id("description"));
String elementVal = descriptionElement.getText();
log.info("description value : " + elementVal);
Expand All @@ -95,6 +101,9 @@ public void testDescriptionField() throws Exception {

@AfterClass(alwaysRun = true)
public void tearDown() throws Exception {
TestUtil.cleanUp(gatewayContext.getContextTenant().getContextUser().getUserName(),
gatewayContext.getContextTenant().getContextUser().getPassword(),
storeUrls.getWebAppURLHttp(), publisherUrls.getWebAppURLHttp());
driver.quit();
}
}
Loading

0 comments on commit 149a963

Please sign in to comment.