Skip to content

Commit

Permalink
Merge pull request #293 from CBIIT/cabreralf
Browse files Browse the repository at this point in the history
APPTRACK-127 Verify the edit application functionality from review application page
  • Loading branch information
Mariachaudhry authored Oct 18, 2024
2 parents 409cc9c + 52d39e1 commit 97fbd6b
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,49 @@ Would you like to log in now or go back to the home page?
And edits an application for a vacancy that status is "Submitted"
Then user sees a banner "You are editing a submitted application. Changes are not saved until the application is submitted again."

@TC_APPTRACK-127 @playwright @cabreralf @Regression @BUG_OPEN
Scenario Outline: Verify the edit application functionality from review application page
Given User is on SSJ Landing page and user is "OKTA_APPLICANT" - PW
When user navigates to Your Applications tab
And edits an application for a vacancy that status is "Draft"
And user verifies is on the "Application Documents" section of the vacancy application
And uploads cover letter if cover letter option is displayed
And uploads qualification statement if qualification statement is displayed
And uploads a Curriculum Vitae if Curriculum Vitae option is displayed
And uploads a Vision Statement if Vision Statement option is displayed
And clicks "Next"
And user verifies is on the "References" section of the vacancy application
And clicks "Next"
And user verifies is on the "Demographic Information" section of the vacancy application
And clicks "Next"
And user verifies is on the "Review" section of the vacancy application
And user clicks on "Demographics" Edit Section button
And user verifies is on the "Demographic Information" section of the vacancy application
And user makes changes to "<sex>", "<ethnicity>", "<race>", "<disabilitySeriousHealthCondition>"
And clicks "Next"
Then user verifies the updated "<sex>", "<ethnicity>", "<race>", "<disabilitySeriousHealthCondition>" values
And clicks "Back"
And user resets the demographics information for test to run again

Examples:
| sex | ethnicity | race | disabilitySeriousHealthCondition |
| Male | Hispanic or Latino | Asian | Missing an arm, leg, hand or foot |
| Female | Not Hispanic or Latino | Black or African-American | Epilepsy or other seizure disorder |
| Female | Not Hispanic or Latino | Native Hawaiian or other Pacific Islander | Deaf or serious difficulty hearing |
| Male | Hispanic or Latino | White | Blind or serious difficulty seeing even when wearing glasses |
| Female | Not Hispanic or Latino | American Indian or Alaska Native | Traumatic brain injury |
| Female | Not Hispanic or Latino | White | Developmental disability: for example, cerebral palsy or autism spectrum disorder |
| Male | Hispanic or Latino | Black or African-American | Paralysis: partial or complete paralysis (any cause) |
| Female | Not Hispanic or Latino | American Indian or Alaska Native | Intellectual disability (formerly described as mental retardation) |
| Male | Hispanic or Latino | White | None of the conditions listed above apply to me. |
| Female | Not Hispanic or Latino | American Indian or Alaska Native | I do not wish to answer questions regarding my disability/health conditions. |
| Female | Not Hispanic or Latino | Asian | Other disability or serious health condition: for example, diabetes, cancer, cardiovascular disease, anxiety disorder or HIV infection; a learning disability, a speech impairment or a hearing impairment |
| Female | Hispanic or Latino | Black or African-American | None of the conditions listed above apply to me. |
| Female | Not Hispanic or Latino | Asian | I do not wish to answer questions regarding my disability/health conditions. |



#APPTRACK-370 - review
#APPTRACK-127
#APPTRACK-928
#APPTRACK-928
#APPTRACK-927
#APPTRACK-1130
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package ServiceNow.PlatformBusinessApps.SSJ.playwright.Pages;

public class Demographic_Information_Page {

/**
* I want to share my demographics details and help improve the hiring process radio button
*/
public static String iWantToShareDemographicsRadioButton = "(//input[@value='1'])[1]";

/**
* I do not want to answer the demographic questions radio button
*/
public static String iDoNotWantToShareRadioButton = "(//input[@value='0'])[1]";
}
Original file line number Diff line number Diff line change
Expand Up @@ -741,4 +741,29 @@ public void edits_an_application_for_a_vacancy_that_status_is(String application
public void user_sees_a_banner(String expectedBanner) {
ApplicantProfileStepsImpl.user_sees_a_banner(expectedBanner);
}

@When("user verifies is on the {string} section of the vacancy application")
public void user_verifies_is_on_the_section_of_the_vacancy_application(String sectionTitle) {
ApplicantProfileStepsImpl.user_verifies_is_on_the_section_of_the_vacancy_application(sectionTitle);
}

@When("user clicks on {string} Edit Section button")
public void user_clicks_on_edit_section_button(String string) {
page.locator("(//span[contains(text(),'Edit Section')])[1]").click();
}

@When("user makes changes to {string}, {string}, {string}, {string}")
public void user_makes_changes_to(String sex, String ethnicity, String race, String disabilitySeriousHealthCondition) {
ApplicantProfileStepsImpl.user_makes_changes_to(sex,ethnicity,race,disabilitySeriousHealthCondition);
}

@Then("user verifies the updated {string}, {string}, {string}, {string} values")
public void user_verifies_the_updated_values(String sex, String ethnicity, String race, String disabilitySeriousHealthCondition) {
ApplicantProfileStepsImpl.user_verifies_the_updated_values(sex,ethnicity,race,disabilitySeriousHealthCondition);
}

@Then("user resets the demographics information for test to run again")
public void user_resets_the_demographics_information_for_test_to_run_again() {
ApplicantProfileStepsImpl.user_resets_the_demographics_information_for_test_to_run_again();
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package ServiceNow.PlatformBusinessApps.SSJ.playwright.StepsImplementation;

import Hooks.Hooks;
import ServiceNow.PlatformBusinessApps.SSJ.playwright.Pages.ApplicationDocumentsPage;
import ServiceNow.PlatformBusinessApps.SSJ.playwright.Pages.Profile_Tab_After_Submission_Page;
import ServiceNow.PlatformBusinessApps.SSJ.playwright.Pages.Profile_Tab_Page;
import ServiceNow.PlatformBusinessApps.SSJ.playwright.Pages.Vacancy_Dashboard_Page;
import ServiceNow.PlatformBusinessApps.SSJ.playwright.Pages.*;
import ServiceNow.PlatformBusinessApps.SSJ.utils.SSJ_Constants;
import appsCommon.Pages.Playwright_Common_Locators;
import appsCommon.PlaywrightUtils.Playwright_Common_Utils;
Expand Down Expand Up @@ -1984,4 +1981,64 @@ public static void user_sees_a_banner(String expectedBanner) {
String actualAlertMessage = alertMessage + " " + alertDescription;
Hooks.softAssert.assertEquals(actualAlertMessage, expectedBanner);
}

/**
* Verifies that the user is on the specified section of the vacancy application.
*
* @param sectionTitle the title of the section to verify
*/
public static void user_verifies_is_on_the_section_of_the_vacancy_application(String sectionTitle) {
String actualSectionTitle = page.locator("(//h3[normalize-space()='" + sectionTitle + "'])[1]").innerText();
System.out.println(actualSectionTitle);
Hooks.softAssert.assertEquals(actualSectionTitle, sectionTitle);
}

/**
* Update the user's demographic information with the provided details.
*
* @param sex The gender of the user
* @param ethnicity The ethnicity of the user
* @param race The race of the user
* @param disabilitySeriousHealthCondition Indicates if the user has a disability or serious health condition
*/
public static void user_makes_changes_to(String sex, String ethnicity, String race, String disabilitySeriousHealthCondition) {
page.locator(Demographic_Information_Page.iWantToShareDemographicsRadioButton).click();
page.locator(Playwright_Common_Locators.dynamicSpanNormalizeSpaceLocator(sex)).click();
page.locator(Playwright_Common_Locators.dynamicSpanNormalizeSpaceLocator(ethnicity)).click();
page.locator(Playwright_Common_Locators.dynamicSpanNormalizeSpaceLocator(race)).click();
page.locator(Playwright_Common_Locators.dynamicSpanNormalizeSpaceLocator(disabilitySeriousHealthCondition)).click();
}

/**
* Method to verify the updated values for sex, ethnicity, race, and disability/serious health condition on the sharing demographics page.
*
* @param sex The expected sex value to verify.
* @param ethnicity The expected ethnicity value to verify.
* @param race The expected race value to verify.
* @param disabilitySeriousHealthCondition The expected disability/serious health condition value to verify.
*/
public static void user_verifies_the_updated_values(String sex, String ethnicity, String race, String disabilitySeriousHealthCondition) {
String sharingText = Playwright_Common_Locators.getTextFromHeaderOrNormalizedSpan("Sharing demographics");
String sexText = Playwright_Common_Locators.getTextFromHeaderOrNormalizedSpan(sex);
String ethnicityText = Playwright_Common_Locators.getTextFromHeaderOrNormalizedSpan(ethnicity);
String raceText = Playwright_Common_Locators.getTextFromHeaderOrNormalizedSpan(race);
String disabilitySeriousHealthConditionText = Playwright_Common_Locators.getTextFromHeaderOrNormalizedSpan(disabilitySeriousHealthCondition);
Hooks.softAssert.assertEquals(sharingText,"Yes");
Hooks.softAssert.assertEquals(sexText,sex);
Hooks.softAssert.assertEquals(ethnicityText,ethnicity);
Hooks.softAssert.assertEquals(raceText,race);
Hooks.softAssert.assertEquals(disabilitySeriousHealthConditionText,disabilitySeriousHealthCondition);
}

/**
* Method to reset the demographics information for the test to run again.
* It clicks on the 'I do not want to share' radio button on the demographics information page,
* clicks on the 'Save Application' button, and asserts that the alert message is as expected.
*/
public static void user_resets_the_demographics_information_for_test_to_run_again() {
page.locator(Demographic_Information_Page.iDoNotWantToShareRadioButton).click();
page.locator(Playwright_Common_Locators.dynamicSpanNormalizeSpaceLocator("Save Application")).click();
String alertMessage = page.textContent(".ant-message-notice-content");
Hooks.softAssert.assertEquals(alertMessage,"Application successfully saved Back to Applications Home?x");
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package ServiceNow.PlatformBusinessApps.SSJ.playwright.Utils;

import ServiceNow.PlatformBusinessApps.SSJ.playwright.Pages.Vacancy_Dashboard_Page;
import appsCommon.PlaywrightUtils.Playwright_Common_Utils;
import com.microsoft.playwright.ElementHandle;
import com.microsoft.playwright.Locator;
import com.nci.automation.web.CommonUtils;
import com.nci.automation.web.PlaywrightUtils;
import java.util.List;
Expand Down
33 changes: 33 additions & 0 deletions src/test/java/appsCommon/Pages/Playwright_Common_Locators.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package appsCommon.Pages;

import com.microsoft.playwright.ElementHandle;
import static com.nci.automation.web.PlaywrightUtils.page;

public class Playwright_Common_Locators {

/**
Expand All @@ -22,4 +25,34 @@ public static String dynamicTextLocator(String text) {
public static String dynamicTextLocatorByIndex(String text, int index) {
return "(//*[text()='" + text + "'])[" + index + "]";
}

/**
* Returns a dynamic XPath locator for locating a span element with normalized space based on the provided text.
*
* @param text the text value of the span element to be located
* @return a string representing the dynamic XPath locator for the span element
*/
public static String dynamicSpanNormalizeSpaceLocator (String text){
return "(//span[normalize-space()='" + text + "'])[1]";
}

/**
* Extracts text content from a header element followed by a span element if available,
* or from a normalized space span element as a fallback.
*
* @param text the text value used to locate the elements
* @return the extracted text content from the located element, or null if not found
*/
public static String getTextFromHeaderOrNormalizedSpan(String text) {
String xpathExpressionH2 = String.format("//h2[text()='%s']/following-sibling::span[1]", text);
String xpathExpressionSpanNormSpace = String.format("(//span[normalize-space()='%s'])[1]", text);
ElementHandle element = page.querySelector(xpathExpressionH2);
if (element == null) {
element = page.querySelector(xpathExpressionSpanNormSpace);
}
if (element == null) {
return null;
}
return element.textContent();
}
}

0 comments on commit 97fbd6b

Please sign in to comment.