Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created selenidetest module for automation tests, added some tests
PageResource.html and PageResource.java: changed the id of the element from basichSearch to basicSearch
- Loading branch information
1 parent
983a22f
commit cdb9831
Showing
20 changed files
with
607 additions
and
514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<name>Selenide tests</name> | ||
<groupId>com.evolveum.midpoint.testing</groupId> | ||
<artifactId>selenidetest</artifactId> | ||
<version>3.2-SNAPSHOT</version> | ||
|
||
<parent> | ||
<artifactId>testing</artifactId> | ||
<groupId>com.evolveum.midpoint</groupId> | ||
<version>3.2-SNAPSHOT</version> | ||
</parent> | ||
<scm> | ||
<connection>https://github.com/Evolveum/midpoint.git</connection> | ||
<developerConnection>git@github.com:Evolveum/midpoint.git</developerConnection> | ||
<url>https://fisheye.evolveum.com/browse/midPoint</url> | ||
</scm> | ||
<organization> | ||
<name>Evolveum</name> | ||
<url>http://www.evolveum.com</url> | ||
</organization> | ||
<licenses> | ||
<license> | ||
<name>Apache License v2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
<issueManagement> | ||
<system>Atlassian JIRA</system> | ||
<url>http://jira.evolveum.com/</url> | ||
</issueManagement> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.8.1</version> | ||
<configuration> | ||
<forkMode>pertest</forkMode> | ||
<parallel>classes</parallel> | ||
<perCoreThreadCount>false</perCoreThreadCount> | ||
<threadCount>1</threadCount> | ||
<runOrder>alphabetical</runOrder> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<!--<dependency>--> | ||
<!--<groupId>com.evolveum.midpoint.infra</groupId>--> | ||
<!--<artifactId>util</artifactId>--> | ||
<!--<version>3.2-SNAPSHOT</version>--> | ||
<!--<scope>test</scope>--> | ||
<!--</dependency>--> | ||
<dependency> | ||
<groupId>com.codeborne</groupId> | ||
<artifactId>selenide</artifactId> | ||
<version>2.21</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.json</groupId> | ||
<artifactId>json</artifactId> | ||
<version>20090211</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
<version>4.0.6.RELEASE</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-beans</artifactId> | ||
<version>4.0.6.RELEASE</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
54 changes: 54 additions & 0 deletions
54
...ing/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/BaseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.evolveum.midpoint.testing.selenide.tests; | ||
|
||
import org.openqa.selenium.By; | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; | ||
import org.springframework.web.context.support.SpringBeanAutowiringSupport; | ||
import org.testng.ITestContext; | ||
import org.testng.annotations.BeforeClass; | ||
|
||
import static com.codeborne.selenide.Condition.enabled; | ||
import static com.codeborne.selenide.Condition.visible; | ||
import static com.codeborne.selenide.Selenide.$; | ||
import static com.codeborne.selenide.Selenide.open; | ||
|
||
/** | ||
* Created by Kate on 09.08.2015. | ||
*/ | ||
@ContextConfiguration(locations = {"classpath:spring-module.xml"}) | ||
public class BaseTest extends AbstractTestNGSpringContextTests { | ||
private static final String PARAM_SITE_URL = "site.url"; | ||
private static final String PARAM_USER_LOGIN = "user.login"; | ||
private static final String PARAM_USER_PASSWORD = "user.password"; | ||
|
||
public String siteUrl; | ||
public String userLogin; | ||
public String userPassword; | ||
|
||
|
||
public BaseTest(){ | ||
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this); | ||
} | ||
|
||
@BeforeClass(alwaysRun = true) | ||
public void beforeClass(ITestContext context) { | ||
siteUrl = context.getCurrentXmlTest().getParameter(PARAM_SITE_URL); | ||
userLogin = context.getCurrentXmlTest().getParameter(PARAM_USER_LOGIN); | ||
userPassword = context.getCurrentXmlTest().getParameter(PARAM_USER_PASSWORD); | ||
} | ||
|
||
public void login(String siteUrl, String username, String password) { | ||
//opens login page | ||
open(siteUrl); | ||
//enter login value | ||
$(By.name("username")).shouldBe(visible).setValue(username); | ||
//enter password value | ||
$(By.name("password")).shouldBe(visible).setValue(password); | ||
//click Sign in button | ||
$(By.cssSelector("html.no-js body div.mp-main-container div.row.mainContainer div.row div.col-md-offset-2.col-md-8.col-lg-offset-4.col-lg-4 div.panel.panel-default div.panel-body form#id6.form-horizontal input.btn.btn-primary.pull-right")).shouldBe(enabled).click(); | ||
} | ||
|
||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...ng/selenidetest/src/test/java/com/evolveum/midpoint/testing/selenide/tests/LoginTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.evolveum.midpoint.testing.selenide.tests; | ||
|
||
import org.openqa.selenium.By; | ||
import org.testng.annotations.Test; | ||
import static com.codeborne.selenide.Selenide.*; | ||
import static com.codeborne.selenide.Condition.*; | ||
|
||
/** | ||
* Created by Kate on 07.08.2015. | ||
*/ | ||
public class LoginTest extends BaseTest{ | ||
|
||
/** | ||
* Log in to system as administrator/5ecr3t | ||
*/ | ||
@Test | ||
public void loginWithCorrectCredentialsTest(){ | ||
//perform login | ||
login(siteUrl, userLogin, userPassword); | ||
|
||
//check if welcome message appears after user logged in | ||
$(By.cssSelector("html.no-js body div.mp-main-container div.row.mainContainer div.page-header h1 small")).shouldHave(text("welcome to midPoint")); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...src/test/java/com/evolveum/midpoint/testing/selenide/tests/account/CreateAccountTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.evolveum.midpoint.testing.selenide.tests.account; | ||
|
||
/** | ||
* Created by Kate on 09.08.2015. | ||
*/ | ||
|
||
import com.evolveum.midpoint.testing.selenide.tests.BaseTest; | ||
import com.evolveum.midpoint.testing.selenide.tests.resource.ImportResourceTest; | ||
import com.evolveum.midpoint.testing.selenide.tests.resource.ResourceUtil; | ||
import com.evolveum.midpoint.testing.selenide.tests.user.UserUtil; | ||
import org.openqa.selenium.By; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import org.testng.annotations.Test; | ||
|
||
import static com.codeborne.selenide.Condition.*; | ||
import static com.codeborne.selenide.Selenide.$; | ||
|
||
@Component | ||
public class CreateAccountTest extends BaseTest{ | ||
|
||
@Autowired | ||
UserUtil userUtil; | ||
|
||
@Autowired | ||
ResourceUtil resourceUtil; | ||
|
||
@Autowired | ||
ImportResourceTest importResourceTest; | ||
|
||
@Autowired | ||
BaseTest baseTest; | ||
|
||
/** | ||
* Prerequirement: Test user is to be created (see CreateUserTest.createUserTest()) | ||
*/ | ||
@Test | ||
public void createOpendjAccountForUser(){ | ||
//open Users page | ||
userUtil.openListUsersPage(); | ||
|
||
//search for user in users list | ||
userUtil.searchForUser(userUtil.getTestUserName()).shouldBe(visible).click(); | ||
|
||
//click on the menu icon in the Accounts section | ||
$(By.xpath("/html/body/div[4]/div/form/div[3]/div[2]/div[1]/div/div[2]/ul/li/a")).shouldBe(visible).click(); | ||
//click on the Add account menu item | ||
$(By.linkText("Add account")).shouldBe(visible).click(); | ||
|
||
//search for OpenDJ resource in resources list in the opened Select resource(s) window | ||
resourceUtil.searchForOpendjResource(resourceUtil.getTestResourceName(), "/html/body/div[6]/form/div/div[2]/div/div/div/div[2]/div/div/div/div/div/div[2]/div/table/tbody/tr/td[2]/div"); | ||
|
||
//select check box in the first row for "Localhost OpenDJ (no extension schema)" resource | ||
$(By.name("resourcePopup:content:table:table:body:rows:4:cells:1:cell:check")).shouldBe(visible).click(); | ||
//click Add resource(s) button | ||
$(By.linkText("Add resource(s)")).shouldBe(enabled).click(); | ||
|
||
//Fill in account fields: Common name, Surname, first and second password fields | ||
$(By.name("accounts:accountList:0:account:body:containers:0:container:properties:3:property:values:0:value:valueContainer:input:input")).shouldBe(visible).setValue("Common name"); | ||
$(By.name("accounts:accountList:0:account:body:containers:0:container:properties:42:property:values:0:value:valueContainer:input:input")).shouldBe(visible).setValue("Surname"); | ||
$(By.name("accounts:accountList:0:account:body:containers:5:container:properties:0:property:values:0:value:valueContainer:input:password2")).shouldBe(visible).setValue("password"); | ||
$(By.name("accounts:accountList:0:account:body:containers:5:container:properties:0:property:values:0:value:valueContainer:input:password1")).shouldBe(visible).setValue("password"); | ||
|
||
//click Save button | ||
$(By.xpath("/html/body/div[4]/div/form/div[6]/a[2]")).shouldHave(text("Save")).click(); | ||
|
||
//check if Success message appears after user saving | ||
$(By.xpath("/html/body/div[4]/div/div[2]/div[1]/ul/li/div/div[1]/div[1]/span")).shouldHave(text("Success")); | ||
|
||
//search for user in users list | ||
userUtil.searchForUser(userUtil.getTestUserName()).shouldBe(visible).click(); | ||
|
||
//check if the created account is displayed in the Accounts section | ||
$(By.linkText(resourceUtil.getTestResourceName())).shouldBe(visible); | ||
|
||
} | ||
|
||
|
||
} |
48 changes: 48 additions & 0 deletions
48
...va/com/evolveum/midpoint/testing/selenide/tests/resource/CheckResourceConnectionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.evolveum.midpoint.testing.selenide.tests.resource; | ||
|
||
import com.evolveum.midpoint.testing.selenide.tests.BaseTest; | ||
import org.openqa.selenium.By; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import org.testng.annotations.Test; | ||
|
||
import static com.codeborne.selenide.Condition.*; | ||
import static com.codeborne.selenide.Selenide.$; | ||
import static com.codeborne.selenide.Selenide.title; | ||
|
||
/** | ||
* Created by Kate on 09.08.2015. | ||
*/ | ||
@Component | ||
public class CheckResourceConnectionTest extends BaseTest{ | ||
|
||
@Autowired | ||
ImportResourceTest importResourceTest; | ||
|
||
@Autowired | ||
BaseTest baseTest; | ||
|
||
@Autowired | ||
ResourceUtil resourceUtil; | ||
|
||
@Test | ||
public void checkOpendjResourceConnectionTest(){ | ||
//open Resources -> List Resources | ||
$(By.xpath("/html/body/div[3]/div/div[2]/ul[1]/li[4]/a")).shouldHave(text("Resources")).click(); | ||
$(By.linkText("List resources")).click(); | ||
|
||
//search for OpenDJ resource in resources list | ||
resourceUtil.searchForOpendjResource(resourceUtil.getTestResourceName(), "/html/body/div[4]/div/form[2]/div[2]/table/tbody/tr/td[2]/div/a/span").click(); | ||
|
||
//click Test connection button | ||
$(By.xpath("/html/body/div[4]/div/form/div[4]/a[1]")).should(appear).click(); | ||
|
||
//check if all statuses are succeeded | ||
$(By.xpath("/html/body/div[4]/div/form/div[2]/div[2]/div/table/tbody/tr[1]/td[2]/i")).shouldHave(hasAttribute("title", "Success")); | ||
$(By.xpath("/html/body/div[4]/div/form/div[2]/div[2]/div/table/tbody/tr[2]/td[2]/i")).shouldHave(hasAttribute("title", "Success")); | ||
$(By.xpath("/html/body/div[4]/div/form/div[2]/div[2]/div/table/tbody/tr[3]/td[2]/i")).shouldHave(hasAttribute("title", "Success")); | ||
$(By.xpath("/html/body/div[4]/div/form/div[2]/div[2]/div/table/tbody/tr[4]/td[2]/i")).shouldHave(hasAttribute("title", "Success")); | ||
$(By.xpath("/html/body/div[4]/div/form/div[2]/div[2]/div/table/tbody/tr[5]/td[2]/i")).shouldHave(hasAttribute("title", "Success")); | ||
|
||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...c/test/java/com/evolveum/midpoint/testing/selenide/tests/resource/ImportResourceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.evolveum.midpoint.testing.selenide.tests.resource; | ||
|
||
import com.codeborne.selenide.SelenideElement; | ||
import com.evolveum.midpoint.testing.selenide.tests.BaseTest; | ||
import org.openqa.selenium.By; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import org.testng.annotations.Test; | ||
|
||
import java.io.File; | ||
|
||
import static com.codeborne.selenide.Condition.*; | ||
import static com.codeborne.selenide.Selenide.$; | ||
|
||
/** | ||
* Created by Kate on 09.08.2015. | ||
*/ | ||
@Component | ||
public class ImportResourceTest extends BaseTest{ | ||
|
||
@Autowired | ||
BaseTest baseTest; | ||
|
||
@Autowired | ||
ResourceUtil resourceUtil; | ||
|
||
|
||
/** | ||
* Import OpenDJ resource test (file "opendj-localhost-resource-sync-no-extension-advanced.xml" is used) | ||
*/ | ||
@Test | ||
public void importOpendjResourceTest(){ | ||
|
||
//click Configuration menu | ||
$(By.xpath("/html/body/div[3]/div/div[2]/ul[1]/li[8]/a")) | ||
.shouldHave(text("Configuration")).click(); | ||
|
||
//click Import object menu item | ||
$(By.linkText("Import object")).click(); | ||
|
||
//select Overwrite existing object check box | ||
$(By.name("importOptions:overwriteExistingObject")).setSelected(true); | ||
|
||
//Specify the file to be uploaded | ||
File test = new File("../../samples/resources/opendj/opendj-localhost-resource-sync-no-extension-advanced.xml"); | ||
$(By.name("input:inputFile:fileInput")).uploadFile(test); | ||
|
||
//click Import object button | ||
$(By.xpath("/html/body/div[4]/div/form/div[6]/a")).shouldHave(text("Import object")).click(); | ||
|
||
//check if Success message appears after resource importing | ||
$(By.xpath("/html/body/div[4]/div/div[2]/div[1]/ul/li/div/div[1]/div[1]/span")).shouldHave(text("Success")); | ||
|
||
//open Resources -> List Resources | ||
$(By.xpath("/html/body/div[3]/div/div[2]/ul[1]/li[4]/a")).shouldHave(text("Resources")).click(); | ||
$(By.linkText("List resources")).click(); | ||
|
||
//search for OpenDJ resource in resources list | ||
resourceUtil.searchForOpendjResource(resourceUtil.getTestResourceName(), "/html/body/div[4]/div/form[2]/div[2]/table/tbody/tr/td[2]/div/a/span") | ||
.shouldBe(visible); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
} |
Oops, something went wrong.