Commit 9860b678cd87702efdf84979d668f53b8e24ed36

Authored by Nelson Torres Universidade U Minho
1 parent 6a2670dc67
Exists in master

added Lareferencia tests - first draft

changed validartor class to validator
README.md
... ... @@ -41,12 +41,12 @@ Ver na classe CustomDataProvider os tipos existentes.
41 41 import static org.testng.Assert.assertTrue;
42 42 import org.openqa.selenium.By;
43 43 import org.testng.annotations.Test;
44   - import dataproviders.DataProviderPortalValidartor;
  44 + import dataproviders.DataProviderPortalValidator;
45 45 import testng.rcaap.TestBase;
46 46  
47 47 public class VerifyContactTest extends TestBase{
48 48  
49   - @Test(dataProvider = "validators-url", dataProviderClass = DataProviderPortalValidartor.class)
  49 + @Test(dataProvider = "validators-url", dataProviderClass = DataProviderPortalValidator.class)
50 50 public void testVerifyContact(String baseUrl) throws Exception {
51 51 driver.get(baseUrl + "/validator2/");
52 52 driver.findElement(By.xpath("//a[contains(@href, 'contact')]")).click();
... ... @@ -66,7 +66,7 @@ Ver na classe CustomDataProvider os tipos existentes.
66 66 import static org.testng.Assert.assertTrue;
67 67 import org.openqa.selenium.By;
68 68 import org.testng.annotations.Test;
69   - import dataproviders.DataProviderPortalValidartor;
  69 + import dataproviders.DataProviderPortalValidator;
70 70 import testng.rcaap.TestBase;
71 71  
72 72 public class VerifyContactTest extends TestBase{
... ... @@ -104,7 +104,7 @@ Ver na classe CustomDataProvider os tipos existentes.
104 104  
105 105 Exemplo:
106 106  
107   - mvn test -Dsuite=testeng.xml -DbaseURL=http://teste.pt -Dteste=Login,TestMenu#testA+testC
  107 + mvn test -Dsuite=testng.xml -DbaseURL=http://teste.pt -Dteste=Login,TestMenu#testA+testC
108 108  
109 109 ### Correr testes com Login (SARI)
110 110  
... ...
TestNGResources/Lrharvester/testng-lrharvester.xml
... ... @@ -0,0 +1,29 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
  3 +<!-- Threading count to execute paralel tests and parallel set to tests (classes see documentation) -->
  4 +<!-- I think if We have 2 classes they will run in parallel -->
  5 +<suite name="Lrharvester" parallel="classes" thread-count="3">
  6 + <test name="Lrharvester-Public" group-by-instances="true" >
  7 + <classes>
  8 +
  9 + <class name="testng.lrharvester.TestLoginLrharvester"/>
  10 + <!--
  11 + <class name="testng.lrharvester.TestAddValidatorLrharvester"/>
  12 + <class name="testng.lrharvester.TestAddNetworkLrharvester"/>
  13 + <class name="testng.lrharvester.TestAddOaiLrharvester"/>
  14 + -->
  15 + <class name="testng.lrharvester.TestAddHarvestFullLrharvester"/>
  16 + <!--
  17 + <class name="testng.lrharvester.TestAddTransformValidateFullLrharvester"/>
  18 + <class name="testng.lrharvester.TestAddDescargadeODLrharvester"/>
  19 + <class name="testng.lrharvester.TestIndexVufindLrharvester"/>
  20 + <class name="testng.lrharvester.TestIndexHistoricLrharvester"/>
  21 + -->
  22 + </classes>
  23 + </test>
  24 +
  25 + <listeners>
  26 + <listener class-name="org.uncommons.reportng.HTMLReporter"/>
  27 + <listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
  28 + </listeners>
  29 +</suite>
0 30 \ No newline at end of file
... ...
TestNGResources/Lrharvester/testng-portal-beanshell.xml
... ... @@ -0,0 +1,85 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!-- Threading count to execute paralel tests and parallel set to tests (classes see documentation) -->
  3 +<!-- I think if We have 2 classes they will run in parallel -->
  4 +<suite name="LrHarvester" >
  5 +
  6 + <test name="LrharvesterChrome">
  7 + <!-- These are defined in the maven and in the Test Files -->
  8 + <!-- groups are overlaped -->
  9 + <method-selectors>
  10 + <method-selector>
  11 + <script language="beanshell"><![CDATA[
  12 + String grps = System.getProperty("browserToRun");
  13 + return grps.contains("chrome") || grps.contains("all");
  14 + ]]></script>
  15 + </method-selector>
  16 +</method-selectors>
  17 + <parameter name="browser" value="chrome" />
  18 + <classes>
  19 + <class name="testng.lrharvester.TestLoginLrharvester"/>
  20 + <class name="testng.lrharvester.TestAddValidatorLrharvester"/>
  21 + <class name="testng.lrharvester.TestAddNetworkLrharvester"/>
  22 + <class name="testng.lrharvester.TestAddOaiLrharvester"/>
  23 + <class name="testng.lrharvester.TestAddHarvestFullLrharvester"/>
  24 + <class name="testng.lrharvester.TestAddTransformValidateFullLrharvester"/>
  25 + <class name="testng.lrharvester.TestAddDescargadeODLrharvester"/>
  26 + <class name="testng.lrharvester.TestIndexVufindLrharvester"/>
  27 + <class name="testng.lrharvester.TestIndexHistoricLrharvester"/>
  28 + </classes>
  29 + </test>
  30 +
  31 + <test name="LrharvesterFirefox">
  32 + <!-- These are defined in the maven and in the Test Files -->
  33 + <!-- groups are overlaped -->
  34 + <method-selectors>
  35 + <method-selector>
  36 + <script language="beanshell"><![CDATA[
  37 + String grps = System.getProperty("browserToRun");
  38 + return grps.contains("firefox") || grps.contains("all");
  39 + ]]></script>
  40 + </method-selector>
  41 +</method-selectors>
  42 + <parameter name="browser" value="firefox" />
  43 + <classes>
  44 + <class name="testng.lrharvester.TestLoginLrharvester"/>
  45 + <class name="testng.lrharvester.TestAddValidatorLrharvester"/>
  46 + <class name="testng.lrharvester.TestAddNetworkLrharvester"/>
  47 + <class name="testng.lrharvester.TestAddOaiLrharvester"/>
  48 + <class name="testng.lrharvester.TestAddHarvestFullLrharvester"/>
  49 + <class name="testng.lrharvester.TestAddTransformValidateFullLrharvester"/>
  50 + <class name="testng.lrharvester.TestAddDescargadeODLrharvester"/>
  51 + <class name="testng.lrharvester.TestIndexVufindLrharvester"/>
  52 + <class name="testng.lrharvester.TestIndexHistoricLrharvester"/>
  53 + </classes>
  54 + </test>
  55 +
  56 + <test name="LrhatvesterHeadless">
  57 + <!-- These are defined in the maven and in the Test Files -->
  58 + <!-- groups are overlaped -->
  59 + <method-selectors>
  60 + <method-selector>
  61 + <script language="beanshell"><![CDATA[
  62 + String grps = System.getProperty("browserToRun");
  63 + return grps.contains("headless") || grps.contains("all");
  64 + ]]></script>
  65 + </method-selector>
  66 +</method-selectors>
  67 + <parameter name="browser" value="headless" />
  68 + <classes>
  69 + <class name="testng.lrharvester.TestLoginLrharvester"/>
  70 + <class name="testng.lrharvester.TestAddValidatorLrharvester"/>
  71 + <class name="testng.lrharvester.TestAddNetworkLrharvester"/>
  72 + <class name="testng.lrharvester.TestAddOaiLrharvester"/>
  73 + <class name="testng.lrharvester.TestAddHarvestFullLrharvester"/>
  74 + <class name="testng.lrharvester.TestAddTransformValidateFullLrharvester"/>
  75 + <class name="testng.lrharvester.TestAddDescargadeODLrharvester"/>
  76 + <class name="testng.lrharvester.TestIndexVufindLrharvester"/>
  77 + <class name="testng.lrharvester.TestIndexHistoricLrharvester"/>
  78 + </classes>
  79 + </test>
  80 +
  81 + <listeners>
  82 + <listener class-name="org.uncommons.reportng.HTMLReporter"/>
  83 + <listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
  84 + </listeners>
  85 +</suite>
0 86 \ No newline at end of file
... ...
driver/linux/chromedriver 100644 → 100755
No preview for this file type
driver/linux/geckodriver 100644 → 100755
No preview for this file type
src/test/java/dataproviders/DataProviderPortalValidartor.java
... ... @@ -1,50 +0,0 @@
1   -package dataproviders;
2   -
3   -import java.util.Arrays;
4   -import java.util.Iterator;
5   -
6   -import org.testng.annotations.DataProvider;
7   -
8   -/*
9   - * Inject this values with Spring??????
10   - */
11   -
12   -public class DataProviderPortalValidartor {
13   -
14   -
15   - /*
16   - *
17   - *
18   - * PORTAL
19   - *
20   - */
21   -
22   - @DataProvider(name = "portal-url")
23   - public static Iterator<Object[]> urlsPortal() {
24   - String[] urls = {
25   - "http://www.rcaap.pt",
26   - };
27   - return Arrays.stream(urls)
28   - .map(s -> new Object[]{s})
29   - .iterator();
30   - }
31   -
32   - /*
33   - *
34   - *
35   - * Validator
36   - *
37   - */
38   -
39   - @DataProvider(name = "validator-url")
40   - public static Iterator<Object[]> urlsValidator() {
41   - String[] urls = {
42   - "http://validator.rcaap.pt",
43   - };
44   - return Arrays.stream(urls)
45   - .map(s -> new Object[]{s})
46   - .iterator();
47   - }
48   -
49   -
50   -}
src/test/java/dataproviders/DataProviderPortalValidator.java
... ... @@ -0,0 +1,50 @@
  1 +package dataproviders;
  2 +
  3 +import org.testng.annotations.DataProvider;
  4 +
  5 +import java.util.Arrays;
  6 +import java.util.Iterator;
  7 +
  8 +/*
  9 + * Inject this values with Spring??????
  10 + */
  11 +
  12 +public class DataProviderPortalValidator {
  13 +
  14 +
  15 + /*
  16 + *
  17 + *
  18 + * PORTAL
  19 + *
  20 + */
  21 +
  22 + @DataProvider(name = "portal-url")
  23 + public static Iterator<Object[]> urlsPortal() {
  24 + String[] urls = {
  25 + "http://www.rcaap.pt",
  26 + };
  27 + return Arrays.stream(urls)
  28 + .map(s -> new Object[]{s})
  29 + .iterator();
  30 + }
  31 +
  32 + /*
  33 + *
  34 + *
  35 + * Validator
  36 + *
  37 + */
  38 +
  39 + @DataProvider(name = "validator-url")
  40 + public static Iterator<Object[]> urlsValidator(){
  41 + String[] urls = {
  42 + "http://validator.rcaap.pt",
  43 + };
  44 + return Arrays.stream(urls)
  45 + .map(s -> new Object[]{s})
  46 + .iterator();
  47 + }
  48 +
  49 +
  50 +}
... ...
src/test/java/example/testclasses/TestExamplePortal.java
... ... @@ -3,11 +3,8 @@
3 3 */
4 4 package example.testclasses;
5 5  
6   -import static org.testng.Assert.assertTrue;
7   -import org.openqa.selenium.By;
  6 +import dataproviders.DataProviderPortalValidator;
8 7 import org.testng.annotations.Test;
9   -
10   -import dataproviders.DataProviderPortalValidartor;
11 8 import testng.rcaap.TestBase;
12 9  
13 10  
... ... @@ -47,7 +44,7 @@ public class TestExamplePortal extends TestBase {
47 44 *
48 45 */
49 46 //@Test
50   - @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidartor.class)
  47 + @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidator.class)
51 48 public void testMethodB(String baseUrl) throws Exception {
52 49 //CODE
53 50 }
... ...
src/test/java/example/testclasses/TestExampleValidator.java
... ... @@ -3,12 +3,8 @@
3 3 */
4 4 package example.testclasses;
5 5  
6   -import static org.testng.Assert.assertTrue;
7   -import org.openqa.selenium.By;
  6 +import dataproviders.DataProviderPortalValidator;
8 7 import org.testng.annotations.Test;
9   -
10   -import dataproviders.DataProviderPortalValidartor;
11   -import dataproviders.DataProviderSARI;
12 8 import testng.rcaap.TestBase;
13 9  
14 10  
... ... @@ -48,7 +44,7 @@ public class TestExampleValidator extends TestBase {
48 44 *
49 45 */
50 46 //@Test
51   - @Test(dataProvider = "validator-url", dataProviderClass = DataProviderPortalValidartor.class)
  47 + @Test(dataProvider = "validator-url", dataProviderClass = DataProviderPortalValidator.class)
52 48 public void testMethodB(String baseUrl) throws Exception {
53 49 //CODE
54 50 }
... ...
src/test/java/testng/lrharvester/TestAddDescargadeODLrharvester.java
... ... @@ -0,0 +1,25 @@
  1 +package testng.lrharvester;
  2 +
  3 +import org.openqa.selenium.By;
  4 +import org.testng.annotations.Test;
  5 +import testng.rcaap.TestBase;
  6 +
  7 +import static org.testng.Assert.assertTrue;
  8 +
  9 +public class TestAddDescargadeODLrharvester extends TestBase {
  10 +
  11 +
  12 +
  13 + @Test
  14 + public void testAddValidator() throws Exception {
  15 + driver.get("http://dev6.rcaap.pt/backend/home#");
  16 + driver.findElement(By.xpath("(//button[@type='button'])[3]")).click();
  17 + acceptNextAlert = true;
  18 + driver.findElement(By.xpath("(//a[contains(text(),'Descarga de OD (full)')])[2]")).click();
  19 + assertTrue(closeAlertAndGetItsText().matches("^¿Está seguro de ejecutar Descarga de OD \\(full\\) [\\s\\S]$"));
  20 + }
  21 +
  22 +
  23 +
  24 +
  25 +}
... ...
src/test/java/testng/lrharvester/TestAddHarvestFullLrharvester.java
... ... @@ -0,0 +1,76 @@
  1 +package testng.lrharvester;
  2 +
  3 +import com.google.gson.JsonElement;
  4 +import com.google.gson.JsonObject;
  5 +import com.google.gson.JsonParser;
  6 +import org.openqa.selenium.By;
  7 +import org.openqa.selenium.support.ui.FluentWait;
  8 +import org.openqa.selenium.support.ui.Wait;
  9 +import org.testng.annotations.Test;
  10 +import testng.rcaap.TestBase;
  11 +
  12 +import java.io.IOException;
  13 +import java.io.InputStream;
  14 +import java.io.InputStreamReader;
  15 +import java.net.URL;
  16 +import java.net.URLConnection;
  17 +import java.util.concurrent.TimeUnit;
  18 +
  19 +import static org.testng.Assert.assertTrue;
  20 +
  21 +public class TestAddHarvestFullLrharvester extends TestBase {
  22 +
  23 +
  24 +
  25 + @Test
  26 + public void testHarvestFull() throws Exception {
  27 + driver.get("http://dev6.rcaap.pt/backend/home#");
  28 + driver.findElement(By.xpath("(//button[@type='button'])[3]")).click();
  29 + acceptNextAlert = true;
  30 + driver.findElement(By.xpath("(//a[contains(text(),'Cosecha (full)')])[2]")).click();
  31 + assertTrue(closeAlertAndGetItsText().matches("^¿Está seguro de ejecutar Cosecha \\(full\\) [\\s\\S]$"));
  32 +
  33 + TimeUnit.SECONDS.sleep(30);
  34 +
  35 + Wait wait = new FluentWait(driver)
  36 + .withTimeout(3600, TimeUnit.SECONDS)
  37 + .pollingEvery(30, TimeUnit.SECONDS)
  38 + .ignoring(IOException.class);
  39 +
  40 + wait.until(o -> {
  41 +
  42 + try {
  43 + return isRunning();
  44 + } catch (IOException e) {
  45 + e.printStackTrace();
  46 +
  47 + }
  48 + return true;
  49 + }
  50 + );
  51 +
  52 + assertTrue(!isRunning());
  53 +
  54 + }
  55 +
  56 + private boolean isRunning() throws IOException {
  57 +
  58 + String sURL = "http://dev6.rcaap.pt/backend/public/getRunningStatus"; //just a string
  59 +
  60 + // Connect to the URL using java's native library
  61 + URL url = new URL(sURL);
  62 + URLConnection request = url.openConnection();
  63 + request.connect();
  64 +
  65 + // Convert to a JSON object to print data
  66 + JsonParser jp = new JsonParser(); //from gson
  67 + JsonElement root = jp.parse(new InputStreamReader((InputStream) request.getContent())); //Convert the input stream to a json element
  68 + JsonObject rootobj = root.getAsJsonObject(); //May be an array, may be an object.
  69 + JsonObject running = rootobj.getAsJsonObject("running");
  70 +
  71 + System.out.println("json object: "+ running);
  72 + return running.size() > 0;
  73 + }
  74 +
  75 +
  76 +}
... ...
src/test/java/testng/lrharvester/TestAddNetworkLrharvester.java
... ... @@ -0,0 +1,69 @@
  1 +package testng.lrharvester;
  2 +
  3 +import org.openqa.selenium.By;
  4 +import org.openqa.selenium.WebDriver;
  5 +import org.openqa.selenium.firefox.FirefoxDriver;
  6 +import org.openqa.selenium.support.ui.Select;
  7 +import org.testng.annotations.BeforeClass;
  8 +import org.testng.annotations.Test;
  9 +import testng.rcaap.TestBase;
  10 +
  11 +import java.util.concurrent.TimeUnit;
  12 +
  13 +import static org.testng.Assert.assertEquals;
  14 +
  15 +public class TestAddNetworkLrharvester extends TestBase {
  16 +
  17 +
  18 + @Test
  19 + public void testAddNewNetwork() throws Exception {
  20 + driver.get("http://dev6.rcaap.pt/backend/home#");
  21 + driver.findElement(By.linkText("Nuevo repositorio")).click();
  22 + driver.findElement(By.id("acronym")).click();
  23 + driver.findElement(By.id("acronym")).clear();
  24 + driver.findElement(By.id("acronym")).sendKeys("teste");
  25 + driver.findElement(By.id("name")).click();
  26 + driver.findElement(By.id("name")).clear();
  27 + driver.findElement(By.id("name")).sendKeys("teste");
  28 + driver.findElement(By.id("institutionAcronym")).click();
  29 + driver.findElement(By.id("institutionAcronym")).clear();
  30 + driver.findElement(By.id("institutionAcronym")).sendKeys("teste");
  31 + driver.findElement(By.id("institutionName")).click();
  32 + driver.findElement(By.id("institutionName")).clear();
  33 + driver.findElement(By.id("institutionName")).sendKeys("teste");
  34 + driver.findElement(By.name("validator")).click();
  35 + new Select(driver.findElement(By.name("validator"))).selectByVisibleText("validator teste");
  36 + driver.findElement(By.xpath("//option[@value='string:http://dev6.rcaap.pt/backend/rest/validator/1']")).click();
  37 + driver.findElement(By.xpath("(//input[@value='Guardar cambios'])[2]")).click();
  38 + driver.findElement(By.linkText("Datos específicos")).click();
  39 + driver.findElement(By.xpath("//div[2]/div/div/div[3]")).click();
  40 + driver.findElement(By.id("type")).click();
  41 + driver.findElement(By.id("type")).clear();
  42 + driver.findElement(By.id("type")).sendKeys("teste");
  43 + driver.findElement(By.id("software")).click();
  44 + driver.findElement(By.id("software")).clear();
  45 + driver.findElement(By.id("software")).sendKeys("teste");
  46 + driver.findElement(By.id("description_pt")).click();
  47 + driver.findElement(By.id("description_pt")).clear();
  48 + driver.findElement(By.id("description_pt")).sendKeys("teste");
  49 + driver.findElement(By.id("description_en")).click();
  50 + driver.findElement(By.id("description_en")).clear();
  51 + driver.findElement(By.id("description_en")).sendKeys("teste");
  52 + driver.findElement(By.id("country")).click();
  53 + driver.findElement(By.id("country")).clear();
  54 + driver.findElement(By.id("country")).sendKeys("teste");
  55 + driver.findElement(By.xpath("(//input[@value='Guardar cambios'])[4]")).click();
  56 + driver.findElement(By.xpath("//div[2]/button")).click();
  57 + driver.findElement(By.name("acronym")).click();
  58 + driver.findElement(By.name("acronym")).clear();
  59 + driver.findElement(By.name("acronym")).sendKeys("teste");
  60 + assertEquals(driver.getTitle(), "LAReferencia - Administración");
  61 + assertEquals(driver.findElement(By.xpath("//td[3]")).getText(), "1");
  62 + assertEquals(driver.findElement(By.xpath("//td[4]")).getText(), "teste");
  63 + assertEquals(driver.findElement(By.xpath("//td[5]")).getText(), "teste");
  64 + }
  65 +
  66 +
  67 +
  68 +
  69 +}
... ...
src/test/java/testng/lrharvester/TestAddOaiLrharvester.java
... ... @@ -0,0 +1,20 @@
  1 +package testng.lrharvester;
  2 +
  3 +import org.testng.annotations.Test;
  4 +import testng.rcaap.TestBase;
  5 +
  6 +import static org.testng.Assert.assertTrue;
  7 +
  8 +public class TestAddOaiLrharvester extends TestBase {
  9 +
  10 +
  11 + @Test
  12 + public void testAddOai() throws Exception {
  13 + driver.get("http://dev6.rcaap.pt/backend/home#");
  14 + assertTrue(false);
  15 + }
  16 +
  17 +
  18 +
  19 +
  20 +}
... ...
src/test/java/testng/lrharvester/TestAddTransformValidateFullLrharvester.java
... ... @@ -0,0 +1,21 @@
  1 +package testng.lrharvester;
  2 +
  3 +import org.openqa.selenium.By;
  4 +import org.testng.annotations.Test;
  5 +import testng.rcaap.TestBase;
  6 +
  7 +import static org.testng.Assert.assertTrue;
  8 +
  9 +public class TestAddTransformValidateFullLrharvester extends TestBase {
  10 +
  11 + @Test
  12 + public void testTransformValidateFull() throws Exception {
  13 + driver.get("http://dev6.rcaap.pt/backend/home#");
  14 + driver.findElement(By.xpath("(//button[@type='button'])[3]")).click();
  15 + acceptNextAlert = true;
  16 + driver.findElement(By.xpath("(//a[contains(text(),'Validación/Transformación (full)')])[2]")).click();
  17 + assertTrue(closeAlertAndGetItsText().matches("^¿Está seguro de ejecutar Validación/Transformación \\(full\\) [\\s\\S]$"));
  18 + }
  19 +
  20 +
  21 +}
... ...
src/test/java/testng/lrharvester/TestAddValidatorLrharvester.java
... ... @@ -0,0 +1,24 @@
  1 +package testng.lrharvester;
  2 +
  3 +import org.openqa.selenium.By;
  4 +import org.testng.annotations.Test;
  5 +import testng.rcaap.TestBase;
  6 +
  7 +public class TestAddValidatorLrharvester extends TestBase {
  8 +
  9 +
  10 + @Test
  11 + public void testAddValidator() throws Exception {
  12 +
  13 + driver.get("http://dev6.rcaap.pt/backend/home#");
  14 + driver.findElement(By.linkText("Editar Validadores")).click();
  15 + driver.findElement(By.xpath("//a/span")).click();
  16 + driver.findElement(By.id("name")).click();
  17 + driver.findElement(By.id("name")).clear();
  18 + driver.findElement(By.id("name")).sendKeys("validator teste");
  19 + driver.findElement(By.xpath("//input[@value='Guardar']")).click();
  20 + }
  21 +
  22 +
  23 +
  24 +}
... ...
src/test/java/testng/lrharvester/TestIndexHistoricLrharvester.java
... ... @@ -0,0 +1,26 @@
  1 +package testng.lrharvester;
  2 +
  3 +import org.openqa.selenium.By;
  4 +import org.testng.annotations.Test;
  5 +import testng.rcaap.TestBase;
  6 +
  7 +import static org.testng.Assert.assertTrue;
  8 +
  9 +public class TestIndexHistoricLrharvester extends TestBase {
  10 +
  11 +
  12 + @Test
  13 + public void testIndexHistoric() throws Exception {
  14 + driver.get("http://dev6.rcaap.pt/backend/home#");
  15 + driver.findElement(By.xpath("(//button[@type='button'])[3]")).click();
  16 + acceptNextAlert = true;
  17 + driver.findElement(By.xpath("(//a[contains(text(),'Indexar histórico no Portal')])[2]")).click();
  18 + assertTrue(closeAlertAndGetItsText().matches("^¿Está seguro de ejecutar Indexar histórico no Portal [\\s\\S]$"));
  19 + }
  20 +
  21 +
  22 +
  23 +
  24 +
  25 +
  26 +}
... ...
src/test/java/testng/lrharvester/TestIndexVufindLrharvester.java
... ... @@ -0,0 +1,23 @@
  1 +package testng.lrharvester;
  2 +
  3 +import org.openqa.selenium.By;
  4 +import org.testng.annotations.Test;
  5 +import testng.rcaap.TestBase;
  6 +
  7 +import static org.testng.Assert.assertTrue;
  8 +
  9 +public class TestIndexVufindLrharvester extends TestBase {
  10 +
  11 +
  12 + @Test
  13 + public void testIndexVufindFull() throws Exception {
  14 + driver.get("http://dev6.rcaap.pt/backend/home#");
  15 + driver.findElement(By.xpath("(//button[@type='button'])[3]")).click();
  16 + acceptNextAlert = true;
  17 + driver.findElement(By.xpath("(//a[contains(text(),'Indexación Vufind (full)')])[2]")).click();
  18 + assertTrue(closeAlertAndGetItsText().matches("^¿Está seguro de ejecutar Indexación Vufind \\(full\\) [\\s\\S]$"));
  19 + }
  20 +
  21 +
  22 +
  23 +}
... ...
src/test/java/testng/lrharvester/TestLoginLrharvester.java
... ... @@ -0,0 +1,19 @@
  1 +package testng.lrharvester;
  2 +
  3 +import org.openqa.selenium.By;
  4 +import org.testng.annotations.Test;
  5 +import testng.rcaap.TestBase;
  6 +
  7 +public class TestLoginLrharvester extends TestBase {
  8 +
  9 + @Test
  10 + public void testLogin() throws Exception {
  11 + driver.get("http://dev6.rcaap.pt/backend");
  12 + driver.findElement(By.id("username")).click();
  13 + driver.findElement(By.id("username")).sendKeys("adminrcaap");
  14 + driver.findElement(By.id("password")).click();
  15 + driver.findElement(By.id("password")).sendKeys("f1n=4=lm3nt3");
  16 + driver.findElement(By.xpath("//input[@value='Log in']")).click();
  17 + }
  18 +
  19 +}
... ...
src/test/java/testng/rcaap/portal/TestInitialPagePortal.java
1 1 package testng.rcaap.portal;
2 2  
3   -import static org.testng.Assert.assertTrue;
4   -
  3 +import dataproviders.DataProviderPortalValidator;
5 4 import org.openqa.selenium.By;
6 5 import org.testng.annotations.Test;
7   -
8   -import dataproviders.DataProviderPortalValidartor;
9 6 import testng.rcaap.TestBase;
10 7  
  8 +import static org.testng.Assert.assertTrue;
  9 +
11 10 //Tests to see if is is present the search box and click button
12 11 public class TestInitialPagePortal extends TestBase {
13 12  
14   - @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidartor.class)
  13 + @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidator.class)
15 14 public void testInitialPage(String baseUrl) throws Exception {
16 15 driver.get(baseUrl + "/");
17 16  
... ...
src/test/java/testng/rcaap/portal/TestLoginAdmin.java
1 1 package testng.rcaap.portal;
2 2  
3   -import static org.testng.Assert.assertTrue;
4   -
  3 +import dataproviders.DataProviderPortalValidator;
5 4 import org.openqa.selenium.Alert;
6 5 import org.openqa.selenium.By;
7 6 import org.openqa.selenium.NoAlertPresentException;
... ... @@ -9,11 +8,10 @@ import org.openqa.selenium.TimeoutException;
9 8 import org.openqa.selenium.support.ui.ExpectedConditions;
10 9 import org.openqa.selenium.support.ui.WebDriverWait;
11 10 import org.testng.annotations.Test;
12   -
13   -import common.Login;
14   -import dataproviders.DataProviderPortalValidartor;
15 11 import testng.rcaap.TestBase;
16 12  
  13 +import static org.testng.Assert.assertTrue;
  14 +
17 15 //Tests to see if is is present the search box and click button - can be extends Login
18 16 public class TestLoginAdmin extends TestBase {
19 17  
... ... @@ -31,7 +29,7 @@ public class TestLoginAdmin extends TestBase {
31 29 this.pass = pass != null ? pass : System.getProperty("PASS");
32 30 }*/
33 31  
34   - @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidartor.class)
  32 + @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidator.class)
35 33 public void testLoginHTTPPortal(String baseUrl) throws Exception {
36 34 //System.out.println("Runing Test - Login Admin");
37 35  
... ...
src/test/java/testng/rcaap/portal/TestSearchPortal.java
1 1 package testng.rcaap.portal;
2 2  
3   -import static org.testng.Assert.assertTrue;
4   -
  3 +import dataproviders.DataProviderPortalValidator;
5 4 import org.openqa.selenium.By;
6 5 import org.testng.annotations.Test;
7   -
8   -import dataproviders.DataProviderPortalValidartor;
9 6 import testng.rcaap.TestBase;
10 7  
  8 +import static org.testng.Assert.assertTrue;
  9 +
11 10 //Tests to see if is is present the search box and click button
12 11 public class TestSearchPortal extends TestBase {
13 12  
14   - @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidartor.class)
  13 + @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidator.class)
15 14 public void testSearchPortal(String baseUrl) throws Exception {
16 15 System.out.println("Runing Test - Search String: " + baseUrl);
17 16  
... ...
src/test/java/testng/rcaap/validator/TestValidation.java
1 1 package testng.rcaap.validator;
2 2  
3   -import static org.testng.Assert.assertTrue;
4   -
  3 +import dataproviders.DataProviderPortalValidator;
5 4 import org.openqa.selenium.By;
6 5 import org.testng.annotations.Test;
7   -
8   -import dataproviders.DataProviderPortalValidartor;
9 6 import testng.rcaap.TestBase;
10 7  
  8 +import static org.testng.Assert.assertTrue;
  9 +
11 10 public class TestValidation extends TestBase {
12 11  
13   - @Test(dataProvider = "validator-url", dataProviderClass = DataProviderPortalValidartor.class)
  12 + @Test(dataProvider = "validator-url", dataProviderClass = DataProviderPortalValidator.class)
14 13 public void TestValidator(String baseUrl) throws Exception {
15 14 driver.get(baseUrl + "/validator2/");
16 15 //System.out.println("URL" + baseUrl);
... ...
src/test/java/testng/rcaap/validator/VerifyContactTest.java
1 1 package testng.rcaap.validator;
2 2  
3   -import static org.testng.Assert.assertTrue;
4   -
  3 +import dataproviders.DataProviderPortalValidator;
5 4 import org.openqa.selenium.By;
6 5 import org.testng.annotations.Test;
7   -
8   -import dataproviders.DataProviderPortalValidartor;
9 6 import testng.rcaap.TestBase;
10 7  
  8 +import static org.testng.Assert.assertTrue;
  9 +
11 10 public class VerifyContactTest extends TestBase{
12 11  
13 12  
14 13 //@Test
15   - @Test(dataProvider = "validator-url", dataProviderClass = DataProviderPortalValidartor.class)
  14 + @Test(dataProvider = "validator-url", dataProviderClass = DataProviderPortalValidator.class)
16 15 public void testVerifyContact(String baseUrl) throws Exception {
17 16 driver.get(baseUrl + "/validator2/");
18 17 driver.findElement(By.xpath("//a[contains(@href, 'contact')]")).click();
... ...