public async void GeneralText() { WebBrowser browser = new WebBrowser(WebDriver.Current); string output = "Here\r\n is\r\n my\r\n output!"; var format = TextFormat.text; await xB.CurrentRun.AddScenario(this) .Given(HtmlReport.OfAStepWithOutput(output, format)) .When(WebUser.ViewsReport(browser)) .AndAsync("the user clicks the first area", async (s) => { await browser.ClickWhenVisible(Pages.HtmlReportPage.Area.Name(1)); await browser.WaitTillVisible(Pages.HtmlReportPage.Area.Features(1)); }) .AndAsync("the user clicks the first feature", async (s) => { await browser.ClickWhenVisible(Pages.HtmlReportPage.Feature.Name(1)); await browser.WaitTillVisible(Pages.HtmlReportPage.Feature.Scenarios(1)); }) .AndAsync("the user clicks the first scenario", async (s) => { await browser.ClickWhenVisible(Pages.HtmlReportPage.Scenario.Name(1)); await browser.WaitTillVisible(Pages.HtmlReportPage.Scenario.Steps(1)); }) .AndAsync("the user clicks the first scenario", async (s) => { await browser.ClickWhenVisible(Pages.HtmlReportPage.Output.Link(1)); await browser.WaitTillVisible(Pages.HtmlReportPage.Output.Section(1)); }) .Then("the report will show the output indented under the step", (s) => { s.Output = browser.GetPageSource(); s.OutputFormat = TextFormat.htmlpreview; browser.ElementHasText(Pages.HtmlReportPage.Output.Text(1), output); }) .Run(); }
internal static Step ViewsReport(WebBrowser browser) { var step = xB.CreateAsyncStep( "the user views the html report", async (s) => { browser.Load(Pages.HtmlReportPage.Location.PageLocation); await browser.WaitTillVisible(Pages.HtmlReportPage.TestRun.Name); s.Output = browser.GetPageSource(); s.OutputFormat = TextFormat.htmlpreview; }); return step; }
public async void ExpandAll() { WebBrowser browser = new WebBrowser(WebDriver.Current); await xB.CurrentRun.AddScenario(this) .Given(HtmlReport.OfAPassingFullTestRun()) .And(WebUser.ViewsReport(browser)) .WhenAsync("the user clicks the expand all areas menu option", async (s) => { await browser.ClickWhenVisible(Pages.HtmlReportPage.Menu.MenuButton); await browser.ClickWhenVisible(Pages.HtmlReportPage.Menu.ExpandAllAreasButton); }) .ThenAsync("the report should expand the features listed under the area", async (s) => { await browser.WaitTillVisible(Pages.HtmlReportPage.Area.Features(1)); await browser.WaitTillVisible(Pages.HtmlReportPage.Area.Features(2)); s.Output = browser.GetPageSource(); s.OutputFormat = TextFormat.htmlpreview; }) .Run(); }