Skip to content
Permalink
Browse files

Added template test

This should be run first to ensure a H3 template is  configured as default template.
  • Loading branch information...
mss
mss committed May 26, 2015
1 parent 00c4331 commit 3a4615ca48e4d61942fecc430e9aa3c83ed3c002
@@ -71,7 +71,7 @@ public void testGetCurrentClasspath() throws Exception {
// Test that some version of the standard libraries are in there
JARS:
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.
// "libidn-.*\\.jar$",
// "lucene-core-.*\\.jar$"
@@ -64,14 +64,14 @@
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.43.1</version>
<version>2.45.0</version>
<scope>test</scope>
</dependency>

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

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

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

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

private void setupFixture() {
@@ -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");
}
}
@@ -1,18 +1,9 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

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

<suite name="Full Functional Acceptance Test" verbose="1">
<test name="Full test" preserve-order="false">
<packages>
<package name="dk.netarkivet.systemtest.functional.*" />
<package name="dk.netarkivet.systemtest.functional" />
</packages>
</test>
<listeners>
<listener class-name="org.jaccept.TestNGListerner" />
</listeners>
</suite>

0 comments on commit 3a4615c

Please sign in to comment.
You can’t perform that action at this time.