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

org.fluentlenium.core.annotation.Page Maven / Gradle / Ivy

package org.fluentlenium.core.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Mark a field as a Page Object that should be automatically created by FluentLenium.
 *
 * 
 * @PageUrl("/")
 * public class Homepage extends FluentPage {
 *
 *      //@FindBy annotated elements
 *      //...
 * }
 *
 * public class HomepageTest extends FluentPage {
 *
 *      @Page
 *      Homepage homepage;
 *
 *      //Homepage is instantiated and can be used by test methods.
 * }
 * 
*

* If you are using Cucumber, it is not just page object classes but also step definitions classes * that can be instantiated and injected using this annotation. *

* Although injecting step definitions classes into other step definitions classes might not be the best approach, * it is still achievable using this annotation if needed. *

 * public class LoginSteps extends FluentCucumberTest {
 *
 *     @Given("a(n) {} user logged in")
 *     public void aUserLoggedIn(User user) {
 *         //login logic
 *     }
 * }
 *
 * public class HomepageSteps extends FluentCucumberTest {
 *
 *      @Page
 *      Homepage homepage;
 *      @Page
 *      LoginSteps loginSteps;
 *
 *      @Given("{} user does stuff")
 *      public void userDoesStuff(User user) {
 *          loginSteps.aUserLoggedIn(user);
 *          //does some stuff
 *      }
 * }
 * 
*/ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface Page { }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy