Skip to content

Instantly share code, notes, and snippets.

@nadvolod
Last active April 30, 2020 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nadvolod/f07e45cae6799042974ed0b1127df954 to your computer and use it in GitHub Desktop.
Save nadvolod/f07e45cae6799042974ed0b1127df954 to your computer and use it in GitHub Desktop.
A test that shows how to use composition
public class CompositionTest
{
@Test
public void aTestUsingComposition() {
InventoryPage inventoryPage = new InventoryPage(driver);
inventoryPage.open();
//If you want to interact with the header
HeaderComponent header = new HeaderComponent(driver);
header.search("backpack");
//If you want to interact with items on the page
InventoryCollectionComponent collection = new InventoryCollectionComponent(driver);
//Here is us using composition to reference an Item inside of the Collection
collection.item.addToCart(ItemType.hoodie);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment