Skip to content

Commit

Permalink
Update installer for Inno 6.4 and save screenshot on test error
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0thyj committed Jan 14, 2025
1 parent 7e18ee0 commit 5d7bc31
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,6 @@ jobs:
if: ${{ failure() }}
with:
name: test-dir
path: test\bin
path: |
test\bin
!test\bin\*.exe
3 changes: 3 additions & 0 deletions scripts/installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
UninstallDisplayIcon={app}\{#MyAppExeName}
ChangesAssociations=yes
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
Expand Down Expand Up @@ -63,6 +64,8 @@ Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "swedish"; MessagesFile: "compiler:Languages\Swedish.isl"
Name: "tamil"; MessagesFile: "compiler:Languages\Tamil.isl"
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"

Expand Down
52 changes: 32 additions & 20 deletions test/SystemTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,42 @@ public SystemTests()
[Fact, Trait("type", "system")]
public void ShouldUpdateWallpaper()
{
driver.FindElementByXPath("//Window[@Name='Select Language']").Click();
driver.FindElementByXPath("//Button[@Name='OK']").Click();
Thread.Sleep(TimeSpan.FromSeconds(5));
try
{
driver.FindElementByXPath("//Window[@Name='Select Language']").Click();
driver.FindElementByXPath("//Button[@Name='OK']").Click();
Thread.Sleep(TimeSpan.FromSeconds(5));

if (HandleLocationPrompt()) Thread.Sleep(TimeSpan.FromSeconds(2));
driver.SwitchTo().Window(driver.WindowHandles[0]);
driver.FindElementByXPath("//Window[@Name='Configure Schedule']").Click();
driver.FindElementByAccessibilityId("radioButton1").Click();
driver.FindElementByAccessibilityId("locationBox").SendKeys("New York NY");
driver.FindElementByXPath("//Button[@Name='OK']").Click();
Thread.Sleep(TimeSpan.FromSeconds(2));
driver.FindElementByXPath("//Button[@Name='Yes']").Click();
Thread.Sleep(TimeSpan.FromSeconds(5));
if (HandleLocationPrompt()) Thread.Sleep(TimeSpan.FromSeconds(2));
driver.SwitchTo().Window(driver.WindowHandles[0]);
driver.FindElementByXPath("//Window[@Name='Configure Schedule']").Click();
driver.FindElementByAccessibilityId("radioButton1").Click();
driver.FindElementByAccessibilityId("locationBox").SendKeys("New York NY");
driver.FindElementByXPath("//Button[@Name='OK']").Click();
Thread.Sleep(TimeSpan.FromSeconds(2));
driver.FindElementByXPath("//Button[@Name='Yes']").Click();
Thread.Sleep(TimeSpan.FromSeconds(5));

driver.SwitchTo().Window(driver.WindowHandles[0]);
driver.FindElementByXPath("//Window[@Name='Select Theme']").Click();
driver.FindElementByAccessibilityId("listView1").SendKeys(Keys.Control + Keys.End);
driver.FindElementByXPath("//ListItem[@Name='Windows 11']").Click();
driver.FindElementByXPath("//Button[@Name='Apply']").Click();
Thread.Sleep(TimeSpan.FromSeconds(2));
driver.SwitchTo().Window(driver.WindowHandles[0]);
driver.FindElementByXPath("//Window[@Name='Select Theme']").Click();
driver.FindElementByAccessibilityId("listView1").SendKeys(Keys.Control + Keys.End);
driver.FindElementByXPath("//ListItem[@Name='Windows 11']").Click();
driver.FindElementByXPath("//Button[@Name='Apply']").Click();
Thread.Sleep(TimeSpan.FromSeconds(2));

Assert.Contains(["scripts", "settings.json", "themes"],
Assert.Contains(["scripts", "settings.json", "themes"],
Directory.GetFileSystemEntries(Path.GetDirectoryName(AppPath)).Select(Path.GetFileName).ToArray());
Assert.StartsWith(Path.Combine(Path.GetDirectoryName(AppPath), "themes", "Windows_11", "img"), GetWallpaperPath());
Assert.StartsWith(Path.Combine(Path.GetDirectoryName(AppPath), "themes", "Windows_11", "img"), GetWallpaperPath());
}
catch (WebDriverException)
{
try
{
driver.GetScreenshot().SaveAsFile(Path.Combine(Path.GetDirectoryName(AppPath), "screenshot.png"));
}
catch { /* Do nothing */ }
throw;
}
}

public void Dispose()
Expand Down

0 comments on commit 5d7bc31

Please sign in to comment.