Skip to content

Commit b0f9380

Browse files
Merge pull request #51 from AutomateThePlanet/ai-augmention-updates
Updates to Bellatrix.Mobile
2 parents 0bdd86a + bf36fc7 commit b0f9380

File tree

5 files changed

+21
-85
lines changed

5 files changed

+21
-85
lines changed

src/Bellatrix.Mobile/findstrategies/iOS/ComponentCreateExtensions.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public static TComponent CreateByName<TComponent>(this Component<IOSDriver, Appi
3535
public static TComponent CreateByClass<TComponent>(this Component<IOSDriver, AppiumElement> element, string elementClass)
3636
where TComponent : Component<IOSDriver, AppiumElement> => element.Create<TComponent, FindClassNameStrategy>(new FindClassNameStrategy(elementClass));
3737

38-
public static TComponent CreateByIOSUIAutomation<TComponent>(this Component<IOSDriver, AppiumElement> element, string automationId)
39-
where TComponent : Component<IOSDriver, AppiumElement> => element.Create<TComponent, FindIOSUIAutomationStrategy>(new FindIOSUIAutomationStrategy(automationId));
40-
4138
public static TComponent CreateByXPath<TComponent>(this Component<IOSDriver, AppiumElement> element, string xpath)
4239
where TComponent : Component<IOSDriver, AppiumElement> => element.Create<TComponent, FindXPathStrategy>(new FindXPathStrategy(xpath));
4340

@@ -59,9 +56,6 @@ public static ComponentsList<TComponent, FindNameStrategy, IOSDriver, AppiumElem
5956
public static ComponentsList<TComponent, FindClassNameStrategy, IOSDriver, AppiumElement> CreateAllByClass<TComponent>(this Component<IOSDriver, AppiumElement> element, string elementClass)
6057
where TComponent : Component<IOSDriver, AppiumElement> => new ComponentsList<TComponent, FindClassNameStrategy, IOSDriver, AppiumElement>(new FindClassNameStrategy(elementClass), element.WrappedElement);
6158

62-
public static ComponentsList<TComponent, FindIOSUIAutomationStrategy, IOSDriver, AppiumElement> CreateAllByIOSUIAutomation<TComponent>(this Component<IOSDriver, AppiumElement> element, string automationId)
63-
where TComponent : Component<IOSDriver, AppiumElement> => new ComponentsList<TComponent, FindIOSUIAutomationStrategy, IOSDriver, AppiumElement>(new FindIOSUIAutomationStrategy(automationId), element.WrappedElement);
64-
6559
public static ComponentsList<TComponent, FindXPathStrategy, IOSDriver, AppiumElement> CreateAllByXPath<TComponent>(this Component<IOSDriver, AppiumElement> element, string xpath)
6660
where TComponent : Component<IOSDriver, AppiumElement> => new ComponentsList<TComponent, FindXPathStrategy, IOSDriver, AppiumElement>(new FindXPathStrategy(xpath), element.WrappedElement);
6761

src/Bellatrix.Mobile/findstrategies/iOS/ComponentRepositoryExtensions.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public static TComponent CreateByName<TComponent>(this ComponentCreateService re
2929
public static TComponent CreateByClass<TComponent>(this ComponentCreateService repo, string elementClass)
3030
where TComponent : Component<IOSDriver, AppiumElement> => repo.Create<TComponent, FindClassNameStrategy, IOSDriver, AppiumElement>(new FindClassNameStrategy(elementClass));
3131

32-
public static TComponent CreateByIOSUIAutomation<TComponent>(this ComponentCreateService repo, string automationId)
33-
where TComponent : Component<IOSDriver, AppiumElement> => repo.Create<TComponent, FindIOSUIAutomationStrategy, IOSDriver, AppiumElement>(new FindIOSUIAutomationStrategy(automationId));
34-
3532
public static TComponent CreateByIOSNsPredicate<TComponent>(this ComponentCreateService repo, string predicate)
3633
where TComponent : Component<IOSDriver, AppiumElement> => repo.Create<TComponent, FindIOSNsPredicateStrategy, IOSDriver, AppiumElement>(new FindIOSNsPredicateStrategy(predicate));
3734

@@ -56,9 +53,6 @@ public static ComponentsList<TComponent, FindNameStrategy, IOSDriver, AppiumElem
5653
public static ComponentsList<TComponent, FindClassNameStrategy, IOSDriver, AppiumElement> CreateAllByClass<TComponent>(this ComponentCreateService repo, string elementClass)
5754
where TComponent : Component<IOSDriver, AppiumElement> => new ComponentsList<TComponent, FindClassNameStrategy, IOSDriver, AppiumElement>(new FindClassNameStrategy(elementClass), null);
5855

59-
public static ComponentsList<TComponent, FindIOSUIAutomationStrategy, IOSDriver, AppiumElement> CreateAllByIOSUIAutomation<TComponent>(this ComponentCreateService repo, string automationId)
60-
where TComponent : Component<IOSDriver, AppiumElement> => new ComponentsList<TComponent, FindIOSUIAutomationStrategy, IOSDriver, AppiumElement>(new FindIOSUIAutomationStrategy(automationId), null);
61-
6256
public static ComponentsList<TComponent, FindIOSNsPredicateStrategy, IOSDriver, AppiumElement> CreateAllByIOSNsPredicate<TComponent>(this ComponentCreateService repo, string predicate)
6357
where TComponent : Component<IOSDriver, AppiumElement> => new ComponentsList<TComponent, FindIOSNsPredicateStrategy, IOSDriver, AppiumElement>(new FindIOSNsPredicateStrategy(predicate), null);
6458

@@ -67,4 +61,4 @@ public static ComponentsList<TComponent, FindXPathStrategy, IOSDriver, AppiumEle
6761

6862
public static ComponentsList<TComponent, FindValueContainingStrategy, IOSDriver, AppiumElement> CreateAllByValueContaining<TComponent>(this ComponentCreateService repo, string text)
6963
where TComponent : Component<IOSDriver, AppiumElement> => new ComponentsList<TComponent, FindValueContainingStrategy, IOSDriver, AppiumElement>(new FindValueContainingStrategy(text), null);
70-
}
64+
}

