Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new Lynda.Test.ConsumerPages.RegPageStep1 class. Does not select a subscription or enter any account information.
 /// </summary>
 /// <param name="browserForPage">Browser instance containing the consumer registration page step 1.</param>
 public RegPageStep1(Browser browserForPage)
 {
     regPageStep1Repo = new RegPageStep1Repo();
     browser = browserForPage;
     browser.ClickTitleBar();
     WaitForLoad();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new Lynda.Test.ConsumerPages.RegConfirm class.
 /// </summary>
 /// <param name="browserForPage"></param>
 public RegConfirm(Browser browserForPage)
 {
     regConfirmRepo = new RegConfirmRepo();
     browser = browserForPage;
     browser.ClickTitleBar();
     WaitForLoad();
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime = 100;
            Keyboard.DefaultKeyPressTime = 40;
            Delay.SpeedFactor = 1.0;

            const string homePageURI = "integration.lynda.com/member.aspx";

            Browser browserIE = new Browser(BrowserProduct.IE,homePageURI,true);
            browserIE.HalfSize();
            Browser browserFF = new Browser(BrowserProduct.Firefox,homePageURI,true);
            browserFF.HalfSize();
            browserFF.Move(200,200);

            //Create new member home page instance which also waits for the page to load
            HomePageMember homePageMemberIE = new HomePageMember(browserIE);
            HomePageMember homePageMemberFF = new HomePageMember(browserFF);

            homePageMemberIE.ClickSubscribeLink();
            homePageMemberFF.ClickSubscribeLink();

            RegPageStep1 regPageStep1IE = new RegPageStep1(browserIE);
            RegPageStep1 regPageStep1FF = new RegPageStep1(browserFF);

            regPageStep1IE.SelectOTLSubscription(OTLSubscriptionPlanRegPage1.SubscriptionPlan.MonthlyPremium);
            regPageStep1FF.SelectOTLSubscription(OTLSubscriptionPlanRegPage1.SubscriptionPlan.Annual);

            regPageStep1IE.FillAccountInfo(new AccountInfo(AccountInfo.DefaultInfo.Standard));
            AccountInfo accountInfo = new AccountInfo(AccountInfo.DefaultInfo.Standard);
            accountInfo.FirstName="John";
            regPageStep1FF.FillAccountInfo(accountInfo);

            regPageStep1IE.ClickContinue();
            regPageStep1FF.ClickContinue();

            RegPageStep2 regPageStep2IE = new RegPageStep2(browserIE,BillingInformation.DefaultInfo.Standard,
                                                           PaymentInformation.DefaultInfo.Standard);
            RegPageStep2 regPageStep2FF = new RegPageStep2(browserFF,BillingInformation.DefaultInfo.Standard,
                                                           PaymentInformation.DefaultInfo.Standard);

            regPageStep2IE.ClickIHaveRead();
            regPageStep2IE.ClickStartMembership();
            regPageStep2FF.ClickIHaveRead();
            regPageStep2FF.ClickStartMembership();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            const string testCaseName = "AllRegistrations";
            string subscriptionPlanRow = TestSuite.Current.GetTestCase(testCaseName).DataContext.CurrentRow["SubscriptionPlan"];
            string regPage2PlanNameExpected = TestSuite.Current.GetTestCase(testCaseName).DataContext.CurrentRow["regPage2PlanNameExpected"];
            string confirmPagePlanNameExpected = TestSuite.Current.GetTestCase(testCaseName).DataContext.CurrentRow["confirmPagePlanNameExpected"];

            OTLSubscriptionPlanRegPage1.SubscriptionPlan subscriptionPlanToSelect = (OTLSubscriptionPlanRegPage1.SubscriptionPlan)
                Enum.Parse(typeof(OTLSubscriptionPlanRegPage1.SubscriptionPlan),subscriptionPlanRow,false);

            Mouse.DefaultMoveTime = AppSettings.MouseDefaultMoveTime;
            Keyboard.DefaultKeyPressTime = AppSettings.KeyboardDefaultKeyPressTime;
            Delay.SpeedFactor = 1.0;

            string url = string.Format("http://{0}/member.aspx", AppSettings.Domain);

            Browser browser = new Browser(AppSettings.Browser,url,true);

            HomePageMember homePageMember = new HomePageMember(browser);
            homePageMember.ClickSubscribeLink();

            RegPageStep1 regPageStep1 = new RegPageStep1(browser,subscriptionPlanToSelect,
                                                         AccountInfo.DefaultInfo.Standard);

            OTLSubscriptionPlanRegPage1 otlPlan = regPageStep1.GetOTLSubscriptionPlan();
            //e.g. Monthly, MonthlyPremium, Annual, AnnualPremium
            OTLSubscriptionPlanRegPage1.SubscriptionPlan regPage1PlanSelected = otlPlan.Subscription;
            //e.g. "$37.50/month" "$250.00/year" "$375.00/year" "$25.00/month"
            string regPage1PlanPrice = otlPlan.SubscriptionPrice;

            regPageStep1.ClickContinue();

            RegPageStep2 regPageStep2 = new RegPageStep2(browser, BillingInformation.DefaultInfo.Standard,
                                                         PaymentInformation.DefaultInfo.Standard);

            OTLSubscriptionPlanRegPage2 otlPlanPage2 = regPageStep2.GetOTLSubscriptionPlan();
            //e.g. "Monthly Premium Subscription" "Monthly Subscription" "Annual Subscription" "Annual Premium Subscription"
            string regPage2PlanName = otlPlanPage2.PlanName;
            //e.g. "$37.50/month" "$25.00/month" "$250.00/year" "$375.00/year"
            string regPage2PlanPrice = otlPlanPage2.PlanPrice;

            regPageStep2.ClickIHaveRead();
            regPageStep2.ClickStartMembership();

            RegConfirm regPageConfirm = new RegConfirm(browser);
            OTLPlanInfo otlPlanInfo = regPageConfirm.GetOTLPlanInfo();
            string confirmPagePlanName = otlPlanInfo.Name; //e.g. "Monthly Premium" "Monthly" "Annual" "Annual Premium"
            string confirmPagePlanPrice = otlPlanInfo.Price; //e.g. "$37.50" "$25.00" "$250.00" "$375.00"

            regPageConfirm.ClickLogoutLink();

            homePageMember.WaitForLoad();

            //Verify displayed subscription info on reg page 2 and confirm page matches what was selected on reg page 1.
            Validate.AreEqual(string.Compare(regPage2PlanName,regPage2PlanNameExpected,false),0,
                              "Actual:{0} Expected:{1}",true);
            Validate.AreEqual(string.Compare(confirmPagePlanName,confirmPagePlanNameExpected,false),0,
                              "Actual:{0} Expected:{1}",true);
            Validate.AreEqual(string.Compare(regPage1PlanPrice,regPage2PlanPrice,false),0,
                              "Actual:{0} Expected:{1}",true);
            Validate.AreEqual(string.Compare(confirmPagePlanPrice,regPage2PlanPrice.Substring(0,confirmPagePlanPrice.Length),false),0,
                              "Actual:{0} Expected:{1}",true);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new Lynda.Test.ConsumerPages.RegPageStep1 class.
 /// </summary>
 /// <param name="browserForPage">Browser instance containing the consumer registration page step 1.</param>
 /// <param name="subscription">Subscription to select.</param>
 /// <param name="customAccountInfo">Custom account information to enter.</param>
 public RegPageStep1(Browser browserForPage, OTLSubscriptionPlanRegPage1.SubscriptionPlan subscription, AccountInfo customAccountInfo)
     : this(browserForPage)
 {
     SelectOTLSubscription(subscription);
     FillAccountInfo(customAccountInfo);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new Lynda.Test.ConsumerPages.RegPageStep1 class.
 /// </summary>
 /// <param name="browserForPage">Browser instance containing the consumer registration page step 1.</param>
 /// <param name="subscription">Subscription to select.</param>
 /// <param name="accountDefaultInfo">Type of account information to enter.</param>
 public RegPageStep1(Browser browserForPage, OTLSubscriptionPlanRegPage1.SubscriptionPlan subscription, AccountInfo.DefaultInfo accountDefaultInfo)
     : this(browserForPage, subscription, new AccountInfo(accountDefaultInfo))
 {
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime = 50;
            Keyboard.DefaultKeyPressTime = 50;
            Delay.SpeedFactor = 1.0;

            string url = string.Format("http://{0}/member.aspx",AppSettings.Domain);

            Browser browser = new Browser(AppSettings.Browser, url,true);

            HomePageMember homePageMember = new HomePageMember(browser);
            homePageMember.ClickSubscribeLink();

            RegPageStep1 regPageStep1 = new RegPageStep1(browser,OTLSubscriptionPlanRegPage1.SubscriptionPlan.MonthlyPremium,
                                                         AccountInfo.DefaultInfo.Standard);

            regPageStep1.CheckOrUncheckMonthlyNewsletters(true);
            regPageStep1.CheckOrUncheckNewReleases(true);
            regPageStep1.CheckOrUncheckSpecialAnnouncements(true);
            regPageStep1.FillAccountInfo(); //standard info default.

            //custom
            AccountInfo accountInfo = new AccountInfo(); //Nothing initialized

            accountInfo.SignMeUpNewReleases=true;
            accountInfo = new AccountInfo(AccountInfo.DefaultInfo.Standard); //Standard account info
            //change standard values to custom
            accountInfo.FirstName="Trebek";
            accountInfo.SignMeUpSpecial=false;
            regPageStep1.FillAccountInfo(accountInfo);
            //write to one field only
            regPageStep1.FillAccountInfo(AccountInfo.Field.LastName, "Connery");
            regPageStep1.FillAccountInfo(AccountInfo.Field.FirstName, "Sean");
            //get current account info
            accountInfo = regPageStep1.GetAccountInfo();
            string firstName = accountInfo.Username;
            bool newReleasesChecked = accountInfo.SignMeUpNewReleases;
            //change subscription plan
            regPageStep1.SelectOTLSubscription(OTLSubscriptionPlanRegPage1.SubscriptionPlan.Monthly);
            //get current plan
            OTLSubscriptionPlanRegPage1 otlSubscriptionPlan = regPageStep1.GetOTLSubscriptionPlan();
            OTLSubscriptionPlanRegPage1.SubscriptionPlan otlCurrentPlan = otlSubscriptionPlan.Subscription;

            regPageStep1.ClickContinue();

            RegPageStep2 regPageStep2 = new RegPageStep2(browser, BillingInformation.DefaultInfo.Standard,
                                                         PaymentInformation.DefaultInfo.Standard);

            regPageStep2.FillBillingInfo(); //standard info default
            regPageStep2.FillPaymentInfo(); //standard info default
            //custom
            BillingInformation billingInfo = new BillingInformation(); //nothing initialized
            billingInfo.HowHear="Radio";
            PaymentInformation paymentInfo = new PaymentInformation(); //nothing ititialized
            paymentInfo.ExpirationYear="2013";
            billingInfo = new BillingInformation(BillingInformation.DefaultInfo.Standard); //standard billing info
            paymentInfo = new PaymentInformation(PaymentInformation.DefaultInfo.Standard); //standard payment info
            //change standard values to custom
            billingInfo.Phone="5555551234";
            paymentInfo.ExpirationYear="2014";
            regPageStep2.FillBillingInfo(billingInfo);
            regPageStep2.FillPaymentInfo(paymentInfo);
            //write to one field only
            regPageStep2.FillBillingInfo(BillingInformation.Field.Apt, "1");
            regPageStep2.FillPaymentInfo(PaymentInformation.Field.ExpireYear, "2015");
            //get current billing and payment info
            billingInfo = regPageStep2.GetBillingInfo();
            paymentInfo = regPageStep2.GetPaymentInfo();
            string billingAddress = billingInfo.Address;
            string paymentNameOnCard = paymentInfo.NameOnCard;

            regPageStep2.ClickIHaveRead();
            regPageStep2.ClickStartMembership();
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime = AppSettings.MouseDefaultMoveTime;
            Keyboard.DefaultKeyPressTime = AppSettings.KeyboardDefaultKeyPressTime;
            Delay.SpeedFactor = 1.0;

            CreateEducatorRepo repo = CreateEducatorRepo.Instance;

            //e.g. admin.release.lynda.com/welcome.aspx
            string url = string.Format("admin.{0}/welcome.aspx", AppSettings.Domain);
            Browser browser = new Browser(AppSettings.Browser,url,true);

            //Deal with security warning per Browser
            switch (AppSettings.Browser)
            {
                case BrowserProduct.IE:
                    {
                        repo.DOM.IECertificateErrorPage.OverrideLink.Click();
                        break;
                    }
                case BrowserProduct.Firefox:
                    {
                        Validate.Exists(repo.DOM.FirefoxUntrustedConnectionPage.IUnderstandTheRisks);
                        repo.DOM.FirefoxUntrustedConnectionPage.IUnderstandTheRisks.Click();
                        Validate.Exists(repo.DOM.FirefoxUntrustedConnectionPage.AddExceptionButton);
                        repo.DOM.FirefoxUntrustedConnectionPage.AddExceptionButton.Click();
                        //Make sure the check box exists before seeing if it is checked,
                        //otherwise .Checked can return the incorrect result if the check box is not enabled yet in the dialog.
                        Validate.Exists(repo.AddSecurityExceptionDialogFirefox.PermanentlyStoreThisExceptionCheckBoxChecked);
                        if (repo.AddSecurityExceptionDialogFirefox.PermanentlyStoreThisExceptionCheckBoxChecked.Checked)
                        {
                            //Uncheck the box if it's checked
                            repo.AddSecurityExceptionDialogFirefox.PermanentlyStoreThisExceptionCheckBoxChecked.Click();
                        }
                        Validate.Exists(repo.AddSecurityExceptionDialogFirefox.ConfirmSecurityExceptionButton);
                        repo.AddSecurityExceptionDialogFirefox.ConfirmSecurityExceptionButton.Click();
                        break;
                    }
                case BrowserProduct.Safari:
                    {
                        repo.ReviewCoursesConfirmDialogSafari.ContinueButton.Click();
                        break;
                    }
                case BrowserProduct.Chrome:
                    {
                        //Handle Chrome "This is probably not the site you are looking for!" page
                        //Ranorex doesn't support this page yet.
                        //Click navigate edit box then tab to "Proceed anyway" button and press Enter for now.
                        Text navigateEditBox = "/form[@title='SSL Error - Google Chrome']/element/text[@accessiblename='Address']";
                        Validate.Exists(navigateEditBox);
                        navigateEditBox.Click();
                        Keyboard.Press(System.Windows.Forms.Keys.Tab);
                        Keyboard.Press("{Enter}");
                        break;
                    }
                default:
                    throw new Exception(String.Format("Code not implemented yet: {0}", AppSettings.Browser.ToString()));
            }

            //Login
            repo.DOM.AdminWelcomePageNotLoggedIn.UsernameInput.PressKeys("knvirtualuser7");
            repo.DOM.AdminWelcomePageNotLoggedIn.PasswordInput.PressKeys("lynda1");
            repo.DOM.AdminWelcomePageNotLoggedIn.LoginInput.Click();

            //Deal with already logged in dialog (if it appears)
            //"Hello Keynote Virtualuser!You are currently logged in to your lynda.com account at another computer.
            //Would you like to log off the other computer and login to your account on this computer?"
            switch (AppSettings.Browser)
            {
                case BrowserProduct.Chrome:
                    {
                        if (Validate.Exists(repo.CurrentlyLoggedInDialogChrome.HelloTextInfo.AbsolutePath.ToString(), repo.CurrentlyLoggedInDialogChrome.HelloTextInfo.SearchTimeout,
                            "{0}", new Validate.Options(false,ReportLevel.Info)))
                        {
                            repo.CurrentlyLoggedInDialogChrome.OKButton.Click();
                        }
                        else
                        {
                            Report.Info("Chrome Already Logged In dialog not found, so no need to handle.");
                        }
                        break;
                    }
                case BrowserProduct.IE:
                    {
                        if (Validate.Exists(repo.CurrentlyLoggedInDialogIE.HelloTextInfo.AbsolutePath.ToString(), repo.CurrentlyLoggedInDialogIE.HelloTextInfo.SearchTimeout,
                            "{0}", new Validate.Options(false,ReportLevel.Info)))
                        {
                            repo.CurrentlyLoggedInDialogIE.OKButton.Click();
                        }
                        else
                        {
                            Report.Info("IE Already Logged In dialog not found, so no need to handle.");
                        }
                        break;
                    }
                case BrowserProduct.Firefox:
                    {
                        if (Validate.Exists(repo.CurrentlyLoggedInDialogFirefox.HelloTextInfo.AbsolutePath.ToString(), repo.CurrentlyLoggedInDialogFirefox.HelloTextInfo.SearchTimeout,
                            "{0}", new Validate.Options(false,ReportLevel.Info)))
                        {
                            Validate.Exists(repo.CurrentlyLoggedInDialogFirefox.OKButton);
                            repo.CurrentlyLoggedInDialogFirefox.OKButton.Click();
                        }
                        else
                        {
                            Report.Info("Firefox Already Logged In dialog not found, so no need to handle.");
                        }
                        break;
                    }
                case BrowserProduct.Safari:
                    {
                        if (Validate.Exists(repo.CurrentlyLoggedInDialogSafari.HelloTextInfo.AbsolutePath.ToString(), repo.CurrentlyLoggedInDialogSafari.HelloTextInfo.SearchTimeout,
                            "{0}", new Validate.Options(false,ReportLevel.Info)))
                        {
                            repo.CurrentlyLoggedInDialogSafari.OKButton.Click();
                            //Workaround for bug where you click on the CS menu after clicking OK to the above dialog and the CS page doesn't appear;
                            //workaround is to click the CS menu here before it is clicked again after this switch code block.
                            Validate.Exists(repo.DOM.AdminWelcomePageLoggedIn.WelcomeMessage);
                            Validate.Exists(repo.DOM.AdminHeaderMenusAbstractPage.CSmenu);
                            repo.DOM.AdminHeaderMenusAbstractPage.CSmenu.Click();
                            Report.Info("Clicking CS menu to workaround bug where the CS page doesn't appear on the first click. Bug http://bugzilla.ldcint.com/bugzilla/show_bug.cgi?id=11318");
                        }
                        else
                        {
                            Report.Info("Safari Already Logged In dialog not found, so no need to handle.");
                        }
                        break;
                    }
                default:
                    throw new Exception(String.Format("Code not implemented yet: {0}", AppSettings.Browser.ToString()));
            }

            //Validate on Welcome page
            Validate.Exists(repo.DOM.AdminWelcomePageLoggedIn.WelcomeMessage);
            //Click CS
            Validate.Exists(repo.DOM.AdminHeaderMenusAbstractPage.CSmenu);
            repo.DOM.AdminHeaderMenusAbstractPage.CSmenu.Click();
            //Click New Account
            repo.DOM.AdminHeaderMenusAbstractPage.CSmenuNewAccount.Click();
            //Select Educator Radio
            repo.DOM.AdminCSNewAccountPage.EducatorRadio.Click();
            //Select Regular Radio
            Validate.Exists(repo.DOM.AdminCSNewAccountPage.RegularRadio);
            repo.DOM.AdminCSNewAccountPage.RegularRadio.Click();
            //Click continue
            repo.DOM.AdminCSNewAccountPage.ContinueButton.Click();

            //Fill-out Educator Registration step 1 page
            SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep1Page.CountrySelect, "United States");
            repo.DOM.AdminCSRegStep1Page.FirstNameInput.PressKeys("Testfirstname");
            repo.DOM.AdminCSRegStep1Page.LastNameInput.PressKeys("Testlastname");
            repo.DOM.AdminCSRegStep1Page.PositionTitleInput.PressKeys("tester");
            repo.DOM.AdminCSRegStep1Page.DepartmentInput.PressKeys("testDepartment");
            repo.DOM.AdminCSRegStep1Page.SchoolInput.PressKeys("testSchool");
            repo.DOM.AdminCSRegStep1Page.PhoneInput.PressKeys("5555555555");
            string username,email;
            const string password = "******";
            FormDataAccount.GenerateUsernameEmail(out username, out email);
            email = string.Format("edu{0}",email);
            username = string.Format("edu{0}",username);
            repo.DOM.AdminCSRegStep1Page.EmailInput.PressKeys(email);
            Report.Info(string.Format("Entering username:{0}",username));
            repo.DOM.AdminCSRegStep1Page.UsernameInput.PressKeys(username);
            repo.DOM.AdminCSRegStep1Page.PasswordInput.PressKeys(password);
            repo.DOM.AdminCSRegStep1Page.PasswordConfirmInput.PressKeys(password);
            Validate.Exists(repo.DOM.AdminCSRegStep1Page.ContinueButton);
            repo.DOM.AdminCSRegStep1Page.ContinueButton.Click();

            //Fill-out step 2 page
            repo.DOM.AdminCSRegStep2Page.ClassNameInput.PressKeys("classTest");
            repo.DOM.AdminCSRegStep2Page.ClassIDInput.PressKeys("1");
            System.DateTime startDateTime = System.DateTime.Now;
            string shortStartDateTime = startDateTime.ToShortDateString();
            System.DateTime endDateTime = startDateTime.AddDays(7);
            string shortEndDateTime = endDateTime.ToShortDateString();
            repo.DOM.AdminCSRegStep2Page.StartDateInput.PressKeys(shortStartDateTime);
            repo.DOM.AdminCSRegStep2Page.EndDateInput.PressKeys(shortEndDateTime);
            Validate.Exists(repo.DOM.AdminCSRegStep2Page.ContinueButton);
            repo.DOM.AdminCSRegStep2Page.ContinueButton.Click();

            //step3 page
            Validate.Exists(repo.DOM.AdminCSRegStep3Page.AddCourseButton);
            repo.DOM.AdminCSRegStep3Page.AddCourseButton.Click();
            //Verify table appears
            Validate.Exists(repo.DOM.AdminCSRegStep3Page.CoursesTableColumn);
            //Click Continue
            Validate.Exists(repo.DOM.AdminCSRegStep3Page.ContinueButton);
            repo.DOM.AdminCSRegStep3Page.ContinueButton.Click();

            //Click OK in review courses dialog
            switch (AppSettings.Browser)
            {
                case BrowserProduct.IE:
                    {
                        Validate.Exists(repo.ReviewCoursesConfirmDialogIE.OKButton);
                        Validate.IsTrue(repo.ReviewCoursesConfirmDialogIE.OKButton.Visible);
                        repo.ReviewCoursesConfirmDialogIE.OKButton.Click();
                        break;
                    }
                case BrowserProduct.Firefox:
                    {
                        Validate.Exists(repo.ReviewCoursesConfirmDialogFirefox.OKButton);
                        Validate.IsTrue(repo.ReviewCoursesConfirmDialogFirefox.OKButton.Visible);
                        repo.ReviewCoursesConfirmDialogFirefox.OKButton.Click();
                        break;
                    }
                case BrowserProduct.Safari:
                    {
                        Validate.Exists(repo.ReviewCoursesConfirmDialogSafari.OKButton);
                        Validate.IsTrue(repo.ReviewCoursesConfirmDialogSafari.OKButton.Visible);
                        repo.ReviewCoursesConfirmDialogSafari.OKButton.Click();
                        break;
                    }
                case BrowserProduct.Chrome:
                    {
                        Validate.Exists(repo.ReviewCoursesConfirmDialogChrome.OKButton);
                        Validate.IsTrue(repo.ReviewCoursesConfirmDialogChrome.OKButton.Visible);
                        repo.ReviewCoursesConfirmDialogChrome.OKButton.Click();
                        break;
                    }
                default:
                    throw new Exception(String.Format("Code not implemented yet: {0}", AppSettings.Browser.ToString()));
            }

            //step 4 page
            string usernameNotUsed,studentEmail;
            FormDataAccount.GenerateUsernameEmail(out usernameNotUsed, out studentEmail);
            string studentFirstName = "testStudentFirst";
            string studentLastName = "testStudentLast";
            repo.DOM.AdminCSRegStep4Page.FirstNameInput.PressKeys(studentFirstName);
            repo.DOM.AdminCSRegStep4Page.LastNameInput.PressKeys(studentLastName);
            repo.DOM.AdminCSRegStep4Page.EmailInput.PressKeys(studentEmail);
            repo.DOM.AdminCSRegStep4Page.AddStudentButton.Click();
            //Verify table appears
            Validate.Exists(repo.DOM.AdminCSRegStep4Page.StudentNameTableColumn);
            //Click Continue
            Validate.Exists(repo.DOM.AdminCSRegStep4Page.ContinueButton);
            repo.DOM.AdminCSRegStep4Page.ContinueButton.Click();

            //step 5 page
            repo.DOM.AdminCSRegStep5Page.PaidBySchoolRadio.Click();
            SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.PaymentTypeSelect, "Credit Card");
            //billing info...
            repo.DOM.AdminCSRegStep5Page.BillingAddressInput.PressKeys("6410 via real");
            repo.DOM.AdminCSRegStep5Page.BillingAptSuiteInput.PressKeys("test");
            repo.DOM.AdminCSRegStep5Page.BillingCityInput.PressKeys("carpintera");
            SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.BillingStateSelect, "California");
            repo.DOM.AdminCSRegStep5Page.BillingZipInput.PressKeys("93013");
            //credit card info...
            SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.CardTypeSelect, "Visa");
            repo.DOM.AdminCSRegStep5Page.CardNumberInput.PressKeys("4111111111111111");
            repo.DOM.AdminCSRegStep5Page.CardNameInput.PressKeys("Sue Axelband");
            repo.DOM.AdminCSRegStep5Page.CardCodeInput.PressKeys("670");
            SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.CardMonthSelect, "08 - August");
            SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.CardYearSelect, "2012");
            //sales info...
            SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.SalesRep1Select, "Donna Gill");
            SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.DOM.AdminCSRegStep5Page.SalesOperationTypeSelect, "New");
            //click continue
            Validate.Exists(repo.DOM.AdminCSRegStep5Page.ContinueButton);
            repo.DOM.AdminCSRegStep5Page.ContinueButton.Click();

            //step 6 page.
            Validate.AreEqual(string.Compare(repo.DOM.AdminCSRegStep6Page.StudentEmail.InnerText.Trim(),studentEmail,false),0,
                              "Actual:{0} Expected:{1}"+string.Format(" Actual:{0} Expected:{1}",repo.DOM.AdminCSRegStep6Page.StudentEmail.InnerText,studentEmail),true);
            //repo.DOM.AdminCSRegStep6Page.StudentName e.g. "testStudentFirst testStudentLast"
            string patternExpectedPageStudentName =  String.Format(@"^{0} {1}$",studentFirstName,studentLastName);
            string expectedPageStudentName = string.Format("{0} {1}",studentFirstName,studentLastName);
            string actualPageStudentName = repo.DOM.AdminCSRegStep6Page.StudentName.InnerText.Trim();
            if (!Regex.IsMatch(actualPageStudentName, patternExpectedPageStudentName))
            {
                throw new Ranorex.ValidationException(string.Format("Student Name. Actual:\"{0}\" Expected:\"{1}\"",
                                             actualPageStudentName,expectedPageStudentName));
            }
            Validate.Exists(repo.DOM.AdminCSRegStep6Page.ApproveNowButton);
            repo.DOM.AdminCSRegStep6Page.ApproveNowButton.Click();

            //reg confirmation page. Click continue.
            Validate.Exists(repo.DOM.AdminCSRegConfirmPage.ContinueButton);
            repo.DOM.AdminCSRegConfirmPage.ContinueButton.Click();
            //Wait for Customer Details page.
            Validate.Exists(repo.DOM.AdminDisplayCustomerPage.CustomerDetailsText);

            //click logout on customer details display customer page
            Validate.Exists(repo.DOM.AdminHeaderMenusAbstractPage.LogoutButton);
            repo.DOM.AdminHeaderMenusAbstractPage.LogoutButton.Click();
            //Wait for login button to appear to signify logout completion
            Validate.Exists(repo.DOM.AdminWelcomePageNotLoggedIn.LoginInput);

            //login and handle terms and conditions page
            browser.Navigate(string.Format("{0}", AppSettings.Domain));
            Validate.Exists(repo.DOM.MemberHomePage.LoginLink);
            repo.DOM.MemberHomePage.LoginLink.Click();
            Validate.Exists(repo.DOM.MemberHomePage.LoginUsername);
            repo.DOM.MemberHomePage.LoginUsername.PressKeys(username);
            repo.DOM.MemberHomePage.LoginPassword.PressKeys(password);
            repo.DOM.MemberHomePage.LoginButton.Click();
            Duration waitForAcceptButtonNotExistTime = new Duration(10000);
            switch (AppSettings.Browser)
            {
                case BrowserProduct.IE:
                    {
                        Validate.Exists(repo.TermsAndConditionsPageIE.IAcceptButton);
                        repo.TermsAndConditionsPageIE.IAcceptButton.EnsureVisible();
                        repo.TermsAndConditionsPageIE.IAcceptButton.Click();
                        repo.TermsAndConditionsPageIE.IAcceptButtonInfo.WaitForNotExists(waitForAcceptButtonNotExistTime);
                        break;
                    }
                case BrowserProduct.Firefox:
                    {
                        Validate.Exists(repo.TermsAndConditionsPageFirefox.IAcceptButton);
                        repo.TermsAndConditionsPageFirefox.IAcceptButton.EnsureVisible();
                        repo.TermsAndConditionsPageFirefox.IAcceptButton.Click();
                        repo.TermsAndConditionsPageFirefox.IAcceptButtonInfo.WaitForNotExists(waitForAcceptButtonNotExistTime);
                        break;
                    }
                case BrowserProduct.Safari:
                    {
                        Validate.Exists(repo.TermsAndConditionsPageSafari.IAcceptButton);
                        repo.TermsAndConditionsPageSafari.IAcceptButton.EnsureVisible();
                        repo.TermsAndConditionsPageSafari.IAcceptButton.Click();
                        repo.TermsAndConditionsPageSafari.IAcceptButtonInfo.WaitForNotExists(waitForAcceptButtonNotExistTime);
                        //Due to issue with Ranorex with Safari in identifying the DOM at this point,
                        //navigate to member home page a couple of times so the DOM is visible.
                        for (int i=0; i<=1; i++)
                        {
                            browser.Navigate(string.Format("{0}", AppSettings.Domain));
                        }
                        break;
                    }
                case BrowserProduct.Chrome:
                    {
                        Validate.Exists(repo.TermsAndConditionsPageChrome.IAcceptButton);
                        repo.TermsAndConditionsPageChrome.IAcceptButton.EnsureVisible();
                        repo.TermsAndConditionsPageChrome.IAcceptButton.Click();
                        repo.TermsAndConditionsPageChrome.IAcceptButtonInfo.WaitForNotExists(waitForAcceptButtonNotExistTime);
                        break;
                    }
                default:
                    throw new Exception(String.Format("Code not implemented yet: {0}", AppSettings.Browser.ToString()));
            }
            //Verify now on member home page; "My courses" shows.
            Validate.Exists(repo.DOM.MemberHomePage.MyCoursesText);
            //Click log out link.
            Validate.Exists(repo.DOM.MemberHomePage.LogoutLink);
            repo.DOM.MemberHomePage.LogoutLink.Click();
            //Verify logout complete; check for login link
            Validate.Exists(repo.DOM.MemberHomePage.LoginLink);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor = 1.0;

            string installedBrowserPath = Browser.GetInstalledExePath(BrowserProduct.IE);
            if (installedBrowserPath == null)
            {
                throw new Exception("Internet Explorer is not installed.");
            }
            int installedBrowserVersion = Browser.GetInstalledVersion(BrowserProduct.IE);
            if (installedBrowserVersion != 9)
            {
                throw new Exception(string.Format("Internet Explorer version {0} ({1}) is not supported by this test. Supported version: 9.", installedBrowserVersion, installedBrowserPath));
            }

              			const string uri = "www.lynda.com";

            Browser browser1 = new Browser(BrowserProduct.IE, uri, true);
            browser1.HalfSize();
            browser1.Move(100, 100);

            Browser browser2 = new Browser(BrowserProduct.Safari, uri, true);
            browser2.HalfSize();
            browser2.Move(200, 200);

            Browser browser3 = new Browser(BrowserProduct.Firefox, uri, true);
            browser3.HalfSize();
            browser3.Move(300, 300);

            Browser browser4 = new Browser(BrowserProduct.Chrome, uri, true);
            browser4.HalfSize();
            browser4.Move(400,400);

            Ranorex.ATag loginLink;
            const string loginLinkRxPath = "dom/body/div[@id='eyebrow']/div[1]/ul/li[4]/a[@id='login-modal']";

            browser1.ClickTitleBar();
            loginLink = Host.Local.FindSingle<Ranorex.ATag>(loginLinkRxPath);
            loginLink.Click();
            Report.Log(ReportLevel.Info,browser1.CurrentUri);

            browser2.ClickTitleBar();
            loginLink = Host.Local.FindSingle<Ranorex.ATag>(loginLinkRxPath);
            loginLink.Click();
            Report.Log(ReportLevel.Info,browser2.CurrentUri);

            browser3.ClickTitleBar();
            loginLink = Host.Local.FindSingle<Ranorex.ATag>(loginLinkRxPath);
            loginLink.Click();
            Report.Log(ReportLevel.Info,browser3.CurrentUri);

            browser4.ClickTitleBar();
            loginLink = Host.Local.FindSingle<Ranorex.ATag>(loginLinkRxPath);
            loginLink.Click();
            Report.Log(ReportLevel.Info,browser4.CurrentUri);

            browser1.Navigate(uri);
            browser2.Navigate(uri);
            browser3.Navigate(uri);
            browser4.Navigate(uri);

            int total = 3;
            Browser[] browsers = new Browser[total];
            for (int i = 0; i <= total-1; i++)
            {
                browsers[i] = new Browser(BrowserProduct.IE, "lynda.com");
                browsers[i].HalfSize();
                browsers[i].HalfSize();
                browsers[i].Move((i+1) * 10, (i+1) * 10);
            }

            browsers[2].Fun();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime = AppSettings.MouseDefaultMoveTime;
            Keyboard.DefaultKeyPressTime = AppSettings.KeyboardDefaultKeyPressTime;
            Delay.SpeedFactor = 1.0;

            const string navigateTo = "/";

            //Open browser and navigate to url
            string url = string.Format("http://{0}{1}", AppSettings.Domain, navigateTo.ToString());
            Browser browser = new Browser(AppSettings.Browser, url);

            //Wait for page to load
            Validate.Exists(repo.MemberPage.SubscribeLink);

               	//Click Subscribe and wait for regpagestep1 to load
               	repo.MemberPage.SubscribeLink.Click();
               	Validate.Exists(repo.RegStep1Page.MonthlyPremiumRadio);

               	//Select Subscription Plan
               	repo.RegStep1Page.MonthlyPremiumRadio.Click();

               	//Fill out Account Information
            repo.RegStep1Page.AccountInfo.FirstNameInput.PressKeys(FormDataAccount.GenerateFirstName());
            repo.RegStep1Page.AccountInfo.LastNameInput.PressKeys(FormDataAccount.GenerateLastName());

            string username,email;
               	FormDataAccount.GenerateUsernameEmail(out username, out email);
               	repo.RegStep1Page.AccountInfo.EmailInput.PressKeys(email);
               	repo.RegStep1Page.AccountInfo.UserNameInput.PressKeys(username);

               	string password = FormDataAccount.GeneratePassword();
               	repo.RegStep1Page.AccountInfo.PasswordInput.PressKeys(password);
               	repo.RegStep1Page.AccountInfo.PasswordConfirmInput.PressKeys(password);

               	//If checkboxes are checked, uncheck them
               	if (Convert.ToBoolean(repo.RegStep1Page.SignMeUp.MonthlyCheckBox.Checked))
               	{
               		repo.RegStep1Page.SignMeUp.MonthlyCheckBox.Click();
               	}

               	if (Convert.ToBoolean(repo.RegStep1Page.SignMeUp.NewReleasesCheckBox.Checked))
               	{
               		repo.RegStep1Page.SignMeUp.NewReleasesCheckBox.Click();
               	}

               	if (Convert.ToBoolean(repo.RegStep1Page.SignMeUp.SpecialCheckBox.Checked))
               	{
               		repo.RegStep1Page.SignMeUp.SpecialCheckBox.Click();
               	}

               	//Click Continue button and wait for regpagestep2 to load
               	repo.RegStep1Page.ContinueButton.Click();
               	Validate.Exists(repo.RegStep2Page.SubmitButton);

               	//Fill out Billing Information
               	string companyName, address, aptSuite, city, state, zip, country, phone;
               	FormDataBilling.GenerateAddress(out companyName, out address, out aptSuite, out city,
               	                                out state, out zip, out country, out phone);
               	repo.RegStep2Page.BillingInfo.CompanyInput.PressKeys(companyName);
               	repo.RegStep2Page.BillingInfo.AddressInput.PressKeys(address);
               	repo.RegStep2Page.BillingInfo.AptSuiteInput.PressKeys(aptSuite);
               	repo.RegStep2Page.BillingInfo.CityInput.PressKeys(city);
               	SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.RegStep2Page.BillingInfo.StateSelect, state);
               	repo.RegStep2Page.BillingInfo.ZipInput.PressKeys(zip);
               	SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.RegStep2Page.BillingInfo.CountrySelect, country);
               	repo.RegStep2Page.BillingInfo.PhoneInput.PressKeys(phone);
               	SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.RegStep2Page.BillingInfo.HowHearSelect, FormDataBilling.GenerateHowDidYouHear());

               	//Fill out Payment Information
               	string paymentType, cardType, cardNumber, nameOnCard, cardSecurityCode, expireMonth, expireYear;
               	FormDataPayment.GenerateCreditCard(out paymentType, out cardType, out cardNumber, out nameOnCard,
               	                                   out cardSecurityCode, out expireMonth, out expireYear);
               	SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.RegStep2Page.PaymentInfo.PaymentTypeSelect, paymentType);
               	SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.RegStep2Page.PaymentInfo.CardTypeSelect, cardType);
               	repo.RegStep2Page.PaymentInfo.CardNumberInput.PressKeys(cardNumber);
               	repo.RegStep2Page.PaymentInfo.NameOnCardInput.PressKeys(nameOnCard);
               	repo.RegStep2Page.PaymentInfo.CardSecurityCodeInput.PressKeys(cardSecurityCode);
               	SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.RegStep2Page.PaymentInfo.CardExpirationMonthSelect, expireMonth);
               	SelectTagUI.ChooseSelectTagOption(repo.DOM.BasePath.ToString(), repo.RegStep2Page.PaymentInfo.CardExpirationYearSelect, expireYear);

               	//If "I have read and..." check box is checked then fail
               	Validate.IsFalse(Convert.ToBoolean(repo.RegStep2Page.IHaveReadCheckBox.Checked));
               	//Check the box
            repo.RegStep2Page.IHaveReadCheckBox.Click();

            //Click Submit and wait for Registration Confirm page to load
            repo.RegStep2Page.SubmitButton.Click();
            Validate.Exists(repo.RegConfirmPage.PrintReceiptButton);

            //Log out and wait for member page to load
            repo.RegConfirmPage.LogoutLink.Click();
            Validate.Exists(repo.MemberPage.SubscribeLink);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new Lynda.Test.ConsumerPages.RegPageStep2 class.
 /// </summary>
 /// <param name="browserForPage">Browser instance containing the consumer registration page step 2.</param>
 /// <param name="customBillingInfo">Custom billing information to enter.</param>
 /// <param name="customPaymentInfo">Custom payment information to enter.</param>
 public RegPageStep2(Browser browserForPage, BillingInformation customBillingInfo, PaymentInformation customPaymentInfo)
     : this(browserForPage)
 {
     FillBillingInfo(customBillingInfo);
     FillPaymentInfo(customPaymentInfo);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new Lynda.Test.ConsumerPages.RegPageStep2 class.
 /// </summary>
 /// <param name="browserForPage">Browser instance containing the consumer registration page step 2.</param>
 /// <param name="billingDefaultInfo">Type of billing information to enter.</param>
 /// <param name="paymentDefaultInfo">Type of payment information to enter.</param>
 public RegPageStep2(Browser browserForPage, BillingInformation.DefaultInfo billingDefaultInfo,
                     PaymentInformation.DefaultInfo paymentDefaultInfo)
     : this(browserForPage, new BillingInformation(billingDefaultInfo), new PaymentInformation(paymentDefaultInfo))
 {
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the Lynda.Test.ConsumerPages.HomePageMember class
 /// and waits for the page to load.
 /// </summary>
 /// <param name="browserForPage">Browser instance containing the member home page.</param>
 public HomePageMember(Browser browserForPage)
 {
     homePageMemberRepo = new HomePageMemberRepo();
     browser=browserForPage;
     WaitForLoad();
 }