Skip to content

Commit

Permalink
Merge branch 'master' into feature/user-search
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Aug 28, 2015
2 parents 1d2a4d0 + 9054e31 commit 389ce0c
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 188 deletions.
28 changes: 28 additions & 0 deletions build-system/pom.xml
Expand Up @@ -1019,6 +1019,34 @@
</plugins>
</build>
</profile>
<profile>
<id>wstest</id>
<build>
<plugins>
<plugin>
<!-- Skip all tests by default. We only want selected tests to run. -->
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>guitest</id>
<build>
<plugins>
<plugin>
<!-- Skip all tests by default. We only want selected tests to run. -->
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
Expand Down
12 changes: 12 additions & 0 deletions testing/pom.xml
Expand Up @@ -55,6 +55,18 @@
<module>conntest</module>
</modules>
</profile>
<profile>
<id>guitest</id>
<modules>
<module>selenidetest</module>
</modules>
</profile>
<profile>
<id>wstest</id>
<modules>
<module>wstest</module>
</modules>
</profile>
</profiles>

</project>
16 changes: 16 additions & 0 deletions testing/selenidetest/pom.xml
Expand Up @@ -98,4 +98,20 @@
<version>4.0.6.RELEASE</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>guitest</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
<argLine>-XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Expand Up @@ -7,7 +7,8 @@
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 java.io.File;
import java.util.HashMap;
Expand Down Expand Up @@ -87,25 +88,27 @@ public class AbstractSelenideTest{

Logger LOGGER = Logger.getLogger(AbstractSelenideTest.class);

// protected AbstractSelenideTest() {
// SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
// // configure log4j properties file
//// DOMConfigurator.configure("log4j.xml");
//// PropertyConfigurator.configure("log4j.properties");
// }
private static final String PARAM_SITE_URL = "site.url";
public String siteUrl;


@BeforeClass(alwaysRun = true)
public void beforeClass(ITestContext context) {
siteUrl = context.getCurrentXmlTest().getParameter(PARAM_SITE_URL);
}

//Login util methods
/**
* Log in to MidPoint as administrator
*/
protected void login(){
//perform login
login(SITE_URL, ADMIN_LOGIN, ADMIN_PASSWORD);
login(siteUrl, ADMIN_LOGIN, ADMIN_PASSWORD);
}

protected void login(String username, String password){
//perform login
login(SITE_URL, username, password);
login(siteUrl, username, password);
}

protected void login(String siteUrl, String username, String password) {
Expand Down
Expand Up @@ -49,7 +49,6 @@ public class CsvAccountTests extends AbstractSelenideTest {

@Test(priority = 0)
public void test001createCsvAccount() {
// LOGGER.info("aaaaaaaaaaaaa");
close();
login();
//check if welcome message appears after user logged in
Expand Down Expand Up @@ -102,6 +101,16 @@ public void test001createCsvAccount() {
System.out.println(isAccountExistInCsvFile(CSV_FILE_PATH, ACCOUNT_NAME_VALUE, ACCOUNT_FIRST_NAME_VALUE, ACCOUNT_LAST_NAME_VALUE, ACCOUNT_PASSWORD_VALUE));
}

/**
* check if account entry was created in the CSV file
* after account creating in the MidPoint
* @param csvFilePath
* @param accountName
* @param accountFirstName
* @param accountLastName
* @param accountPassword
* @return
*/
public boolean isAccountExistInCsvFile(String csvFilePath, String accountName,
String accountFirstName, String accountLastName, String accountPassword) {
BufferedReader br = null;
Expand Down Expand Up @@ -138,18 +147,17 @@ public boolean isAccountExistInCsvFile(String csvFilePath, String accountName,
return false;
}

/**
* Update icfccsvfile:filePath tag value, set the correct
* path to midpoint-flatfile.csv file
*/
public void updateCsvFilePath() {
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(CSV_RESOURCE_XML_PATH);

// Get the staff element , it may not working if tag has spaces, or
// whatever weird characters in front...it's better to use
// getElementsByTagName() to get it directly.
// Node staff = company.getFirstChild();

// Get the staff element by tag name directly
// Get the CSV filePath element by tag name directly
Node filePathNode = doc.getElementsByTagName("icfccsvfile:filePath").item(0);
filePathNode.setTextContent(System.getProperty("user.dir") + "/src/test/resources/mp-resources/midpoint-flatfile.csv");

Expand All @@ -159,9 +167,6 @@ public void updateCsvFilePath() {
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File(CSV_RESOURCE_XML_PATH));
transformer.transform(source, result);

System.out.println("Done");

} catch (ParserConfigurationException pce) {
pce.printStackTrace();
} catch (TransformerException tfe) {
Expand Down
Expand Up @@ -21,9 +21,8 @@ public class LoginTest extends AbstractSelenideTest {
*/
@Test
public void test001loginWithCorrectCredentialsTest(){
open(SITE_URL);
//perform login
login(SITE_URL, ADMIN_LOGIN, ADMIN_PASSWORD);
login(ADMIN_LOGIN, ADMIN_PASSWORD);

//check if welcome message appears after user logged in
$(byText("welcome to midPoint")).shouldBe(visible);
Expand All @@ -39,9 +38,8 @@ public void test001loginWithCorrectCredentialsTest(){
*/
@Test
public void test002loginWithIncorrectUsernameTest(){
open(SITE_URL);
//perform login
login(SITE_URL, "incorrectUserName", ADMIN_PASSWORD);
login("incorrectUserName", ADMIN_PASSWORD);

//check if error message appears
$(byText("Invalid username and/or password.")).shouldBe(visible);
Expand All @@ -54,9 +52,8 @@ public void test002loginWithIncorrectUsernameTest(){
*/
@Test
public void test003loginWithoutUsernameTest(){
open(SITE_URL);
//perform login
login(SITE_URL, "", ADMIN_PASSWORD);
login("", ADMIN_PASSWORD);

//check if error message appears
$(By.className("messages-error")).find(by("title", "Partial error")).shouldBe(visible);
Expand All @@ -69,9 +66,8 @@ public void test003loginWithoutUsernameTest(){
*/
@Test
public void test004loginWithIncorrectPasswordTest(){
open(SITE_URL);
//perform login
login(SITE_URL, ADMIN_LOGIN, "incorrectPassword");
login(ADMIN_LOGIN, "incorrectPassword");

//check if error message appears
$(byText("Invalid username and/or password.")).shouldBe(visible);
Expand All @@ -84,9 +80,8 @@ public void test004loginWithIncorrectPasswordTest(){
*/
@Test
public void test005loginWithoutPasswordTest(){
open(SITE_URL);
//perform login
login(SITE_URL, ADMIN_LOGIN, "");
login(ADMIN_LOGIN, "");

//check if error message appears
$(By.className("messages-error")).find(by("title", "Partial error")).shouldBe(visible);
Expand Down
1 change: 1 addition & 0 deletions testing/selenidetest/testng.xml
Expand Up @@ -17,6 +17,7 @@
-->
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="selenidetests" parallel="false">
<parameter name="site.url" value="http://localhost:9080/midpoint"/>
<suite-files>
<suite-file path="./basic-tests-suite.xml"/>
</suite-files>
Expand Down
84 changes: 0 additions & 84 deletions testing/selenium-tests/pom.xml

This file was deleted.

30 changes: 0 additions & 30 deletions testing/selenium-tests/src/test/resources/logback-test.xml

This file was deleted.

0 comments on commit 389ce0c

Please sign in to comment.