Exemple #1
0
        //this is the test code generated by selenium
        //****Paste test script here*****
        public override void RunTest()
        {
            //set speed to lower value
            selenium.SetSpeed("300");

            quality.AreEqual("Garmin Product Updates for Kenwood", quality.GetTitle());
            quality.Click("link=Sign In");
            quality.WaitForPageToLoad("30000");

            ken.SignInPage();

            ken.Login(username, password, fullname, false);

            // comment: Check the My Account menu
            quality.Click("link=My Account");
            quality.WaitForPageToLoad("30000");

            ken.MyAccountPage(false);

            // comment: Click on the "View Subscription" button
            quality.Click("//div[@id='bd']/div[6]/a/span");
            quality.WaitForPageToLoad("30000");

            ken.ViewSubscriptionsPage(false, true);

            //comment: Click on the first FOUND UnlockCode button
            bool check = false;

            if (quality.GetText("css=#button > a.button > span") == "Unlock Code")
            {
                quality.Click("css=#button > a.button > span");
                quality.WaitForPageToLoad("30000");
            }
            else if (quality.IsElementPresent("//div[@id='mySubscriptions']/div[2]"))//(quality.IsElementPresent("//div[" + 4 + "]/div[3]/a/span"))
            {
                int i = 2;
                while (!check && (quality.IsElementPresent("//div[@id='mySubscriptions']/div[" + i + "]") == true))//(quality.IsElementPresent("//div[" + i + "]/div[3]/a/span") == true))
                {
                    if (quality.GetText("xpath=(//div[@id='button']/a/span)[" + i + "]") == "Unlock Code")
                    {
                        check = true;
                        quality.Click("xpath=(//div[@id='button']/a/span)[" + i + "]");
                        quality.WaitForPageToLoad("30000");
                    }

                    i++;
                }
            }

            //comment: Check the Activate Traffic Subscription Unlock Page
            ken.ActivateTrafficSubscriptionUnlockCodePage();

            //comment: Click on Send button without entering any email address : Traffic Subscription Unlock Code
            quality.Click("css=a.button.left > span");
            quality.WaitForPageToLoad("30000");
            quality.AreEqual("Traffic Subscription Unlock Code", quality.GetTitle());
            quality.AreEqual("Email address is required", quality.GetText("css=ul.error > li"));

            //comment: Click on Send button with an invalid email address : Traffic Subscription Unlock Code
            quality.Type("id=email", "1@1");
            quality.Click("css=a.button.left > span");
            quality.WaitForPageToLoad("30000");
            quality.AreEqual("Traffic Subscription Unlock Code", quality.GetTitle());
            quality.AreEqual("Please enter a valid Email Address", quality.GetText("css=ul.error > li"));

            //comment: Click on Send button with a valid email address : Traffic Subscription Unlock Code
            quality.Type("id=email", "*****@*****.**");
            quality.Click("css=a.button.left > span");
            quality.WaitForPageToLoad("30000");
            quality.AreEqual("Traffic Subscription Unlock Code", quality.GetTitle());
            quality.AreEqual("We have sent the unlock code to your email address", quality.GetText("css=div.confirmationDialog-mid"));

            //comment: GO to Subscriptions page
            quality.Click("link=My Subscriptions");
            quality.WaitForPageToLoad("30000");

            // comment: Go back to My Account
            quality.Click("link=« Back");
            quality.WaitForPageToLoad("30000");
            quality.AreEqual("Account Settings", quality.GetTitle());

            // comment: Sign Out
            ken.Logout();
        }