All Downloads are FREE. Search and download functionalities are using the official Maven repository.

automated.assertions.SeleniumAssertion Maven / Gradle / Ivy

The newest version!
package automated.assertions;

import automated.platforms.web.WebActions;
import automated.reporting.TestReporter;

/**
 * Created by Ismail on 12/25/2017.
 * This class contains all specific Selenium Assertions
 * Assert actions that needs some calls from Selenium WebDriver
 */
public class SeleniumAssertion {

    /*************** Class Methods Section ***************/
    // This method get current Title of active tab and compare with expected
    // String provided in method params
    // If fails will fail test case
    public static void assertCurrentTitle(String expectedTitle, String errMessage) {
        // Get current Title
        String actualTitle = WebActions.getCurrentTitle().toLowerCase();
        // Call verifyTwoStrings method from StringAssertion class and pass
        // Actual, expected strings to compare them
        StringAssertion.verifyTwoStrings(actualTitle, expectedTitle, errMessage);
        // If pass then will write to report that step passed
        TestReporter.pass("Current Title is correct: " + actualTitle);
    }

    // This method get current URL of active tab and compare with expected
    // String provided in method params
    // If fails will fail test case
    public static void assertCurrentURL(String expectedURL, String errMessage) {
        // Get current URL
        String actualURL = WebActions.getCurrentURL();
        // Call verifyTwoStrings method from StringAssertion class and pass
        // Actual, expected strings to compare them
        StringAssertion.verifyTwoStrings(actualURL, expectedURL, errMessage);
        // If pass then will write to report that step passed
        TestReporter.pass("Current URL is correct: " + actualURL);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy