Пример #1
0
        private void AuthenticateOmni(string deviceIP, string userName)
        {
            IDevice device = DeviceFactory.Create(deviceIP, "!QAZ2wsx");
            //AuthenticationCredential credential = new AuthenticationCredential(userName, "1qaz2wsx", "etl.boi.rd.hpicorp.net");
            AuthenticationCredential credential = new AuthenticationCredential("03000");

            JediOmniPreparationManager prepMgr = new JediOmniPreparationManager(((JediOmniDevice)device));
            JediOmniLaunchHelper       helper  = new JediOmniLaunchHelper((JediOmniDevice)device);

            // Set up the device for Authentication
            prepMgr.Reset();
            helper.PressSignInButton();

            IAuthenticator authenticator = AuthenticatorFactory.Create(device, credential, AuthenticationProvider.Auto);

            authenticator.Authenticate();
        }
Пример #2
0
        internal void Exercise(DirtyDeviceActivityData activityData)
        {
            const string AppButtonFilter = "-homescreen-button";

            var controls = _controlPanel.GetIds("div", OmniIdCollectionType.Children).Where(id => id.EndsWith(AppButtonFilter)).ToArray();

            _owner.OnUpdateStatus(this, $"Found {controls.Length} app buttons...");

            for (int controlIndex = 0; controlIndex < controls.Length; controlIndex++)
            {
                string controlSelector = "#" + controls[controlIndex];

                string innerText = _controlPanel.GetValue(controlSelector, "innerText", OmniPropertyType.Property).Trim();

                _controlPanel.ScrollToItem(controlSelector);

                if (_controlPanel.WaitForState(controlSelector, OmniElementState.Useable, TimeSpan.FromSeconds(10)))
                {
                    _owner.OnUpdateStatus(this, $"  Pressing {innerText} ({controlIndex + 1:##}/{controls.Length:##})");
                    _controlPanel.Press(controlSelector);
                }
                else
                {
                    _owner.OnUpdateStatus(this, $"  Skipping {innerText}.  App is not available currently. ({controlIndex + 1:##}/{controls.Length:##})");
                    continue;
                }
                System.Threading.Thread.Sleep(5000);

                try
                {
                    _preparationManager.Reset();
                }
                catch (Exception x)
                {
                    _owner.OnUpdateStatus(this, x.ToString());
                    _owner.OnUpdateStatus(this, $"  Pressing 'Home' button did not exit {innerText}.  Consider filing a bug report against the app.");
                    _owner.OnUpdateStatus(this, $"  Attempting to return to home screen by waiting for timeout.");
                    UnauthenticateByTimeout();
                }
            }
        }