Skip to content

Commit a9037d6

Browse files
committedJul 3, 2012
Using the Selenium server instead of the Selelium IDE
1 parent cacc744 commit a9037d6

File tree

3 files changed

+107
-9
lines changed

3 files changed

+107
-9
lines changed
 

‎selenium/README

+37-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,49 @@
1+
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
2+
scrottie git branch selenium; git checkout selenium
3+
scrottie git cherry-pick b8596fd10da910254150db02dc7336bda5a25c89 # to bring over the one commit that you did
4+
scrottie then to push that: git push origin selenium
5+
6+
17
Install WebGUI using to the instructions at: https://github.com/plainblack/webgui/tree/WebGUI8
28

9+
Create the following settings in your test site webgui.conf file:
10+
11+
"selenium" : {
12+
"server" : "localhost",
13+
"port" : "4444",
14+
"browser" : "firefox",
15+
"webgui_url" : "http://your_webgui_test_site_url"
16+
},
17+
318
Make sure you select all the defaults (do not change the "admin" user password)
419

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

22+
Download the Selenium server from: http://seleniumhq.org/download/)
23+
as of this writing it was selenium-server-standalone-2.24.1.jar
24+
25+
Running the Selenium Server (run in a separate command line/window)
26+
java -jar selenium-server-standalone-2.24.1.jar
27+
28+
The -browserSessionReuse is to keep the selenium session open so you may troubleshoot page issues
29+
The Selenium software automatically closes the browser when the tests are concluded. If you are writing/troubleshooting tests
30+
and need the browser to remain open use:
31+
java -jar selenium-server-standalone-2.24.1.jar -browserSessionReuse
32+
33+
GOTCHAS ---
34+
If running the selenium tests in the IDE make sure to change:
35+
<link rel="selenium.base" href="http://webgui.dbash.com" /> TO: <link rel="selenium.base" href="http://your_webgui_test_site_url" />
36+
37+
Selenium server not running (this may vary according to the values in your webgui.conf file):
38+
Error requesting http://localhost:4444/selenium-server/driver/:
39+
500 Can't connect to localhost:4444 (Connection refused)
40+
41+
Optional:
42+
743
Download and install the Selenium IDE from: http://seleniumhq.org/projects/ide/
844

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

1147
Youtube videos can be quite handy:
1248
http://www.youtube.com/watch?v=i4NTGUm6oeQ
13-
http://www.youtube.com/results?search_query=selenium+tutorial+for+beginner
14-
15-
Use the Selenium IDE to open the test suites:
16-
adminSuite.html
17-
frameless/suite.html
18-
19-
GOTCHAS ---
20-
Change: <link rel="selenium.base" href="http://webgui.dbash.com" /> TO: <link rel="selenium.base" href="http://your_test_website" />
49+
http://www.youtube.com/results?search_query=selenium+tutorial+for+beginner

‎selenium/login.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
44
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
55
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6-
<link rel="selenium.base" href="http://webgui.dbash.com" />
6+
<link rel="selenium.base" href="http://webgui.dbash.com/" />
77
<title>login</title>
88
</head>
99
<body>

‎selenium/test.pl

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/perl
2+
use Test::More tests => 98;
3+
use Test::WWW::Selenium;
4+
use Test::WWW::Selenium::HTML;
5+
use WebGUI::Paths -inc;
6+
use WebGUI::Config;
7+
use strict;
8+
9+
WebGUI::Paths->siteConfigs or die "no configuration files found";
10+
11+
my $config = undef;
12+
my $webguiSiteUrl = undef;
13+
my $browser = undef;
14+
my $seleniumServer = undef;
15+
my $seleniumServerPort = undef;
16+
if ( my $config_file = $ENV{WEBGUI_CONFIG} ){
17+
my $webguiTestConfigFilename = WebGUI::Paths->configBase . '/' . $config_file;
18+
$config = WebGUI::Config->new( $webguiTestConfigFilename ) or die "failed to load configuration file: $webguiTestConfigFilename: $!";
19+
20+
eval{
21+
$webguiSiteUrl = $config->{config}->{selenium}->{webgui_url};
22+
$browser = $config->{config}->{selenium}->{browser}; # firefox, iexplore, safari
23+
$seleniumServer = $config->{config}->{selenium}->{server};
24+
$seleniumServerPort = $config->{config}->{selenium}->{port};
25+
26+
} || die "Can't get Selenium configuration values from configuration file: $webguiTestConfigFilename\n";
27+
28+
}else{
29+
die "Please read the instructions, you must specify a PERL5LIB and WEBGUI_CONFIG file value!\n";
30+
31+
}
32+
33+
#
34+
my $sel = Test::WWW::Selenium->new(
35+
host => $seleniumServer,
36+
port => $seleniumServerPort,
37+
browser => "*$browser",
38+
browser_url => $webguiSiteUrl );
39+
40+
my $selh = Test::WWW::Selenium::HTML->new( $sel );
41+
42+
$selh->diag_body_text_on_failure(0);
43+
44+
#------------------------- Run All Tests here -----------------------
45+
46+
ok(1, "Login test");
47+
$selh->run(path => "login.html");
48+
ok(1, "Turn On Admin test");
49+
$selh->run(path => "turnOnAdmin.html");
50+
ok(1, "Admin Console tests");
51+
$selh->run(path => "turnOnAdmin.html");
52+
ok(1, "Version Tags tests");
53+
$selh->run(path => "versionTags.html");
54+
ok(1, "Clipboard test");
55+
$selh->run(path => "clipboard.html");
56+
ok(1, "Asset Helpers tests");
57+
$selh->run(path => "assetHelpers.html");
58+
ok(1, "New Content->Basic tests");
59+
$selh->run(path => "newContentBasic.html");
60+
ok(1, "New Content->Community tests");
61+
$selh->run(path => "newContentCommunity.html");
62+
ok(1, "New Content->Intranet tests");
63+
$selh->run(path => "newContentIntranet.html");
64+
ok(1, "New Content->Prototypes tests");
65+
$selh->run(path => "newContentPrototypes.html");
66+
ok(1, "New Content->Shop tests");
67+
$selh->run(path => "newContentShop.html");
68+
ok(1, "New Content->Utilities tests");
69+
$selh->run(path => "newContentUtilities.html");

0 commit comments

Comments
 (0)
Please sign in to comment.