-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #426 from bcgov/qa-ofmcc-6476-funding-envelope-cha…
…nge-request OFMCC-6476-Create Funding Envelope Change Request through Funding Tile
- Loading branch information
Showing
4 changed files
with
238 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...est/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalFundingAllocationTab.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_Portal; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.CacheLookup; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
import java.time.Duration; | ||
|
||
public class PortalFundingAllocationTab{ | ||
private WebDriver driver; | ||
WebDriverWait wait; | ||
|
||
@FindBy(xpath = "//body/div[@id='app']/div[@id='app']/div[1]/main[1]/div[2]/div[1]/div[3]/div[1]/div[1]/div[3]/div[1]/div[2]/button[1]/span[3]/span[1]") | ||
@CacheLookup | ||
private WebElement requestToReallocateFunds ; | ||
|
||
public PortalFundingAllocationTab(WebDriver driver) { | ||
this.driver = driver; | ||
PageFactory.initElements(driver, this); | ||
wait = new WebDriverWait(driver, Duration.ofMillis(10000)); | ||
} | ||
|
||
|
||
public void ClickReallocateFunds() throws InterruptedException { | ||
try { | ||
wait.until(ExpectedConditions.elementToBeClickable(requestToReallocateFunds)).click(); | ||
} | ||
catch(Exception e) { | ||
System.out.println("Request to Re-allocate funds button is not available"); | ||
driver.quit(); | ||
} | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
.../ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalFundingEnvelopeChangeRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_Portal; | ||
|
||
import org.openqa.selenium.JavascriptExecutor; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.CacheLookup; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
import java.time.Duration; | ||
|
||
public class PortalFundingEnvelopeChangeRequest { | ||
private WebDriver driver; | ||
WebDriverWait wait; | ||
|
||
@FindBy(id = "add-new-file") | ||
@CacheLookup | ||
private WebElement addNewFileButton; | ||
|
||
@FindBy(id = "submit-new-request") | ||
@CacheLookup | ||
private WebElement submitNewRequestButton; | ||
|
||
@FindBy(id = "selectFacility") | ||
@CacheLookup | ||
private WebElement selectFacilityField; | ||
|
||
@FindBy(xpath = "//input[@placeholder='Brief summary of request']") | ||
@CacheLookup | ||
private WebElement summary; | ||
|
||
@FindBy(xpath = "//textarea[@placeholder='Detailed description of request']") | ||
@CacheLookup | ||
private WebElement requestDescription; | ||
|
||
@FindBy(xpath = "//input[@type='file']") | ||
@CacheLookup | ||
private WebElement addFile; | ||
|
||
@FindBy(xpath= "//input[@placeholder='Enter a description (Optional)']") | ||
@CacheLookup | ||
private WebElement description; | ||
|
||
public PortalFundingEnvelopeChangeRequest(WebDriver driver) { | ||
this.driver = driver; | ||
PageFactory.initElements(driver, this); | ||
wait = new WebDriverWait(driver, Duration.ofMillis(10000)); | ||
} | ||
|
||
private final String filePath = System.getProperty("user.dir") + "/src/test/resources/testFile.jpg"; | ||
|
||
public void setSummaryTextField(String summaryValue) { | ||
summary.sendKeys(summaryValue); | ||
} | ||
|
||
public void setRequestDescriptionTextField(String requestDescriptionValue) { | ||
requestDescription.sendKeys(requestDescriptionValue); | ||
} | ||
|
||
public void addFacility(String facility) { | ||
selectFacilityField.sendKeys(facility); | ||
} | ||
|
||
public void addNewFile() { | ||
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", addNewFileButton); | ||
addFile.sendKeys(filePath); | ||
description.sendKeys("Funding Envelope Change Request file"); | ||
} | ||
|
||
public void clickSubmitNewRequest() { | ||
submitNewRequestButton.click(); | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...ing/src/test/java/ca/bc/gov/ecc/ofm/selenium/v1/PageFactory_Portal/PortalFundingPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_Portal; | ||
|
||
import org.openqa.selenium.support.CacheLookup; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.PageFactory; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
import java.time.Duration; | ||
|
||
public class PortalFundingPage { | ||
|
||
private WebDriver driver; | ||
WebDriverWait wait; | ||
|
||
|
||
@FindBy(xpath = "//strong[contains(text(),'Funding Agreements')]") | ||
@CacheLookup | ||
private WebElement fundingAgreementsTab; | ||
|
||
@FindBy(xpath = "//strong[contains(text(),'Payment Records')]") | ||
@CacheLookup | ||
private WebElement paymentRecordsTab; | ||
|
||
@FindBy(xpath = "//strong[contains(text(),'Funding Allocation')]") | ||
@CacheLookup | ||
private WebElement fundingAllocationTab; | ||
|
||
public PortalFundingPage(WebDriver driver) { | ||
this.driver = driver; | ||
PageFactory.initElements(driver, this); | ||
wait = new WebDriverWait(driver, Duration.ofMillis(10000)); | ||
} | ||
|
||
public void clickOnFundingAgreementsTab() { | ||
wait.until(ExpectedConditions.elementToBeClickable(fundingAgreementsTab)).click(); | ||
} | ||
public void clickOnPaymentRecordsTab() {; | ||
wait.until(ExpectedConditions.elementToBeClickable(paymentRecordsTab)).click(); | ||
} | ||
public void clickOnFundingAllocationTab() { | ||
wait.until(ExpectedConditions.elementToBeClickable(fundingAllocationTab)).click(); | ||
} | ||
|
||
} |
79 changes: 79 additions & 0 deletions
79
.../ca/bc/gov/ecc/ofm/selenium/v1/tests/portal/PortalCreateFundingEnvelopeChangeRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package ca.bc.gov.ecc.ofm.selenium.v1.tests.portal; | ||
|
||
import ca.bc.gov.ecc.ofm.selenium.v1.PageFactory_Portal.*; | ||
import ca.bc.gov.ecc.ofm.selenium.v1.tests.BaseTest; | ||
import io.github.bonigarcia.wdm.WebDriverManager; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.chrome.ChromeDriver; | ||
import org.openqa.selenium.chrome.ChromeOptions; | ||
import org.testng.Assert; | ||
import org.testng.annotations.AfterTest; | ||
import org.testng.annotations.BeforeTest; | ||
import org.testng.annotations.Test; | ||
|
||
public class PortalCreateFundingEnvelopeChangeRequest extends BaseTest { | ||
WebDriver driver; | ||
|
||
@BeforeTest | ||
public void initDriver() { | ||
ChromeOptions options = new ChromeOptions(); | ||
WebDriverManager.chromedriver().setup(); | ||
driver = new ChromeDriver(options); | ||
driver.manage().window().maximize(); | ||
} | ||
|
||
|
||
@Test | ||
public void CreateFundingEnvelopeChangeRequest() throws InterruptedException { | ||
try { | ||
driver.get(QA_PORTAL_URL); | ||
test = extent.createTest("Test - Create Funding Envelope Change Request"); | ||
test.info("Starting Test - Create Funding Envelope Change Request"); | ||
|
||
PortalSignInFirstPage objPortalSigninFirstPage = new PortalSignInFirstPage(driver); | ||
Thread.sleep(3000); | ||
objPortalSigninFirstPage.clickOnBCeIdLogin(); | ||
|
||
PortalSignInCredentialPage objPortalSignInCredentialPage = new PortalSignInCredentialPage(driver); | ||
objPortalSignInCredentialPage.enterUserId(QA_PORTAL_USERNAME); | ||
objPortalSignInCredentialPage.enterPassword(QA_PORTAL_PASSWORD); | ||
objPortalSignInCredentialPage.clickSubmit(); | ||
objPortalSignInCredentialPage.clickSignatureRequired(); | ||
test.info("Login complete"); | ||
|
||
PortalHomePage objPortalHomePage = new PortalHomePage(driver); | ||
objPortalHomePage.clickFundingTile(); | ||
PortalFundingPage portalFundingPage = new PortalFundingPage(driver); | ||
test.info("Homepage complete,Landed on Funding Page"); | ||
|
||
Thread.sleep(5000); | ||
portalFundingPage.clickOnFundingAllocationTab(); | ||
PortalFundingAllocationTab portalFundingAllocationTab =new PortalFundingAllocationTab(driver); | ||
portalFundingAllocationTab.ClickReallocateFunds(); | ||
PortalFundingEnvelopeChangeRequest portalFundingEnvelopeChangeRequest = new PortalFundingEnvelopeChangeRequest(driver); | ||
|
||
portalFundingEnvelopeChangeRequest.setSummaryTextField("Funding Envelope Change Request test"); | ||
portalFundingEnvelopeChangeRequest.addFacility("jpan"); | ||
portalFundingEnvelopeChangeRequest.setRequestDescriptionTextField("This is a test Funding envelope change request application."); | ||
portalFundingEnvelopeChangeRequest.addNewFile(); | ||
portalFundingEnvelopeChangeRequest.clickSubmitNewRequest(); | ||
|
||
test.info("Request complete and submitted"); | ||
|
||
test.pass("Testcase passed!"); | ||
} | ||
|
||
catch (Exception e) { | ||
test.fail("testcase failed!"); | ||
Assert.fail("testcase failed!"); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@AfterTest | ||
public void tearDown() { | ||
driver.quit(); | ||
} | ||
} | ||
|
||
|