Compare commits

...

10 Commits

Author SHA1 Message Date
9a2fa3ee3d Bump version to 0.8.9
All checks were successful
Deploy / Build and Deploy (push) Successful in 2m37s
2024-07-23 20:22:52 +02:00
ba9e1d7201 Export/Ods: Escape strings in XML 2024-07-23 20:13:04 +02:00
49f03c0a3c CheckComboBox: Fix SelectedItems property
All checks were successful
Test / Run tests (push) Successful in 2m12s
2024-07-23 11:08:42 +02:00
37adf92e80 Bump version to 0.8.8
All checks were successful
Test / Run tests (push) Successful in 2m37s
Deploy / Build and Deploy (push) Successful in 2m33s
2024-07-22 09:48:53 +02:00
4c75dbe4aa GassnerScale: Hot fix record parsing 2024-07-22 09:48:18 +02:00
5c31ad8851 Bump version to 0.8.7
All checks were successful
Deploy / Build and Deploy (push) Successful in 2m47s
2024-07-22 00:19:11 +02:00
3ac9536e76 App: Small changes in auto updater
All checks were successful
Test / Run tests (push) Successful in 2m41s
2024-07-21 15:52:57 +02:00
7246852181 E2ETests: Refactor to use .FindElement(By.Something())
All checks were successful
Test / Run tests (push) Successful in 2m12s
2024-07-19 14:34:12 +02:00
dd48a24c58 Setup: Update dependencies
All checks were successful
Test / Run tests (push) Successful in 2m30s
2024-07-19 13:43:48 +02:00
ffef1fd6e4 Elwig: Update dependencies 2024-07-19 13:43:40 +02:00
15 changed files with 186 additions and 118 deletions

View File

