package cz.moneta.test.harness.support.web;


import java.lang.annotation.*;

/**
 * Annotation is used for check element content. String parameter is <u>mandatory</u>. If Element does not contains
 * defined content <u><i>AssertException</i></u> is thrown.<br>
 * <u>Example:</u>
 *    <pre>
 *         {@literal @}CheckElementContent (SOME_VALUE)
 *          SomePage checkSomeElementContent(String content);
 *    </pre>
 * {@link #by()} can be used for use XPATH, ID or DEFAULT to identify element.<br>
 * <u>Example2:</u><br>
 *    <pre>
 *         {@literal @}CheckElementContent (
 *               value = SOME_XPATH,
 *               by = Lookup.XPATH,
 *          )
 *          SomePage checkSomeElementContent(String content);
 *    </pre>
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(CheckElementContents.class)
public @interface CheckElementContent {
    /**
     * Value for element identification.
     */
    String value();

    /**
     * Type of element identification which will be used for element search. XPATH, ID or DEFAULT can be used.
     * @see Lookup
     */
    Lookup by() default Lookup.DEFAULT;

    /**
     * If set true will be used input String parameter of method to substitute %s in xpath. In container of method with TypeInto annotation you must have everywhere use just normal xpath or dynamic xpath!
     */
    boolean isStringDynamicXpath() default false;
}
