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

com.nordstrom.automation.selenium.annotations.PageUrl Maven / Gradle / Ivy

Go to download

Selenium Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium (WebDriver).

There is a newer version: 28.3.1-s4
Show newest version
package com.nordstrom.automation.selenium.annotations;

import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

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

import com.nordstrom.automation.selenium.SeleniumConfig;
import com.nordstrom.automation.selenium.model.ComponentContainer;

/**
 * This annotation can be applied to page class declarations to enable landing page verification and direct navigation.
 * 

* LANDING PAGE VERIFICATION *

* The {@link ComponentContainer#verifyLandingPage} method is used to verify actual landing page against elements * of the {@link PageUrl} annotation of the specified page object. *

* NOTES:

    *
  • The values and patterns used to verify the actual landing page URL are provided by the {@link PageUrl} * annotation of the specified page object combined with the configured {@link SeleniumConfig#getTargetUri * target URI}.
  • *
  • Expected path can be specified by either explicit value or pattern. If the {@code pattern} element of * the {@link PageUrl} annotation is specified, its value provides a template to verify the actual path. * Otherwise, the actual path must match the path component of the specified {@code value} element of the * {@link PageUrl} annotation.
  • *
  • Expected parameters can be specified by either explicit query or a collection of name/pattern pairs. * If the {@code params} element of the {@link PageUrl} annotation is specified, its value provides the * collection of name/pattern pairs used to verify the actual parameters. Otherwise, the actual query * parameters must include all of the name/value pairs in the query component of the specified {@code * value} element of the {@link PageUrl} annotation.
  • *
*

* DIRECT PAGE NAVIGATION *

* The core of the implementation for direct page navigation uses {@link ComponentContainer#getPageUrl} to get * the URL defined by the specified {@link PageUrl} annotation. *

* NOTES:

    *
  • If the {@code pageUrl} argument is {@code null} or the {@code value} element of the specified * {@link PageUrl} annotation is unspecified, this method returns {@code null}. *
  • If {@code scheme} of the specified {@code pageUrl} argument is unspecified or set to {@code http/https}, * the specified {@code targetUri} is overlaid by the elements of the {@link PageUrl} annotation to * produce the fully-qualified HTTP target page URL.
      *
    • If the {@code value} element specifies an absolute path, this path is returned as-is.
    • *
    • If the {@code value} element specifies a relative path, this is appended to the path specified by * {@code targetUri} to resolve the page URL.
    • *
    • If the {@code scheme} element is specified, its value overrides the scheme of {@code targetUri}. * If the value of the {@code scheme} element is empty, the scheme of {@code targetUri} is set to * {@code null}.
    • *
    • If the {@code userInfo} element is specified, its value overrides the userInfo of {@code targetUrl}. * If the value of the {@code userInfo} element is empty, the userInfo of {@code targetUri} is set to * {@code null}.
    • *
    • If the {@code host} element is specified, its value overrides the host of {@code targetUrl}. If the * value of the {@code host} element is empty, the host of {@code targetUri} is set to {@code null}. *
    • *
    • If the {@code port} element is specified, its value overrides the port of {@code targetUri}. If the * value of the {@code port} element is empty, the port of {@code targetUri} is set to 0.
    • *
  • *
  • For HTTP URLs that require query parameters, these parameters must be included in the * {@code value} element of the specified {@link PageUrl} annotation. The {@code params} element of the * annotation is only used for pattern-based landing page verification.
  • *
  • If {@code scheme} of the specified {@code pageUrl} is set to {@code file}, the value of the * {@code targetUri} argument is ignored. The only element of the {@link PageUrl} annotation that * is used to produce the fully-qualified FILE target page URL is {@code value}. The value of the * {@code value} element specifies the relative path of a file within your project's resources, which is * resolved via {@link ClassLoader#getResource}.
  • *
*/ @Retention(RUNTIME) @Target({TYPE}) public @interface PageUrl { /** * Get the page URL scheme. * * @return URL scheme (http, https, or file) */ String scheme() default "{}"; /** * Get the page URL user info. * * @return URL user info as user:password */ String userInfo() default "{}"; /** * Get the page URL host name. * * @return URL host name */ String host() default "{}"; /** * Get the page URL port number. * * @return URL port number */ String port() default "{}"; /** * Get the page URL path or Android application activity. * * @return URL path or Android application activity */ String value() default "{}"; /** * Get the page URL query parameters. * * @return array of URL query parameters as name=value */ String[] params() default {}; /** * Get the regular expression to validate path/parameters. * * @return regular expression to validate path/parameters */ String pattern() default "{}"; /** * Get the Android application package. * * @return application package name */ String appPackage() default "{}"; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy