Example #1
0
        private bool UseSafeComLdap()
        {
            bool             useSafeComLdap = true;
            JediOmniMasthead masthead       = new JediOmniMasthead(ControlPanel);

            if (ControlPanel.CheckState(masthead.MastheadSpinner, OmniElementState.Exists))
            {
                if (Wait.ForTrue(() => masthead.BusyStateActive(), TimeSpan.FromSeconds(30)))
                {
                    throw new DeviceWorkflowException("SafeCom Authentication screen did not show within 30 seconds.");
                }
            }
            if (ControlPanel.WaitForAvailable(AuthDropdownId, TimeSpan.FromSeconds(30)))
            {
                string value = GetSignInText();
                if (value.Contains("code", StringComparison.OrdinalIgnoreCase))
                {
                    useSafeComLdap = false;
                }
            }
            else
            {
                throw new DeviceWorkflowException("Unable to determine type of authentication (LDAP/PIN) for SafeCom.");
            }
            return(useSafeComLdap);
        }
Example #2
0
        /// <summary>
        /// Submits the authentication request.
        /// </summary>
        public override void SubmitAuthentication()
        {
            base.SubmitAuthentication();

            if (!ControlPanel.CheckState("#hp-button-signin-or-signout", OmniElementState.Useable) && ExistElementIdOxpd("js-login-button"))
            {
                PressElementOxpd("js-login-button");
            }
        }
        /// <summary>
        /// Presses the given element and waits for the keyboard to be usable.
        /// </summary>
        /// <returns>true if the keyboard exists and is usable.  False otherwise.</returns>
        /// <exception cref="DeviceInvalidOperationException">Timed out waiting for element {KeyboardId} with state {OmniElementState.Useable}.</exception>
        protected bool PressElementForKeyboard(string elementId)
        {
            bool success = false;
            if (ControlPanel.CheckState(elementId, OmniElementState.Exists))
            {
                success = ControlPanel.ScrollPressWait(elementId, KeyboardId);
            }

            return success;
        }
        /// <summary>
        /// Enters the local device access code using the device virtual keyboard.
        /// </summary>
        /// <param name="accessCode">The access code.</param>
        private void EnterAccessCode(string accessCode)
        {
            if (ControlPanel.CheckState(".hp-textbox:last", OmniElementState.Useable))
            {
                ControlPanel.Press(".hp-textbox:last");
            }

            //VerifyKeyboard();
            ControlPanel.TypeOnVirtualKeyboard(accessCode);
        }
