2022-12-19 02:54:34 +03:00
|
|
|
using NAPS2.App.Tests.Targets;
|
|
|
|
using NAPS2.Remoting;
|
|
|
|
using NAPS2.Sdk.Tests;
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
namespace NAPS2.App.Tests;
|
|
|
|
|
|
|
|
public class GuiAppTests : ContextualTests
|
|
|
|
{
|
2022-12-26 00:15:31 +03:00
|
|
|
[GuiTheory]
|
2022-12-19 02:54:34 +03:00
|
|
|
[ClassData(typeof(AppTestData))]
|
|
|
|
public void CreatesWindow(IAppTestTarget target)
|
|
|
|
{
|
|
|
|
var process = AppTestHelper.StartGuiProcess(target.Gui, FolderPath);
|
|
|
|
try
|
|
|
|
{
|
2024-04-01 20:40:19 +03:00
|
|
|
if (target.IsWindows)
|
2022-12-19 02:54:34 +03:00
|
|
|
{
|
|
|
|
AppTestHelper.WaitForVisibleWindow(process);
|
|
|
|
Assert.Equal("NAPS2 - Not Another PDF Scanner", process.MainWindowTitle);
|
|
|
|
Assert.True(process.CloseMainWindow());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2024-03-30 23:00:25 +03:00
|
|
|
var helper = ProcessCoordinator.CreateDefault();
|
|
|
|
Assert.True(helper.CloseWindow(process, 1000));
|
2022-12-19 02:54:34 +03:00
|
|
|
}
|
|
|
|
Assert.True(process.WaitForExit(5000));
|
|
|
|
AppTestHelper.AssertNoErrorLog(FolderPath);
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
AppTestHelper.Cleanup(process);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|