Skip to content

Commit

Permalink
Added template test
Browse files Browse the repository at this point in the history
This should be run first to ensure a H3 template is  configured as default template.
  • Loading branch information
mss committed May 26, 2015
1 parent 00c4331 commit 3a4615c
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 16 deletions.
Expand Up @@ -71,7 +71,7 @@ public void testGetCurrentClasspath() throws Exception {
// Test that some version of the standard libraries are in there // Test that some version of the standard libraries are in there
JARS: JARS:
for (String jar : new String[] {"commons-fileupload.*\\.jar$", "commons-httpclient.*\\.jar$", for (String jar : new String[] {"commons-fileupload.*\\.jar$", "commons-httpclient.*\\.jar$",
"commons-logging.*\\.jar$", "dom4j-.*\\.jar$", "jaxen-.*\\.jar$", "jetty-.*\\.jar$", "junit-.*\\.jar$", "dom4j-.*\\.jar$", "jaxen-.*\\.jar$", "jetty-.*\\.jar$", "junit-.*\\.jar$",
// Removed as not used in common. // Removed as not used in common.
// "libidn-.*\\.jar$", // "libidn-.*\\.jar$",
// "lucene-core-.*\\.jar$" // "lucene-core-.*\\.jar$"
Expand Down
4 changes: 2 additions & 2 deletions integration-test/system-test/pom.xml
Expand Up @@ -64,14 +64,14 @@
<dependency> <dependency>
<groupId>org.seleniumhq.selenium</groupId> <groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId> <artifactId>selenium-java</artifactId>
<version>2.43.1</version> <version>2.45.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>


<dependency> <dependency>
<groupId>org.seleniumhq.selenium</groupId> <groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId> <artifactId>selenium-api</artifactId>
<version>2.43.1</version> <version>2.45.0</version>
</dependency> </dependency>


<dependency> <dependency>
Expand Down
Expand Up @@ -27,8 +27,10 @@
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;


import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.jaccept.TestEventManager;
import org.jaccept.structure.ExtendedTestCase; import org.jaccept.structure.ExtendedTestCase;
import org.jaccept.testreport.ReportGenerator; import org.jaccept.testreport.ReportGenerator;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType; import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
Expand Down Expand Up @@ -100,7 +102,8 @@ private void initialiseSelenium() {
baseUrl = testController.ENV.getGuiHost() + ":" + testController.ENV.getGuiPort(); baseUrl = testController.ENV.getGuiHost() + ":" + testController.ENV.getGuiPort();
PageHelper.initialize(driver, baseUrl); PageHelper.initialize(driver, baseUrl);
TestGUIController.waitForGUIToStart(60); TestGUIController.waitForGUIToStart(60);

TestEventManager.getInstance().addFixture("Selecting English as language");
driver.findElement(By.linkText("English")).click();
} }


private void setupFixture() { private void setupFixture() {
Expand Down
@@ -0,0 +1,78 @@
/*
* #%L
* NetarchiveSuite System test
* %%
* Copyright (C) 2005 - 2014 The Royal Danish Library, the Danish State and University Library,
* the National Library of France and the Austrian National Library.
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
package dk.netarkivet.systemtest.functional;

import static dk.netarkivet.systemtest.page.DomainWebTestHelper.HIDE_UNUSED_CONFIGURATIONS_LINK;
import static dk.netarkivet.systemtest.page.DomainWebTestHelper.HIDE_UNUSED_SEED_LISTS_LINK;
import static dk.netarkivet.systemtest.page.DomainWebTestHelper.SHOW_UNUSED_CONFIGURATIONS_LINK;
import static dk.netarkivet.systemtest.page.DomainWebTestHelper.SHOW_UNUSED_SEED_LISTS_LINK;

import java.lang.reflect.Method;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import dk.netarkivet.systemtest.AbstractSystemTest;
import dk.netarkivet.systemtest.NASAssert;
import dk.netarkivet.systemtest.page.DomainConfigurationPageHelper;
import dk.netarkivet.systemtest.page.DomainWebTestHelper;
import dk.netarkivet.systemtest.page.PageHelper;

public class TemplatePageTest extends AbstractSystemTest {

@BeforeMethod(alwaysRun = true)
public void setup(Method method) {
}

@Test(priority=-1, groups = {"guitest", "functest"})
public void updateTemplateTest() throws Exception {
addDescription("Tests that harvest tempplates can be updated.");
addStep("Goto the template page", "The template page should load");
PageHelper.gotoPage(PageHelper.MenuPages.EditHarvestTemplates);
NASAssert.assertTrue(driver.getPageSource().contains("Edit Harvest Templates"),
"Template page not loaded correctly");

addStep("Select the 'default_orderxml' in the Replace... drop down", "");
new Select(driver.findElement(By.name("order_xml_to_replace"))).selectByVisibleText("default_orderxml");

addStep("Select the 'default_orderxml' in the Replace... drop down", "");
Path currentRelativePath = Paths.get("");
String s = currentRelativePath.toAbsolutePath().toString();
driver.findElement(By.name("upload_file")).sendKeys(s + "/../../deploy/distribution/src/main/resources/order_templates_dist/default_orderxml.xml");

addStep("Click the upload button.", "The text 'The harvest template 'default_orderxml' has been updated' should be displayed");
driver.findElement(By.name("upload")).click();
NASAssert.assertTrue(driver.getPageSource().contains("The harvest template 'default_orderxml' has been updated"),
"Template not updated correctly");
}
}
15 changes: 3 additions & 12 deletions integration-test/system-test/src/test/resources/full-test.xml
@@ -1,18 +1,9 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >


<suite name="Full Functional Acceptance Test" verbose="1" > <suite name="Full Functional Acceptance Test" verbose="1">
<test name="Full test"> <test name="Full test" preserve-order="false">
<groups>
<run>
<include name="functest"/>
</run>
</groups>

<packages> <packages>
<package name="dk.netarkivet.systemtest.functional.*" /> <package name="dk.netarkivet.systemtest.functional" />
</packages> </packages>
</test> </test>
<listeners>
<listener class-name="org.jaccept.TestNGListerner" />
</listeners>
</suite> </suite>

0 comments on commit 3a4615c

Please sign in to comment.