hu.ibello.expect.BrowserHaveExpectations Maven / Gradle / Ivy
Show all versions of ibello-api Show documentation
/*
* Ark-Sys Kft. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package hu.ibello.expect;
import java.util.regex.Pattern;
/**
* Instance of this interface contains methods to create and execute expectations
* about the browser.
*
* About the ibello expectation engine, see {@link hu.ibello.expect}.
*
* @author Kornél Simon
*
*/
public interface BrowserHaveExpectations {
/**
* Runs an expectation which successes when the current URL matches a pattern.
* The pattern is created from the argument. If the method was called after
* {@link BrowserExpectationBuilder#toNotHave()}, then the outcome of the expectation is
* the opposite: if the current URL matches the pattern, then it will fail.
*
* The argument may or may not contain a protocol. If there is no protocol in it,
* then the pattern will match http
and https
protocols
* in the current URL.
*
*
* The argument can be a relative URL, starting with /
. In this case,
* http
and https
protocols, any host and any port in the current URL
* will be matched by the pattern.
*
*
* The argument may contain *
and ?
wildchars.
* *
means any path element, ?
means any character (except
* /
). The double asterisk (**
) means any characters
* (including /
).
*
*
* If the ibello configuration contains the ibello.url.base
property,
* then it's value will override the protocol, host and port in the argument.
*
* @param url URL or URL pattern
*/
void url(String url);
/**
* Runs an expectation which successes when the current URL matches the given regular
* expression. If the method was called after
* {@link BrowserExpectationBuilder#toNotHave()}, then the outcome of the expectation is
* the opposite: if the current URL matches the pattern, then it will fail.
* @param pattern a regular expression
*/
void url(Pattern pattern);
}