This test case deals with counting of the number of posts currently available in the blog, using the following code:
@Test public void testCountPost() { AdminLoginPage loginPage = PageFactory.initElements(driver, AdminLoginPage.class); AllPostsPage allPostsPage = loginPage.login(username, password); Assert.assertEquals(allPostsPage.getAllPostsCount(), 1);}
The following is the sequence of steps executed in the preceding test script to test counting the number of posts in the WordPress blog:
- It creates an instance of the AdminLoginPage PageObject that uses the driver instance created in the previous step.
- Once it gets the instance of the AdminLoginPage PageObject, it uses the login service to log into the WordPress Admin console. ...