Exemple #1
0
        /// <summary>
        /// Applies additional authentication parameters before submission of authentication request.
        /// </summary>
        /// <param name="parameters">Enters the device admin password.</param>
        public override void ApplyParameters(Dictionary <string, object> parameters)
        {
            string key = parameters.Keys.First();

            ControlPanel.Type((string)parameters[key]);
            Pacekeeper.Sync();
        }
Exemple #2
0
        /// <summary>
        /// Enters the user name and password on the device control panel.
        /// </summary>
        private void EnterUserNamePassword()
        {
            var currentScreenLabels = ControlPanel.GetScreenInfo().ScreenLabels.ToList();

            if (currentScreenLabels.Contains("AnA_Login_With_Windows_Authentication") || currentScreenLabels.Contains("AnA_Login_With_LDAP_Authentication"))
            {
                string doneButtonId = "_done";

                string userNameButton = _userNameButtonId[(int)_screenSize];
                string userNameWidget = _userNameWidgetId[(int)_screenSize];

                //Enter UserName
                ControlPanel.Press(userNameButton);
                Pacekeeper.Pause();
                ControlPanel.SetValue(userNameWidget, Credential.UserName);

                ControlPanel.WaitForWidget(doneButtonId);

                Pacekeeper.Pause();
                ControlPanel.Press(doneButtonId);
                Pacekeeper.Sync();

                //Enter Password
                ControlPanel.Press(_passwordButtonId[(int)_screenSize]);
                Pacekeeper.Pause();
                ControlPanel.SetValue(_passwordWidgetId[(int)_screenSize], Credential.Password);

                ControlPanel.WaitForWidget(doneButtonId);

                Pacekeeper.Pause();
                ControlPanel.Press(doneButtonId);
                Pacekeeper.Sync();
            }
        }
Exemple #3
0
        /// <summary>
        /// Adds the specified name for the job
        /// </summary>
        /// <param name="jobname">The job name.</param>
        /// <exception cref="HP.ScalableTest.DeviceAutomation.DeviceWorkflowException">
        /// File name is not user-editable.
        /// or
        /// $Error entering file name: {message}
        /// </exception>
        public void AddJobName(string jobname)
        {
            try
            {
                _controlPanel.PressToNavigate("mFileNameTextBox", "SaveToUsbKeyboardForm", ignorePopups: false);
                Pacekeeper.Pause();
                _controlPanel.TypeOnVirtualKeyboard("mKeyboard", jobname);
                Pacekeeper.Sync();
                _controlPanel.PressToNavigate("ok", SAVE_TO_USB_FORM, ignorePopups: false);
                Pacekeeper.Pause();
            }
            catch (WindjammerInvalidOperationException ex)
            {
                switch (_controlPanel.CurrentForm())
                {
                case SAVE_TO_USB_FORM:
                    if (_controlPanel.GetProperty <bool>("mFileNameTextBox", "Enabled") == false)
                    {
                        throw new DeviceWorkflowException("File name is not user-editable.", ex);
                    }
                    else
                    {
                        throw;
                    }

                case "OneButtonMessageBox":
                    string message = _controlPanel.GetProperty("mMessageLabel", "Text");
                    throw new DeviceWorkflowException($"Error entering file name: {message}", ex);

                default:
                    throw;
                }
            }
        }
        /// <summary>
        /// Applies additional authentication parameters before submission of authentication request.
        /// </summary>
        /// <param name="parameters">Enters the device admin password.</param>
        public override void ApplyParameters(Dictionary <string, object> parameters)
        {
            string key = parameters.Keys.First();

            EnterAccessCode((string)parameters[key]);
            Pacekeeper.Sync();
        }