src/Bellatrix.Mobile/findstrategies/iOS/FindIOSUIAutomationStrategy.cs

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/Bellatrix.Mobile/findstrategies/iOS/FindStrategyFactory.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,5 @@ public class FindStrategyFactory
2929

3030
public FindXPathStrategy XPath(string name) => new FindXPathStrategy(name);
3131

32-
public FindIOSUIAutomationStrategy IOSUIAutomation(string name) => new FindIOSUIAutomationStrategy(name);
33-
3432
public FindValueContainingStrategy ValueContaining(string name) => new FindValueContainingStrategy(name);
35-
}
33+
}

src/Bellatrix.Mobile/services/TouchActionsService.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ public TouchActionsService<TDriver, TDriverElement> Press<TComponent>(TComponent
6666
var sequence = new SI.ActionSequence(touchAction, 0);
6767
sequence.AddAction(touchAction.CreatePointerMove(SI.CoordinateOrigin.Viewport, element.Location.X, element.Location.Y, TimeSpan.Zero));
6868
sequence.AddAction(touchAction.CreatePointerDown(PointerButton.TouchContact));
69-
//if (waitTimeSeconds > 0)
70-
//{
71-
// sequence.AddAction(new SI.PauseAction(touchAction, TimeSpan.FromSeconds(waitTimeSeconds)));
72-
//}
69+
if (waitTimeSeconds > 0)
70+
{
71+
sequence.AddAction(touchAction.CreatePause(TimeSpan.FromSeconds(waitTimeSeconds)));
72+
}
7373
sequence.AddAction(touchAction.CreatePointerUp(PointerButton.TouchContact));
7474
_actionSequences.Add(sequence);
7575
return this;
@@ -81,10 +81,10 @@ public TouchActionsService<TDriver, TDriverElement> Press(int x, int y, int wait
8181
var sequence = new SI.ActionSequence(touchAction, 0);
8282
sequence.AddAction(touchAction.CreatePointerMove(SI.CoordinateOrigin.Viewport, x, y, TimeSpan.Zero));
8383
sequence.AddAction(touchAction.CreatePointerDown(PointerButton.TouchContact));
84-
//if (waitTimeSeconds > 0)
85-
//{
86-
// sequence.AddAction(new PauseAction(touchAction, TimeSpan.FromSeconds(waitTimeSeconds)));
87-
//}
84+
if (waitTimeSeconds > 0)
85+
{
86+
sequence.AddAction(touchAction.CreatePause(TimeSpan.FromSeconds(waitTimeSeconds)));
87+
}
8888
sequence.AddAction(touchAction.CreatePointerUp(PointerButton.TouchContact));
8989
_actionSequences.Add(sequence);
9090
return this;
@@ -97,7 +97,7 @@ public TouchActionsService<TDriver, TDriverElement> LongPress<TComponent>(TCompo
9797
var sequence = new SI.ActionSequence(touchAction, 0);
9898
sequence.AddAction(touchAction.CreatePointerMove(SI.CoordinateOrigin.Viewport, element.Location.X, element.Location.Y, TimeSpan.Zero));
9999
sequence.AddAction(touchAction.CreatePointerDown(PointerButton.TouchContact));
100-
//sequence.AddAction(new PauseAction(touchAction, TimeSpan.FromSeconds(waitTimeSeconds)));
100+
sequence.AddAction(touchAction.CreatePause(TimeSpan.FromSeconds(waitTimeSeconds)));
101101
sequence.AddAction(touchAction.CreatePointerUp(PointerButton.TouchContact));
102102
_actionSequences.Add(sequence);
103103
return this;
@@ -109,20 +109,20 @@ public TouchActionsService<TDriver, TDriverElement> LongPress(int x, int y, int
109109
var sequence = new SI.ActionSequence(touchAction, 0);
110110
sequence.AddAction(touchAction.CreatePointerMove(SI.CoordinateOrigin.Viewport, x, y, TimeSpan.Zero));
111111
sequence.AddAction(touchAction.CreatePointerDown(PointerButton.TouchContact));
112-
//sequence.AddAction(new PauseAction(touchAction, TimeSpan.FromSeconds(waitTimeSeconds)));
112+
sequence.AddAction(touchAction.CreatePause(TimeSpan.FromSeconds(waitTimeSeconds)));
113113
sequence.AddAction(touchAction.CreatePointerUp(PointerButton.TouchContact));
114114
_actionSequences.Add(sequence);
115115
return this;
116116
}
117117

118-
//public TouchActionsService<TDriver, TDriverElement> Wait(long waitTimeMilliseconds)
119-
//{
120-
// var touchAction = new PointerInputDevice(SI.PointerKind.Touch);
121-
// var sequence = new SI.ActionSequence(touchAction, 0);
122-
// sequence.AddAction(new PauseAction(touchAction, TimeSpan.FromMilliseconds(waitTimeMilliseconds)));
123-
// _actionSequences.Add(sequence);
124-
// return this;
125-
//}
118+
public TouchActionsService<TDriver, TDriverElement> Wait(long waitTimeMilliseconds)
119+
{
120+
var touchAction = new PointerInputDevice(SI.PointerKind.Touch);
121+
var sequence = new SI.ActionSequence(touchAction, 0);
122+
sequence.AddAction(touchAction.CreatePause(TimeSpan.FromMilliseconds(waitTimeMilliseconds)));
123+
_actionSequences.Add(sequence);
124+
return this;
125+
}
126126

127127
public TouchActionsService<TDriver, TDriverElement> MoveTo<TComponent>(TComponent element)
128128
where TComponent : Component<TDriver, TDriverElement>
@@ -182,4 +182,4 @@ public void Perform()
182182
_actionSequences.Clear();
183183
}
184184
}
185-
}
185+
}

0 commit comments

Comments
 (0)