Skip to content

Commit

Permalink
Merge pull request #248 from CBIIT/juarezds
Browse files Browse the repository at this point in the history
EM Automation - Verify Create Account - Active Account scenario
  • Loading branch information
alenaminsk authored Jul 2, 2024
2 parents 5918172 + 9c5cd9d commit 3ef6c88
Show file tree
Hide file tree
Showing 10 changed files with 491 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/SSJ-Smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ jobs:
echo "<h3><a href='${{ steps.reportpath.outputs.path }}/report-${{ steps.timestamp.outputs.timestamp }}.html'>Test Report ${{ steps.reportpath.outputs.path }}/report-${{ steps.timestamp.outputs.timestamp }}.html</a></h3>" >> ssj-smoke-test-results.html
git add ssj-smoke-test-results.html
git commit -m "Update ssj-smoke-test-results.html"
git push https://${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:gh-pages
git push https://${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:gh-pages
14 changes: 14 additions & 0 deletions src/main/java/com/nci/automation/web/CommonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -786,4 +786,18 @@ public static String getDateOneMonthFromNowIn_YYYY_MM_DD_format() {
LocalDate oneMonthFromNow = LocalDate.now().plusMonths(1);
return oneMonthFromNow.format(formatter);
}

/**
* Compares two lists of elements and asserts that they are equal.
*
* @param actualValues The list of actual values.
* @param expectedValues The list of expected values.
* @throws AssertionError if the sizes of the lists are different or if any corresponding elements in the lists are not equal.
*/
public static void comparingTwoLists(List<WebElement> actualValues, List<String> expectedValues){
Assert.assertEquals(actualValues.size(), expectedValues.size());
for (int i = 0; i < actualValues.size(); i++) {
Assert.assertEquals(actualValues.get(i).getText(), expectedValues.get(i));
}
}
}
22 changes: 19 additions & 3 deletions src/test/java/GrantsApps/EM/playwright/Features/EMFlow.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Feature: EM Flow

@I2E_ROLE_DROP_DOWN_LIST @Jira950 @JUAREZDS @Regression @playwright
@I2E_ROLE_DROP_DOWN_LIST @JIRA-950 @JUAREZDS @Regression @playwright
Scenario: I2E Role Drop Down List
Given User is logged in as Primary ITwoE Coordinator - PW
When User inputs "Mata Rodriguez, Kevin Osmaldo" into the Name field and clicks search - PW
Expand All @@ -27,7 +27,7 @@ Feature: EM Flow
When the user chooses Referral option from Business Area dropdown - PW
Then the following roles should display "ARA Referral Liaison", "ARA Referral Officer", "Referral Officer"

@BUSINESS_AREA_DROP_DOWN @Jira938 @Regression @JUAREZDS @playwright
@BUSINESS_AREA_DROP_DOWN @JIRA-938 @Regression @JUAREZDS @playwright
Scenario: Verify Business Area Drop Down List
Given User is logged in as Primary ITwoE Coordinator - PW
When User inputs "Mata Rodriguez, Kevin Osmaldo" into the Name field and clicks search - PW
Expand All @@ -47,4 +47,20 @@ Feature: EM Flow
And when user selects All option
Then user can verify that Administrative option is no longer selected
And user Removes selected value from business area drop down
Then user can verify that the value is no longer present
Then user can verify that the value is no longer present

