programming pointers


MojoMojo and Selenium test

As suggested by Mateu I was further looking into MojoMojo Selenium tests on CPAN. Actually all selenium.t tests require a test configuration file mojomojo.yml file resides in t/app/mojomojo.yml this file is used to add the authentication configurations. Also resides in the same directory the sqlite mojomojo database: mojomojo.db.

The complete test is as follows:

[code lang=”perl”]

#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;

# This test requires that a Selenium server be running.
# A Selenium server # is included in Alien::SeleniumRC which is a dependency of
# Test::WWW::Selenium::Catalyst so having it installed should be sufficient to run this test.
# # The selenium server is a java application that can also be started like:
# java -jar selenium-server.jar
# See for the download of Selenium Remote Control (RC) # which includes a selenium server.

BEGIN { eval {require Test::WWW::Selenium::Catalyst};
plan skip_all => ‘Selenium tests need Test::WWW::Selenium::Catalyst’ if $@;
plan skip_all => ‘Set SELENIUM_TESTS ENV variable to enable Selenium tests’ unless $ENV{SELENIUM_TESTS};
plan tests => 22;
$ENV{MOJOMOJO_CONFIG} = ‘t/app/mojomojo.yml’; }
my $sel = Test::WWW::Selenium::Catalyst->start;
$sel->is_text_present_ok(“Log in”);
$sel->is_text_present_ok(“Log in”);
$sel->is_text_present_ok(“Log in”);
$sel->is_text_present_ok(“Log in”);
$sel->click_ok(“link=Log in”);
$sel->wait_for_page_to_load_ok( “15000”);
$sel->type_ok( “loginField”, “admin” );
$sel->type_ok( “pass”, “admin” );
# Check that .recent was not cached.
$sel->is_text_present_ok(“Log out”);
# Check that profile was no cached.
$sel->is_text_present_ok(“Log out”);
$sel->is_text_present_ok(“Log out”);
$sel->click_ok(“link=Log out”);

Reference: MojoMojo on CPAN



Copyright © 2007-2023 PRADEEP K. PANT

Made with Jekyll | Source Code | RSS