Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 101a9fe3 authored by Harald Martini's avatar Harald Martini
Browse files

Updated AirdragModified Enum

Added Debug Message to SaveVIF if created file is not valid,

Changes in test methods
parent daea2a2d
No related branches found
No related tags found
No related merge requests found
......@@ -27,34 +27,35 @@ using Convert = System.Convert;
namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
{
public enum AirdragModifiedEnum
public enum AIRDRAGMODIFIED
{
[GuiLabel("Unknown")]
UNKNOWN = -1,
UNKNOWN = 0,
[GuiLabel("True")]
TRUE = 1,
[GuiLabel("False")]
FALSE = 0,
FALSE = 2,
}
public static class AirdragModifiedEnumHelper
{
public static AirdragModifiedEnum toAirdragModifiedEnum(this bool? nullableBool)
public static AIRDRAGMODIFIED toAirdragModifiedEnum(this bool? nullableBool)
{
if (nullableBool.HasValue) {
return nullableBool.Value == true ? AirdragModifiedEnum.TRUE : AirdragModifiedEnum.FALSE;
return nullableBool.Value == true ? AIRDRAGMODIFIED.TRUE : AIRDRAGMODIFIED.FALSE;
}
return AirdragModifiedEnum.UNKNOWN;
return AIRDRAGMODIFIED.UNKNOWN;
}
public static bool? toNullableBool(this AirdragModifiedEnum airdragModified)
public static bool? toNullableBool(this AIRDRAGMODIFIED airdragModified)
{
switch (airdragModified) {
case AirdragModifiedEnum.TRUE:
case AIRDRAGMODIFIED.TRUE:
return true;
case AirdragModifiedEnum.FALSE:
case AIRDRAGMODIFIED.FALSE:
return false;
default:
return null;
......@@ -69,7 +70,6 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
IMultistageAirdragViewModel MultistageAirdragViewModel { get; set; }
IMultistageAuxiliariesViewModel MultistageAuxiliariesViewModel { get; set; }
void SetAirdragData(IAirdragDeclarationInputData airdragData);
void SetBusAuxiliaries(IBusAuxiliariesDeclarationData busAuxData);
void SetVehicleInputData(IVehicleDeclarationInputData vehicleInputData);
}
......@@ -136,12 +136,13 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
public void SetAirdragData(IAirdragDeclarationInputData airdragData)
{
throw new NotImplementedException();
MultistageAirdragViewModel.SetAirdragInputData(airdragInputData: airdragData);
}
public void SetBusAuxiliaries(IBusAuxiliariesDeclarationData busAuxData)
{
//BusAuxiliaries.SetBusAuxiliariesInputData()
throw new NotImplementedException();
}
public void SetVehicleInputData(IVehicleDeclarationInputData vehicleInputData)
......@@ -199,7 +200,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
private VehicleCode? _vehicleCode;
private RegistrationClass? _registeredClass;
private bool? _airdragModifiedMultistage;
private bool _airdragModifiedEditingEnabled;
private bool _airdragModifiedEditingEnabled = false;
private LegislativeClass? _legislativeClass;
private ConsumerTechnology? _doorDriveTechnology;
private TankSystem? _tankSystem;
......@@ -392,24 +393,30 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
#region AirdragModified
public AirdragModifiedEnum AirdragModifiedEnum
public AIRDRAGMODIFIED? AirdragModifiedEnum
{
get => _airdragModifiedMultistage.toAirdragModifiedEnum();
get
{
if (AirdragModifiedMultistageEditingEnabled) {
return _airdragModifiedMultistage.toAirdragModifiedEnum();
} else {
return null;
}
}
set {
AirdragModifiedMultistage = value.toNullableBool();
AirdragModifiedMultistage = value?.toNullableBool();
}
}
public AirdragModifiedEnum ConsolidatedAirdragModifiedEnum
public AIRDRAGMODIFIED? ConsolidatedAirdragmodified
{
get
{
if (_consolidatedVehicleData?.AirdragModifiedMultistage != null) {
return _consolidatedVehicleData.AirdragModifiedMultistage.toAirdragModifiedEnum();
} else {
return AirdragModifiedEnum.UNKNOWN;
return null;
}
}
set => throw new NotImplementedException();
}
......@@ -420,7 +427,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
set => SetProperty(ref _airdragModifiedMultistage, value);
}
#endregion;
public bool AirdragModifiedMultistageEditingEnabled
{
get
......@@ -431,9 +438,12 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
}
return _airdragModifiedEditingEnabled;
}
set => SetProperty(ref _airdragModifiedEditingEnabled, value);
set{
SetProperty(ref _airdragModifiedEditingEnabled, value);
}
}
#endregion;
public RegistrationClass? RegisteredClass
{
......@@ -533,53 +543,92 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
public IAdvancedDriverAssistantSystemDeclarationInputData ADAS
{
get { return _adasEditingEnabled ? this : null; }
get
{
if (EngineStopStartNullable.HasValue
|| EcoRollTypeNullable.HasValue
|| PredictiveCruiseControlNullable.HasValue
|| ATEcoRollReleaseLockupClutch.HasValue) {
return this;
} else {
return null;
}
;
}
}
public bool AdasEditingEnabled
{
get => _adasEditingEnabled;
set => SetProperty(ref _adasEditingEnabled, value);
set
{
SetProperty(ref _adasEditingEnabled, value);
}
}
public bool? EngineStopStartNullable
{
get => _engineStopStartNullable;
set => SetProperty(ref _engineStopStartNullable, value);
set
{
SetProperty(ref _engineStopStartNullable, value);
}
}
public bool EngineStopStart
{
get => _engineStopStartNullable.HasValue ? _engineStopStartNullable.Value : false;
get
{
return _engineStopStartNullable.HasValue ? _engineStopStartNullable.Value : false;
}
}
public EcoRollType? EcoRollTypeNullable
{
get => _ecoRollTypeNullable;
set => SetProperty(ref _ecoRollTypeNullable, value);
set
{
SetProperty(ref _ecoRollTypeNullable, value);
}
}
public EcoRollType EcoRoll
{
get => _ecoRollTypeNullable.HasValue ? _ecoRollTypeNullable.Value : EcoRollType.None;
get
{
return _ecoRollTypeNullable.HasValue ? _ecoRollTypeNullable.Value : EcoRollType.None;
}
}
public PredictiveCruiseControlType? PredictiveCruiseControlNullable
{
get => _predictiveCruiseControlNullable;
set => SetProperty(ref _predictiveCruiseControlNullable, value);
set
{
SetProperty(ref _predictiveCruiseControlNullable, value);
}
}
public PredictiveCruiseControlType PredictiveCruiseControl
{
get => _predictiveCruiseControlNullable.HasValue ? _predictiveCruiseControlNullable.Value : PredictiveCruiseControlType.None;
get
{
return _predictiveCruiseControlNullable.HasValue
? _predictiveCruiseControlNullable.Value
: PredictiveCruiseControlType.None;
}
}
public bool? ATEcoRollReleaseLockupClutch
{
get => _atEcoRollReleaseLockupClutch;
set => SetProperty(ref _atEcoRollReleaseLockupClutch, value);
set
{
SetProperty(ref _atEcoRollReleaseLockupClutch, value);
}
}
#endregion
......@@ -783,12 +832,12 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
}
break;
case nameof(AirdragModifiedEnum):
if (AirdragModifiedMultistageEditingEnabled && AirdragModifiedEnum == AirdragModifiedEnum.UNKNOWN) {
if (AirdragModifiedMultistageEditingEnabled && (AirdragModifiedEnum == AIRDRAGMODIFIED.UNKNOWN)) {
result = "Air drag modified has to be set";
}
break;
}
//string result_null; //https://www.youtube.com/watch?v=5KF0GGObuAQ
//https://www.youtube.com/watch?v=5KF0GGObuAQ
if (result == null) {
if(Errors.ContainsKey(propertyName))
......
......@@ -76,8 +76,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
public static void SaveVif(IMultistageVIFInputData vifData, string outputFile)
{
Debug.Assert(outputFile != null);
var numberOfManufacturingStages =
vifData.MultistageJobInputData.JobInputData.ManufacturingStages?.Count ?? 1;
......@@ -103,7 +103,19 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
var validator = new XMLValidator(XmlReader.Create(writer.XMLMultistageReportFileName));
var vifInputData = inputData;
var valid = validator.ValidateXML(XmlDocumentType.MultistageOutputData);
if (!valid) {
Debug.WriteLine("Invalid Outputfile");
}
Debug.WriteLine($"Written to {writer.XMLMultistageReportFileName}");
}
private ICommand _saveInputDataCommand;
......
......@@ -80,6 +80,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation
return;
}
MultiStageJobViewModel = null;
MultiStageJobViewModel =
_vmFactory.GetMultiStageJobViewModel(inputDataProvider);
VifPath = fileName;
......
......@@ -49,7 +49,7 @@
<custom:MultiStageParameter x:Name="AirdragModified"
Validation.ErrorTemplate="{StaticResource multistageParameterControlErrorTemplate}"
EditingEnabled="{Binding AirdragModifiedMultistageEditingEnabled}"
PreviousContent="{Binding ConsolidatedAirdragModifiedEnum}"
PreviousContent="{Binding ConsolidatedAirdragmodified}"
Content="{Binding AirdragModifiedEnum, ValidatesOnDataErrors=True}"
Mode="COMBOBOX"/>
......
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
......@@ -30,11 +31,19 @@ namespace Vecto3GUI2020Test
{
session.FindElementByXPath(
"//Button[@Name=\"New Multistage File\"][@AutomationId=\"JobListViewNewManufacturingStageFileButton\"]").Click(); //open new multistageWindow
session.SwitchTo().Window(session.WindowHandles.Last());
Assert.AreEqual(2, session.WindowHandles.Count);
//session.SwitchTo().Window(session.WindowHandles.First());
session.FindElementByXPath(
".//Custom[@AutomationId=\"NewMultistageJobView\"]/Custom[@AutomationId=\"NewMultistageFilePicker\"]/Button[@AutomationId=\"button\"]").Click();
session.FindElementByXPath("//Button[@AutomationId=\"button\"]").Click(); //open filepicker
Assert.AreEqual(3, session.WindowHandles);
Thread.Sleep(100000);
......@@ -45,194 +54,194 @@ namespace Vecto3GUI2020Test
#region DesktopSessionTests
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFile()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages.xml");
}
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFileAirdrag()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages_airdrag.xml");
}
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFileheatPump()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages_heatPump.xml");
}
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFilehev()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages_hev.xml");
}
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFileNGTankSystem()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages_NGTankSystem.xml");
}
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFileConsolidatedOneStage()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_one_stage.xml");
}
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFileConsolidatedTwoStages()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_two_stages.xml");
}
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFilePrimaryVehicleOnly()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_primary_vehicle_only.xml");
}
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFilePrimaryVehicleStage_2_3()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_one_stage.xml");
}
[Ignore("disabled Desktop Session tests")]
[Test]
public void LoadFilePrimaryVehicleOnlyAndCheckFields()
{
LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_primary_vehicle_only.xml");
//Check vehicle fields
SelectVehicleTab();
focusToActiveWindow();
//var element = session.FindElementByXPath()
}
private void LoadFileThroughUIWithDesktopSession(string fileName)
{
// LeftClick on Button "New Multistage File" at (65,28)
// LeftClick on Button "New Multistage File" at (87,25)
Console.WriteLine("LeftClick on Button \"New Multistage File\" at (87,25)");
string xpath_LeftClickButtonNewMultist_87_25 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][@Name=\"Vecto\"]/Custom[@ClassName=\"JobListView\"]/Button[@Name=\"New Multistage File\"][@AutomationId=\"JobListViewNewManufacturingStageFileButton\"]";
var winElem_LeftClickButtonNewMultist_87_25 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftClickButtonNewMultist_87_25);
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFile()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages.xml");
//}
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFileAirdrag()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages_airdrag.xml");
//}
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFileheatPump()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages_heatPump.xml");
//}
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFilehev()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages_hev.xml");
//}
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFileNGTankSystem()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_multiple_stages_NGTankSystem.xml");
//}
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFileConsolidatedOneStage()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_one_stage.xml");
//}
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFileConsolidatedTwoStages()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_two_stages.xml");
//}
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFilePrimaryVehicleOnly()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_primary_vehicle_only.xml");
//}
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFilePrimaryVehicleStage_2_3()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_consolidated_one_stage.xml");
//}
//[Ignore("disabled Desktop Session tests")]
//[Test]
//public void LoadFilePrimaryVehicleOnlyAndCheckFields()
//{
// LoadFileThroughUIWithDesktopSession(fileName: "vecto_multistage_primary_vehicle_only.xml");
// //Check vehicle fields
// SelectVehicleTab();
// focusToActiveWindow();
// //var element = session.FindElementByXPath()
//}
//private void LoadFileThroughUIWithDesktopSession(string fileName)
//{
// // LeftClick on Button "New Multistage File" at (65,28)
// // LeftClick on Button "New Multistage File" at (87,25)
// Console.WriteLine("LeftClick on Button \"New Multistage File\" at (87,25)");
// string xpath_LeftClickButtonNewMultist_87_25 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][@Name=\"Vecto\"]/Custom[@ClassName=\"JobListView\"]/Button[@Name=\"New Multistage File\"][@AutomationId=\"JobListViewNewManufacturingStageFileButton\"]";
// var winElem_LeftClickButtonNewMultist_87_25 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftClickButtonNewMultist_87_25);
if (winElem_LeftClickButtonNewMultist_87_25 != null)
{
winElem_LeftClickButtonNewMultist_87_25.Click();
}
else
{
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickButtonNewMultist_87_25}");
}
Assert.NotNull(winElem_LeftClickButtonNewMultist_87_25);
// LeftDblClick on Button "" at (11,11)
Console.WriteLine("LeftDblClick on Button \"\" at (11,11)");
string xpath_LeftDblClickButton_11_11 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Custom[@AutomationId=\"NewMultistageJobView\"]/Custom[@AutomationId=\"NewMultistageFilePicker\"]/Button[@AutomationId=\"button\"]";
var winElem_LeftDblClickButton_11_11 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftDblClickButton_11_11);
// if (winElem_LeftClickButtonNewMultist_87_25 != null)
// {
// winElem_LeftClickButtonNewMultist_87_25.Click();
// }
// else
// {
// Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickButtonNewMultist_87_25}");
// }
// Assert.NotNull(winElem_LeftClickButtonNewMultist_87_25);
// // LeftDblClick on Button "" at (11,11)
// Console.WriteLine("LeftDblClick on Button \"\" at (11,11)");
// string xpath_LeftDblClickButton_11_11 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Custom[@AutomationId=\"NewMultistageJobView\"]/Custom[@AutomationId=\"NewMultistageFilePicker\"]/Button[@AutomationId=\"button\"]";
// var winElem_LeftDblClickButton_11_11 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftDblClickButton_11_11);
if (winElem_LeftDblClickButton_11_11 != null) {
desktopSession.DesktopSessionElement.Mouse.MouseMove(winElem_LeftDblClickButton_11_11.Coordinates);
desktopSession.DesktopSessionElement.Mouse.DoubleClick(null);
}
else
{
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftDblClickButton_11_11}");
}
Assert.NotNull(winElem_LeftDblClickButton_11_11);
// LeftDblClick on Edit "Name" at (284,8)
Console.WriteLine("LeftDblClick on Edit \"Name\" at (284,8)");
string xpath_LeftDblClickEditName_284_8 = $"/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Window[@ClassName=\"#32770\"][@Name=\"Öffnen\"]/Pane[@ClassName=\"DUIViewWndClassName\"]/Pane[@Name=\"Shellordneransicht\"][@AutomationId=\"listview\"]/List[@ClassName=\"UIItemsView\"][@Name=\"Elementansicht\"]/ListItem[@ClassName=\"UIItem\"][@Name={fileName}]/Edit[@Name=\"Name\"][@AutomationId=\"System.ItemNameDisplay\"]";
var winElem_LeftDblClickEditName_284_8 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftDblClickEditName_284_8);
if (winElem_LeftDblClickEditName_284_8 != null)
{
desktopSession.DesktopSessionElement.Mouse.MouseMove(winElem_LeftDblClickEditName_284_8.Coordinates);
desktopSession.DesktopSessionElement.Mouse.DoubleClick(null);
}
else
{
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftDblClickEditName_284_8}");
}
Assert.NotNull(winElem_LeftDblClickEditName_284_8);
SelectAirdragTab();
SelectAuxiliariesTab();
SelectVehicleTab();
SelectAuxiliariesTab();
SelectAirdragTab();
// if (winElem_LeftDblClickButton_11_11 != null) {
// desktopSession.DesktopSessionElement.Mouse.MouseMove(winElem_LeftDblClickButton_11_11.Coordinates);
// desktopSession.DesktopSessionElement.Mouse.DoubleClick(null);
// }
// else
// {
// Console.WriteLine($"Failed to find element using xpath: {xpath_LeftDblClickButton_11_11}");
// }
// Assert.NotNull(winElem_LeftDblClickButton_11_11);
// // LeftDblClick on Edit "Name" at (284,8)
// Console.WriteLine("LeftDblClick on Edit \"Name\" at (284,8)");
// string xpath_LeftDblClickEditName_284_8 = $"/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Window[@ClassName=\"#32770\"][@Name=\"Öffnen\"]/Pane[@ClassName=\"DUIViewWndClassName\"]/Pane[@Name=\"Shellordneransicht\"][@AutomationId=\"listview\"]/List[@ClassName=\"UIItemsView\"][@Name=\"Elementansicht\"]/ListItem[@ClassName=\"UIItem\"][@Name={fileName}]/Edit[@Name=\"Name\"][@AutomationId=\"System.ItemNameDisplay\"]";
// var winElem_LeftDblClickEditName_284_8 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftDblClickEditName_284_8);
// if (winElem_LeftDblClickEditName_284_8 != null)
// {
// desktopSession.DesktopSessionElement.Mouse.MouseMove(winElem_LeftDblClickEditName_284_8.Coordinates);
// desktopSession.DesktopSessionElement.Mouse.DoubleClick(null);
// }
// else
// {
// Console.WriteLine($"Failed to find element using xpath: {xpath_LeftDblClickEditName_284_8}");
// }
// Assert.NotNull(winElem_LeftDblClickEditName_284_8);
// SelectAirdragTab();
// SelectAuxiliariesTab();
// SelectVehicleTab();
// SelectAuxiliariesTab();
// SelectAirdragTab();
}
private void SelectVehicleTab()
{
// LeftClick on Text "Vehicle" at (13,14)
Console.WriteLine("LeftClick on Text \"Vehicle\" at (13,14)");
string xpath_LeftClickTextVehicle_13_14 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Custom[@AutomationId=\"NewMultistageJobView\"]/Custom[@ClassName=\"MultiStageView\"]/Custom[@ClassName=\"ManufacturingStageView\"]/Button[@ClassName=\"Button\"][@Name=\"Vehicle\"]/Text[@ClassName=\"TextBlock\"][@Name=\"Vehicle\"]";
var winElem_LeftClickTextVehicle_13_14 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftClickTextVehicle_13_14);
if (winElem_LeftClickTextVehicle_13_14 != null)
{
winElem_LeftClickTextVehicle_13_14.Click();
}
else
{
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickTextVehicle_13_14}");
}
Assert.NotNull(winElem_LeftClickTextVehicle_13_14);
}
private void SelectAirdragTab()
{
// LeftClick on Text "Airdrag" at (21,13)
Console.WriteLine("LeftClick on Text \"Airdrag\" at (21,13)");
string xpath_LeftClickTextAirdrag_21_13 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Custom[@AutomationId=\"NewMultistageJobView\"]/Custom[@ClassName=\"MultiStageView\"]/Custom[@ClassName=\"ManufacturingStageView\"]/Button[@ClassName=\"Button\"][@Name=\"Airdrag\"]/Text[@ClassName=\"TextBlock\"][@Name=\"Airdrag\"]";
var winElem_LeftClickTextAirdrag_21_13 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftClickTextAirdrag_21_13);
if (winElem_LeftClickTextAirdrag_21_13 != null)
{
winElem_LeftClickTextAirdrag_21_13.Click();
}
else
{
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickTextAirdrag_21_13}");
return;
}
Assert.NotNull(winElem_LeftClickTextAirdrag_21_13);
}
private void SelectAuxiliariesTab()
{
// LeftClick on Button "Auxiliaries" at (9,13)
Console.WriteLine("LeftClick on Button \"Auxiliaries\" at (9,13)");
string xpath_LeftClickButtonAuxiliarie_9_13 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Custom[@AutomationId=\"NewMultistageJobView\"]/Custom[@ClassName=\"MultiStageView\"]/Custom[@ClassName=\"ManufacturingStageView\"]/Button[@ClassName=\"Button\"][@Name=\"Auxiliaries\"]";
var winElem_LeftClickButtonAuxiliarie_9_13 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftClickButtonAuxiliarie_9_13);
if (winElem_LeftClickButtonAuxiliarie_9_13 != null)
{
winElem_LeftClickButtonAuxiliarie_9_13.Click();
}
else
{
Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickButtonAuxiliarie_9_13}");
}
Assert.NotNull(winElem_LeftClickButtonAuxiliarie_9_13);
}
//}
//private void SelectVehicleTab()
//{
// // LeftClick on Text "Vehicle" at (13,14)
// Console.WriteLine("LeftClick on Text \"Vehicle\" at (13,14)");
// string xpath_LeftClickTextVehicle_13_14 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Custom[@AutomationId=\"NewMultistageJobView\"]/Custom[@ClassName=\"MultiStageView\"]/Custom[@ClassName=\"ManufacturingStageView\"]/Button[@ClassName=\"Button\"][@Name=\"Vehicle\"]/Text[@ClassName=\"TextBlock\"][@Name=\"Vehicle\"]";
// var winElem_LeftClickTextVehicle_13_14 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftClickTextVehicle_13_14);
// if (winElem_LeftClickTextVehicle_13_14 != null)
// {
// winElem_LeftClickTextVehicle_13_14.Click();
// }
// else
// {
// Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickTextVehicle_13_14}");
// }
// Assert.NotNull(winElem_LeftClickTextVehicle_13_14);
//}
//private void SelectAirdragTab()
//{
// // LeftClick on Text "Airdrag" at (21,13)
// Console.WriteLine("LeftClick on Text \"Airdrag\" at (21,13)");
// string xpath_LeftClickTextAirdrag_21_13 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Custom[@AutomationId=\"NewMultistageJobView\"]/Custom[@ClassName=\"MultiStageView\"]/Custom[@ClassName=\"ManufacturingStageView\"]/Button[@ClassName=\"Button\"][@Name=\"Airdrag\"]/Text[@ClassName=\"TextBlock\"][@Name=\"Airdrag\"]";
// var winElem_LeftClickTextAirdrag_21_13 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftClickTextAirdrag_21_13);
// if (winElem_LeftClickTextAirdrag_21_13 != null)
// {
// winElem_LeftClickTextAirdrag_21_13.Click();
// }
// else
// {
// Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickTextAirdrag_21_13}");
// return;
// }
// Assert.NotNull(winElem_LeftClickTextAirdrag_21_13);
//}
//private void SelectAuxiliariesTab()
//{
// // LeftClick on Button "Auxiliaries" at (9,13)
// Console.WriteLine("LeftClick on Button \"Auxiliaries\" at (9,13)");
// string xpath_LeftClickButtonAuxiliarie_9_13 = "/Pane[@ClassName=\"#32769\"][@Name=\"Vecto\"]/Window[@ClassName=\"Window\"][starts-with(@Name,\"VECTO3GUI2020.ViewModel.MultiStage.Implementation.NewMultiStageJ\")]/Custom[@AutomationId=\"NewMultistageJobView\"]/Custom[@ClassName=\"MultiStageView\"]/Custom[@ClassName=\"ManufacturingStageView\"]/Button[@ClassName=\"Button\"][@Name=\"Auxiliaries\"]";
// var winElem_LeftClickButtonAuxiliarie_9_13 = desktopSession.FindElementByAbsoluteXPath(xpath_LeftClickButtonAuxiliarie_9_13);
// if (winElem_LeftClickButtonAuxiliarie_9_13 != null)
// {
// winElem_LeftClickButtonAuxiliarie_9_13.Click();
// }
// else
// {
// Console.WriteLine($"Failed to find element using xpath: {xpath_LeftClickButtonAuxiliarie_9_13}");
// }
// Assert.NotNull(winElem_LeftClickButtonAuxiliarie_9_13);
//}
#endregion
......
......@@ -3,6 +3,7 @@ using System.Diagnostics;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium.Windows;
using VECTO3GUI2020.Properties;
namespace Vecto3GUI2020Test.UI
{
......@@ -12,6 +13,9 @@ namespace Vecto3GUI2020Test.UI
protected const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723";
private const string NotepadAppId = @"C:\Windows\System32\notepad.exe";
private const string vectoLocation =
@"C:\Users\Harry\source\repos\vecto-dev\VECTO3GUI2020\bin\Debug\VECTO3GUI2020.exe";
private static Process winappDriverProcess;
internal static WindowsDriver<WindowsElement> session;
......@@ -28,12 +32,15 @@ namespace Vecto3GUI2020Test.UI
if (session == null) {
winappDriverProcess = Process.Start(@"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe");
// Create a new session to launch Notepad application
var appiumOptions = new OpenQA.Selenium.Appium.AppiumOptions();
appiumOptions.AddAdditionalCapability("app", @"C:\Users\Harry\source\repos\vecto-dev\VECTO3GUI2020\bin\Debug\VECTO3GUI2020.exe");
appiumOptions.AddAdditionalCapability("deviceName", "WindowsPC");
session = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), appiumOptions);
session.ActivateApp(vectoLocation);
// Use the session to control the app
// Use the session to control the app
Assert.IsNotNull(session);
Assert.IsNotNull(session.SessionId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment