Example #1
0
 public void TextBox()
 {
     NavigationHelper.NavigateToURL(ObjectRepository.Config.GetDemoRegister());
     LinkHelper.ClickLink(By.Id("input-email"));
     //IWebElement EmaiBoxField = ObjectRepository.driver.FindElement(By.Name("email"));
     //EmaiBoxField.Clear();
     TextBoxHelper.ClearTextBox(By.Id("input-email"));
     TextBoxHelper.SendTextToTextbox(By.Id("input-email"), ObjectRepository.Config.GetEmail());
     TextBoxHelper.ClearTextBox(By.Id("input-password"));
     TextBoxHelper.SendTextToTextbox(By.Id("input-password"), ObjectRepository.Config.GetPassword());
 }
Example #2
0
        public void IvalidPostcodeTest()
        {
            NavigationHelper.NavigateToURL(ObjectRepository.Config.GetGoCompareHome());
            Thread.Sleep(5000);
            TextBoxHelper.SendTextToTextbox(By.CssSelector("#AddressLookup_Postcode"), "W30");
            ObjectRepository.driver.FindElement(By.CssSelector("a[id='AddressLookup_SearchButton']")).Click();
            Thread.Sleep(3000);
            var actualErrorMessage = ObjectRepository.driver.FindElement(By.CssSelector("div[class*='message']")).Text;

            Assert.AreEqual("Please provide a valid postcode.", actualErrorMessage, "Values are not equal");
            Console.WriteLine(actualErrorMessage);
        }
Example #3
0
 public void XMLRegisterNewAccount()
 {
     NavigationHelper.NavigateToURL(ObjectRepository.Config.GetDemoHome());
     MenuButtonHelper.SelectMenuButton(_myAccountTab);
     MenuButtonHelper.SelectMenuButton(_registerButton);
     TextBoxHelper.SendTextToTextbox(_firstName, _testContext.DataRow["Firstname"].ToString());
     TextBoxHelper.SendTextToTextbox(_lastName, _testContext.DataRow["Lastname"].ToString());
     TextBoxHelper.SendTextToTextbox(_email, _testContext.DataRow["Email"].ToString());
     TextBoxHelper.SendTextToTextbox(_telephone, _testContext.DataRow["Telephone"].ToString());
     TextBoxHelper.SendTextToTextbox(_password, _testContext.DataRow["Password"].ToString());
     TextBoxHelper.SendTextToTextbox(_confirmPassword, _testContext.DataRow["ConfirmPassword"].ToString());
     RadioButtonHelper.ClickOnOneRadiobutton(_newsletterYes);
     CheckBoxHelper.ClickCheckBox(_policyBox);
     MenuButtonHelper.SelectMenuButton(_createAccountButton);
     MenuButtonHelper.SelectMenuButton(_myAccountTab);
     MenuButtonHelper.SelectMenuButton(_logoutButton);
 }
Example #4
0
 public void CreateNewAccount()
 {
     NavigationHelper.NavigateToURL(ObjectRepository.Config.GetDemoHome());
     MenuButtonHelper.SelectMenuButton(_myAccountTab);
     MenuButtonHelper.SelectMenuButton(_registerButton);
     TextBoxHelper.SendTextToTextbox(_firstName, _testContext.DataRow["FIRSTNAME"].ToString());
     TextBoxHelper.SendTextToTextbox(_lastName, _testContext.DataRow["LASTNAME"].ToString());
     TextBoxHelper.SendTextToTextbox(_email, _testContext.DataRow["EMAIL"].ToString());
     TextBoxHelper.SendTextToTextbox(_telephone, _testContext.DataRow["TELEPHONE"].ToString());
     TextBoxHelper.SendTextToTextbox(_password, _testContext.DataRow["PASSWORD"].ToString());
     TextBoxHelper.SendTextToTextbox(_confirmPassword, _testContext.DataRow["CONFIRMPASSWORD"].ToString());
     RadioButtonHelper.ClickOnOneRadiobutton(_newsletterYes);
     CheckBoxHelper.ClickCheckBox(_policyBox);
     MenuButtonHelper.SelectMenuButton(_createAccountButton);
     MenuButtonHelper.SelectMenuButton(_myAccountTab);
     MenuButtonHelper.SelectMenuButton(_logoutButton);
 }
