How to use validateKeysInDataFile method of com.paypal.selion.plugins.GUIObjectDetails class

Best SeLion code snippet using com.paypal.selion.plugins.GUIObjectDetails.validateKeysInDataFile

Source:GUIObjectDetailsTest.java Github

copy

Full Screen

...29 public void validateWebElements() throws Exception {30 String dataFile = "src/test/resources/SampleV2YamlPage.yaml";31 DataReader reader = new DataReader(dataFile);32 TestPlatform currentPlatform = reader.platform();33 GUIObjectDetails.validateKeysInDataFile(reader.getKeys(), dataFile, currentPlatform);34 }35 @Test36 public void validateIOSElements() throws Exception {37 String dataFile = "src/test/resources/IOSInteractionPage.yaml";38 DataReader reader = new DataReader(dataFile);39 TestPlatform currentPlatform = reader.platform();40 GUIObjectDetails.validateKeysInDataFile(reader.getKeys(), dataFile, currentPlatform);41 }42 @Test43 public void validateMobileElements() throws Exception {44 String dataFile = "src/test/resources/SampleMobilePage.yaml";45 DataReader reader = new DataReader(dataFile);46 TestPlatform currentPlatform = reader.platform();47 GUIObjectDetails.validateKeysInDataFile(reader.getKeys(), dataFile, currentPlatform);48 }49 @Test50 public void validateCustomWebElements() throws Exception {51 String dataFile = "src/test/resources/CustomWebElementPage.yaml";52 HtmlSeLionElementSet.getInstance().add("com.paypal.test.CustomElement");53 HtmlSeLionElementSet.getInstance().add("com.paypal.test.AnotherElement");54 DataReader reader = new DataReader(dataFile);55 TestPlatform currentPlatform = reader.platform();56 GUIObjectDetails.validateKeysInDataFile(reader.getKeys(), dataFile, currentPlatform);57 }58 @Test59 public void validateCustomMobileElements() throws Exception {60 String dataFile = "src/test/resources/CustomIOSElementPage.yaml";61 IOSSeLionElementSet.getInstance().add("com.paypal.test.CustomElement");62 IOSSeLionElementSet.getInstance().add("com.paypal.test.AnotherElement");63 DataReader reader = new DataReader(dataFile);64 TestPlatform currentPlatform = reader.platform();65 GUIObjectDetails.validateKeysInDataFile(reader.getKeys(), dataFile, currentPlatform);66 }67 @Test68 public void validateCustomElementInContainer() throws Exception {69 String dataFile = "src/test/resources/CustomElementInContainerPage.yaml";70 HtmlSeLionElementSet.getInstance().add("com.paypal.test.CustomElement");71 DataReader reader = new DataReader(dataFile);72 TestPlatform currentPlatform = reader.platform();73 GUIObjectDetails.validateKeysInDataFile(reader.getKeys(), dataFile, currentPlatform);74 String expectedContainerName = "foo" + "Container";75 String expectedCustomName = expectedContainerName + "#exampleCustomElement";76 assertTrue(reader.getKeys().contains(expectedContainerName));77 assertTrue(reader.getKeys().contains(expectedCustomName));78 // get the GUI customElement and verify parent is the container79 GUIObjectDetails customGuiElement = GUIObjectDetails.transformKeys(reader.getKeys(), currentPlatform).get(1);80 assertTrue(customGuiElement.getParent().contains(expectedContainerName));81 }82 @Test(expectedExceptions = { IllegalArgumentException.class })83 public void testInvalidElement() throws Exception {84 String dataFile = "src/test/resources/SampleV2YamlPage.yaml";85 DataReader reader = new DataReader(dataFile);86 // Note: forcing to load a WEaB platform YAML using IOS platform87 GUIObjectDetails.validateKeysInDataFile(reader.getKeys(), dataFile, TestPlatform.IOS);88 }89 @Test(expectedExceptions = { IllegalArgumentException.class })90 public void testInvalidSeLionElement() {91 List<String> invalidKeyList = new ArrayList<>();92 invalidKeyList.add("invalidButton1");93 GUIObjectDetails.validateKeysInDataFile(invalidKeyList, "DummyPage", TestPlatform.WEB);94 }95}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run SeLion automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful