E2ETests: Use ElwigTestDB.sqlite3 instead of default
All checks were successful
Test / Run tests (push) Successful in 2m38s
All checks were successful
Test / Run tests (push) Successful in 2m38s
This commit is contained in:
@ -9,10 +9,12 @@ namespace Tests.E2ETests {
|
||||
public readonly WindowsDriver<WindowsElement> App;
|
||||
public readonly WindowsDriver<WindowsElement> Desktop;
|
||||
|
||||
public AppSession(string appPath, string winAppDriverUrl) {
|
||||
public AppSession(string appPath, string? appArgs, string winAppDriverUrl) {
|
||||
WinAppDriverUrl = winAppDriverUrl;
|
||||
var appiumOptions = new AppiumOptions();
|
||||
appiumOptions.AddAdditionalCapability("app", appPath);
|
||||
if (appArgs != null)
|
||||
appiumOptions.AddAdditionalCapability("appArguments", appArgs);
|
||||
appiumOptions.AddAdditionalCapability("deviceName", "WindowsPC");
|
||||
appiumOptions.AddAdditionalCapability("ms:waitForAppLaunch", WaitForAppLaunch);
|
||||
App = new WindowsDriver<WindowsElement>(new Uri(WinAppDriverUrl), appiumOptions);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void Setup() {
|
||||
Session = new(Utils.ApplicationPath, WinAppDriver.WinAppDriverUrl);
|
||||
Session = new(Utils.ApplicationPath, Utils.ConfigPath, WinAppDriver.WinAppDriverUrl);
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
|
@ -9,7 +9,7 @@ namespace Tests.E2ETests {
|
||||
|
||||
[OneTimeSetUp]
|
||||
public void WindowSetup() {
|
||||
Session = new(Utils.ApplicationPath, WinAppDriver.WinAppDriverUrl);
|
||||
Session = new(Utils.ApplicationPath, Utils.ConfigPath, WinAppDriver.WinAppDriverUrl);
|
||||
Session.App.FindElementByName("Mitglieder").Click();
|
||||
Thread.Sleep(1000);
|
||||
Window = Session.CreateWindowDriver("MemberAdminWindow");
|
||||
@ -33,10 +33,10 @@ namespace Tests.E2ETests {
|
||||
Window!.FindById("NewMemberButton").Click();
|
||||
|
||||
Window.FindById("MgNrInput").Clear();
|
||||
Window.FindById("MgNrInput").SendKeys("10003");
|
||||
Window.FindById("MgNrInput").SendKeys("9999");
|
||||
|
||||
Window.FindById("GivenNameInput").SendKeys("Max");
|
||||
Window.FindById("FamilyNameInput").SendKeys("Mustermann");
|
||||
Window.FindById("GivenNameInput").SendKeys("Norbert");
|
||||
Window.FindById("FamilyNameInput").SendKeys("Neuling");
|
||||
Window.FindById("PrefixInput").SendKeys("Ing.");
|
||||
Window.FindById("SuffixInput").SendKeys("jun.");
|
||||
Window.FindById("BirthdayInput").SendKeys("1987");
|
||||
@ -45,8 +45,8 @@ namespace Tests.E2ETests {
|
||||
Window.FindById("PlzInput").SendKeys("2120");
|
||||
Window.SelectComboBoxItemByCount("OrtInput", 1);
|
||||
|
||||
Window.FindById("EmailAddress1Input").SendKeys("max.mustermann@aon.at");
|
||||
Window.FindById("EmailAddress2Input").SendKeys("erika.mustermann@aon.at");
|
||||
Window.FindById("EmailAddress1Input").SendKeys("norbert.neuling@aon.at");
|
||||
Window.FindById("EmailAddress2Input").SendKeys("nathalie.neuling@aon.at");
|
||||
|
||||
Window.SelectComboBoxItemByCount("PhoneNr1TypeInput", 1);
|
||||
Window.FindById("PhoneNr1Input").SendKeys("012345678");
|
||||
@ -57,13 +57,13 @@ namespace Tests.E2ETests {
|
||||
Window.FindById("IbanInput").SendKeys("AT611904300234573201");
|
||||
Window.FindById("BicInput").SendKeys("RLNWATWWWDF");
|
||||
|
||||
Window.FindById("UstIdNrInput").SendKeys("ATU66192906"); //TODO: Testdaten?
|
||||
Window.FindById("LfbisNrInput").SendKeys("1251074"); //TODO: Testdaten?
|
||||
Window.FindById("UstIdNrInput").SendKeys("ATU66192906"); // TODO: Testdaten?
|
||||
Window.FindById("LfbisNrInput").SendKeys("1251074"); // TODO: Testdaten?
|
||||
|
||||
Window.FindById("BuchführendInput").Click();
|
||||
Window.FindById("OrganicInput").Click();
|
||||
|
||||
Window.FindById("BillingNameInput").SendKeys("Mustermann KG");
|
||||
Window.FindById("BillingNameInput").SendKeys("Neuling KG");
|
||||
Window.FindById("BillingAddressInput").SendKeys("Betriebsstraße 1");
|
||||
Window.FindById("BillingPlzInput").SendKeys("2120");
|
||||
Window.SelectComboBoxItemByCount("BillingOrtInput", 2);
|
||||
@ -80,20 +80,20 @@ namespace Tests.E2ETests {
|
||||
|
||||
Window.FindById("SaveButton").Click();
|
||||
|
||||
Window.FindById("SearchInput").SendKeys("10003 Max Mustermann");
|
||||
Window.FindById("SearchInput").SendKeys("9999");
|
||||
Thread.Sleep(500);
|
||||
var memberListRow = Window.FindById("MemberList").FindElementByClassName("DataGridRow");
|
||||
Assert.Multiple(() => {
|
||||
Assert.That(memberListRow, Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("10003 "), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("Max"), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("Mustermann"), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("9999 "), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("Norbert"), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("Neuling"), Is.Not.Null);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_2_EditMember() {
|
||||
Window!.FindById("SearchInput").SendKeys("10003 Max Mustermann");
|
||||
Window!.FindById("SearchInput").SendKeys("9999");
|
||||
Thread.Sleep(500);
|
||||
var memberList = Window.FindById("MemberList");
|
||||
Assert.That(memberList, Is.Not.Null);
|
||||
@ -118,7 +118,7 @@ namespace Tests.E2ETests {
|
||||
|
||||
[Test]
|
||||
public void Test_3_DeleteMember() {
|
||||
Window!.FindById("SearchInput").SendKeys("10003 Max Mustermann");
|
||||
Window!.FindById("SearchInput").SendKeys("9999");
|
||||
Thread.Sleep(500);
|
||||
var memberList = Window.FindById("MemberList");
|
||||
Assert.That(memberList, Is.Not.Null);
|
||||
@ -129,14 +129,14 @@ namespace Tests.E2ETests {
|
||||
var memberListRow = memberListRows.First();
|
||||
Assert.Multiple(() => {
|
||||
Assert.That(memberListRow, Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("10003 "), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("Max"), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("Mustermann"), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("9999 "), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("Norbert"), Is.Not.Null);
|
||||
Assert.That(memberListRow.FindElementByName("Neuling"), Is.Not.Null);
|
||||
});
|
||||
|
||||
Window.FindById("DeleteMemberButton").Click();
|
||||
var dialog = Session.CreateWindowDriver("DeleteMemberDialog");
|
||||
dialog.FindById("NameInput").SendKeys("10003 Ing. Max Mustermann jun.");
|
||||
dialog.FindById("NameInput").SendKeys("9999 Ing. Norbert Neuling jun.");
|
||||
dialog.FindById("ConfirmButton").Click();
|
||||
|
||||
memberListRows = memberList.FindElementsByClassName("DataGridRow");
|
||||
|
@ -1,4 +1,7 @@
|
||||
namespace Tests.E2ETests {
|
||||
using Elwig.Helpers;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Tests.E2ETests {
|
||||
[SetUpFixture]
|
||||
public static class Setup {
|
||||
|
||||
@ -9,9 +12,25 @@
|
||||
Driver = new();
|
||||
}
|
||||
|
||||
[OneTimeSetUp]
|
||||
public static async Task SetupDatabase() {
|
||||
if (File.Exists(Utils.TestDatabasePath)) File.Delete(Utils.TestDatabasePath);
|
||||
using var cnx = await AppDbContext.ConnectAsync($"Data Source=\"{Utils.TestDatabasePath}\"; Mode=ReadWriteCreate; Foreign Keys=True; Cache=Default");
|
||||
await AppDbContext.ExecuteEmbeddedScript(cnx, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.Create.sql");
|
||||
await AppDbContext.ExecuteEmbeddedScript(cnx, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.Insert.sql");
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public static void TeardownWinAppDriver() {
|
||||
Driver?.Dispose();
|
||||
}
|
||||
|
||||
[OneTimeTearDown]
|
||||
public static void TeardownDatabase() {
|
||||
try {
|
||||
// FIXME not working - other process using file
|
||||
File.Delete(Utils.TestDatabasePath);
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,9 @@ using OpenQA.Selenium.Appium.Windows;
|
||||
namespace Tests.E2ETests {
|
||||
public static class Utils {
|
||||
|
||||
public const string ApplicationPath = @"..\..\..\..\Elwig\bin\Debug\net8.0-windows\Elwig.exe";
|
||||
public static readonly string ApplicationPath = Path.GetFullPath(@"..\..\..\..\Elwig\bin\Debug\net8.0-windows\Elwig.exe");
|
||||
public static readonly string ConfigPath = Path.GetFullPath(@"..\..\..\..\Tests\config.test.ini");
|
||||
public static readonly string TestDatabasePath = Path.GetFullPath(@"..\..\..\..\Tests\ElwigTestDB.sqlite3");
|
||||
|
||||
public static WindowsElement FindById(this WindowsDriver<WindowsElement> session, string accessibilityId) {
|
||||
return session.FindElementByAccessibilityId(accessibilityId);
|
||||
|
7
Tests/config.test.ini
Normal file
7
Tests/config.test.ini
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
[general]
|
||||
debug = true
|
||||
|
||||
[database]
|
||||
file = ElwigTestDB.sqlite3
|
||||
|
Reference in New Issue
Block a user