Skip to content

Commit

Permalink
Merge branch 'master' into BugFix/DoubleClickIssue
Browse files Browse the repository at this point in the history
  • Loading branch information
prashelke committed Jan 29, 2024
2 parents 518253e + c77c904 commit 896f4d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -909,11 +909,11 @@ private void MobileDeviceActionHandler(ActMobileDevice act)
break;

case ActMobileDevice.eMobileDeviceAction.SwipeDown:
SwipeScreen(eSwipeSide.Down, 0.25);
SwipeScreen(eSwipeSide.Down, 1);
break;

case ActMobileDevice.eMobileDeviceAction.SwipeUp:
SwipeScreen(eSwipeSide.Up, 0.25);
SwipeScreen(eSwipeSide.Up, 1);
break;
case ActMobileDevice.eMobileDeviceAction.SwipeLeft:
SwipeScreen(eSwipeSide.Left);
Expand Down Expand Up @@ -1424,7 +1424,6 @@ await Task.Run(() =>

public void SwipeScreen(eSwipeSide side, double impact = 1)
{
impact = 1;
System.Drawing.Size sz = Driver.Manage().Window.Size;
double startX;
double startY;
Expand All @@ -1445,15 +1444,15 @@ public void SwipeScreen(eSwipeSide side, double impact = 1)
endY = sz.Height * 0.3;
break;
case eSwipeSide.Right: // center of left side
startX = sz.Width * 0.8 * impact;
startX = sz.Width * 0.7 * impact;
startY = sz.Height * 0.5;
endX = sz.Width * 0.1;
endX = sz.Width * 0.3;
endY = sz.Height * 0.5;
break;
case eSwipeSide.Left: // center of right side
startX = sz.Width * 0.1;
startX = sz.Width * 0.3;
startY = sz.Height * 0.5;
endX = sz.Width * 0.8 * impact;
endX = sz.Width * 0.7 * impact;
endY = sz.Height * 0.5;
break;
default:
Expand All @@ -1463,25 +1462,14 @@ public void SwipeScreen(eSwipeSide side, double impact = 1)
(BuildTouchAction(Driver, startX, startY, endX, endY, 200)).Perform();
}

public ITouchAction BuildTouchAction(AppiumDriver driver, double startX, double startY, double endX, double endY, int waitDuration=200)
public ITouchAction BuildTouchAction(AppiumDriver driver, double startX, double startY, double endX, double endY, int waitDuration = 200)
{
ITouchAction touchAction;

if (DevicePlatformType == eDevicePlatformType.Android)
{
touchAction = new TouchAction(driver)
.Press(startX, startY)
.MoveTo(endX, endY)
.Release();
}
else //iOS
{
touchAction = new TouchAction(driver)
.Press(startX, startY)
.Wait(waitDuration)
.MoveTo(endX, endY)
.Release();
}
touchAction = new TouchAction(driver)
.Press(startX, startY)
.Wait(waitDuration)
.MoveTo(endX, endY)
.Release();

return touchAction;
}
Expand Down
2 changes: 1 addition & 1 deletion Ginger/GingerCoreNET/GingerCoreNET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@

<ItemGroup>

<PackageReference Include="Appium.WebDriver" Version="5.0.0-beta01" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.1" />

<PackageReference Include="Azure.Identity" Version="1.10.4" />

Expand Down

0 comments on commit 896f4d5

Please sign in to comment.