Exemple #5
0
        /// <summary>
        /// Enters the user name, password (and domain if applicable) on the device control panel.
        /// </summary>
        protected virtual void EnterUserNamePassword(bool enterDomain = false)
        {
            //Enter user name
            ControlPanel.Type(Credential.UserName);
            Pacekeeper.Sync();

            // tab to Next control
            ControlPanel.Type(SpecialCharacter.Tab);
            Pacekeeper.Sync();

            // Check if domain field is expected
            if (enterDomain)
            {
                // Enter domain if populated
                if (!string.IsNullOrEmpty(Credential.Domain))
                {
                    ControlPanel.Type(Credential.Domain);
                    Pacekeeper.Sync();
                }

                //Tab to next control
                ControlPanel.Type(SpecialCharacter.Tab);
                Pacekeeper.Sync();
            }

            //Enter password
            ControlPanel.Type(Credential.Password);
            Pacekeeper.Sync();
        }
        protected override void EnterDomain()
        {
            bool noOpException = true;

            try
            {
                if (WaitForHtmlContains("Domain", TimeSpan.FromMilliseconds(500)))
                {
                    string script = $"document.getElementsByClassName('{_codeTextBoxClassname}')[2].value";

                    if (_engine.ExecuteJavaScript(script).Trim('"') == "")
                    {
                        noOpException = false;
                        PressElementOxpdByClassIndex(_codeTextBoxClassname, 2);
                        TypeOnVirtualKeyboard(Credential.Domain);
                        Pacekeeper.Sync();
                    }
                }
            }
            catch (DeviceInvalidOperationException ex)
            {
                ExecutionServices.SystemTrace.LogDebug($"Unable to determine the existence of 'Domain' textbox.  {ex.ToString()}");
                // The intention here is to only throw a DeviceWorkflowException if the Domain textbox was detected AND failure occurred in entering the domain name.
                // All other failures in different locations (even while trying to detect if the domain textbox even exists) can just no-op.
                if (!noOpException)
                {
                    throw new DeviceWorkflowException("Domain textbox was not found.", ex);
                }
            }
        }
Exemple #7
0
 private void EnterText(string button, string screen, string control, string controlValue)
 {
     ControlPanel.Press(button);
     Pacekeeper.Sync();
     ControlPanel.WaitForActiveScreenLabel(screen, TimeSpan.FromSeconds(3));
     ControlPanel.SetValue(control, controlValue);
     Pacekeeper.Sync();
 }
Exemple #8
0
 /// <summary>
 /// Enters the PIN on the device control panel.
 /// </summary>
 protected virtual void EnterPin()
 {
     if (!VerifyKeyboard(UserNameIds))
     {
         throw new DeviceWorkflowException("Unable to find 'Code' text box.");
     }
     ControlPanel.TypeOnVirtualKeyboard(Credential.Pin);
     Pacekeeper.Sync();
 }
Exemple #9
0
 /// <summary>
 /// Enters Pin for HP Roam
 /// </summary>
 private void EnterPin()
 {
     if (!PressElementForKeyboard("#hpid-signin-textbox-UserNameTextBox"))
     {
         throw new DeviceWorkflowException("Keyboard is not displayed.");
     }
     ControlPanel.TypeOnVirtualKeyboard(Credential.UserName.Substring(2));
     Pacekeeper.Sync();
 }
 private void EnterPin()
 {
     if (!ControlPanel.WaitForAvailable(KeyboardId, TimeSpan.FromSeconds(3)))
     {
         throw new DeviceWorkflowException("Keyboard is not displayed");
     }
     ControlPanel.TypeOnVirtualKeyboard(Credential.Pin);
     Pacekeeper.Sync();
 }
        /// <summary>
        /// Enters the specified value for the specified workflow prompt.
        /// </summary>
        /// <param name="prompt">The prompt.</param>
        /// <param name="value">The value.</param>
        public void EnterPromptValue(string prompt, string value)
        {
            string currentForm = _controlPanel.CurrentForm();

            if (currentForm == "OxpBaseForm")
            {
                EnterPromptValueLegacy(prompt, value);
            }
            else
            {
                _enhancedWorkflowApp.SelectPrompt(prompt);
                Pacekeeper.Pause();
                _controlPanel.TypeOnVirtualKeyboard("mKeyboard", value);
                Pacekeeper.Sync();
                _controlPanel.PressToNavigate("ok", currentForm, ignorePopups: false);
            }
            Pacekeeper.Pause();
        }
