public void OrderE2E() { string NewSearchButton = "newSearchBtn"; Login("john", "hp"); Thread.Sleep(1000); SpecialActions.BookFlight("Paris", "London", "24.02.2017", "Economy", "5", "hpjohn"); string order = SpecialActions.GetOrderNumber(); string PriceExpected = SpecialActions.GetTicketPrice(); string TotalExpected = SpecialActions.GetTotalPrice(); AfterTest(); BeforeEachTest(); Login("john", "hp"); ///Actions.Click(NewSearchButton); SpecialActions.SelectSearchOrderTab(); Actions.SelectItem("byNumberRadio"); Actions.SetValue("byNumberWatermark", order); Actions.Click("searchBtn"); string TicketNumber = Actions.GetSelection("numOfTicketsCombo"); string ClassSelected = Actions.GetSelection("flightClassCombo"); string PriceActual = SpecialActions.GetTicketPrice(); string TotalActual = SpecialActions.GetTotalPrice(); Assert.AreEqual(PriceExpected, PriceActual); Assert.AreEqual(TotalExpected, TotalActual); Assert.AreEqual(ClassSelected, "Economy"); Assert.AreEqual(TicketNumber, "5"); SpecialActions.DeleteOrder(); }
public void OrderNumber() { Login("john", "hp"); Thread.Sleep(1000); SpecialActions.SelectSearchOrderTab(); var radio_button = ControlFinder.FindByAutomationId("byNumberRadio"); var order_number = ControlFinder.FindByAutomationId("byNumberWatermark"); bool order_number_selected = order_number.Current.IsEnabled; var selected = radio_button.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern; bool is_radio_selected = selected.Current.IsSelected; Assert.AreEqual(is_radio_selected, order_number_selected); Thread.Sleep(1000); Actions.SelectItem("byNumberRadio"); var type = order_number.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern; var search = ControlFinder.FindByAutomationId("searchBtn"); Assert.AreEqual(false, search.Current.IsEnabled); type.SetValue("123456"); Assert.AreEqual(true, search.Current.IsEnabled); Thread.Sleep(1000); Actions.Click("searchBtn"); var error_message = ControlFinder.FindByAutomationId("65535"); var error_text = error_message.Current.Name; Assert.AreEqual("Order number does not exist.", error_text); }
public static void Reward(Quest quest, Player player) { var unit = CreatureGroupManager.GetAllByPlayer(player).FirstOrDefault(); // Debug.LogError(unit); if (unit == null) { return; } var pos = AI_Calculation.FindFreePosNearPos(unit.ChunkNumber, unit.CurrentPos, true); var questReward = quest.reward; //Debug.LogError(questReward); if (questReward.Contains("npc")) { var unitChunkNumber = unit.ChunkNumber; var chunk = ChunkManager.GetChunkByNum(unitChunkNumber); chunk.SetupUnit(questReward, pos, unit.Owner); } else if (questReward.Contains("item") || questReward.Contains("building")) { // Debug.LogError("item/building"); SpecialActions.SpawnItem(questReward, pos, unit.Owner); } }
private void Awake() { if (instance == null) { instance = this; } }
public static void SelectSearchOrderTab() { var mainwindow = ControlFinder.FindByClassName("NavigationWindow"); var tabs = mainwindow.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.TabItem)); var search_order = tabs.Cast <AutomationElement>().ToList().First(tab => tab.Current.Name.Equals("SEARCH ORDER")); SpecialActions.SelectElementItem(search_order); }
public static void BookFlight(string Tocity, string FromCity, string FlightDate, string FlightClass, string TicketQuantity, string Passenger) { string FromCityCombo = "fromCity"; string ToCityCombo = "toCity"; string Date = "PART_TextBox"; string Class = "Class"; string Tickets = "numOfTickets"; string DataGrid = "flightsDataGrid"; string SelectFlight = "selectFlightBtn"; string PassengerName = "passengerName"; string OrderButton = "orderBtn"; Actions.ComboboxSelectItem(FromCityCombo, Tocity); Actions.ComboboxSelectItem(ToCityCombo, FromCity); Actions.SetValue(Date, FlightDate); Actions.ComboboxSelectItem(Class, FlightClass); Actions.ComboboxSelectItem(Tickets, TicketQuantity); SpecialActions.FindFlights(); Actions.TableItemSelect(DataGrid, 1); Actions.Click(SelectFlight); Actions.SetValue(PassengerName, Passenger); Actions.Click(OrderButton); Thread.Sleep(2000); }
public static void Update(GameUnit unit) { if (unit.State != EventManager.InProgressEvents.Stay) { ProgressUnitBar.RemoveProgressBar(unit); unit.StayOnBuilding = false; return; } //Dropping at ground if (unit.pickUped != null) { //if item on ground and not stacking return if (!SecondaryGroundLvL.IsEmptyPos(unit.ChunkNumber, unit.CurrentPos)) { var gEntName = SecondaryGroundLvL.GetGroundEnt(unit.ChunkNumber, unit.CurrentPos).OriginalName; if (ItemGroup.GetStackResult(unit.pickUped.OriginalName, gEntName).Length == 0) { return; } } //Item on ground if (!SecondaryGroundLvL.IsEmptyPos(unit.ChunkNumber, unit.CurrentPos)) { var progressName = ProgressUnitBar.ProgressName.Stucking; ProgressUnitBar.Setup(unit, progressName, NeedToPickupTime); //Time to pickup if (!ProgressUnitBar.IsReady(unit) || !ProgressUnitBar.IsThisProgressName(unit, progressName)) { return; } var onGround = SecondaryGroundLvL.GetGroundEnt(unit.ChunkNumber, unit.CurrentPos); var stack = ItemGroup.GetStackResult(unit.pickUped.OriginalName, onGround.OriginalName); if (stack.Length > 0) { var item = SpecialActions.SpawnItem(stack, unit.CurrentPos, unit.Owner); ItemEvents.OnDropItem(unit.pickUped, unit); unit.pickUped.KillSelf(); onGround.KillSelf(); unit.pickUped = null; SecondaryGroundLvL.SetGroundEnt(unit.ChunkNumber, unit.CurrentPos, item); QuestManager.OnItemStuck(item); var chunk = ChunkManager.GetChunkByNum(unit.ChunkNumber); chunk.SetIndex(unit.CurrentPos, unit.PrefabIndex); chunk.SetObjectAtPos(unit.CurrentPos, unit); } } //Ground empty else { var progressName = ProgressUnitBar.ProgressName.Dropping; ProgressUnitBar.Setup(unit, progressName, NeedToPickupTime); //Time to pickup if (!ProgressUnitBar.IsReady(unit) || !ProgressUnitBar.IsThisProgressName(unit, progressName)) { return; } var prev3DPos = Util.Get3DPosByIndex(unit.pickUped.CurrentPos); var pos = unit.pickUped.transform.position - prev3DPos; pos.z = 0; var d = unit.CurrentPos; var get3DPosByIndex = Util.Get3DPosByIndex(d); get3DPosByIndex.z -= d.z / 150f; unit.pickUped.CurrentPos = unit.CurrentPos; unit.pickUped.transform.position = get3DPosByIndex + pos; unit.pickUped.transform.Translate(0, 0, 0.01f); var rend = unit.pickUped.GetComponent <SpriteRenderer>(); rend.enabled = true; SecondaryGroundLvL.SetGroundEnt(unit.ChunkNumber, unit.CurrentPos, unit.pickUped); ItemEvents.OnDropItem(unit.pickUped, unit); unit.pickUped = null; } ProgressUnitBar.RemoveProgressBar(unit); } //Pickuping from ground else if ( unit.StayOnBuilding || !SecondaryGroundLvL.IsEmptyPos(unit.ChunkNumber, unit.CurrentPos)) { var progressName = ProgressUnitBar.ProgressName.Pickuping; var item = SecondaryGroundLvL.GetGroundEnt(unit.ChunkNumber, unit.CurrentPos); var objGroup = item.Group; if (objGroup.ToLower() != "item") { return; } if (item.SoloEvolution) { return; } unit.StayOnBuilding = true; ProgressUnitBar.Setup(unit, progressName, NeedToPickupTime); if (!ProgressUnitBar.IsReady(unit) || !ProgressUnitBar.IsThisProgressName(unit, progressName)) { return; } unit.StayOnBuilding = false; ProgressUnitBar.RemoveProgressBar(unit, progressName); if (item.Destroyed) { return; } var rend = item.GetComponent <SpriteRenderer>(); rend.enabled = false; unit.pickUped = item; ItemEvents.OnPickup(unit.pickUped, unit); SecondaryGroundLvL.RemovePos(unit.ChunkNumber, unit.CurrentPos); } }
private void Start() { pathModel = GetComponent <PathModel>(); specialActions = SpecialActions.instance; }
private void Start() { specialActions = SpecialActions.instance; }