-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for Appium Client v8 and v9 (#141)
* adding support for v8 and v9 * adding backward compatibility for Mobile Element
- Loading branch information
Showing
8 changed files
with
99 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/test/java/io/percy/appium/lib/ScreenshotOptionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.percy.appium.lib; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.openqa.selenium.WebElement; | ||
|
||
import io.appium.java_client.MobileElement; | ||
|
||
@RunWith(org.mockito.junit.MockitoJUnitRunner.class) | ||
public class ScreenshotOptionsTest { | ||
@Test | ||
public void testCastMobileElementsToWebElements() { | ||
ScreenshotOptions casting = new ScreenshotOptions(); | ||
|
||
// Create a list of MobileElements | ||
List<Object> mobileElements = new ArrayList<>(); | ||
mobileElements.add(new MobileElement() {}); | ||
mobileElements.add(new Object()); | ||
mobileElements.add(new Object()); | ||
mobileElements.add(new MobileElement() {}); | ||
mobileElements.add(new MobileElement() {}); | ||
|
||
// Call the function to cast them to WebElements | ||
List<WebElement> webElements = casting.castMobileElementsToWebElements(mobileElements); | ||
|
||
// Check if the sizes of the original and converted lists are the same | ||
assertEquals(webElements.size(), 3); | ||
|
||
// Check that each element in the converted list is an instance of WebElement | ||
for (WebElement element : webElements) { | ||
assertTrue(element instanceof WebElement); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters