mautomation-ui/src/main/java/com/machint/automation/StepDefinition/RegistrationSteps.java
2020-09-23 11:37:27 +05:30

152 lines
6.0 KiB
Java

package com.machint.automation.StepDefinition;
import org.testng.annotations.Test;
import com.machint.automation.AutomationController;
import com.machint.automation.PageObject.RegistrationFrom_PageObject;
import com.machint.automation.model.FormObject;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class RegistrationSteps extends RegistrationFrom_PageObject
{
@Test
@Given("^user navigate to registration form$")
public void user_navigate_to_registration_form() throws Throwable
{
FormObject formData = AutomationController.formObject;
launchBrowser(formData.getBrowser(),formData.getEnvironment());
}
@Test
@When("^user validates the homepage$")
public void user_validates_the_homepage() throws Throwable
{
Machint_getTitle("hint");
}
@Test
@Then("^user entered the Personal Information details$")
public void user_entered_the_Personal_Information_details() throws Throwable
{
readExcel("RegistrationForm");
String firstname = Machint_TestDataFromExcel("FirstName");
Machint_EnterTextField("xpath", First_Name, firstname, "visibilityOf");
String lastname = Machint_TestDataFromExcel("LastName");
Machint_EnterTextField("id", Last_Name, lastname, "visibilityOf");
String contactno = Machint_TestDataFromExcel("ContactNumber");
Machint_EnterTextField("id",Contact_Number, contactno, "visibilityOf");
String alternatecontactno = Machint_TestDataFromExcel("AlternateContactNumber");
Machint_EnterTextField("id",Alternate_Contact_Number, alternatecontactno, "visibilityOf");
String email = Machint_TestDataFromExcel("Email");
Machint_EnterTextField("id",Email, email, "visibilityOf");
String city = Machint_TestDataFromExcel("City");
Machint_EnterTextField("id",City, city, "visibilityOf");
String location = Machint_TestDataFromExcel("CurrentLocation");
Machint_EnterTextField("id",Location, location, "visibilityOf");
String permanentlocation = Machint_TestDataFromExcel("PermanentLocation");
Machint_EnterTextField("id",Permanent_Location, permanentlocation, "visibilityOf");
String address = Machint_TestDataFromExcel("Address");
Machint_EnterTextField("xpath",Address, address, "visibilityOf");
Machint_mouseHover(Education_Information);
Machint_AssertEquals("xpath", "//div/h4[text()='Personal Information']", "Personal Information:");
}
@Test
@And("^user navigate to Education Information and entered the Education Information details$")
public void user_navigate_to_Education_Information_and_entered_the_Education_Information_details() throws Throwable
{
String highestqualification = Machint_TestDataFromExcel("HighestQualification");
Machint_selectVisibleText("xpath",Highest_Qualification, highestqualification, "visibilityOf");
String specialization = Machint_TestDataFromExcel("Specialization");
Machint_selectVisibleText("id",Specialization, specialization, "visibilityOf");
String percentage = Machint_TestDataFromExcel("Percentage");
Machint_EnterTextField("id",Percentage, percentage, "visibilityOf");
String yearofpassing = Machint_TestDataFromExcel("YearOfPassing");
Machint_EnterTextField("name",Year_Of_Passing, yearofpassing, "visibilityOf");
Machint_mouseHover(Technical_Knowledge);
Machint_AssertEquals("xpath", "//div/h4[text()='Education Information']", "Education Information");
}
@Test
@And("^user navigate to Technical Knowledge and entered the Technical Knowledge details$")
public void user_navigate_to_Technical_Knowledge_and_entered_the_Technical_Knowledge_details() throws Throwable
{
String Java = Machint_TestDataFromExcel("Knowledge In JAVA");
Machint_selectValue("xpath",Knowledge_In_JAVA, Java, "visibilityOf");
String Pega = Machint_TestDataFromExcel("Knowledge In PEGA");
Machint_selectValue("xpath",Knowledge_In_PEGA, Pega, "visibilityOf");
String Appian = Machint_TestDataFromExcel("Knowledge In APPIAN");
Machint_selectValue("xpath",Knowledge_In_APPIAN, Appian, "visibilityOf");
String RPA = Machint_TestDataFromExcel("Knowledge In RPA");
Machint_selectValue("xpath",Knowledge_In_RPA, RPA, "visibilityOf");
String Python = Machint_TestDataFromExcel("Knowledge In PYTHON");
Machint_selectValue("xpath",Knowledge_In_PYTHON, Python, "visibilityOf");
String Database= Machint_TestDataFromExcel("Knowledge In DATABASE");
Machint_selectValue("xpath",Knowledge_In_DATABASE, Database, "visibilityOf");
Machint_mouseHover(Other_Info);
Machint_AssertEquals("xpath", "//div/h4[text()='Technical Knowledge']", "Technical Knowledge");
}
@Test
@Then("^user navigate the Other Info and entered the Other Info details$")
public void user_navigate_the_Other_Info_and_entered_the_Other_Info_details() throws Exception
{
String source = Machint_TestDataFromExcel("Source");
Machint_selectValue("name",Source, source, "visibilityOf");
// String employee_referral = Machint_TestDataFromExcel("Employee referral");
// Machint_selectValue("xpath",registration.Employee_referral, employee_referral, "visibilityOf");
String message = Machint_TestDataFromExcel("Message");
Machint_EnterTextField("name",Message, message, "visibilityOf");
String position = Machint_TestDataFromExcel("Have you applied for any position in our organization in past 6 months");
Machint_selectValue("id",Position, position, "visibilityOf");
Machint_AssertEquals("xpath", "//div/h4[text()='Other Info']", "Other Info:");
}
@Test
@And("^user click on choose file and upload the resume$")
public void user_click_on_choose_file_and_upload_the_resume() throws Throwable
{
Machint_EnterTextField("xpath",Resume, "C:\\Users\\durga\\Desktop\\Automation\\Automation Strategy.docx", "visibilityOf");
}
@Test
@And("^click on Submit button$")
public void click_on_Submit_button() throws Throwable
{
Machint_Click("xpath", submit, "visibilityOf");
}
@Test
@Then("^your registration process completed$")
public void your_registration_process_completed() throws Throwable
{
driver.close();
}
}