Example #5
0
 public void AccountLogin()
 {
     NavigationHelper.NavigateToURL(ObjectRepository.Config.GetDemoHome());
     MenuButtonHelper.SelectMenuButton(_myAccountTab);
     MenuButtonHelper.SelectMenuButton(_loginTab);
     TextBoxHelper.SendTextToTextbox(_loginEmail, _testContext.DataRow["EMAIL"].ToString());
     TextBoxHelper.SendTextToTextbox(_loginPassword, _testContext.DataRow["PASSWORD"].ToString());
     MenuButtonHelper.SelectMenuButton(_loginUserButton);
     //IWebDriver driver = new ChromeDriver();
     //driver.Navigate().GoToUrl("https://demo.opencart.com/");
     //driver.Manage().Window.Maximize();
     //driver.FindElement(_myAccountTab).Click();
     //driver.FindElement(_loginTab).Click();
     //driver.FindElement(_loginEmail).SendKeys(_testContext.DataRow["EMAIL"].ToString());
     //driver.FindElement(_loginPassword).SendKeys(_testContext.DataRow["PASSWORD"].ToString());
     //driver.FindElement(_loginUserButton).Click();
     //driver.Quit();
 }
Example #6
0
        public void ValidPostcodeTest()
        {
            //ObjectRepository.driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(1));
            WebDriverWait wait = new WebDriverWait(ObjectRepository.driver, TimeSpan.FromSeconds(50));

            wait.PollingInterval = TimeSpan.FromMilliseconds(250);
            wait.IgnoreExceptionTypes(typeof(NoSuchElementException), typeof(ElementNotVisibleException));
            NavigationHelper.NavigateToURL(ObjectRepository.Config.GetGoCompareHome());
            Thread.Sleep(1000);
            TextBoxHelper.SendTextToTextbox(By.CssSelector("#AddressLookup_Postcode"), "W30PN");
            Thread.Sleep(1000);
            MenuButtonHelper.SelectMenuButton(By.CssSelector("a[id='AddressLookup_SearchButton']"));
            Thread.Sleep(1000);
            MenuButtonHelper.SelectMenuButton(By.CssSelector("#AddressLookup_AddressList li:nth-child(1)"));
            Thread.Sleep(1000);
            MenuButtonHelper.SelectMenuButton(By.CssSelector("label[for='Both gas and electricity']"));
            Thread.Sleep(1000);
            MenuButtonHelper.SelectMenuButton(By.CssSelector("label[for='IsDualFuel_Yes']"));
            Thread.Sleep(1000);
            MenuButtonHelper.SelectMenuButton(By.CssSelector("label[for='dual-British Gas']"));
            Thread.Sleep(1000);
            MenuButtonHelper.SelectMenuButton(By.CssSelector("label[for='dual-Monthly Direct Debit']"));
            Thread.Sleep(1000);
            MenuButtonHelper.SelectMenuButton(By.CssSelector("label[for='DualFuelIsEconomy7_Yes']"));
            Thread.Sleep(1000);
            MenuButtonHelper.SelectMenuButton(By.CssSelector("label[for='dual-Paper']"));
            Thread.Sleep(1000);
            MenuButtonHelper.SelectMenuButton(By.CssSelector("#DualFuelTariff_EnabledDropdown"));
            Thread.Sleep(1000);
            //DropDownHelper.SelectByIndex(By.CssSelector("#DualFuelTariff_EnabledDropdown"),1);
            DropDownHelper.SelectByText(By.CssSelector("#DualFuelTariff_EnabledDropdown"), "Fixed Price July 2018");
            //MenuButtonHelper.SelectMenuButton(By.CssSelector("span[class='continue__text']"));
            //MenuButtonHelper.SelectMenuButton(By.CssSelector("//p[contains(text(),'British Gas')]"));
            //MenuButtonHelper.SelectMenuButton(By.XPath("//button[@type='submit']"));
            //Assert.AreNotEqual("https://energy.gocompare.com/gas-electricity/step1", ObjectRepository.driver.Url);
            //Thread.Sleep(2000);
            //var pageMainHeader = ObjectRepository.driver.FindElement(By.CssSelector
            //    ("")).Text;
            //Assert.IsFalse(pageMainHeader.Contains("YOUR SEARCH"));
        }