Skip to content
Permalink
Browse files

Using the Selenium server instead of the Selelium IDE

  • Loading branch information...
dannymk committed Jul 2, 2012
1 parent cacc744 commit a9037d6a22a8d3489887f448a8391058c1659ab1
Showing with 107 additions and 9 deletions.
  1. +37 −8 selenium/README
  2. +1 −1 selenium/login.html
  3. +69 −0 selenium/test.pl
@@ -1,20 +1,49 @@
danny_mk, yeah. the best thing you could do is make a branch for the selenium work that doesn't have any other commits in it for other stuff
scrottie git branch selenium; git checkout selenium
scrottie git cherry-pick b8596fd10da910254150db02dc7336bda5a25c89 # to bring over the one commit that you did
scrottie then to push that: git push origin selenium


Install WebGUI using to the instructions at: https://github.com/plainblack/webgui/tree/WebGUI8

Create the following settings in your test site webgui.conf file:

"selenium" : {
"server" : "localhost",
"port" : "4444",
"browser" : "firefox",
"webgui_url" : "http://your_webgui_test_site_url"
},

Make sure you select all the defaults (do not change the "admin" user password)

Pick the site design: "Style 03" (This is the style selected for testing)

Download the Selenium server from: http://seleniumhq.org/download/)
as of this writing it was selenium-server-standalone-2.24.1.jar

Running the Selenium Server (run in a separate command line/window)
java -jar selenium-server-standalone-2.24.1.jar

The -browserSessionReuse is to keep the selenium session open so you may troubleshoot page issues
The Selenium software automatically closes the browser when the tests are concluded. If you are writing/troubleshooting tests
and need the browser to remain open use:
java -jar selenium-server-standalone-2.24.1.jar -browserSessionReuse

GOTCHAS ---
If running the selenium tests in the IDE make sure to change:
<link rel="selenium.base" href="http://webgui.dbash.com" /> TO: <link rel="selenium.base" href="http://your_webgui_test_site_url" />

Selenium server not running (this may vary according to the values in your webgui.conf file):
Error requesting http://localhost:4444/selenium-server/driver/:
500 Can't connect to localhost:4444 (Connection refused)

Optional:

Download and install the Selenium IDE from: http://seleniumhq.org/projects/ide/

Take a look at the Selenium IDE documentation: http://seleniumhq.org/docs/02_selenium_ide.html

Youtube videos can be quite handy:
http://www.youtube.com/watch?v=i4NTGUm6oeQ
http://www.youtube.com/results?search_query=selenium+tutorial+for+beginner

Use the Selenium IDE to open the test suites:
adminSuite.html
frameless/suite.html

GOTCHAS ---
Change: <link rel="selenium.base" href="http://webgui.dbash.com" /> TO: <link rel="selenium.base" href="http://your_test_website" />
http://www.youtube.com/results?search_query=selenium+tutorial+for+beginner
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://webgui.dbash.com" />
<link rel="selenium.base" href="http://webgui.dbash.com/" />
<title>login</title>
</head>
<body>
@@ -0,0 +1,69 @@
#!/usr/bin/perl
use Test::More tests => 98;
use Test::WWW::Selenium;
use Test::WWW::Selenium::HTML;
use WebGUI::Paths -inc;
use WebGUI::Config;
use strict;

WebGUI::Paths->siteConfigs or die "no configuration files found";

my $config = undef;
my $webguiSiteUrl = undef;
my $browser = undef;
my $seleniumServer = undef;
my $seleniumServerPort = undef;
if ( my $config_file = $ENV{WEBGUI_CONFIG} ){
my $webguiTestConfigFilename = WebGUI::Paths->configBase . '/' . $config_file;
$config = WebGUI::Config->new( $webguiTestConfigFilename ) or die "failed to load configuration file: $webguiTestConfigFilename: $!";

eval{
$webguiSiteUrl = $config->{config}->{selenium}->{webgui_url};
$browser = $config->{config}->{selenium}->{browser}; # firefox, iexplore, safari
$seleniumServer = $config->{config}->{selenium}->{server};
$seleniumServerPort = $config->{config}->{selenium}->{port};

} || die "Can't get Selenium configuration values from configuration file: $webguiTestConfigFilename\n";

}else{
die "Please read the instructions, you must specify a PERL5LIB and WEBGUI_CONFIG file value!\n";

}

#
my $sel = Test::WWW::Selenium->new(
host => $seleniumServer,
port => $seleniumServerPort,
browser => "*$browser",
browser_url => $webguiSiteUrl );

my $selh = Test::WWW::Selenium::HTML->new( $sel );

$selh->diag_body_text_on_failure(0);

#------------------------- Run All Tests here -----------------------

ok(1, "Login test");
$selh->run(path => "login.html");
ok(1, "Turn On Admin test");
$selh->run(path => "turnOnAdmin.html");
ok(1, "Admin Console tests");
$selh->run(path => "turnOnAdmin.html");
ok(1, "Version Tags tests");
$selh->run(path => "versionTags.html");
ok(1, "Clipboard test");
$selh->run(path => "clipboard.html");
ok(1, "Asset Helpers tests");
$selh->run(path => "assetHelpers.html");
ok(1, "New Content->Basic tests");
$selh->run(path => "newContentBasic.html");
ok(1, "New Content->Community tests");
$selh->run(path => "newContentCommunity.html");
ok(1, "New Content->Intranet tests");
$selh->run(path => "newContentIntranet.html");
ok(1, "New Content->Prototypes tests");
$selh->run(path => "newContentPrototypes.html");
ok(1, "New Content->Shop tests");
$selh->run(path => "newContentShop.html");
ok(1, "New Content->Utilities tests");
$selh->run(path => "newContentUtilities.html");

0 comments on commit a9037d6

Please sign in to comment.
You can’t perform that action at this time.