public static void OpenElement(string elementName) { try { var elementList = ElementList.GetInternalElement().FindElementsByClassName("android.widget.EditText"); for (int i = 0; i < elementList.Count; i++) { var element = elementList[i]; if (element.Text.Contains(elementName)) { ElementList.GetInternalElement().FindElementsById("document_icon")[i].Click(); break; } } ConsoleMessage.Pass(String.Format("{0}. Find and tap on flow element with name: {1} in flow list", ActivityName, elementName)); } catch (Exception ex) { ConsoleMessage.Fail( String.Format("{0}. Can't Find and tap on flow element with name: {1} in flow list", ActivityName, elementName), ex); throw; } }
public static void TapOnFlowElement(int position) { try { ElementList.GetInternalElement().FindElementsById("document_icon")[position].Click(); ConsoleMessage.Pass(String.Format("{0}. Tap flow element by position: {1}", ActivityName, position)); } catch (Exception ex) { ConsoleMessage.Fail(String.Format("{0}. Tap flow element by position: {1}", ActivityName, position), ex); throw; } }
public static void OpenElement(int pos) { try { ElementList.GetInternalElement().FindElementsById("document_icon")[pos].Click(); ConsoleMessage.Pass(String.Format("{0}. Find and tap on flow element at position: {1} in flow list", ActivityName, pos)); } catch (Exception ex) { ConsoleMessage.Fail( String.Format("{0}. Find and tap on flow element at position: {1} in flow list", ActivityName, pos), ex); throw; } }
public static void VerifyElementMarkAsBlocked(int position) { try { var currentText = ElementList.GetInternalElement().FindElementsById("document_name")[position].Text; Assert.True(String.IsNullOrEmpty(currentText), "Current element text name: " + currentText + " but should be empty"); ConsoleMessage.Pass(String.Format("{0}. Verify, element at position: {1} is blocked", ActivityName, position)); } catch (Exception ex) { ConsoleMessage.Fail(String.Format("{0}. Can't verify element at position: {1} is blocked", ActivityName, position), ex); throw; } }
public static void VerifyListNotEmpty() { try { int currentSize = ElementList.GetInternalElement().FindElementsByClassName("android.widget.TableLayout").Count; Assert.Greater(currentSize, 0, "Current list item count equal 0"); ConsoleMessage.Pass(String.Format("{0}. Verify {1} not empty", ActivityName, ElementList.ElementName)); } catch (Exception ex) { ConsoleMessage.Fail(String.Format("{0}. {1} is empty", ActivityName, "Pulse list"), ex); throw; } }
public static void VerifyElementName(int position, string expectedName) { try { var currentText = ElementList.GetInternalElement().FindElementsById("document_name")[position].Text; Assert.True(currentText.Contains(expectedName), String.Format("Current element name: {0} at position {1} not contain expected: {2}", currentText, position, expectedName)); ConsoleMessage.Pass(String.Format("{0}. Verify, element at position: {1} contain name: {2}", ActivityName, position, expectedName)); } catch (Exception ex) { ConsoleMessage.Fail(String.Format("{0}. Verify FAIL, element at position: {1} not contain name: {2}", ActivityName, position, expectedName), ex); throw; } }
public static void AddElement(string elementName) { AndroidElement dragItem = LibraryList.FindElement(elementName); AndroidElement dropItem = ElementList.GetInternalElement(); try { TouchAction action = new TouchAction(Appium.Instance.Driver); action.Press(dragItem).MoveTo(dropItem).Release().Perform(); ConsoleMessage.Pass(String.Format("{0}. Add element to flow. Drag item: {1} and drop to: {2}", ActivityName, elementName, ElementList.ElementName)); } catch (Exception ex) { ConsoleMessage.Fail(String.Format("{0}. Can't add element to flow. Can't drag item: {1} and drop to: {2}", ActivityName, elementName, ElementList.ElementName), ex); throw; } }
public static void MoveToFlow() { try { var flowElement = ElementList.GetInternalElement() .FindElementByClassName("android.widget.TableRow") .FindElementsByClassName("android.widget.TextView")[2]; string expectedFlowName = flowElement.Text; flowElement.Click(); CommonOperation.Delay(1); string currentName = FlowActivity.FlowName.GetInternalElement().Text; Assert.AreEqual(expectedFlowName, currentName, "Current flow name: " + currentName + " not equal to expected: " + expectedFlowName); ConsoleMessage.Pass(String.Format("{0}. Verify, move to flow function. Click on first flow in list: {1}", ActivityName, expectedFlowName)); } catch (Exception ex) { ConsoleMessage.Fail(String.Format("{0}. Can't verify move to flow function", ActivityName), ex); throw; } }