예제 #1
0
        public void verifyBalance(string testname)
        {
            reports.verifyElement(EnvtestOR.ManageMyAccount);
            reports.Screenshot(driver, "Account Overview", testname);
            Core.Click(EnvtestOR.ManageMyAccount);

            Thread.Sleep(10000);
            wait.Until(x => ((IJavaScriptExecutor)x).ExecuteScript("return document.readyState").Equals("complete"));

            try
            {
                Thread.Sleep(3000);
                //Core.MoveToElement(EnvtestOR.Airtime);
                reports.verifyElement(EnvtestOR.Airtime);
                reports.Screenshot(driver, "Verify Airtime", testname);
            }
            catch
            {
                Thread.Sleep(15000);
                Core.MoveToElement(EnvtestOR.Billsofar);
                wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(EnvtestOR.Billsofar)));
                reports.verifyElement(EnvtestOR.Billsofar);
                reports.Screenshot(driver, "Verify Bill so far", testname);
            }
        }
예제 #2
0
        public static void PerformloginOtp(string userName, string passwrd, string testname, ReportsManager reports)
        {
            Thread.Sleep(5000);
            StartUp();
            Click(EnvtestOR.Login);

            reports.verifyElement(EnvtestOR.UsernameInput);
            reports.verifyElement(EnvtestOR.LoginButton);
            reports.Screenshot(webDriver, "LogIn page", testname);

            EnterValue(EnvtestOR.UsernameInput, userName);
            webDriver.FindElement(By.XPath("//a[contains(.,'Use OTP')]")).Click();
            Thread.Sleep(3000);
            reports.Screenshot(webDriver, "Requesting OTP", testname);

            var value = Core.ReadMessege(reports, testname);

            Thread.Sleep(3000);
            //Move to OTPLogin button
            MoveToElement("//a[@class='btn btnPurple login-otp']");
            webDriver.FindElement(By.XPath("//input[@name='otp']")).SendKeys(value);

            reports.Screenshot(webDriver, "OTP Entered", testname);
            //loginOTP button
            Click("//a[@class='btn btnPurple login-otp']");

            Thread.Sleep(5000);
            reports.Screenshot(webDriver, "Succesfully logged-in", testname);
        }
        public void USSD_Test()
        {
            try
            {
                String testname = MethodBase.GetCurrentMethod().Name;
                reports = new ReportsManager(Core.getBrowser, Core.getURL, className, testname);
                //   reports.verifyURL(Core.getURL);

                // Set the capabilities instance
                DesiredCapabilities capabilities = new DesiredCapabilities();
                capabilities.SetCapability("deviceName", Device.Emulator);

                // Set device capabilities
                capabilities.SetCapability("PlatformName", "Android");

                //voda app
                capabilities.SetCapability("appPackage","com.android.dialer");
                capabilities.SetCapability("appActivity","com.android.dialer.DialtactsActivity");

                // Create new Appium driver pointing to the MC server and based on the capabilities set above.
                AndroidDriver<AppiumWebElement> Phone = new AndroidDriver<AppiumWebElement>(new Uri(MC_SERVER + "/wd/hub"), capabilities, TimeSpan.FromMinutes(10));

                // Create a wait object instance
                WebDriverWait waitController = new WebDriverWait(Phone, TimeSpan.FromSeconds(30));

                Thread.Sleep(3000);

                //Dialing *111# on a mobile device
                reports.Screenshot(Phone,"Dialer Opened", testname);
                Phone.FindElement(By.Id("star")).Click();
                Phone.FindElement(By.Id("one")).Click();
                Phone.FindElement(By.Id("one")).Click();
                Phone.FindElement(By.Id("one")).Click();
                Phone.FindElement(By.Id("pound")).Click();

                //Press Call button
                reports.Screenshot(Phone,"Dialed *111#", testname);
                Phone.FindElement(By.Id("dialButton")).Click();
                //Dual Sim choose profile sim
                try
                {
                    Phone.FindElement(By.Id("select_account_list_item_view")).Click();
                }
                catch
                {
                   //if you dont have non Dual-sim it will skip this part
                }
                reports.Screenshot(Phone, "Dialer opened", testname);
            }
            finally
            {
                // Core.Close();
            }
        }
예제 #4
0
        public static string ReadMessege(ReportsManager reports, string testname)
        {
            // Set the capabilities instance
            DesiredCapabilities capabilities = new DesiredCapabilities();

            capabilities.SetCapability("deviceName", "3a2bad9");

            // Set device capabilities
            capabilities.SetCapability("PlatformName", "Android");
            // Set application capabilities
            //SMS
            capabilities.SetCapability("appPackage", dictProfiles["MessegingAppPckg"]);
            capabilities.SetCapability("appActivity", dictProfiles["MessegingAppActivty"]);

            // Create new Appium driver pointing to the MC server and based on the capabilities set above.
            AndroidDriver <AppiumWebElement> Phone = new AndroidDriver <AppiumWebElement>(new Uri(MC_SERVER + "/wd/hub"), capabilities, TimeSpan.FromMinutes(10));

            // Create a wait object instance
            WebDriverWait waitController = new WebDriverWait(Phone, TimeSpan.FromSeconds(30));
            MobileCore    mobile         = new MobileCore();

            try
            {
                mobile.MobileFindElement(waitController, "TextView", "text", "Write new message");
                mobile.MobileClicks(waitController, "ImageButton", "content-desc", "Navigate up");
            }
            catch { }

            mobile.MobileFindElement(waitController, "TextView", "text", "Messaging");

            var i = Phone.FindElement(By.XPath("//android.widget.TextView[@resource-id='" + Sony.sms_resID + "']")).Text.Substring(47);

            //com.android.mms:id / subject

            Phone.FindElement(By.XPath("//android.widget.TextView[@resource-id='" + Sony.sms_resID + "']")).Click();
            Thread.Sleep(3000);

            //getBrowser the sms sent
            reports.Screenshot(Phone, "Sms sent to phone", testname);
            Console.WriteLine(i);
            Console.WriteLine(dictProfiles["MessegingAppPckg"]);
            Console.WriteLine(dictProfiles["MessegingAppActivty"]);

            return(i);
        }
예제 #5
0
        public static void Performlogin(string userName, string passwrd, string testname, ReportsManager reports)
        {
            Thread.Sleep(5000);

            Click(EnvtestOR.Login);


            reports.verifyElement(EnvtestOR.UsernameInput);
            reports.verifyElement(EnvtestOR.PasswordInput);
            reports.verifyElement(EnvtestOR.LoginButton);
            reports.Screenshot(webDriver, "Verified Log In", testname);

            EnterValue(EnvtestOR.UsernameInput, userName);
            EnterValue(EnvtestOR.PasswordInput, passwrd);

            Click(EnvtestOR.LoginButton);

            Thread.Sleep(5000);
            reports.verifyElement(EnvtestOR.Logout);
        }