Exemple #12
0
        /// <summary>
        /// Enters credentials on the device by entering the device admin password.
        /// </summary>
        public override void EnterCredentials()
        {
            //Click on the Dropdown
            ControlPanel.Press("mButton");
            Pacekeeper.Sync();

            //Press select Administrator Access Code
            ControlPanel.ScrollPress("mListBox", "mName", "AdminItem");
            Pacekeeper.Sync();
        }
        /// <summary>
        /// Enters the user name into the appropriate text box.
        /// </summary>
        private void EnterUserNameForGeniusBytes()
        {
            if (!ControlPanel.WaitForAvailable(KeyboardId, TimeSpan.FromSeconds(3)))
            {
                throw new DeviceWorkflowException("Keyboard is not displayed");
            }
            ControlPanel.TypeOnVirtualKeyboard(Credential.UserName);

            Pacekeeper.Sync();
            SubmitAuthentication();
        }
Exemple #14
0
        /// <summary>
        /// Enters the password into the appropriate text box.
        /// </summary>
        private void EnterPasswordForSafeQ()
        {
            PressElementOxpd("js-credentials-password");

            if (!ControlPanel.WaitForAvailable(KeyboardId, TimeSpan.FromSeconds(3)))
            {
                throw new DeviceWorkflowException("Keyboard is not displayed");
            }
            TypeOnVirtualKeyboard(Credential.Password);

            Pacekeeper.Sync();
        }
        /// <summary>
        /// Scans the proximity card.
        /// </summary>
        private void ScanCard()
        {
            RobotControllerClient badgeBox         = new RobotControllerClient(Credential.BadgeBoxInfo.Address);
            RfidSwitch            badgeBoxEndPoint = badgeBox.GetEndpoint <RfidSwitch>();
            RfidActivateResult    scanResult       = null;

            LogDebug("Entering Badge Scan.");
            try
            {
                //Check card with user
                BadgeInfo badge = Credential.BadgeBoxInfo.Badges.FirstOrDefault(x => x.UserName.EqualsIgnoreCase(Credential.UserName));
                if (badge == null)
                {
                    throw new DeviceWorkflowException($"Unable fo find badge info for User {Credential.UserName}");
                }

                LogDebug($"Swiping badge for user {badge.UserName}. (index {badge.Index})");
                scanResult = badgeBoxEndPoint.Activate(badge.Index);

                if (scanResult.DetectionOffset != null)
                {
                    LogDebug("Badge Scan Successful.");
                }
                else
                {
                    LogDebug("Badge Scan Failed.");
                }

                //Handle Notification Screen, if present.  It may not be present for all cases.
                Widget okButton = ControlPanel.WaitForWidgetByValue("OK", TimeSpan.FromSeconds(1));
                if (okButton != null)
                {
                    ControlPanel.Press(okButton);
                    Pacekeeper.Sync();
                }

                if (ValidateAuthentication())
                {
                    LogDebug("Login Successful.");
                }
                else
                {
                    throw new DeviceWorkflowException("No 'Sign Out' button detected.");
                }

                Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                throw new DeviceWorkflowException($"Unable to authenticate badge scan.", ex);
            }
        }
 protected override void EnterUserName()
 {
     try
     {
         PressElementOxpdByClassIndex(_codeTextBoxClassname, 0);
         TypeOnVirtualKeyboard(Credential.UserName);
         Pacekeeper.Sync();
     }
     catch (DeviceInvalidOperationException ex)
     {
         throw new DeviceWorkflowException("User Name textbox was not found.", ex);
     }
 }
Exemple #17
0
        /// <summary>
        /// Submits the authentication request.
        /// </summary>
        public override void SubmitAuthentication()
        {
            try
            {
                ControlPanel.WaitForActiveScreenLabel("view_sips_form");
                ControlPanel.PressByValue("Login");

                Pacekeeper.Sync();
            }
            catch (SiriusInvalidOperationException ex)
            {
                throw new DeviceWorkflowException($"Could not sign in: {ex.Message}", ex);
            }
        }
        private void SetKeyValue(string textBox, string value)
        {
            var screenText = ControlPanel.GetDisplayedStrings().ToList();

            if (screenText.Contains("Sign In: LDAP") || screenText.Contains("Sign In: Windows"))
            {
                ControlPanel.Press(textBox);
                Thread.Sleep(TimeSpan.FromSeconds(1));
                ControlPanel.TypeOnVirtualKeyboard(value);
                Pacekeeper.Pause();
                ControlPanel.Press("cOKTouchButton");
            }
            Pacekeeper.Sync();
        }