@@ -3,6 +3,53 @@ Changelog
=========
[v0.8.9][v0.8.9] (2024-07-23) {#v0.8.9}
---------------------------------------
### Behobene Fehler {#v0.8.8-bugfixes}
* Absturz im Rundschreiben-Fenster (`MailWindow`). Fehler bei `CheckComboBox`. (49f03c0a3c)
* Excel-Exporte können nun auch Sonderzeichen (wie `&`) enthalten. (ba9e1d7201)
[v0.8.9]: https://git.necronda.net/winzer/elwig/releases/tag/v0.8.9
[v0.8.8][v0.8.8] (2024-07-22) {#v0.8.8}
---------------------------------------
### Behobene Fehler {#v0.8.8-bugfixes}
* Schnittstelle für Gassner-Waagen nicht funktionsfähig. (4c75dbe4aa)
[v0.8.8]: https://git.necronda.net/winzer/elwig/releases/tag/v0.8.8
[v0.8.7][v0.8.7] (2024-07-22) {#v0.8.7}
---------------------------------------
### Neue Funktionen {#v0.8.7-features}
* Im Mitglieder-Fenster (`MemberAdminWindow`) muss eine E-Mail-Adresse angegeben werden, wenn E-Mail als Kontaktart angegeben wird. (5a36e84b1f)
### Sonstiges {#v0.8.7-misc}
* Automatisierte Ende-zu-Ende-Tests (`E2ETests`) hinzugefügt. (ddd821e478, 6b48a1090c, dd5049faae, 5b2f617a68, 7246852181)
* Automatisierte Tests überarbeitet. (44656e0022, 86937485e4, 34178105a7, ffe0ff5508, 01d658f51d)
* Update-Dialog (`UpdateDialog`) überarbeitet. (62f63ef63d, e9de54415a)
* Eingebefelder vom Typ _Mehrfachauswahl mit Dropdown_ (`CheckComboBox`) etwas verbessert. (26d75ea3cd, daf83c4bbc)
* Im Übernahme-Fenster (`DeliveryAdminWindow`) werden nur noch aktive Mitglieder angezeigt. (658a1f4dc1)
* Abhängigkeiten aktualisiert. (ffef1fd6e4, dd48a24c58)
* Auto-Update-Funktion überarbeitet. (3ac9536e76)
[v0.8.7]: https://git.necronda.net/winzer/elwig/releases/tag/v0.8.7
[v0.8.6][v0.8.6] (2024-07-01) {#v0.8.6}
---------------------------------------

View File

@@ -227,7 +227,7 @@ namespace Elwig {
}
}
public static async Task CheckForUpdates(bool showSuccess = false) {
public static async Task CheckForUpdates(bool showAlert = false) {
if (Config.UpdateUrl == null) return;
var latest = await Utils.GetLatestInstallerUrl(Config.UpdateUrl);
if (latest != null && new Version(latest.Value.Version) > new Version(Version)) {
@@ -238,9 +238,14 @@ namespace Elwig {
Current.Shutdown();
}
});
} else if (showSuccess) {
MessageBox.Show("Elwig ist auf dem aktuellsten Stand!", "Nach Updates suchen",
MessageBoxButton.OK, MessageBoxImage.Information);
} else if (showAlert) {
if (latest == null) {
MessageBox.Show("Informationen konnten nicht abgerufen werden!", "Nach Updates suchen",
MessageBoxButton.OK, MessageBoxImage.Error);
} else {
MessageBox.Show($"Elwig ist auf dem aktuellsten Stand! (Version: {latest.Value.Version})", "Nach Updates suchen",
MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}

View File

@@ -8,7 +8,7 @@ using System.Windows.Controls;
namespace Elwig.Controls {
public class CheckComboBox : ListBox {
public new static readonly DependencyProperty SelectedItemsProperty = DependencyProperty.Register(nameof(SelectedItems), typeof(IList), typeof(CheckComboBox), new FrameworkPropertyMetadata(new ObservableCollection<object>(), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnSelectedItemsChangedCallback));
public new static readonly DependencyProperty SelectedItemsProperty = DependencyProperty.Register(nameof(SelectedItems), typeof(IList), typeof(CheckComboBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnSelectedItemsChangedCallback));
public new IList SelectedItems {
get => (IList)GetValue(SelectedItemsProperty);
set => SetValue(SelectedItemsProperty, value);
@@ -72,6 +72,7 @@ namespace Elwig.Controls {
public CheckComboBox() {
SelectionMode = SelectionMode.Multiple;
SelectedItems = new ObservableCollection<object>();
}
public override void OnApplyTemplate() {

View File

@@ -7,7 +7,7 @@
<UseWPF>true</UseWPF>
<PreserveCompilationContext>true</PreserveCompilationContext>
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
<Version>0.8.6</Version>
<Version>0.8.9</Version>
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationManifest>app.manifest</ApplicationManifest>
@@ -25,16 +25,16 @@
</Target>
<ItemGroup>
<PackageReference Include="LinqKit" Version="1.2.5" />
<PackageReference Include="MailKit" Version="4.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.31" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
<PackageReference Include="LinqKit" Version="1.3.0" />
<PackageReference Include="MailKit" Version="4.7.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.32" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="8.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2535.41" />
<PackageReference Include="NJsonSchema" Version="11.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
<PackageReference Include="NJsonSchema" Version="11.0.2" />
<PackageReference Include="RazorLight" Version="2.3.1" />
<PackageReference Include="ScottPlot.WPF" Version="5.0.34" />
<PackageReference Include="ScottPlot.WPF" Version="5.0.36" />
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
</ItemGroup>

View File

@@ -6,6 +6,7 @@ using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Security;
using System.Threading.Tasks;
namespace Elwig.Helpers.Export {
@@ -312,7 +313,7 @@ namespace Elwig.Helpers.Export {
}
c = $"<{ct} office:value-type=\"float\" calcext:value-type=\"float\" office:value=\"{v.ToString(CultureInfo.InvariantCulture)}\"{add}><text:p>{data}</text:p></{ct}>";
} else {
c = $"<{ct} office:value-type=\"string\" calcext:value-type=\"string\"{add}><text:p>{data}</text:p></{ct}>";
c = $"<{ct} office:value-type=\"string\" calcext:value-type=\"string\"{add}><text:p>{SecurityElement.Escape(data.ToString())}</text:p></{ct}>";
}
return $" {c}\r\n" + (colSpan > 1 ? $" <table:covered-table-cell table:number-rows-repeated=\"{colSpan - 1}\"/>\r\n" : "");

View File

@@ -425,8 +425,11 @@ namespace Elwig.Helpers {
public static async Task<(string Version, string Url, long Size)?> GetLatestInstallerUrl(string url) {
try {
using var client = GetHttpClient(accept: "application/json");
var resJson = JsonNode.Parse(await client.GetStringAsync(url));
var data = resJson!["data"]![0]!;
using var res = await client.GetAsync(url);
if (!res.IsSuccessStatusCode)
return null;
var resJson = JsonNode.Parse(await res.Content.ReadAsStringAsync());
var data = resJson!["data"]!.AsArray()[^1]!;
return ((string)data["version"]!, (string)data["url"]!, (long)data["size"]!);
} catch {
return null;

View File

@@ -60,14 +60,13 @@ namespace Elwig.Helpers.Weighing {
throw new IOException("Invalid response from scale: Received record has invalid size");
var line = record[2..];
var status = line[ 0.. 2];
var brutto = line[ 2.. 9].Trim();
var tara = line[ 9..16].Trim();
var netto = line[16..23].Trim();
var scaleNr = line[23..25].Trim();
var identNr = line[25..31].Trim();
var date = line[31..39];
var time = line[39..45];
var brutto = line[ 0.. 7].Trim();
var tara = line[ 7..14].Trim();
var netto = line[14..21].Trim();
var scaleNr = line[21..23].Trim();
var identNr = line[23..29].Trim();
var date = line[29..37];
var time = line[37..43];
identNr = identNr.Length > 0 && identNr != "0" ? identNr : null;
var parsedDate = DateOnly.ParseExact(date, "yyyyMMdd");

View File

@@ -1,5 +1,6 @@
<local:ContextWindow
x:Class="Elwig.Windows.MailWindow"
AutomationProperties.AutomationId="MailWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -139,7 +139,7 @@ namespace Elwig.Windows {
AvaiableDocumentsList.ItemsSource = l;
ControlUtils.RenewItemsSource(MemberBranchInput, await ctx.Branches
.Where(b => b.Members.Any())
.Where(b => b.Members.Count != 0)
.OrderBy(b => b.Name)
.ToListAsync(), MemberInput_SelectionChanged);
if (MemberBranchInput.SelectedItems.Count == 0) {
@@ -148,7 +148,7 @@ namespace Elwig.Windows {
MemberBranchInput.SelectionChanged += MemberInput_SelectionChanged;
}
ControlUtils.RenewItemsSource(MemberKgInput, await ctx.Katastralgemeinden
.Where(k => k.WbKg!.Members.Any())
.Where(k => k.WbKg!.Members.Count != 0)
.OrderBy(k => k.Name)
.ToListAsync(), MemberInput_SelectionChanged);
if (MemberKgInput.SelectedItems.Count == 0) {
@@ -561,7 +561,7 @@ namespace Elwig.Windows {
double totalNum = printNum + emailNum;
var email = memberDocs
.Where(d => d.Docs.Count > 0 && d.Member.EmailAddresses.Any() && (emailMode == 2 || (emailMode == 1 && d.Member.ContactViaEmail)))
.Where(d => d.Docs.Count > 0 && d.Member.EmailAddresses.Count > 0 && (emailMode == 2 || (emailMode == 1 && d.Member.ContactViaEmail)))
.ToDictionary(d => d.Member, m => {
var docs = m.Docs.Select(d => d.Doc).ToList();
foreach (var doc in docs) {

View File

@@ -13,7 +13,7 @@
</Target>
<ItemGroup>
<ProjectReference Include="..\Installer\Installer.wixproj" />
<PackageReference Include="WixToolset.Bal.wixext" Version="5.0.0" />
<PackageReference Include="WixToolset.Util.wixext" Version="5.0.0" />
<PackageReference Include="WixToolset.Bal.wixext" Version="5.0.1" />
<PackageReference Include="WixToolset.Util.wixext" Version="5.0.1" />
</ItemGroup>
</Project>

View File

@@ -39,7 +39,7 @@ namespace Tests.E2ETests {
GC.SuppressFinalize(this);
App.Close();
try {
Desktop.FindElementByName("Ja").Click();
Desktop.FindElement(By.Name("Ja")).Click();
} catch { }
App.Dispose();
Desktop.Close();

View File

@@ -3,7 +3,7 @@ using OpenQA.Selenium.Appium.Windows;
using Tests.WeighingTests;
namespace Tests.E2ETests {
[TestFixture]
[TestFixture, Order(2)]
public class DeliveryAdminWindowReceiptTest {
private MockScale Mock;
@@ -15,13 +15,13 @@ namespace Tests.E2ETests {
Weight = 3210,
};
Session = new(Utils.ApplicationPath, Utils.ConfigPath, WinAppDriver.WinAppDriverUrl);
Session.App.FindElementByName("Stammdaten").Click();
Session.App.FindElement(By.Name("Stammdaten")).Click();
Thread.Sleep(500);
var window = Session.CreateWindowDriver("BaseDataWindow");
window.FindElementByName("Saisons").Click();
window.FindElementByName("Neu anlegen...").Click();
window.FindElement(By.Name("Saisons")).Click();
window.FindElement(By.Name("Neu anlegen...")).Click();
var dialog = Session.CreateWindowDriver("NewSeasonDialog");
dialog.FindElementByName("Bestätigen").Click();
dialog.FindElement(By.Name("Bestätigen")).Click();
dialog.Close();
Thread.Sleep(500);
window.Close();
@@ -34,13 +34,13 @@ namespace Tests.E2ETests {
}
private WindowsDriver<WindowsElement> OpenReceiptWindow() {
Session.App.FindElementByName("Übernahme").Click();
Session.App.FindElement(By.Name("Übernahme")).Click();
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
return Session.CreateWindowDriver("DeliveryAdminWindow");
}
private void FinishDeliveryNote(WindowsDriver<WindowsElement> window) {
window.FindElementByName("Abschließen").Click();
window.FindElement(By.Name("Abschließen")).Click();
Thread.Sleep(2000);
var doc = Session.CreateWindowDriver("DocumentViewerWindow");
Assert.That(doc.Title, Contains.Substring("Traubenübernahmeschein"));
@@ -52,7 +52,7 @@ namespace Tests.E2ETests {
[Test]
public void Test_1_Minimal() {
var window = OpenReceiptWindow();
window.FindById("MgNrInput").SendKeys("101" + Keys.Enter + "GV" + Keys.Enter + "73" + Keys.Enter + Keys.Enter);
window.FindElement(By.WpfId("MgNrInput")).SendKeys("101" + Keys.Enter + "GV" + Keys.Enter + "73" + Keys.Enter + Keys.Enter);
Thread.Sleep(500);
FinishDeliveryNote(window);
window.Close();
@@ -61,10 +61,10 @@ namespace Tests.E2ETests {
[Test]
public void Test_2_OtherInputs() {
var window = OpenReceiptWindow();
window.FindById("MemberInput").SendKeys("Mustermann Max");
window.SelectComboBoxItemByText("WineVarietyInput", "Zweigelt");
window.FindById("GradationKmwInput").SendKeys("18");
window.FindElementByName("Wiegen").Click();
window.FindElement(By.WpfId("MemberInput")).SendKeys("Mustermann Max");
window.FindElement(By.WpfId("WineVarietyInput")).SelectItem("Zweigelt");
window.FindElement(By.WpfId("GradationKmwInput")).SendKeys("18");
window.FindElement(By.Name("Wiegen")).Click();
Thread.Sleep(500);
FinishDeliveryNote(window);
window.Close();
@@ -73,9 +73,9 @@ namespace Tests.E2ETests {
[Test]
public void Test_3_AttributeCultivationModifier() {
var window = OpenReceiptWindow();
window.FindById("MgNrInput").SendKeys("102" + Keys.Enter + "GVK");
window.SelectComboBoxItemByText("CultivationInput", "Bio");
window.FindById("GradationOeInput").SendKeys("73" + Keys.Enter + Keys.Enter);
window.FindElement(By.WpfId("MgNrInput")).SendKeys("102" + Keys.Enter + "GVK");
window.FindElement(By.WpfId("CultivationInput")).SelectItem("Bio");
window.FindElement(By.WpfId("GradationOeInput")).SendKeys("73" + Keys.Enter + Keys.Enter);
Thread.Sleep(500);
FinishDeliveryNote(window);

View File

@@ -1,5 +1,5 @@
namespace Tests.E2ETests {
[TestFixture]
[TestFixture, Order(1)]
public class MainWindowTest {
private AppSession Session;
@@ -17,7 +17,7 @@
[Test]
public void Test_Open_MemberAdminWindow() {
Assert.DoesNotThrow(() => {
Session.App.FindElementByName("Mitglieder").Click();
Session.App.FindElement(By.Name("Mitglieder")).Click();
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
var window = Session.CreateWindowDriver("MemberAdminWindow");
Assert.That(window.Title, Is.EqualTo("Mitglieder - Elwig"));
@@ -28,7 +28,7 @@
[Test]
public void Test_Open_DeliveryAdminWindow() {
Assert.DoesNotThrow(() => {
Session.App.FindElementByName("Lieferungen").Click();
Session.App.FindElement(By.Name("Lieferungen")).Click();
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
var window = Session.CreateWindowDriver("DeliveryAdminWindow");
Assert.That(window.Title, Is.EqualTo("Lieferungen - Elwig"));
@@ -39,12 +39,23 @@
[Test]
public void Test_Open_BaseDataWindow() {
Assert.DoesNotThrow(() => {
Session.App.FindElementByName("Stammdaten").Click();
Session.App.FindElement(By.Name("Stammdaten")).Click();
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
var window = Session.CreateWindowDriver("BaseDataWindow");
Assert.That(window.Title, Is.EqualTo("Stammdaten - Elwig"));
window.Close();
});
}
[Test]
public void Test_Open_MailWindow() {
Assert.DoesNotThrow(() => {
Session.App.FindElement(By.Name("Rundschreiben")).Click();
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
var window = Session.CreateWindowDriver("MailWindow");
Assert.That(window.Title, Is.EqualTo($"Rundschreiben - Lese {Elwig.Helpers.Utils.Today.Year} - Elwig"));
window.Close();
});
}
}
}

View File

@@ -1,7 +1,7 @@
using OpenQA.Selenium.Appium.Windows;
namespace Tests.E2ETests {
[TestFixture]
[TestFixture, Order(3)]
public class MemberAdminWindowTest {
private AppSession Session;
@@ -10,7 +10,7 @@ namespace Tests.E2ETests {
[OneTimeSetUp]
public void WindowSetup() {
Session = new(Utils.ApplicationPath, Utils.ConfigPath, WinAppDriver.WinAppDriverUrl);
Session.App.FindElementByName("Mitglieder").Click();
Session.App.FindElement(By.Name("Mitglieder")).Click();
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
Window = Session.CreateWindowDriver("MemberAdminWindow");
}
@@ -24,93 +24,93 @@ namespace Tests.E2ETests {
[TearDown]
public void Teardown() {
Window!.FindById("SearchInput").Clear();
Window.FindElement(By.WpfId("SearchInput")).Clear();
Thread.Sleep(500);
}
[Test]
public void Test_1_CreateMember() {
Window!.FindById("NewMemberButton").Click();
Window.FindElement(By.WpfId("NewMemberButton")).Click();
Window.FindById("MgNrInput").Clear();
Window.FindById("MgNrInput").SendKeys("9999");
Window.FindElement(By.WpfId("MgNrInput")).Clear();
Window.FindElement(By.WpfId("MgNrInput")).SendKeys("9999");
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");
Window.FindElement(By.WpfId("GivenNameInput")).SendKeys("Norbert");
Window.FindElement(By.WpfId("FamilyNameInput")).SendKeys("Neuling");
Window.FindElement(By.WpfId("PrefixInput")).SendKeys("Ing.");
Window.FindElement(By.WpfId("SuffixInput")).SendKeys("jun.");
Window.FindElement(By.WpfId("BirthdayInput")).SendKeys("1987");
Window.FindById("AddressInput").SendKeys("Musterstraße 9");
Window.FindById("PlzInput").SendKeys("2120");
Window.SelectComboBoxItemByCount("OrtInput", 1);
Window.FindElement(By.WpfId("AddressInput")).SendKeys("Musterstraße 9");
Window.FindElement(By.WpfId("PlzInput")).SendKeys("2120");
Window.FindElement(By.WpfId("OrtInput")).SelectItem(1);
Window.FindById("EmailAddress1Input").SendKeys("norbert.neuling@aon.at");
Window.FindById("EmailAddress2Input").SendKeys("nathalie.neuling@aon.at");
Window.FindElement(By.WpfId("EmailAddress1Input")).SendKeys("norbert.neuling@aon.at");
Window.FindElement(By.WpfId("EmailAddress2Input")).SendKeys("nathalie.neuling@aon.at");
Window.SelectComboBoxItemByCount("PhoneNr1TypeInput", 1);
Window.FindById("PhoneNr1Input").SendKeys("012345678");
Window.FindElement(By.WpfId("PhoneNr1TypeInput")).SelectItem(1);
Window.FindElement(By.WpfId("PhoneNr1Input")).SendKeys("012345678");
Window.SelectComboBoxItemByCount("PhoneNr2TypeInput", 2);
Window.FindById("PhoneNr2Input").SendKeys("0664123456");
Window.FindElement(By.WpfId("PhoneNr2TypeInput")).SelectItem(2);
Window.FindElement(By.WpfId("PhoneNr2Input")).SendKeys("0664123456");
Window.FindById("IbanInput").SendKeys("AT611904300234573201");
Window.FindById("BicInput").SendKeys("RLNWATWWWDF");
Window.FindElement(By.WpfId("IbanInput")).SendKeys("AT611904300234573201");
Window.FindElement(By.WpfId("BicInput")).SendKeys("RLNWATWWWDF");
Window.FindById("UstIdNrInput").SendKeys("ATU66192906"); // TODO: Testdaten?
Window.FindById("LfbisNrInput").SendKeys("1251074"); // TODO: Testdaten?
Window.FindElement(By.WpfId("UstIdNrInput")).SendKeys("ATU66192906"); // TODO: Testdaten?
Window.FindElement(By.WpfId("LfbisNrInput")).SendKeys("1251074"); // TODO: Testdaten?
Window.FindById("BuchführendInput").Click();
Window.FindById("OrganicInput").Click();
Window.FindElement(By.WpfId("BuchführendInput")).Click();
Window.FindElement(By.WpfId("OrganicInput")).Click();
Window.FindById("BillingNameInput").SendKeys("Neuling KG");
Window.FindById("BillingAddressInput").SendKeys("Betriebsstraße 1");
Window.FindById("BillingPlzInput").SendKeys("2120");
Window.SelectComboBoxItemByCount("BillingOrtInput", 2);
Window.FindElement(By.WpfId("BillingNameInput")).SendKeys("Neuling KG");
Window.FindElement(By.WpfId("BillingAddressInput")).SendKeys("Betriebsstraße 1");
Window.FindElement(By.WpfId("BillingPlzInput")).SendKeys("2120");
Window.FindElement(By.WpfId("BillingOrtInput")).SelectItem(2);
Window.FindById("BusinessSharesInput").SendKeys("10");
Window.SelectComboBoxItemByText("BranchInput", "Matzen");
Window.SelectComboBoxItemByCount("DefaultKgInput", 3);
Window.FindElement(By.WpfId("BusinessSharesInput")).SendKeys("10");
Window.FindElement(By.WpfId("BranchInput")).SelectItem("Matzen");
Window.FindElement(By.WpfId("DefaultKgInput")).SelectItem(3);
Window.FindById("VollLieferantInput").Click();
Window.FindById("FunkionärInput").Click();
Window.FindElement(By.WpfId("VollLieferantInput")).Click();
Window.FindElement(By.WpfId("FunkionärInput")).Click();
Window.FindById("CommentInput").SendKeys("Die lieben Mustermänner und Musterfrauen!");
Window.FindById("ContactEmailInput").Click();
Window.FindElement(By.WpfId("CommentInput")).SendKeys("Die lieben Mustermänner und Musterfrauen!");
Window.FindElement(By.WpfId("ContactEmailInput")).Click();
Window.FindById("SaveButton").Click();
Window.FindElement(By.WpfId("SaveButton")).Click();
Window.FindById("SearchInput").SendKeys("9999");
Window.FindElement(By.WpfId("SearchInput")).SendKeys("9999");
Thread.Sleep(500);
var memberListRow = Window.FindById("MemberList").FindElementByClassName("DataGridRow");
var memberListRow = Window.FindElement(By.WpfId("MemberList")).FindElement(By.ClassName("DataGridRow"));
Assert.Multiple(() => {
Assert.That(memberListRow, 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);
Assert.That(memberListRow.FindElement(By.Name("9999 ")), Is.Not.Null);
Assert.That(memberListRow.FindElement(By.Name("Norbert")), Is.Not.Null);
Assert.That(memberListRow.FindElement(By.Name("Neuling")), Is.Not.Null);
});
}
[Test]
public void Test_2_EditMember() {
Window!.FindById("SearchInput").SendKeys("9999");
Window!.FindElement(By.WpfId("SearchInput")).SendKeys("9999");
Thread.Sleep(500);
var memberList = Window.FindById("MemberList");
var memberList = Window.FindElement(By.WpfId("MemberList"));
Assert.That(memberList, Is.Not.Null);
var memberListRows = memberList.FindElementsByClassName("DataGridRow");
var memberListRows = memberList.FindElements(By.ClassName("DataGridRow"));
Assert.That(memberListRows, Has.Count.EqualTo(1));
Window.FindById("EditMemberButton").Click();
Window.FindElement(By.WpfId("EditMemberButton")).Click();
var businessSharesInput = Window.FindById("BusinessSharesInput");
var businessSharesInput = Window.FindElement(By.WpfId("BusinessSharesInput"));
Assert.That(businessSharesInput, Is.Not.Null);
var businessShares = int.Parse(businessSharesInput.Text);
businessSharesInput.Clear();
businessSharesInput.SendKeys($"{businessShares + 5}");
Window.FindById("SaveButton").Click();
Window.FindElement(By.WpfId("SaveButton")).Click();
var newBusinessShares = int.Parse(businessSharesInput.Text);
Assert.That(newBusinessShares, Is.EqualTo(businessShares + 5));
@@ -118,28 +118,28 @@ namespace Tests.E2ETests {
[Test]
public void Test_3_DeleteMember() {
Window!.FindById("SearchInput").SendKeys("9999");
Window!.FindElement(By.WpfId("SearchInput")).SendKeys("9999");
Thread.Sleep(500);
var memberList = Window.FindById("MemberList");
var memberList = Window.FindElement(By.WpfId("MemberList"));
Assert.That(memberList, Is.Not.Null);
var memberListRows = memberList.FindElementsByClassName("DataGridRow");
var memberListRows = memberList.FindElements(By.ClassName("DataGridRow"));
Assert.That(memberListRows, Has.Count.EqualTo(1));
var memberListRow = memberListRows.First();
Assert.Multiple(() => {
Assert.That(memberListRow, 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);
Assert.That(memberListRow.FindElement(By.Name("9999 ")), Is.Not.Null);
Assert.That(memberListRow.FindElement(By.Name("Norbert")), Is.Not.Null);
Assert.That(memberListRow.FindElement(By.Name("Neuling")), Is.Not.Null);
});
Window.FindById("DeleteMemberButton").Click();
Window.FindElement(By.WpfId("DeleteMemberButton")).Click();
var dialog = Session.CreateWindowDriver("DeleteMemberDialog");
dialog.FindById("NameInput").SendKeys("9999 Ing. Norbert Neuling jun.");
dialog.FindById("ConfirmButton").Click();
dialog.FindElement(By.WpfId("NameInput")).SendKeys("9999 Ing. Norbert Neuling jun.");
dialog.FindElement(By.WpfId("ConfirmButton")).Click();
memberListRows = memberList.FindElementsByClassName("DataGridRow");
memberListRows = memberList.FindElements(By.ClassName("DataGridRow"));
Assert.That(memberListRows, Has.Count.EqualTo(0));
}
}

View File

@@ -1,5 +1,5 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Appium.Windows;
using OpenQA.Selenium.Appium;
namespace Tests.E2ETests {
public static class Utils {
@@ -10,22 +10,22 @@ namespace Tests.E2ETests {
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);
}
public static void SelectComboBoxItemByCount(this WindowsDriver<WindowsElement> session, string accessibilityId, int count) {
var element = session.FindElementByAccessibilityId(accessibilityId);
public static void SelectItem(this IWebElement element, int count) {
element.Click();
element.SendKeys(string.Concat(Enumerable.Repeat(Keys.Down, count)));
element.SendKeys(Keys.Enter);
}
public static void SelectComboBoxItemByText(this WindowsDriver<WindowsElement> session, string accessibilityId, string text) {
var element = session.FindElementByAccessibilityId(accessibilityId);
public static void SelectItem(this IWebElement element, string text) {
element.Click();
element.SendKeys(text);
element.SendKeys(Keys.Enter);
}
}
public class By : OpenQA.Selenium.By {
public static OpenQA.Selenium.By WpfId(string wpfName) {
return new ByAccessibilityId(wpfName);
}
}
}