E2ETests: Add DeliveryAdminWindowReceiptTest
All checks were successful
Test / Run tests (push) Successful in 1m56s

This commit is contained in:
2024-07-18 23:56:23 +02:00
parent ffe0ff5508
commit dd5049faae
10 changed files with 116 additions and 5 deletions

View File

@ -0,0 +1,85 @@
using OpenQA.Selenium;
using OpenQA.Selenium.Appium.Windows;
using Tests.WeighingTests;
namespace Tests.E2ETests {
[TestFixture]
public class DeliveryAdminWindowReceiptTest {
private MockScale Mock;
private AppSession Session;
[OneTimeSetUp]
public void Setup() {
Mock = new CommandMockScale(12345, ScaleHandlers.Handle_IT3000A) {
Weight = 3210,
};
Session = new(Utils.ApplicationPath, Utils.ConfigPath, WinAppDriver.WinAppDriverUrl);
Session.App.FindElementByName("Stammdaten").Click();
Thread.Sleep(500);
var window = Session.CreateWindowDriver("BaseDataWindow");
window.FindElementByName("Saisons").Click();
window.FindElementByName("Neu anlegen...").Click();
var dialog = Session.CreateWindowDriver("NewSeasonDialog");
dialog.FindElementByName("Bestätigen").Click();
dialog.Close();
Thread.Sleep(500);
window.Close();
}
[OneTimeTearDown]
public void Teardown() {
Session.Dispose();
Mock.Dispose();
}
private WindowsDriver<WindowsElement> OpenReceiptWindow() {
Session.App.FindElementByName("Übernahme").Click();
Thread.Sleep(Utils.WINDOW_OPEN_SLEEP);
return Session.CreateWindowDriver("DeliveryAdminWindow");
}
private void FinishDeliveryNote(WindowsDriver<WindowsElement> window) {
window.FindElementByName("Abschließen").Click();
Thread.Sleep(2000);
var doc = Session.CreateWindowDriver("DocumentViewerWindow");
Assert.That(doc.Title, Contains.Substring("Traubenübernahmeschein"));
Thread.Sleep(500);
doc.Close();
Thread.Sleep(500);
}
[Test]
public void Test_1_Minimal() {
var window = OpenReceiptWindow();
window.FindById("MgNrInput").SendKeys("101" + Keys.Enter + "GV" + Keys.Enter + "73" + Keys.Enter + Keys.Enter);
Thread.Sleep(500);
FinishDeliveryNote(window);
window.Close();
}
[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();
Thread.Sleep(500);
FinishDeliveryNote(window);
window.Close();
}
[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);
Thread.Sleep(500);
FinishDeliveryNote(window);
window.Close();
}
}
}