This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node { | |
stage 'Checkout' | |
checkout scm | |
stage 'Build' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string VideoInHtml(string sessionId) | |
{ | |
//Place where you put url address to Selenoid | |
var html = $"<html><body><video width=\'100%\' height=\'100%\' controls autoplay><source src=\'http://addressToYourSelenoid:4444/video/{sessionId}.mp4' type=\'video/mp4\'></video></body></html>"; | |
return html; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void SaveScreenshot(string title, string step) | |
{ | |
try | |
{ | |
var path = $"{TestConfiguration.DirectoryPath}\\{title}{DateTime.Now:HH}"; | |
Directory.CreateDirectory(path); | |
var pathToFile = $"{path}\\{CleanFileName(DateTime.UtcNow.ToLongTimeString())}.png"; | |
if (scenarioContext.TestError != null) | |
{ | |
var errorPath = $"{path}\\errors\\"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AfterStep] | |
public void AfterStep() | |
{ | |
if (scenarioContext.TestError != null) | |
allureReport.SaveScreenshot(Guid.NewGuid().ToString(),scenarioContext.StepContext.StepInfo.Text); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AfterScenario] | |
public void AfterScenario() | |
{ | |
var driver = container.Resolve<IWebDriver>() as RemoteWebDriver; | |
if (scenarioContext.TestError!=null) | |
allureReport.AddVideoToScenario(scenarioContext.ScenarioInfo.Title, driver.SessionId.ToString()); | |
driver.Quit(); | |
container.Dispose(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Shouldly; | |
using TestContentFromPdf.Extension; | |
using TestContentFromPdf.Pages; | |
using Xunit; | |
namespace TestContentFromPdf.Tests | |
{ | |
public class TestContentFromPdf : BaseTest | |
{ | |
[Fact] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using OpenQA.Selenium; | |
namespace TestContentFromPdf.Pages | |
{ | |
public class HomePage | |
{ | |
public By FirstAvailableLinkToDocument => By.CssSelector("td a:nth-child(4)"); | |
private IWebDriver driver; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using System.Text; | |
using iTextSharp.text.pdf; | |
using iTextSharp.text.pdf.parser; | |
using OpenQA.Selenium; | |
namespace TestContentFromPdf.Extension | |
{ | |
public static class SeleniumExtension | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using OpenQA.Selenium; | |
using OpenQA.Selenium.Chrome; | |
namespace TestContentFromPdf.Extension | |
{ | |
public class BaseTest : IDisposable | |
{ | |
protected IWebDriver driver; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace TestContentFromPdf.Extension | |
{ | |
public class TestSettings | |
{ | |
public static string PathToDownloads => $"{Environment.CurrentDirectory}/Downloads"; | |
} | |
} |
OlderNewer