86 lines
3.1 KiB
C#
86 lines
3.1 KiB
C#
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();
|
|
}
|
|
}
|
|
}
|