Exemple #19
0
        /// <summary>
        /// Enters credentials on the device control panel.
        /// </summary>
        public override void EnterCredentials()
        {
            // Enter domain\user name
            ControlPanel.Type(Credential.Domain + "\\" + Credential.UserName);
            Pacekeeper.Sync();

            // Tab to Next control
            ControlPanel.Type(SpecialCharacter.Tab);
            Pacekeeper.Sync();

            // Enter password
            ControlPanel.Type(Credential.Password);
            Pacekeeper.Sync();
        }
Exemple #20
0
        /// <summary>
        /// Enters the username on one screen and the password on the next
        /// </summary>
        private void EnterUserNamePasswordSplitPage()
        {
            EnterUserName();

            SubmitAuthentication();
            Pacekeeper.Sync();
            bool result = ControlPanel.WaitForAvailable(".hp-credential-control:password", TimeSpan.FromSeconds(5));

            if (!result)
            {
                throw new DeviceWorkflowException("Unable to find the 'Password' text box");
            }
            EnterPassword();
        }
        /// <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");
            }
        }
Exemple #22
0
        /// <summary>
        /// Submits the authentication request by pressing the specified button.
        /// </summary>
        /// <param name="buttonText">The button text.</param>
        protected void SubmitAuthentication(string buttonText)
        {
            //Get widget by text value.
            Widget signInButton = ControlPanel.WaitForWidgetByValue(buttonText);

            if (signInButton != null)
            {
                ControlPanel.Press(signInButton);
                Pacekeeper.Sync();
                return;
            }

            //If we get here, we did not find the sign in button.
            throw new DeviceWorkflowException($"Unable to find widget with value: {buttonText}.");
        }
Exemple #23
0
        /// <summary>
        /// Enters the user name, password (and domain if applicable) on the device control panel.
        /// </summary>
        protected override void EnterUserNamePassword(bool enterDomain = false)
        {
            //Enter user name
            ControlPanel.Type(Credential.UserName);
            Pacekeeper.Sync();

            string okCtlrs = "ok|mOkButton.*";

            if (ControlPanel.WaitForControl(okCtlrs, StringMatch.Regex, TimeSpan.FromSeconds(5)))
            {
                string okButton = ControlPanel.GetControls().Contains("ok") ? "ok" : "mOkButton";

                ControlPanel.Press(okButton);
                Pacekeeper.Sync();

                // Check if domain field is expected
                if (enterDomain)
                {
                    // Enter domain if populated
                    if (!string.IsNullOrEmpty(Credential.Domain))
                    {
                        ControlPanel.Type(Credential.Domain);
                        Pacekeeper.Sync();
                    }

                    //Tab to next control
                    if (ControlPanel.WaitForControl(okButton, TimeSpan.FromSeconds(5)))
                    {
                        ControlPanel.Press(okButton);
                        Pacekeeper.Sync();
                    }
                    else
                    {
                        throw new DeviceWorkflowException($"Unable to press '{okButton}'");
                    }
                }

                //Enter password
                ControlPanel.Type(Credential.Password);
                Pacekeeper.Sync();
            }
            else
            {
                throw new DeviceWorkflowException("Unable to press the Blueprint 'OK' button");
            }
        }
