public ProgressDialog(string title,IStep step) : base(Font.MediumFont, title) { this.step = step; progressLine = 1; CreateProcessThread (); }
public override bool Show() { bool ok = true; errorStep = null; OnShow (); Draw (); StartProgressAnimation (progressLine); for (stepIndex = 0; stepIndex < steps.Count; stepIndex++) { Draw (); try { if (!steps [stepIndex].Execute ()) { StopProgressAnimation (); ClearContent (); WriteTextOnDialog (steps [stepIndex].ErrorText); DrawCenterButton ("Ok", false); Lcd.Instance.Update (); Buttons.Instance.GetKeypress ();//Wait for any key errorStep = steps [stepIndex]; ok = false; break; } else { if (steps [stepIndex].ShowOkText) { StopProgressAnimation (); ClearContent (); WriteTextOnDialog (steps [stepIndex].ErrorText); DrawCenterButton ("Ok", false); Lcd.Instance.Update (); Buttons.Instance.GetKeypress ();//Wait for any key StartProgressAnimation (progressLine); } } } catch(Exception e) { StopProgressAnimation (); ClearContent (); WriteTextOnDialog ("Exception excuting " + steps [stepIndex].StepText); DrawCenterButton ("Ok", false); Console.WriteLine("Exception " + e.Message); Console.WriteLine(e.StackTrace); Lcd.Instance.Update (); Buttons.Instance.GetKeypress ();//Wait for any key errorStep = steps [stepIndex]; ok = false; break; } } StopProgressAnimation (); if (allDoneText != "" && ok) { ClearContent(); WriteTextOnDialog(allDoneText); DrawCenterButton("Ok",false); Lcd.Instance.Update(); Buttons.Instance.GetKeypress();//Wait for any key*/ } OnExit(); return ok; }
public void onStepLoad(IStep step, Assembly assembly) { var assemblyInvoke = (ascx_AssemblyInvoke)step.FirstControl; assemblyInvoke.loadAssembly(assembly); assemblyInvoke.setExecuteMethodOnDoubleClick(true); //PublicDI.log.error("type:{0}:", assemblyInvoke.GetType().FullName); }
void ITestStream.Do(DoGrammarStructure structure, IStep step) { _paragraphResults.ForExceptionText(text => { _document.Add(new ExceptionTag(text)); }); }
public void ReadExpected(ITestContext context, IStep step, SetRow row) { Cell.ReadArgument(context, step, x => { row.Values[Cell.Key] = x; }); }
protected override void execute(IWebElement element, IDictionary<string, object> cellValues, IStep step, ITestContext context) { assertCondition(element.Enabled, DisabledElementMessage); assertCondition(element.Displayed, HiddenElementMessage); element.Click(); }
protected override void execute(IWebElement element, IDictionary<string, object> cellValues, IStep step, ITestContext context) { // TODO -- StoryTeller needs to pull this all inside the Cell if (!cellValues.ContainsKey(_cell.Key)) { // already caught as a syntax error return; } var handler = ElementHandlers.FindHandler(element); var expectedValue = cellValues[_cell.Key]; var matchingHandler = handler as IMatchingHandler ?? new BasicMatchingHandler(handler, context); if (matchingHandler.MatchesData(element, expectedValue)) { context.IncrementRights(); } else { context.ResultsFor(step).MarkFailure(_cell.Key); context.IncrementWrongs(); } context.ResultsFor(step).SetActual(_cell.Key, handler.GetData(CurrentContext, element)); }
public SentenceTag(Sentence sentence, IStep step) : base("div") { _sentence = sentence; _step = step; this.AddSafeClassName(sentence.Name); AddClass("sentence"); }
private void SetStep(IStep step) { TopMost = step.TopMost; _steps.Push(step); step.Initialize(_state); SetUI(step); }
public void Execute(IStep containerStep, ITestContext context) { context.PerformAction(containerStep, _before); containerStep.LeafFor(_leafName).AllSteps().Each(step => { context.RunStep(InnerGrammar, step); }); context.PerformAction(containerStep, _after); }
public void step2_loadFiles(IStep step) { O2Thread.mtaThread( () => { var testFiles = Files.getFilesFromDir_returnFullPath(PublicDI.config.O2TempDir,"*.cs", true); var searchTargets = (ascx_SearchTargets)step.Controller.steps[2].FirstControl; searchTargets.loadFiles(testFiles); }); }
public void InvokefMethod(IStep step, string clause) { "Given a string" .Given(() => clause = "Given foo"); "When the do extension method is invoked" .When(() => step = clause.f(() => { })); "Then a step is returned" .Then(() => step.Should().NotBeNull()); }
public void AddStepBefore(Type target, IStep step) { for (int i = 0; i < _steps.Count; i++) { if (_steps [i].GetType () == target) { _steps.Insert (i, step); return; } } }
public void Parse(string template, IStep step, IEnumerable<Cell> cells) { MatchCollection matches = Regex.Matches(template, @"\{(\w+)\}"); List<string> keys = getKeys(matches); validate(template, cells, keys); parse(template, matches, cells, step); }
public CellTag(Cell cell, IStep step) : base("span") { if (step == null) throw new ArgumentNullException("step"); _cell = cell; _step = step; AddClass(HtmlClasses.INPUT); }
public void SetUp() { sentence = Sentence.For("{x} + {y} should equal {z}", Cell.For<int>("x"), Cell.For<int>("y"), Cell.For<int>("z")); sentence.Name = "Add"; sentence.Description = "adds x to y"; theExample = sentence.CreateExample(); }
public void SetUp() { table = new Table("The Label", "rows", new List<Cell> { Cell.For<string>("name"), Cell.For<int>("age") }); step = table.CreateExample(); }
public override void Execute(IStep containerStep, ITestContext context) { _callback = value => { var returnCell = GetCells().Where(x => x.IsResult).FirstOrDefault(); if (returnCell != null) returnCell.RecordActual(value, containerStep, context); }; _method.Call(_target, containerStep, context, _callback); }
public Continuation Invoke(IStep step, StepContext stepContext) { if (step == null) throw new ArgumentNullException("step"); if (stepContext == null) throw new ArgumentNullException("stepContext"); var handler = _locator.GetStepHandler(step.GetType()); if (handler == null) throw new ArgumentException("No handler for Step: " + step.GetType(), "step"); return handler.Handle(step, stepContext); }
public void SetUp() { FixtureLibrary library = FixtureGraph.Library; FixtureStructure fixture = library.FixtureFor("Math"); embeddedSection = new EmbeddedSectionGrammar<MathFixture>().ToStructure(library).ShouldBeOfType<EmbeddedSection>(); embeddedSection.Name = "MathGrammar"; theExample = embeddedSection.CreateExample(); }
public void AddStepBefore (Type target, IStep step) { for (int i = 0; i < _steps.Count; i++) { if (target.IsInstanceOfType (_steps [i])) { _steps.Insert (i, step); return; } } string msg = String.Format ("Step {0} could not be inserted before (not found) {1}", step, target); throw new InvalidOperationException (msg); }
public void AddStepAfter(IStep target, IStep step) { for (int i = 0; i < _steps.Count; i++) { if (_steps [i] == target) { if (i == _steps.Count - 1) _steps.Add (step); else _steps.Insert (i + 1, step); return; } } }
protected override void execute(IWebElement element, IDictionary<string, object> cellValues, IStep step, ITestContext context) { assertCondition(element.Enabled, DisabledElementMessage); // TODO -- start a convenience class for extensions on IWebElement bool isShown = element.Displayed || element.IsHiddenInput(); assertCondition(isShown, HiddenElementMessage); var data = cellValues[Config.CellName]; ElementHandlers.FindHandler(element).EnterData(CurrentContext, element, data); }
public void AddStep( IStep step ) { if (_head == null) { _head = step; _tail = _head; } else { _tail.Next = step; _tail = step; } }
public void Execute(IStep containerStep, ITestContext context) { var actualObjects = findTheObjects(containerStep, context); var actualRows = buildActualRows(actualObjects); var expectedRows = buildExpectedRows(context, containerStep); var matcher = new SetRowMatcher(expectedRows, actualRows, context); IList<SetRow> results = Ordered ? matcher.CompareOrdered() : matcher.Compare(); markCounts(context, results); context.ResultsFor(containerStep).SetResult(results, _leafName); }
public void step0_loadDefaultValues(IStep step) { O2Thread.mtaThread( () => { PublicDI.log.error("in step0_loadDefaultValues"); PublicDI.log.error(step.Controller.steps[0].FirstControl.GetType().FullName); var fileMappings = (FileMappings)step.Controller.steps[0].FirstControl; PublicDI.reflection.invoke(fileMappings,"hideDropHelpInfo", new object[]{}); var fileFilter = ".cs"; fileMappings.setExtensionsToShow(fileFilter); fileMappings.loadFilesFromFolder(PublicDI.config.O2TempDir,fileFilter); }); }
public void confirmBackupAction(IStep step) { O2Thread.mtaThread( ()=> { step.set_Text(""); var sourceDirectory = step.getPathFromStep(0); var targetDirectory = step.getPathFromStep(1); var targetFile = calculateTargetFileName(sourceDirectory, targetDirectory); step.append_Text("You are about to create a backup of the folder: {1}{1}\t{0} {1}{1} ", sourceDirectory, Environment.NewLine); step.append_Text("into the file: {1}{1}\t{0}{1}{1}", targetFile, Environment.NewLine); step.append_Text("Do you want to processed"); }); }
public StepInvoker( IStep step, Func<IStepContext, Task> body, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource) { Guard.AgainstNullArgument("aggregator", aggregator); Guard.AgainstNullArgument("cancellationTokenSource", cancellationTokenSource); this.step = step; this.body = body; this.aggregator = aggregator; this.cancellationTokenSource = cancellationTokenSource; }
public IStep GetStepAfter(IStep step) { Node iterator = _root; while (iterator.Step != step) { iterator = iterator.Next; } if (iterator.Next == null) return null; return iterator.Next.Step; }
public ParagraphTag(Paragraph paragraph, IStep step) : base("div") { _paragraph = paragraph; _step = step; AddClass("paragraph"); AddClass(paragraph.Style.ToString()); if (paragraph.Style == EmbedStyle.TitledAndIndented) { Add("div").AddClass(HtmlClasses.SECTION_TITLE); } }
public static ascx_Directory add_Directory(this IStep step) { return(step.add_Directory(PublicDI.config.O2TempDir)); }
void ITestStream.InvalidGrammar(string grammarKey, IStep step) { markGrammar(grammarKey); }
void IGrammarVisitor.SetVerification(SetVerification setVerification, IStep step) { _link.Label(setVerification.Label); }
public void PrependStep(IStep step) { _steps.Insert(0, step); }
public DefaultStep(ICommandMiddleware middleware, IStep next) { this.middleware = middleware; this.next = next; }
public static TextBox add_TextBox(this IStep step, string originalText, int top, int left) { return(add_TextBox(step, originalText, top, left, -1)); }
private async Task RunStepAsync(IStep step, CancellationToken jobCancellationToken) { // Start the step. Trace.Info("Starting the step."); step.ExecutionContext.Section(StringUtil.Loc("StepStarting", step.DisplayName)); step.ExecutionContext.SetTimeout(timeout: step.Timeout); try { await step.RunAsync(); } catch (OperationCanceledException ex) { if (step.ExecutionContext.CancellationToken.IsCancellationRequested && !jobCancellationToken.IsCancellationRequested) { Trace.Error($"Caught timeout exception from step: {ex.Message}"); step.ExecutionContext.Error(StringUtil.Loc("StepTimedOut")); step.ExecutionContext.Result = TaskResult.Failed; } else { // Log the exception and cancel the step. Trace.Error($"Caught cancellation exception from step: {ex}"); step.ExecutionContext.Error(ex); step.ExecutionContext.Result = TaskResult.Canceled; } } catch (Exception ex) { // Log the error and fail the step. Trace.Error($"Caught exception from step: {ex}"); step.ExecutionContext.Error(ex); step.ExecutionContext.Result = TaskResult.Failed; } // Wait till all async commands finish. foreach (var command in step.ExecutionContext.AsyncCommands ?? new List <IAsyncCommandContext>()) { try { // wait async command to finish. await command.WaitAsync(); } catch (OperationCanceledException ex) { if (step.ExecutionContext.CancellationToken.IsCancellationRequested && !jobCancellationToken.IsCancellationRequested) { // Log the timeout error, set step result to falied if the current result is not canceled. Trace.Error($"Caught timeout exception from async command {command.Name}: {ex}"); step.ExecutionContext.Error(StringUtil.Loc("StepTimedOut")); // if the step already canceled, don't set it to failed. step.ExecutionContext.CommandResult = TaskResultUtil.MergeTaskResults(step.ExecutionContext.CommandResult, TaskResult.Failed); } else { // log and save the OperationCanceledException, set step result to canceled if the current result is not failed. Trace.Error($"Caught cancellation exception from async command {command.Name}: {ex}"); step.ExecutionContext.Error(ex); // if the step already failed, don't set it to canceled. step.ExecutionContext.CommandResult = TaskResultUtil.MergeTaskResults(step.ExecutionContext.CommandResult, TaskResult.Canceled); } } catch (Exception ex) { // Log the error, set step result to falied if the current result is not canceled. Trace.Error($"Caught exception from async command {command.Name}: {ex}"); step.ExecutionContext.Error(ex); // if the step already canceled, don't set it to failed. step.ExecutionContext.CommandResult = TaskResultUtil.MergeTaskResults(step.ExecutionContext.CommandResult, TaskResult.Failed); } } // Merge executioncontext result with command result if (step.ExecutionContext.CommandResult != null) { step.ExecutionContext.Result = TaskResultUtil.MergeTaskResults(step.ExecutionContext.Result, step.ExecutionContext.CommandResult.Value); } // Fixup the step result if ContinueOnError. if (step.ExecutionContext.Result == TaskResult.Failed && step.ContinueOnError) { step.ExecutionContext.Result = TaskResult.SucceededWithIssues; Trace.Info($"Updated step result: {step.ExecutionContext.Result}"); } else { Trace.Info($"Step result: {step.ExecutionContext.Result}"); } // Complete the step context. step.ExecutionContext.Section(StringUtil.Loc("StepFinishing", step.DisplayName)); step.ExecutionContext.Complete(); }
public void ReplaceStep(Type target, IStep step) { AddStepBefore(target, step); RemoveStep(target); }
void ITestStream.Table(Table table, IStep step) { markGrammar(table.Name); }
public ControllerGenericBaseRead(IMapper mapper, IStep <IManagementModelRetrieverRequest <TModel> > retrieverbusinessLogic) { _retrieverBusinessLogic = retrieverbusinessLogic; _mapper = mapper; }
void IGrammarVisitor.DoGrammar(DoGrammarStructure grammar, IStep step) { }
void IGrammarVisitor.EmbeddedSection(EmbeddedSection section, IStep step) { _link.Label(section.Label); }
void IGrammarVisitor.Sentence(Sentence sentence, IStep step) { sentence.Parts.Each(x => x.AcceptVisitor(this)); }
/*public static IStep add_WebBrowserAndTextBox(this List<IStep> steps, string stepTitle, string stepSubTitle, Action<IStep> onComponentLoad) * { * var hostPanel = new Panel(); * var splitControl = hostPanel.add_SplitContainer( * false, //setOrientationToHorizontal * true, // setDockStyleoFill * true); // setBorderStyleTo3D) * splitControl.Panel1.add_GroupBox("Webpage"); * splitControl.Panel2.add_GroupBox("Analysis"); * * splitControl.SplitterDistance = 100; * return steps.add_Control(hostPanel, stepTitle, stepSubTitle, onComponentLoad); * }*/ public static Label add_Label(this IStep step, string text) { return(step.add_Label(text, -1, -1)); }
public static Label add_Label(this IStep step, string text, int top) { return(step.add_Label(text, top, -1)); }
private async Task RunStepAsync(IStep step, CancellationToken jobCancellationToken) { // Start the step. Trace.Info("Starting the step."); step.ExecutionContext.Section(StringUtil.Loc("StepStarting", step.DisplayName)); step.ExecutionContext.SetTimeout(timeout: step.Timeout); #if OS_WINDOWS try { if (step.ExecutionContext.Variables.Retain_Default_Encoding != true && Console.InputEncoding.CodePage != 65001) { using (var p = HostContext.CreateService <IProcessInvoker>()) { // Use UTF8 code page int exitCode = await p.ExecuteAsync(workingDirectory : HostContext.GetDirectory(WellKnownDirectory.Work), fileName : WhichUtil.Which("chcp", true, Trace), arguments : "65001", environment : null, requireExitCodeZero : false, outputEncoding : null, killProcessOnCancel : false, redirectStandardIn : null, inheritConsoleHandler : true, cancellationToken : step.ExecutionContext.CancellationToken); if (exitCode == 0) { Trace.Info("Successfully returned to code page 65001 (UTF8)"); } else { Trace.Warning($"'chcp 65001' failed with exit code {exitCode}"); } } } } catch (Exception ex) { Trace.Warning($"'chcp 65001' failed with exception {ex.Message}"); } #endif try { await step.RunAsync(); } catch (OperationCanceledException ex) { if (step.ExecutionContext.CancellationToken.IsCancellationRequested && !jobCancellationToken.IsCancellationRequested) { Trace.Error($"Caught timeout exception from step: {ex.Message}"); step.ExecutionContext.Error(StringUtil.Loc("StepTimedOut")); step.ExecutionContext.Result = TaskResult.Failed; } else { // Log the exception and cancel the step. Trace.Error($"Caught cancellation exception from step: {ex}"); step.ExecutionContext.Error(ex); step.ExecutionContext.Result = TaskResult.Canceled; } } catch (Exception ex) { // Log the error and fail the step. Trace.Error($"Caught exception from step: {ex}"); step.ExecutionContext.Error(ex); step.ExecutionContext.Result = TaskResult.Failed; } // Wait till all async commands finish. foreach (var command in step.ExecutionContext.AsyncCommands ?? new List <IAsyncCommandContext>()) { try { // wait async command to finish. await command.WaitAsync(); } catch (OperationCanceledException ex) { if (step.ExecutionContext.CancellationToken.IsCancellationRequested && !jobCancellationToken.IsCancellationRequested) { // Log the timeout error, set step result to falied if the current result is not canceled. Trace.Error($"Caught timeout exception from async command {command.Name}: {ex}"); step.ExecutionContext.Error(StringUtil.Loc("StepTimedOut")); // if the step already canceled, don't set it to failed. step.ExecutionContext.CommandResult = TaskResultUtil.MergeTaskResults(step.ExecutionContext.CommandResult, TaskResult.Failed); } else { // log and save the OperationCanceledException, set step result to canceled if the current result is not failed. Trace.Error($"Caught cancellation exception from async command {command.Name}: {ex}"); step.ExecutionContext.Error(ex); // if the step already failed, don't set it to canceled. step.ExecutionContext.CommandResult = TaskResultUtil.MergeTaskResults(step.ExecutionContext.CommandResult, TaskResult.Canceled); } } catch (Exception ex) { // Log the error, set step result to falied if the current result is not canceled. Trace.Error($"Caught exception from async command {command.Name}: {ex}"); step.ExecutionContext.Error(ex); // if the step already canceled, don't set it to failed. step.ExecutionContext.CommandResult = TaskResultUtil.MergeTaskResults(step.ExecutionContext.CommandResult, TaskResult.Failed); } } // Merge executioncontext result with command result if (step.ExecutionContext.CommandResult != null) { step.ExecutionContext.Result = TaskResultUtil.MergeTaskResults(step.ExecutionContext.Result, step.ExecutionContext.CommandResult.Value); } // Fixup the step result if ContinueOnError. if (step.ExecutionContext.Result == TaskResult.Failed && step.ContinueOnError) { step.ExecutionContext.Result = TaskResult.SucceededWithIssues; Trace.Info($"Updated step result: {step.ExecutionContext.Result}"); } else { Trace.Info($"Step result: {step.ExecutionContext.Result}"); } // Complete the step context. step.ExecutionContext.Section(StringUtil.Loc("StepFinishing", step.DisplayName)); step.ExecutionContext.Complete(); }
public TimeStampStep(IStep step) { message = step.ToString(); }
public void RegisterPostJobStep(string refName, IStep step) { step.ExecutionContext = Root.CreatePostChild(step.DisplayName, refName, IntraActionState); Root.PostJobSteps.Push(step); }
public Task <bool> UpdateAsync(IStep step) { return(StepRepository.UpdateAsync(step)); }
void ITestStream.Do(DoGrammarStructure structure, IStep step) { }
public void AppendStep(IStep step) { _steps.Add(step); }
void ITestStream.Sentence(Sentence sentence, IStep step) { markGrammar(sentence.Name); }
void ITestStream.StartEmbeddedSection(EmbeddedSection section, IStep step) { markGrammar(section.Name); ForFixture(section.Fixture.Name).Mark(_currentTest); _fixtureStack.Push(section.Fixture); }
void IGrammarVisitor.Table(Table table, IStep step) { _link.Label(table.Label); }
void ITestStream.EndEmbeddedSection(EmbeddedSection section, IStep step) { _fixtureStack.Pop(); }
public Task <IStep> CreateAsync(IStep step) { return(StepRepository.CreateAsync(step)); }
void ITestStream.SetVerification(SetVerification verification, IStep step) { markGrammar(verification.Name); }
void ITestStream.EndParagraph(Paragraph paragraph, IStep step) { }
void IGrammarVisitor.Paragraph(Paragraph paragraph, IStep step) { _link.Label(paragraph.Label); }
void ITestStream.StartParagraph(Paragraph paragraph, IStep step) { markGrammar(paragraph.Name); }