From 6e47efad7fa29c04f91561e2cc34d479befe6e2c Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 11 Aug 2019 23:22:19 -0400 Subject: [PATCH] fix automation tests for new ui --- azure-pipelines.yml | 18 +++++++++++++-- .../AutomationTest.cs | 2 +- src/NzbDrone.Automation.Test/MainPagesTest.cs | 23 +++++++++++-------- .../NzbDrone.Automation.Test.csproj | 8 ++++++- .../PageModel/PageBase.cs | 16 ++++++------- 5 files changed, 45 insertions(+), 22 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 22243e55f..20ca25182 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -67,7 +67,7 @@ stages: - publish: $(outputFolder) artifact: '$(osName)Backend' condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - publish: $(Pipeline.Workspace) + - publish: $(Build.SourcesDirectory) artifact: 'CoverageBuild' condition: and(succeeded(), eq(variables['osName'], 'Windows')) - publish: $(testsFolder) @@ -354,6 +354,20 @@ stages: buildType: 'current' artifactName: Tests targetPath: $(testsFolder) + - task: DownloadPipelineArtifact@2 + displayName: Download Build Artifact + inputs: + buildType: 'current' + artifactName: Packages + itemPattern: '**\Lidarr.**.windows.zip' + targetPath: $(Build.ArtifactStagingDirectory) + - task: ExtractFiles@1 + inputs: + archiveFilePatterns: '$(Build.ArtifactStagingDirectory)/**/Lidarr.**.windows.zip' + destinationFolder: '$(Build.ArtifactStagingDirectory)/bin' + - bash: | + mkdir -p ./bin/ + cp -r -v ${BUILD_ARTIFACTSTAGINGDIRECTORY}/bin/Lidarr/. ./bin/ - task: Bash@3 displayName: Windows Automation Tests inputs: @@ -406,7 +420,7 @@ stages: inputs: buildType: 'current' artifactName: CoverageBuild - targetPath: $(Pipeline.Workspace) + targetPath: $(Build.SourcesDirectory) - bash: | ls -R ./ #- publish: $(testsFolder) diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs index 2a855b06c..a048668cd 100644 --- a/src/NzbDrone.Automation.Test/AutomationTest.cs +++ b/src/NzbDrone.Automation.Test/AutomationTest.cs @@ -45,7 +45,7 @@ namespace NzbDrone.Automation.Test var page = new PageBase(driver); page.WaitForNoSpinner(); - driver.ExecuteScript("window.NzbDrone.NameViews = true;"); + driver.ExecuteScript("window.Lidarr.NameViews = true;"); GetPageErrors().Should().BeEmpty(); } diff --git a/src/NzbDrone.Automation.Test/MainPagesTest.cs b/src/NzbDrone.Automation.Test/MainPagesTest.cs index 76e68e296..005d55cec 100644 --- a/src/NzbDrone.Automation.Test/MainPagesTest.cs +++ b/src/NzbDrone.Automation.Test/MainPagesTest.cs @@ -1,4 +1,4 @@ -using FluentAssertions; +using FluentAssertions; using NUnit.Framework; using NzbDrone.Automation.Test.PageModel; using OpenQA.Selenium; @@ -21,7 +21,7 @@ namespace NzbDrone.Automation.Test { page.ArtistNavIcon.Click(); page.WaitForNoSpinner(); - page.FindByClass("iv-artist-index-artistindexlayout").Should().NotBeNull(); + page.Find(By.CssSelector("div[class*='ArtistIndex']")).Should().NotBeNull(); } [Test] @@ -30,7 +30,7 @@ namespace NzbDrone.Automation.Test page.CalendarNavIcon.Click(); page.WaitForNoSpinner(); - page.FindByClass("iv-calendar-calendarlayout").Should().NotBeNull(); + page.Find(By.CssSelector("div[class*='CalendarPage']")).Should().NotBeNull(); } [Test] @@ -39,7 +39,9 @@ namespace NzbDrone.Automation.Test page.ActivityNavIcon.Click(); page.WaitForNoSpinner(); - page.FindByClass("iv-activity-activitylayout").Should().NotBeNull(); + page.Find(By.LinkText("Queue")).Should().NotBeNull(); + page.Find(By.LinkText("History")).Should().NotBeNull(); + page.Find(By.LinkText("Blacklist")).Should().NotBeNull(); } [Test] @@ -48,7 +50,8 @@ namespace NzbDrone.Automation.Test page.WantedNavIcon.Click(); page.WaitForNoSpinner(); - page.FindByClass("iv-wanted-missing-missinglayout").Should().NotBeNull(); + page.Find(By.LinkText("Missing")).Should().NotBeNull(); + page.Find(By.LinkText("Cutoff Unmet")).Should().NotBeNull(); } [Test] @@ -57,20 +60,20 @@ namespace NzbDrone.Automation.Test page.SystemNavIcon.Click(); page.WaitForNoSpinner(); - page.FindByClass("iv-system-systemlayout").Should().NotBeNull(); + page.Find(By.CssSelector("div[class*='Health']")).Should().NotBeNull(); } [Test] - public void add_series_page() + public void add_artist_page() { page.ArtistNavIcon.Click(); page.WaitForNoSpinner(); - page.Find(By.LinkText("Add Artist")).Click(); + page.Find(By.LinkText("Add New")).Click(); page.WaitForNoSpinner(); - page.FindByClass("iv-addartist-addartistlayout").Should().NotBeNull(); + page.Find(By.CssSelector("input[class*='AddNewArtist-searchInput']")).Should().NotBeNull(); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj b/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj index fc9ffb6e5..50bf57b92 100644 --- a/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj +++ b/src/NzbDrone.Automation.Test/NzbDrone.Automation.Test.csproj @@ -85,8 +85,14 @@ 3.11.0 + + 0.24.0 + - 3.2.0 + 3.141.0 + + + 3.141.0 diff --git a/src/NzbDrone.Automation.Test/PageModel/PageBase.cs b/src/NzbDrone.Automation.Test/PageModel/PageBase.cs index 16bacc540..720eafd8c 100644 --- a/src/NzbDrone.Automation.Test/PageModel/PageBase.cs +++ b/src/NzbDrone.Automation.Test/PageModel/PageBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using OpenQA.Selenium; using OpenQA.Selenium.Remote; @@ -47,16 +47,16 @@ namespace NzbDrone.Automation.Test.PageModel }); } - public IWebElement ArtistNavIcon => FindByClass("x-artist-nav"); + public IWebElement ArtistNavIcon => Find(By.LinkText("Artist")); - public IWebElement CalendarNavIcon => FindByClass("x-calendar-nav"); + public IWebElement CalendarNavIcon => Find(By.LinkText("Calendar")); - public IWebElement ActivityNavIcon => FindByClass("x-activity-nav"); + public IWebElement ActivityNavIcon => Find(By.LinkText("Activity")); - public IWebElement WantedNavIcon => FindByClass("x-wanted-nav"); + public IWebElement WantedNavIcon => Find(By.LinkText("Wanted")); - public IWebElement SettingNavIcon => FindByClass("x-settings-nav"); + public IWebElement SettingNavIcon => Find(By.LinkText("Settings")); - public IWebElement SystemNavIcon => FindByClass("x-system-nav"); + public IWebElement SystemNavIcon => Find(By.PartialLinkText("System")); } -} \ No newline at end of file +}