Skip to content

Commit

Permalink
Update appium tests for new device selection window
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanfish committed Aug 11, 2024
1 parent 430f12c commit cbebedf
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions NAPS2.App.Tests/Appium/ScanAndSaveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ public void ScanWiaSavePdf(IAppTestTarget target)
Init(target);
// Clicking Scan without a profile opens the profile settings window
ClickAtName("Scan");
// WIA driver is selected by default, so we open the WIA device dialog
ClickAtName("Choose device");
Thread.Sleep(100);
WaitFor(() => HasElementWithName("Always Ask"));
var deviceName = AppTestHelper.GetDeviceName(Driver.Wia);
// WIA driver is selected by default, so we just click the device
if (!string.IsNullOrEmpty(deviceName)) ClickAtName(deviceName);
// Click OK in the wia device dialog (selecting the first available device by default)
// TODO: More consistent way to pick the right OK button
ClickAt(_session.FindElementsByName("OK")[0]);
WaitFor(() => !HasElementWithName("Properties"));
ClickAt(_session.FindElementByName("Select"));
WaitFor(() => !HasElementWithName("Select"));
// Click OK in the profile settings window
ClickAtName("OK");
WaitFor(() => HasElementWithName("Cancel"));
Expand Down Expand Up @@ -54,13 +52,13 @@ public void ScanTwainSaveImage(IAppTestTarget target)
Init(target);
// Clicking Scan without a profile opens the profile settings window
ClickAtName("Scan");
ClickAtName("TWAIN Driver");
// Open the TWAIN device dialog
ClickAtName("Choose device");
Thread.Sleep(100);
WaitFor(() => HasElementWithName("Always Ask"));
var deviceName = AppTestHelper.GetDeviceName(Driver.Twain);
ClickAtName("TWAIN Driver");
Thread.Sleep(100);
WaitFor(() => HasElementWithName("Always Ask"));
if (!string.IsNullOrEmpty(deviceName)) ClickAtName(deviceName);
// Click Select in the twain device dialog (selecting the first available device by default)
ClickAtName("Select");
WaitFor(() => !HasElementWithName("Select"));
// Click OK in the profile settings window
Expand Down

0 comments on commit cbebedf

Please sign in to comment.