Exemple #24
0
        /// <summary>
        /// Enters the user name and password on the device control panel.
        /// </summary>
        private void EnterUserNamePassword()
        {
            string label;

            try
            {
                label = ControlPanel.ActiveScreenLabel();

                switch (label)
                {
                case "view_authentication_ldap_login":
                    //Enter Username
                    EnterText("ldap_login_username_edit", "view_ldap_login_username_touch", "ldap_ldap_login_username_keyboard.4", Credential.UserName);
                    Pacekeeper.Sync();
                    //Enter Password
                    EnterText("ldap_password_entry_password", "view_user_password_entry_password", "user_password_entry_password_keyboard.4", Credential.Password);
                    break;

                case "view_authentication_window_login":
                    //Enter Username
                    EnterText("windows_login_username_entry", "view_windows_login_username_entry_username", "ldap_windows_login_username_keyboard.4", Credential.UserName);
                    Pacekeeper.Sync();
                    //Enter Password
                    EnterText("windows_login_password_entry_password", "view_windows_password_entry_password", "windows_password_entry_password_keyboard.4", Credential.Password);
                    break;
                }
                Pacekeeper.Sync();
            }
            catch (ElementNotFoundException ex)
            {
                label = ControlPanel.ActiveScreenLabel();
                switch (label)
                {
                case "view_authentication_window_login":
                    throw new DeviceWorkflowException("Could not sign in using Windows authentication.", ex);

                case "view_oxpd_auth_result":
                    ControlPanel.Press("oxpd_auth_result_msg_footer.0");
                    throw new DeviceWorkflowException("Could not sign in using LDAP authentication.", ex);
                }
            }
        }
        private void EnterParameter(string labelText, string value)
        {
            Widget label = ControlPanel.GetWidgets().Find(labelText, StringMatch.Contains);

            if (label != null)
            {
                Widget stringBox = ControlPanel.GetWidgets().FindByLabel(label, WidgetType.StringBox, WidgetType.EditBox);
                ControlPanel.Press(stringBox);
                ControlPanel.WaitForScreen(_signInKeyboard, TimeSpan.FromSeconds(5));
                Pacekeeper.Sync();

                ControlPanel.TypeOnVirtualKeyboard(value);
                Pacekeeper.Sync();
                ControlPanel.Press("OK");
                ControlPanel.WaitForScreen(_signInScreen, TimeSpan.FromSeconds(5));
                Pacekeeper.Sync();
            }
            else
            {
                throw new DeviceWorkflowException($"Could not sign in using Windows authentication: No label with text {labelText}.");
            }
        }
 /// <summary>
 /// Signin in Udocx
 /// </summary>
 /// <param name="id">id for signin</param>
 /// <param name="pw">pw for signin</param>
 private void Login(string id, string pw)
 {
     try
     {
         if (!_engine.HtmlContains(_differentUser[0]))
         {
             PressButton(_inputId[0]);
             _controlPanel.WaitForAvailable("#hpid-keyboard-key-done", _idleTimeoutOffset);
             _controlPanel.TypeOnVirtualKeyboard(id);
             Pacekeeper.Sync();
             PressButton(_inputPw[0]);
             _controlPanel.WaitForAvailable("#hpid-keyboard-key-done", _idleTimeoutOffset);
             _controlPanel.TypeOnVirtualKeyboard(pw);
             Pacekeeper.Sync();
         }
         else
         {
             PressButton(_differentUser[0]);
             _engine.WaitForHtmlContains(_inputId[0], TimeSpan.FromMilliseconds(20000));
             PressButton(_inputId[0]);
             _controlPanel.WaitForAvailable("#hpid-keyboard-key-done", _idleTimeoutOffset);
             _controlPanel.TypeOnVirtualKeyboard(id);
             Pacekeeper.Sync();
             PressButton(_inputPw[0]);
             _controlPanel.WaitForAvailable("#hpid-keyboard-key-done", _idleTimeoutOffset);
             _controlPanel.TypeOnVirtualKeyboard(pw);
             Pacekeeper.Sync();
         }
         _controlPanel.Press("#hpid-keyboard-key-done");
         Pacekeeper.Pause();
     }
     catch (Exception ex)
     {
         DeviceWorkflowException e = new DeviceWorkflowException("Fail to signIn", ex);
         throw e;
     }
 }
 /// <summary>
 /// Enters Pin on the device.
 /// </summary>
 protected override void EnterPin()
 {
     ControlPanel.TypeOnVirtualKeyboard(Credential.Pin);
     Pacekeeper.Sync();
 }
 protected override void EnterPin()
 {
     PressElementOxpdByClassIndex(_codeTextBoxClassname, 0);
     TypeOnVirtualKeyboard(Credential.Pin);
     Pacekeeper.Sync();
 }
 /// <summary>
 /// Enters the PIN on the device control panel.
 /// </summary>
 protected void EnterPin()
 {
     ControlPanel.Type(Credential.Pin);
     Pacekeeper.Sync();
 }