@HOME_PAGE_FOOTERS @JIRA-944 @JUAREZDS @Regression @playwright
Scenario: Verify Home Page Footers
Given User is logged in as Primary ITwoE Coordinator - PW
Then first and last name "Diego Juarez" of logged in user are displayed
Then user can navigate to "IMPAC II" hyperlink and verifies hyperlink URL "https://inside.era.nih.gov/index.htm"
Then user can navigate to "Accessibility" hyperlink and verify hyperlink URL "https://www.cancer.gov/policies/accessibility"
Then user can navigate to "Disclaimer" hyperlink and verify hyperlink URL "https://www.cancer.gov/policies/disclaimer"
Then user can navigate to "FOIA" hyperlink and verify hyperlink URL "https://www.cancer.gov/policies/foia"
Then user can navigate to "Privacy & Security" hyperlink and verify hyperlink URL "https://www.cancer.gov/policies/privacy-security"
Then user can navigate to "U.S. Department of Health and Human Services" hyperlink and verify hyperlink URL "https://www.hhs.gov/"
Then user can navigate to "National Institutes of Health" hyperlink and verify hyperlink URL "https://www.nih.gov/"
Then user can navigate to "National Cancer Institute" hyperlink and verifies hyperlink URL "https://www.cancer.gov/"
Then user can navigate to "USA.gov" hyperlink and verify hyperlink URL "https://www.usa.gov/"
Then user can confirm the application version number "v2.4.0"
Then user can verify NIH motto "NIH … Turning Discovery Into Health®"
25 changes: 25 additions & 0 deletions src/test/java/GrantsApps/EM/playwright/Steps/EMFlowSteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,29 @@ public void user_removes_selected_value_from_business_area_drop_down() {
public void user_can_verify_that_the_value_is_no_longer_present() {
EM_Steps_Implementation.user_can_verify_that_the_value_is_no_longer_present();
}

@Then("first and last name {string} of logged in user are displayed")
public void first_and_last_name_of_logged_in_user_are_displayed(String expectedFirstAndLastName) {
EM_Steps_Implementation.first_and_last_name_of_logged_in_user_are_displayed(expectedFirstAndLastName);
}

@Then("user can navigate to {string} hyperlink and verify hyperlink URL {string}")
public void user_can_navigate_to_hyperlink_and_verify_hyperlink_url(String hyperlinkText, String expectedURL) {
EM_Steps_Implementation.user_can_navigate_to_hyperlink_and_verify_hyperlink_url(hyperlinkText, expectedURL);
}

@Then("user can navigate to {string} hyperlink and verifies hyperlink URL {string}")
public void user_can_navigate_to_hyperlink_and_verifies_hyperlink_url(String hyperlinkText, String expectedURL) {
EM_Steps_Implementation.user_can_navigate_to_hyperlink_and_verifies_hyperlink_url(hyperlinkText, expectedURL);
}

@Then("user can confirm the application version number {string}")
public void user_can_confirm_the_application_version_number(String applicationVersionNumber) {
EM_Steps_Implementation.user_can_confirm_the_application_version_number(applicationVersionNumber);
}

@Then("user can verify NIH motto {string}")
public void user_can_verify_nih_motto(String nihMottoText) {
EM_Steps_Implementation.user_can_verify_nih_motto(nihMottoText);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -468,4 +468,64 @@ public static void user_can_verify_that_the_value_is_no_longer_present() {
CucumberLogUtils.playwrightScreenshot(page);
assertThat(page.locator("app-business-area-dropdown")).containsText("");
}

/**
* Displays the first and last name of the logged in user
*
* @param expectedFirstAndLastName the expected first and last name of the logged in user
*/
public static void first_and_last_name_of_logged_in_user_are_displayed(String expectedFirstAndLastName) {
assertThat(page.locator("#headerCollapse")).containsText(expectedFirstAndLastName);
CucumberLogUtils.playwrightScreenshot(page);
}

/**
* Navigates to a hyperlink and verifies the URL of the hyperlink.
*
* @param hyperlinkText the text of the hyperlink to navigate to
* @param expectedURL the expected URL of the hyperlink
*/
public static void user_can_navigate_to_hyperlink_and_verify_hyperlink_url(String hyperlinkText, String expectedURL) {
Page page1 = page.waitForPopup(() -> {
page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName(hyperlinkText)).click();
});
CucumberLogUtils.playwrightScreenshot(page);
Assert.assertEquals(page1.url(), expectedURL);
page1.close();
}

/**
* This method allows the user to navigate to a hyperlink with the given text and verifies the URL of the hyperlink.
*
* @param hyperlinkText The text of the hyperlink the user wants to navigate to.
* @param expectedURL The expected URL of the hyperlink.
*/
public static void user_can_navigate_to_hyperlink_and_verifies_hyperlink_url(String hyperlinkText, String expectedURL) {
Page page5 = page.waitForPopup(() -> {
page.getByRole(AriaRole.CONTENTINFO).getByRole(AriaRole.LINK, new Locator.GetByRoleOptions().setName(hyperlinkText)).click();
});
CucumberLogUtils.playwrightScreenshot(page);
Assert.assertEquals(page5.url(), expectedURL);
page5.close();
}

/**
* This method allows the user to confirm the application version number.
*
* @param applicationVersionNumber The application version number to confirm.
*/
public static void user_can_confirm_the_application_version_number(String applicationVersionNumber) {
CucumberLogUtils.playwrightScreenshot(page);
assertThat(page.getByRole(AriaRole.CONTENTINFO)).containsText(applicationVersionNumber);
}

/**
* Verifies if the given text is present in the NIH motto paragraph on the page.
*
* @param nihMottoText The text to verify in the NIH motto paragraph.
*/
public static void user_can_verify_nih_motto(String nihMottoText) {
CucumberLogUtils.playwrightScreenshot(page);
assertThat(page.getByRole(AriaRole.PARAGRAPH)).containsText(nihMottoText);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,40 @@ Feature: Managing User Accounts
And clicks Add Role button within Add Role pop up
And saves changes
And can verify the success message is displayed "Success! I2E account has been created."
And can verify that Return to Manage I2E Users hyperlink directs to url "https://i2e-test.nci.nih.gov/em/#/search"
And can verify that Return to Manage I2E Users hyperlink directs to url "https://i2e-test.nci.nih.gov/em/#/search"

@ACTIVE_ACCOUNT_SCENARIO @JIRA-965 @JUAREZDS @Regression @selenium
Scenario: Verify Create Account - Active Account scenario
Given User is logged in as Primary IC Coordinator
And clicks Show Advanced Filters
And selects "Active" in I2E Account Status drop down list
And searches
And gets the full NED name of the first record
And clicks Create on the first record in the results
And User can verify the page name is "Modify Account"
And can verify that User's full name is displayed
And can verify the respective wording of Full Name tooltip "Legal Name is always displayed first, followed by Preferred Name."
And can verify that the following fields have values displayed: NIH (Network) ID, E-mail, NED Organization, SAC Code, NED Classification
And can verify that Account Status is set to "Active"
And can verify the Add Role button
And can verify the table title is "Active I2E Roles"
And can verify the PDF document link "https://i2e-test.nci.nih.gov/em/assets/docs/I2E%20Roles%20and%20Descriptions.pdf" opens upon clicking on the List of I2E Roles hyperlink
And can verify that the following fields "Role", "Role Organization", "Assigned Cancer Activities", "Start Date", "Action" are present
And can verify that "Cancer Activity Monitors (Optional)" title is present with tooltip "⠂ Can be assigned to any I2E user"
"""
⠂ Can be assigned to any I2E user.
⠂ Users with a Program Analyst role and Cancer Activity monitor can perform referral actions, process ARA and save greensheet(s). All users can run default queries in Referral, ARA, Greensheets, Funding Selections and other modules.
"""
And user can verify that "Deactivate Account" button is enabled
And user can verify that " Save Changes " button is disabled
And user can verify that "Cancel" button is enabled
And user can verify that "I2E Account History" section is displayed
And user clicks on Show for "Inactive I2E Roles"
And user verifies Inactive I2E Roles column header names "Role", "Role Organization", "Start Date", "End Date", "Updated by"
And user verifies that Start Dates are displayed in descending order
And user clicks on Show for "Inactive Cancer Activities"
And user verifies Inactive Cancer Activities column header names "Cancer Activity", "Type", "Start Date", "End Date", "Updated By"
And user clicks on Show for "Change History"
And user verifies Change History column header names "Date", "Change(s) Made", "Updated By"
And user verifies that Start Dates for Change History table are displayed in descending order
And user is able to click on the hyperlink "Return to Manage I2E Users"
61 changes: 61 additions & 0 deletions src/test/java/GrantsApps/EM/selenium/Pages/ModifyAccountPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package GrantsApps.EM.selenium.Pages;

import com.nci.automation.web.WebDriverUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import java.util.List;

public class ModifyAccountPage {

/**
* ACTUAL INACTIVE I2E ROLES COLUMN HEADER VALUES
*/
@FindBy(xpath = "(//thead)[3]/tr/th")
public List<WebElement> actualInactiveI2ERolesColumnHeaderValues;

/**
* ACTUAL INACTIVE CANCER ACTIVITIES COLUMN HEADER VALUES
*/
@FindBy(xpath = "(//thead)[4]/tr/th")
public List<WebElement> actualInactiveCancerActivitiesValues;

/**
* ACTUAL CHANGE HISTORY COLUMN HEADER VALUES
*/
@FindBy(xpath = "(//thead)[5]/tr/th")
public List<WebElement> actualChangeHistoryValues;

/**
* CANCER ACTIVITY MONITORS (OPTIONAL) TOOLTIP
*/
@FindBy(xpath = "//main[@data-select2-id='main']//app-create-account//div//div//div//h5//a//i")
public WebElement cancerActivityMonitorsToolTip;

/**
* INACTIVE I2E ROLES TABLE COLUMN HEADERS
*/
@FindBy(xpath = "(//tbody)[4]/tr/td[3]")
public List<WebElement> inactiveI2ERolesTableColumnHeaders;

/**
* CHANGE HISTORY DATE VALUES
*/
@FindBy(xpath = "(//tbody)[6]/tr/td[1]")
public List<WebElement> changeHistoryDateValues;

/**
* Returns the WebElement of the first link with the specified text within its parent div.
*
* @param text the text to search for
* @return the WebElement of the link
*/
public static WebElement dynamicShowLinkLocator(String text) {
return WebDriverUtils.webDriver.findElement(By.xpath("(//*[text()='" + text + "'])[1]//parent::div/a"));
}

public ModifyAccountPage() {
PageFactory.initElements(WebDriverUtils.webDriver, this);
}
}
Loading

0 comments on commit 3ef6c88

Please sign in to comment.