public CustomerAccountHelper CreateAccount(CustomerAccountData account)
        {
            manager.Navigator.GoToCreateAccountPage();

            Type(pages.Registration.FirstNameField, account.FirstName);
            Type(pages.Registration.LastNameField, account.LastName);
            Type(pages.Registration.Address1Field, account.Address1);
            Type(pages.Registration.PostcodeField, account.Postcode);
            Type(pages.Registration.CityField, account.City);

            // country
            IJavaScriptExecutor js           = driver as IJavaScriptExecutor;
            IWebElement         сountryField = pages.Registration.CountryField;

            js.ExecuteScript("arguments[0].selectedIndex = 224; arguments[0].dispatchEvent(new Event('change'))",
                             сountryField);

            Type(pages.Registration.EmailField, account.EmailAddress);
            Type(pages.Registration.PhoneField, account.Phone);
            Type(pages.Registration.PasswordField, account.Password);
            Type(pages.Registration.ConfirmPasswordField, account.Password);

            pages.Registration.CreateAccountButton.Click();

            return(this);
        }
 public void Login(CustomerAccountData account)
 {
     manager.Navigator.GoToMainPage();
     Type(pages.Main.EmailAddresFieldInLoginSection, account.EmailAddress);
     Type(pages.Main.PasswordFieldInLoginSection, account.Password);
     pages.Main.LoginButtonInLoginSection.Click();
 }
Exemple #3
0
        public void Accounts_NewAccountRegistration()
        {
            // prepare

            string timeStamp = app.Customer.GetTimestamp(DateTime.Now);

            CustomerAccountData account = new CustomerAccountData("email-" + timeStamp + "@qa.test", "customer")
            {
                FirstName = "John",
                LastName  = "Johnson",
                Address1  = "500 West Broadway",
                Postcode  = "92101",
                City      = "San Diego",
                State     = "California",
                Country   = "United States",
                Phone     = "+18883407255"
            };

            // action
            app.Customer.CreateAccount(account);
            app.Customer.Logout();
            app.Customer.Login(account);
            app.Customer.Logout();
        }