mirror of
https://github.com/Radarr/Radarr
synced 2024-12-27 18:30:45 +00:00
Take Screenshot on Automation tests for build status notifications
This commit is contained in:
parent
6b41ad7442
commit
603d26bb5f
3 changed files with 50 additions and 4 deletions
|
@ -711,6 +711,16 @@ stages:
|
||||||
chmod a+x ${TESTSFOLDER}/test.sh
|
chmod a+x ${TESTSFOLDER}/test.sh
|
||||||
${TESTSFOLDER}/test.sh ${OSNAME} Automation Test
|
${TESTSFOLDER}/test.sh ${OSNAME} Automation Test
|
||||||
displayName: Run Automation Tests
|
displayName: Run Automation Tests
|
||||||
|
- task: CopyFiles@2
|
||||||
|
displayName: 'Copy Screenshot to: $(Build.ArtifactStagingDirectory)'
|
||||||
|
inputs:
|
||||||
|
SourceFolder: '$(Build.SourcesDirectory)'
|
||||||
|
Contents: |
|
||||||
|
**/*_test_screenshot.png
|
||||||
|
TargetFolder: '$(Build.ArtifactStagingDirectory)/screenshots'
|
||||||
|
- publish: $(Build.ArtifactStagingDirectory)/screenshots
|
||||||
|
artifact: '$(osName)AutomationScreenshots'
|
||||||
|
displayName: Publish Screenshot Bundle
|
||||||
- task: PublishTestResults@2
|
- task: PublishTestResults@2
|
||||||
inputs:
|
inputs:
|
||||||
testResultsFormat: 'NUnit'
|
testResultsFormat: 'NUnit'
|
||||||
|
@ -859,8 +869,14 @@ stages:
|
||||||
- job:
|
- job:
|
||||||
displayName: Discord Notification
|
displayName: Discord Notification
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-18.04'
|
vmImage: 'windows-2019'
|
||||||
steps:
|
steps:
|
||||||
|
- task: DownloadPipelineArtifact@2
|
||||||
|
displayName: Download Screenshot Artifact
|
||||||
|
inputs:
|
||||||
|
buildType: 'current'
|
||||||
|
artifactName: 'WindowsAutomationScreenshots'
|
||||||
|
targetPath: $(Build.SourcesDirectory)
|
||||||
- checkout: none
|
- checkout: none
|
||||||
- powershell: |
|
- powershell: |
|
||||||
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Servarr/AzureDiscordNotify/master/DiscordNotify.ps1'))
|
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/Servarr/AzureDiscordNotify/master/DiscordNotify.ps1'))
|
||||||
|
|
|
@ -42,6 +42,8 @@ public void SmokeTestSetup()
|
||||||
// Timeout as windows automation tests seem to take alot longer to get going
|
// Timeout as windows automation tests seem to take alot longer to get going
|
||||||
driver = new ChromeDriver(service, options, new TimeSpan(0, 3, 0));
|
driver = new ChromeDriver(service, options, new TimeSpan(0, 3, 0));
|
||||||
|
|
||||||
|
driver.Manage().Window.Size = new System.Drawing.Size(1920, 1080);
|
||||||
|
|
||||||
_runner = new NzbDroneRunner(LogManager.GetCurrentClassLogger());
|
_runner = new NzbDroneRunner(LogManager.GetCurrentClassLogger());
|
||||||
_runner.KillAll();
|
_runner.KillAll();
|
||||||
_runner.Start();
|
_runner.Start();
|
||||||
|
@ -62,6 +64,19 @@ protected IEnumerable<string> GetPageErrors()
|
||||||
.Select(e => e.Text);
|
.Select(e => e.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void TakeScreenshot(string name)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Screenshot image = ((ITakesScreenshot)driver).GetScreenshot();
|
||||||
|
image.SaveAsFile($"./{name}_test_screenshot.png", ScreenshotImageFormat.Png);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Failed to save screenshot {name}, {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[OneTimeTearDown]
|
[OneTimeTearDown]
|
||||||
public void SmokeTestTearDown()
|
public void SmokeTestTearDown()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using FluentAssertions;
|
using System.Reflection;
|
||||||
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Automation.Test.PageModel;
|
using NzbDrone.Automation.Test.PageModel;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
|
@ -21,6 +22,10 @@ public void movie_page()
|
||||||
{
|
{
|
||||||
_page.MovieNavIcon.Click();
|
_page.MovieNavIcon.Click();
|
||||||
_page.WaitForNoSpinner();
|
_page.WaitForNoSpinner();
|
||||||
|
|
||||||
|
var imageName = MethodBase.GetCurrentMethod().Name;
|
||||||
|
TakeScreenshot(imageName);
|
||||||
|
|
||||||
_page.Find(By.CssSelector("div[class*='MovieIndex']")).Should().NotBeNull();
|
_page.Find(By.CssSelector("div[class*='MovieIndex']")).Should().NotBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +35,9 @@ public void calendar_page()
|
||||||
_page.CalendarNavIcon.Click();
|
_page.CalendarNavIcon.Click();
|
||||||
_page.WaitForNoSpinner();
|
_page.WaitForNoSpinner();
|
||||||
|
|
||||||
|
var imageName = MethodBase.GetCurrentMethod().Name;
|
||||||
|
TakeScreenshot(imageName);
|
||||||
|
|
||||||
_page.Find(By.CssSelector("div[class*='CalendarPage']")).Should().NotBeNull();
|
_page.Find(By.CssSelector("div[class*='CalendarPage']")).Should().NotBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +47,9 @@ public void activity_page()
|
||||||
_page.ActivityNavIcon.Click();
|
_page.ActivityNavIcon.Click();
|
||||||
_page.WaitForNoSpinner();
|
_page.WaitForNoSpinner();
|
||||||
|
|
||||||
|
var imageName = MethodBase.GetCurrentMethod().Name;
|
||||||
|
TakeScreenshot(imageName);
|
||||||
|
|
||||||
_page.Find(By.LinkText("Queue")).Should().NotBeNull();
|
_page.Find(By.LinkText("Queue")).Should().NotBeNull();
|
||||||
_page.Find(By.LinkText("History")).Should().NotBeNull();
|
_page.Find(By.LinkText("History")).Should().NotBeNull();
|
||||||
_page.Find(By.LinkText("Blacklist")).Should().NotBeNull();
|
_page.Find(By.LinkText("Blacklist")).Should().NotBeNull();
|
||||||
|
@ -50,6 +61,9 @@ public void system_page()
|
||||||
_page.SystemNavIcon.Click();
|
_page.SystemNavIcon.Click();
|
||||||
_page.WaitForNoSpinner();
|
_page.WaitForNoSpinner();
|
||||||
|
|
||||||
|
var imageName = MethodBase.GetCurrentMethod().Name;
|
||||||
|
TakeScreenshot(imageName);
|
||||||
|
|
||||||
_page.Find(By.CssSelector("div[class*='Health']")).Should().NotBeNull();
|
_page.Find(By.CssSelector("div[class*='Health']")).Should().NotBeNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,11 +72,12 @@ public void add_movie_page()
|
||||||
{
|
{
|
||||||
_page.MovieNavIcon.Click();
|
_page.MovieNavIcon.Click();
|
||||||
_page.WaitForNoSpinner();
|
_page.WaitForNoSpinner();
|
||||||
|
|
||||||
_page.Find(By.LinkText("Add New")).Click();
|
_page.Find(By.LinkText("Add New")).Click();
|
||||||
|
|
||||||
_page.WaitForNoSpinner();
|
_page.WaitForNoSpinner();
|
||||||
|
|
||||||
|
var imageName = MethodBase.GetCurrentMethod().Name;
|
||||||
|
TakeScreenshot(imageName);
|
||||||
|
|
||||||
_page.Find(By.CssSelector("input[class*='AddNewMovie-searchInput']")).Should().NotBeNull();
|
_page.Find(By.CssSelector("input[class*='AddNewMovie-searchInput']")).Should().NotBeNull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue