private void CheckAppReady()
        {
            TimeSpan interval = TimeSpan.FromSeconds(3);
            TimeSpan timeOut  = TimeSpan.FromSeconds(20);

            Func <bool> action = new Func <bool>(() =>
            {
                List <string> jobListFormDescriptors = new List <string>()
                {
                    "Job history"
                };

                foreach (string descriptor in jobListFormDescriptors)
                {
                    if (OxpdEngine.HtmlContains(descriptor))
                    {
                        return(true);
                    }
                }
                return(false);
            });

            if (!Wait.ForTrue(action, timeOut, interval))
            {
                throw new DeviceWorkflowException($"HP Roam did not load within {timeOut.TotalSeconds} seconds.");
            }
        }
Example #2
0
        /// <summary>
        /// Presses the PrintAll button.
        /// </summary>
        public void PrintAll()
        {
            TimeSpan timeOut = TimeSpan.FromSeconds(30);

            OxpdEngine.PressElementByClassIndex(_printButtonId[0], 0);
            if (!StartedProcessingWork(timeOut))
            {
                throw new DeviceWorkflowException($"HpRoam PrintAll did not start printing documents within {timeOut.TotalSeconds} seconds.");
            }
        }
Example #3
0
        /// <summary>
        /// Gets the count of selected documents.
        /// </summary>
        /// <returns></returns>
        public int GetSelectedDocumentCount()
        {
            int count = 0;

            if (int.TryParse(OxpdEngine.ExecuteFunction("getSelectedDocumentCount"), out count) && count > 0)
            {
                return(count);
            }

            return(0);
        }
Example #4
0
        /// <summary>
        /// Selects the first document ID.
        /// </summary>
        public void SelectFirstDocument()
        {
            if (OxpdEngine.ExecuteFunction("isElementSelected", "circle-check").Equals("true"))
            {
                OxpdEngine.PressElementByClassIndex("select-all-circle-check", 0);
            }

            if (OxpdEngine.WaitToExistElementId("circle-check", TimeSpan.FromSeconds(1)))
            {
                OxpdEngine.PressElementByClassIndex("circle-check", 0);
            }
        }
Example #5
0
        /// <summary>
        /// Returns true when finished processing the current print job
        /// </summary>
        /// <returns>true if job(s) are finished printing.</returns>
        public bool FinishedProcessingJob()
        {
            bool   parseSuccess     = false;
            string javascriptResult = string.Empty;
            int    processingCount  = -1;

            javascriptResult = OxpdEngine.ExecuteFunction("getJobProcessingCount");
            System.Diagnostics.Debug.WriteLine($"Jobs processing = {javascriptResult}");
            parseSuccess = int.TryParse(javascriptResult, out processingCount);
            if (parseSuccess)
            {
                return(processingCount == 0);
            }

            return(false);
        }
Example #6
0
        /// <summary>
        /// Waits for app to finish processing a single delete
        /// </summary>
        public virtual bool FinishProcessDelete(int initialJobCount)
        {
            bool success      = false;
            int  finishCount  = -1;
            bool parseSuccess = int.TryParse(OxpdEngine.ExecuteFunction("getDocumentCount"), out finishCount);

            if (parseSuccess && finishCount < initialJobCount)
            {
                success = true;
            }
            else
            {
                success = false;
            }

            return(success);
        }
        /// <summary>
        /// Launches HpRoam with the specified authenticator using the given authentication mode
        /// </summary>
        /// <param name="authenticator">The authenticator.</param>
        /// <param name="authenticationMode">The authentication mode, eager or lazy.</param>
        /// <exception cref="NotImplementedException"></exception>
        public override void Launch(IAuthenticator authenticator, AuthenticationMode authenticationMode)
        {
            _launchHelper.WorkflowLogger = WorkflowLogger;
            if (authenticationMode.Equals(AuthenticationMode.Eager))
            {
                if (authenticator.Provider != AuthenticationProvider.Card)
                {
                    _launchHelper.PressSignInButton();
                }
                Authenticate(authenticator, JediOmniLaunchHelper.SignInOrSignoutButton, null);
                PressHpRoamSolutionButton(JediOmniLaunchHelper.LazySuccessScreen);
            }
            else // AuthenticationMode.Lazy
            {
                switch (authenticator.Provider)
                {
                case AuthenticationProvider.HpId:
                    PressHpRoamSolutionButton(JediOmniLaunchHelper.LazySuccessScreen);
                    TimeSpan waitTime = TimeSpan.FromSeconds(10);
                    if (!OxpdEngine.WaitToExistElementId("manual-sign-in", waitTime))
                    {
                        throw new DeviceWorkflowException($"Roam Authentication screen did not display within {waitTime.TotalSeconds} seconds.");
                    }
                    PressButton("manual-sign-in");
                    break;

                default:
                    PressHpRoamSolutionButton(JediOmniLaunchHelper.SignInForm);
                    break;
                }
                Authenticate(authenticator, JediOmniLaunchHelper.LazySuccessScreen, null);
            }

            CheckAppReady();
            RecordEvent(DeviceWorkflowMarker.AppShown);
        }
Example #8
0
 /// <summary>
 /// Presses the Print-Delete button.
 /// </summary>
 public void Print()
 {
     OxpdEngine.PressElementByClassIndex(_printButtonId[0], 0);
 }
Example #9
0
 /// <summary>
 /// Wait specific value for available
 /// </summary>
 /// <param name="value">Value for waiting</param>
 /// <param name="time">Waiting time</param>
 /// <returns></returns>
 protected bool WaitForHtmlContains(string value, TimeSpan time)
 {
     return(OxpdEngine.WaitForHtmlContains(value, time));
 }
Example #10
0
 /// <summary>
 /// Presses a button via the Oxpd Engine.
 /// </summary>
 /// <param name="buttonId">The id of the button to press</param>
 protected void PressButton(string buttonId)
 {
     OxpdEngine.PressElementById(buttonId);
 }
Example #11
0
 /// <summary>
 /// Presses the OK button on the Roam Alert.
 /// </summary>
 public void HandleAlert()
 {
     OxpdEngine.PressElementById("ok-btn");
 }
Example #12
0
        /// <summary>
        /// Returns Roam Alert text.
        /// </summary>
        public string GetAlertText()
        {
            string rawText = OxpdEngine.ExecuteFunction("getRoamAlertText");

            return(rawText.Trim('"'));
        }