Example #5
0
 /// <summary>
 /// Enters credentials on the device by entering Username and Password.
 /// </summary>
 public override void EnterCredentials()
 {
     // Blueprint 6.5
     if (ControlPanel.CheckState(".hp-credential-control:password", OmniElementState.VisibleCompletely))
     {
         EnterUserNamePassword();
     }
     else // 5.5
     {
         EnterUserNamePasswordSplitPage();
     }
 }
        /// <summary>
        /// Submits the authentication request.
        /// </summary>
        public override void SubmitAuthentication()
        {
            if (ControlPanel.CheckState(KeyboardId, OmniElementState.Useable) && ControlPanel.CheckState("#hpid-keyboard-key-done", OmniElementState.Useable))
            {
                ControlPanel.Press("#hpid-keyboard-key-done");
                ControlPanel.WaitForState(KeyboardId, OmniElementState.Hidden);
            }

            if (ControlPanel.CheckState("#hpid-button-signin-ok", OmniElementState.Exists) && ControlPanel.CheckState("#hpid-button-signin-ok", OmniElementState.Useable))
            {
                ControlPanel.Press("#hpid-button-signin-ok");
            }
        }
        /// <summary>
        /// Enters the password into the appropriate text box.
        /// </summary>
        protected virtual void EnterPassword()
        {
            bool available = true;

            if (!ControlPanel.CheckState(".hp-credential-control:password", OmniElementState.Exists))
            {
                available = ControlPanel.WaitForAvailable(".hp-credential-control:password", TimeSpan.FromSeconds(3));
            }
            if (!available || !PressElementForKeyboard(".hp-credential-control:password"))
            {
                throw new DeviceWorkflowException("Unable to find 'Password' text box.");
            }
            TypeOnVirtualKeyboard(Credential.Password);
        }
        /// <summary>
        /// Utilizes the control panel TypeOnVirutalKeyboard to enter the given text value and then
        /// closes the keyboard if specified.
        /// </summary>
        /// <param name="value">The value to enter.</param>
        /// <param name="closeKeyboard">Whether or not to close the keyboard.</param>
        protected void TypeOnVirtualKeyboard(string value, bool closeKeyboard)
        {
            if (!ControlPanel.WaitForAvailable(KeyboardId, TimeSpan.FromSeconds(15)))
            {
                throw new DeviceWorkflowException("Keyboard did not show within 15 seconds.");
            }

            ControlPanel.TypeOnVirtualKeyboard(value);
            Pacekeeper.Sync();

            if (closeKeyboard && ControlPanel.CheckState("#hpid-keyboard-key-done", OmniElementState.Useable))
            {
                ControlPanel.Press("#hpid-keyboard-key-done");
            }
        }
        private void SetAccessType(string accessType)
        {
            //Check to see if the text exists in the AccessType dropdown
            bool itemExists = ControlPanel.CheckState($".hp-drop-down .hp-listitem-text:contains({accessType})", OmniElementState.Exists);

            if (itemExists)
            {
                //Set the item value
                ControlPanel.Press(".hp-drop-down.hp-control.hp-credential-control");
                ControlPanel.PressWait($".hp-drop-down .hp-listitem-text:contains({accessType})", JediOmniLaunchHelper.SignInForm);
            }
            else
            {
                throw new DeviceInvalidOperationException($"Unable to set Access Type to {accessType}.");
            }
        }
        /// <summary>
        /// A catch all; if not on the home screen or sign in screen, are we on a solution screen? If so,
        /// then assume authentication was successful.
        /// </summary>
        /// <param name="authenticated">if set to <c>true</c> [authenticated].</param>
        /// <returns></returns>
        protected bool OnOxpdApplicationScreen(out bool authenticated)
        {
            bool otherScreen = false;
            authenticated = false;

            if (!_popupManager.PopupDisplayed())
            {
                bool oxpdScreen = ControlPanel.CheckState(".hp-app, .hp-oxpd-app-screen", OmniElementState.Exists);
                if (oxpdScreen || (!OnSignInScreen(ref authenticated) && !AtHomeScreen()))
                {
                    // assume on the application screen
                    otherScreen = true;
                    authenticated = true;
                }
            }
            System.Diagnostics.Debug.WriteLine($"{DateTime.Now}: JediOmniAppAuthenticatorBase::OnOxpdApplicationScreen::On Oxpd App Screen: {otherScreen}");

            return otherScreen;
        }
        private bool UseSafeComLdap()
        {
            JediOmniMasthead masthead = new JediOmniMasthead(ControlPanel);

            DateTime start = DateTime.Now;

            if (ControlPanel.CheckState(masthead.MastheadSpinner, OmniElementState.Exists))
            {
                if (!Wait.ForTrue(() => masthead.BusyStateActive() == false, TimeSpan.FromSeconds(30)))
                {
                    throw new DeviceWorkflowException("SafeCom UC Authentication screen did not display within 30 seconds.");
                }
            }

            if (_engine.HtmlContains("Code"))
            {
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// Checks the device control panel for successful authentication.
        /// </summary>
        /// <returns>
        ///   <c>true</c> if the authentication operation is valid, <c>false</c> otherwise.
        /// </returns>
        public override bool ValidateAuthentication()
        {
            DateTime expiration   = DateTime.Now.Add(TimeSpan.FromSeconds(60));
            bool     signedIn     = true; //Assume the login operation was successful
            bool     authNotified = false;

            System.Diagnostics.Debug.WriteLine($"{DateTime.Now}: Checking for indication of login status.");

            // will only run the loop for one minute. If longer than will break and an error will eventually be thrown
            while (!authNotified && (DateTime.Now < expiration))
            {
                authNotified = ControlPanel.CheckState("#hpid-button-reset", OmniElementState.Hidden);

                // Get the device a break before looping back through the handler list
                if (!authNotified)
                {
                    Thread.Sleep(250);
                }
            }

            System.Diagnostics.Debug.WriteLine($"{DateTime.Now}: SignIn status: {signedIn}.");
            return(signedIn);
        }
 /// <summary>
 /// Whether or not at the home screen.
 /// </summary>
 /// <returns>bool</returns>
 protected bool AtHomeScreen()
 {
     return ControlPanel.CheckState($".hp-homescreen-folder-view{_topViewAttribute}", OmniElementState.Exists)
         && ControlPanel.CheckState(_homeScreenLogo, OmniElementState.VisibleCompletely);
 }