Skip to content

renanoliveira/ape

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WHY?

Ape is a library to make selenium tests easy, providing some utilities and using conventions to make your tests easy to write and read.

INSTALLATION

git clone git://github.com/andrerigon/ape.git
cd ape
mvn install

USAGE

create your test and extend SeleniumBaseTest. This allows you to use several assertions like:


assertPresent(String elementLocator)

also you can use the raw api to manipulate elements of the page:


on(String elementLocator).click()

or you can even access selenium driver directly


selenium()

After extend SeleniumBaseTest, you have to provide information about the selenium driver. To do that, just annotate your test (or your base test) with:


@SeleniumDriverConfig(baseURL="http://base", host="http://mySeleniumRCURL", browser="*firefox", port = "1234")

If you don’t want or don’t have setup a selenium RC server, just use:


@SeleniumDriverConfig(useEmbbebedSeleniumRC = true)

and a instance of SeleniumRC will be created for you.

ADITIONAL OPTIONS

If you want your tests windows to be maximized, use:


@MaximizedBrowserWindow

To slow down selenium action commands, just define a diferent delay:


@SeleniumActionDelay(delay = 500, timeUnit = TimeUnit.MILLISECONDS)

AUTHENTICATED TESTS

When running your tests, frequently (all the time?) your test need to login in the system.
To simplify that, take the following steps:

  1. make you test or base test to implements AuthenticatedTest
  2. define a junit rule:
     
    @Rule public final AuthenticationRule visaoLoginRule = AuthenticationRule.defaultUserAndPasswd("test_user", "123");
    
  3. annotate your test methods with @Authenticate

If you want to use another credentials, define them in the @Authenticate:


@Authenticate(username="test_user2", password="456")

About

selenium tests made simple

Resources

Stars

Watchers

Forks

Packages

No packages published