Skip to content

Instantly share code, notes, and snippets.

@angiejones
Created February 21, 2021 23:59
Show Gist options
  • Save angiejones/67ab84d225ecaa6de84c4c4f36546905 to your computer and use it in GitHub Desktop.
Save angiejones/67ab84d225ecaa6de84c4c4f36546905 to your computer and use it in GitHub Desktop.
Adding visual testing
@Test
public void testAddTasksInDifferentCategories(){
String task1 = "fix bug";
String task2 = "wash car";
String task3 = "grocery shopping";
String task4 = "get nails done";
screen.addItem(task1, TasksScreen.TaskColor.PURPLE);
screen.addItem(task2, TasksScreen.TaskColor.YELLOW);
screen.addItem(task3, TasksScreen.TaskColor.BLUE);
screen.addItem(task4, TasksScreen.TaskColor.PINK);
List tasks = screen.getTasks();
assertTrue(tasks.contains(task1), task1 + " not on the list");
assertTrue(tasks.contains(task2), task2 + " not on the list");
assertTrue(tasks.contains(task3), task3 + " not on the list");
assertTrue(tasks.contains(task4), task4 + " not on the list");
assertEquals(tasks.size(), 4, "Number of todo items");
//Visual testing
Eyes eyes = new Eyes();
eyes.open(driver, "ToDo App", "colored tasks");
eyes.check(Target.window().ignore(screen.getStatusBarLocator())); //status bar is dynamic. let's ignore
eyes.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment