public void ReportTest(ScenarioContext scenarioContext) { CommonMethod.test = CommonMethod.extent.CreateTest(scenarioContext.StepContext.StepInfo.Text); String img = SaveScreenShot.SaveScreenshot(driver, "Report"); if (scenarioContext.TestError != null) { CommonMethod.test.Fail(scenarioContext.TestError.Message) .Log(Status.Error, scenarioContext.TestError.Message + ": Image example: " + img); } else { CommonMethod.test.Log(Status.Pass, scenarioContext.StepContext.StepInfo.Text + ": Image example: " + img); } }
public static void create(Form1 frm, List <UserControl> userControls, List <DrawLine> drawedLines) { Bitmap Image = new Bitmap(frm.Width, frm.Height); frm.DrawToBitmap(Image, new Rectangle(0, 0, frm.Width, frm.Height)); SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = IMAGE_FORMATS; if (saveFileDialog.ShowDialog() == DialogResult.Cancel) { return; } string ImagePath = string.Format(saveFileDialog.FileName, DateTime.Now.Ticks); Image.Save(ImagePath, System.Drawing.Imaging.ImageFormat.Png); ISave save = new SaveScreenShot(); save.execute(ImagePath, userControls, drawedLines); }
public string IsLogin() { Thread.Sleep(3000); string logo = driver.FindElement(By.XPath("//a[contains(.,'Mars Logo')]")).Text; String img = SaveScreenShot.SaveScreenshot(driver, "Report");//AddScreenCapture(@""); if (logo == "Mars Logo") { CommonMethod.test.Log(Status.Pass, "Login Success: " + img); Console.WriteLine("Pass"); return("Pass"); } else { CommonMethod.test.Log(Status.Fail, "Something went Wrong: " + img); Console.WriteLine("Fail"); return("Fail"); } }