public void AddLanguage(IWebDriver driver) { //Populate Test Data ExcelLib.PopulateInCollection(ConstantUtils.TestDataPath, "Profile"); // Click Language tab WaitForElement(driver, "XPath", "//a[@data-tab='first']", 5); LanguageTab.Click(); // Click Add New WaitForElement(driver, "XPath", "//div[@data-tab='first']//div[contains(text(),'Add New')]", 5); LanguageAddNewBtn.Click(); // Enter Language WaitForElement(driver, "XPath", "//input[@placeholder='Add Language']", 5); LanguageName.SendKeys(ExcelLib.ReadData(2, "Language")); // Choose Language level 0-basic; 1-conversational; 2-fluent; 3-native LanguageDropdownBox.Click(); new SelectElement(LanguageDropdownBox).SelectByText (ExcelLib.ReadData(2, "Language Level")); // Need using OpenQA.Selenium.Support.UI; // Click Add LanguageAddBtn.Click(); }
public void AddExistingLanguageWithDifferentLanguageLevel(IWebDriver driver) { //Start extent report CommonMethods.test = CommonMethods.extent.StartTest("Add an existing language"); //Populate Test Data ExcelLib.PopulateInCollection(ConstantUtils.TestDataPath, "Profile"); // Click Language tab WaitForElement(driver, "XPath", "//a[@data-tab='first']", 5); LanguageTab.Click(); // Click Add New WaitForElement(driver, "XPath", "//div[@data-tab='first']//div[contains(text(),'Add New')]", 5); LanguageAddNewBtn.Click(); // Enter Language WaitForElement(driver, "XPath", "//input[@placeholder='Add Language']", 5); LanguageName.SendKeys(ExcelLib.ReadData(3, "Language")); // Choose Language level 0-basic; 1-conversational; 2-fluent; 3-native LanguageDropdownBox.Click(); new SelectElement(LanguageDropdownBox).SelectByText (ExcelLib.ReadData(3, "Language Level")); // Need using OpenQA.Selenium.Support.UI; // Click Add LanguageAddBtn.Click(); // Record the msg msg = "add an existing language with different language level"; }
// Enter Profile internal void EnterProfile() { // Populate the data saved in Excel to Collection try { GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "Profile"); } catch (Exception e) { Assert.Fail("Test failed to populate in collection at entering profile step", e.Message); } #region Enter Availability Type try { // Click Edit icon GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//span[contains(text(),'Time')]/i", 5); AvailabilityTimeEdit.Click(); // Click dropdown menu AvailabilityTime.Click(); // Choose Availability parttime; fulltime new SelectElement(AvailabilityTime).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Availability Type")); //Base.test.Log(LogStatus.Info, "Enter availability type successfully"); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Enter availability type successfully"); } catch (Exception ex) { Assert.Fail("Test failed to enter Availability Type", ex.Message); } #endregion #region Enter Availability Hours try { // Click Edit icon GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//span[contains(text(),'30hours') or contains(text(),'As needed')]/i", 5); AvailabilityHoursEdit.Click(); // Click dropdown menu AvailabilityHours.Click(); // Select Hours 0-less than 30h; 1-more than 30h 2-as needed new SelectElement(AvailabilityHours).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Availability Hours")); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Enter availability successfully"); } catch (Exception ex) { Assert.Fail("Test failed to enter Availability Hours", ex.Message); } #endregion #region Enter Earn Target try { // Click Edit icon GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//span[contains(text(),'per month')]/i", 5); SalaryEdit.Click(); // Click dropdown menu Salary.Click(); // Click earn 0-less than 500; 1-500~1000; 2-more than 1000 new SelectElement(Salary).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Earn Target")); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Enter earn target successfully"); } catch (Exception ex) { Assert.Fail("Test failed to enter Earn Target", ex.Message); } #endregion #region Enter Description try { // Click Edit icon DescriptionEdit.Click(); // Input description in text area GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//textarea[@name='value']", 5); Description.Clear(); Description.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); // Click Save DescriptionSave.Click(); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Enter description successfully"); } catch (Exception ex) { Assert.Fail("Test failed to Enter Description", ex.Message); } #endregion #region Enter Language try { // Click Language tab GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//a[@data-tab='first']", 5); LanguageTab.Click(); // Click Add New GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//div[@data-tab='first']//div[contains(text(),'Add New')]", 5); LanguageAddNewBtn.Click(); // Enter Language GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@placeholder='Add Language']", 5); LanguageName.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Language")); // Choose Language level 0-basic; 1-conversational; 2-fluent; 3-native LanguageDropdownBox.Click(); new SelectElement(LanguageDropdownBox).SelectByText (GlobalDefinitions.ExcelLib.ReadData(2, "Language Level")); // Need using OpenQA.Selenium.Support.UI; // Click Add LanguageAddBtn.Click(); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Enter language successfully"); } catch (Exception ex) { Assert.Fail("Test failed to enter/add Language", ex.Message); } #endregion #region Enter Skills try { // Click Skills tab GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//a[@data-tab='second']", 5); SkillTab.Click(); // Click Add New GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//div[@data-tab='second']//div[contains(text(),'Add New')]", 5); SkillAddNewBtn.Click(); // Enter Skill GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@placeholder='Add Skill']", 5); SkillName.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill")); // Choose Skill level 0-beginer; 1-intermediate; 2-expert SkillDropdownBox.Click(); new SelectElement(SkillDropdownBox).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Skill Level")); // Click Add SkillAddBtn.Click(); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Enter skills successfully"); } catch (Exception ex) { Assert.Fail("Test failed to enter/add Skills", ex.Message); } #endregion #region Enter Education try { // Click Education tab GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//a[@data-tab='third']", 5); EducationTab.Click(); // Click Add New GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//div[@data-tab='third']//div[contains(text(),'Add New')]", 5); EducationAddNewBtn.Click(); // Enter University Name GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='instituteName']", 5); EducationName.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "University")); // Enter Degree EducationDegree.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Degree")); // Choose Country EducationCountryDropdownBox.Click(); new SelectElement(EducationCountryDropdownBox).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Country")); // Choose Title 0-Associate; 1-B.A; 2-BArch; 3-BFA; 4-B.Sc... EducationTitleDropdownBox.Click(); new SelectElement(EducationTitleDropdownBox).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); // Choose Year EducationGraduationYearDropdownBox.Click(); new SelectElement(EducationGraduationYearDropdownBox).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Graduation Year")); // Click Add EducationAddBtn.Click(); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Enter education successfully"); } catch (Exception ex) { Assert.Fail("Test failed to enter/add Education", ex.Message); } #endregion #region Enter Certifications try { // Click Certifications tab GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//a[@data-tab='fourth']", 5); CertificationTab.Click(); // Click Add New GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//div[@data-tab='fourth']//div[contains(text(),'Add New')]", 5); CertificationAddNewBtn.Click(); // Enter Certificate name GlobalDefinitions.WaitForElement(GlobalDefinitions.driver, "XPath", "//input[@name='certificationName']", 5); CertificationName.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Certificate")); // Enter Issuing place CertificationFrom.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CertifiedFrom")); // Choose Year CertificationYearDropdownBox.Click(); new SelectElement(CertificationYearDropdownBox).SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "Certificate Issuing Year")); // Click Add CertificationAddBtn.Click(); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Enter certificate successfully"); } catch (Exception ex) { Assert.Fail("Test failed to enter/add Certificate", ex.Message); } #endregion }