Commit 0ef6ef2b612750737aa7c7961d627f8f4b022346

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

added funding tests

TestNGResources/Portal/testng-portal.xml
... ... @@ -5,15 +5,14 @@
5 5 <suite name="Portal" parallel="classes" thread-count="3">
6 6 <test name="Portal-Public" group-by-instances="true" >
7 7 <classes>
8   - <class name="testng.rcaap.portal.TestInitialPagePortal"/>
9   - <class name="testng.rcaap.portal.TestSearchPortal"/>
10   - </classes>
11   - </test>
12   - <test name="Portal-Admin" group-by-instances="true">
13   - <classes>
14   - <class name="testng.rcaap.portal.TestLoginAdmin"/>
  8 + <class name="testng.rcaap.portal.funding.fundingPage"/>
15 9 </classes>
16 10 </test>
  11 + <!--test name="Portal-Admin" group-by-instances="true">
  12 + <classes>
  13 + <class name="testng.rcaap.portal.TestLoginAdmin"/>
  14 + </classes>
  15 + </test-->
17 16  
18 17 <listeners>
19 18 <listener class-name="org.uncommons.reportng.HTMLReporter"/>
... ...
src/test/java/testng/rcaap/portal/funding/fundingPage.java
... ... @@ -0,0 +1,64 @@
  1 +package testng.rcaap.portal.funding;
  2 +
  3 +import dataproviders.DataProviderPortalValidator;
  4 +import org.openqa.selenium.By;
  5 +import org.testng.annotations.Test;
  6 +import testng.rcaap.TestBase;
  7 +
  8 +import static org.testng.Assert.assertFalse;
  9 +
  10 +//Tests to see if is is present the search box and click button
  11 +public class fundingPage extends TestBase {
  12 +
  13 +
  14 + @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidator.class)
  15 + public void testFundingFromHomepage(String baseUrl) {
  16 + driver.get(baseUrl);
  17 + driver.findElement(By.linkText("Funding")).click();
  18 + }
  19 +
  20 + @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidator.class)
  21 + public void testFundingSearch(String baseUrl) {
  22 + driver.get(baseUrl);
  23 + driver.findElement(By.linkText("Funding")).click();
  24 + driver.findElement(By.id("fld1")).click();
  25 + driver.findElement(By.id("fld1")).clear();
  26 + driver.findElement(By.id("fld1")).sendKeys("mush");
  27 + driver.findElement(By.name("btnSearch")).click();
  28 + }
  29 +
  30 + @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidator.class)
  31 + public void testFundingMoreInfo(String baseUrl) {
  32 + driver.get(baseUrl);
  33 + driver.findElement(By.linkText("Funding")).click();
  34 + driver.findElement(By.id("fld1")).click();
  35 + driver.findElement(By.id("fld1")).clear();
  36 + driver.findElement(By.id("fld1")).sendKeys("mush");
  37 + driver.findElement(By.name("btnSearch")).click();
  38 + driver.findElement(By.xpath("//div[@id='container']/div[2]/div/div[3]/div/div[2]/div/div[2]/a/strong")).click();
  39 + try {
  40 + assertFalse(driver.getTitle().isEmpty());
  41 + } catch (Error e) {
  42 + verificationErrors.append(e.toString());
  43 + }
  44 + }
  45 +
  46 + @Test(dataProvider = "portal-url", dataProviderClass = DataProviderPortalValidator.class)
  47 + public void testGenerateReport(String baseUrl) {
  48 + driver.get(baseUrl);
  49 + driver.findElement(By.linkText("Funding")).click();
  50 + driver.findElement(By.id("fld1")).click();
  51 + driver.findElement(By.id("fld1")).clear();
  52 + driver.findElement(By.id("fld1")).sendKeys("mush");
  53 + driver.findElement(By.name("btnSearch")).click();
  54 + driver.findElement(By.xpath("//div[@id='container']/div[2]/div/div[3]/div/div[2]/div/div[2]/a/strong")).click();
  55 + driver.findElement(By.id("generate-report")).click();
  56 + try {
  57 + assertFalse(driver.findElement(By.xpath("//h1")).getText().isEmpty());
  58 + } catch (Error e) {
  59 + verificationErrors.append(e.toString());
  60 + }
  61 + }
  62 +
  63 +
  64 +}
... ...