Selenium 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/selenium/version CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -0,0 +1,18 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ module Selenium
4
+ # Class that models a web page with a title
5
+ class WebPage
6
+ attr_reader :title
7
+
8
+ def initialize(browser, expected_title)
9
+ @browser = browser
10
+ @expected_title = expected_title
11
+ end
12
+
13
+ def title
14
+ @browser.get_title
15
+ end
16
+
17
+ end
18
+ end
@@ -1,13 +1,11 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
  require 'menu'
3
+ require 'web_page'
3
4
 
4
5
  module Selenium
5
- class DownloadPage
6
- include Menu
7
- attr_reader :browser
8
-
6
+ class DownloadPage < SeleniumRubyPage
9
7
  def initialize(browser)
10
- @browser = browser
8
+ super(browser, 'Selenium Ruby - Download')
11
9
  end
12
10
  end
13
11
  end
@@ -1,17 +1,16 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
  require 'menu'
3
+ require 'selenium_ruby_page'
3
4
 
4
5
  $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib', 'selenium')
5
6
 
6
7
  require 'link'
7
8
 
8
9
  module Selenium
9
- class HomePage
10
- include Menu
11
- attr_reader :browser
10
+ class HomePage < SeleniumRubyPage
12
11
 
13
12
  def initialize(browser)
14
- @browser = browser
13
+ super(browser, 'Selenium Ruby - Home')
15
14
  end
16
15
 
17
16
  end
@@ -0,0 +1,11 @@
1
+ $:.unshift File.join(File.dirname(__FILE__))
2
+
3
+ require 'menu'
4
+
5
+ module Selenium
6
+ class LicensePage < SeleniumRubyPage
7
+ def initialize(browser)
8
+ super(browser, 'Selenium Ruby - License')
9
+ end
10
+ end
11
+ end
@@ -1,8 +1,21 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ require 'home_page'
4
+
5
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib', 'selenium')
6
+
7
+ require 'directory_listing_page'
8
+ require 'license_page'
9
+
1
10
  module Selenium
2
- module Menu
11
+ class Menu
12
+ attr_reader :browser
13
+ def initialize(browser)
14
+ @browser = browser
15
+ end
3
16
  def home_link
4
17
  # todo there should be a way to alter this instance so that the click returns the directory listing page
5
- Link.by_id(browser, 'home')
18
+ Link.by_id(browser, 'home', DirectoryListingPage.new(@browser))
6
19
  end
7
20
 
8
21
  #MENU START
@@ -11,7 +24,7 @@ module Menu
11
24
  end
12
25
 
13
26
  def license_link
14
- Link.by_text(browser, 'License')
27
+ Link.by_text(browser, 'License', LicensePage.new(@browser))
15
28
  end
16
29
  #MENU END
17
30
  end
@@ -0,0 +1,25 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib', 'selenium')
2
+
3
+ require 'web_page'
4
+
5
+ $:.unshift File.dirname(__FILE__)
6
+
7
+ require 'menu'
8
+
9
+ module Selenium
10
+ class SeleniumRubyPage < WebPage
11
+ attr_reader :menu
12
+
13
+ def initialize(browser, expected_title)
14
+ super(browser, expected_title)
15
+ end
16
+
17
+ def assert_page
18
+ title.should == @expected_title
19
+ end
20
+
21
+ def menu
22
+ Menu.new(@browser)
23
+ end
24
+ end
25
+ end
@@ -7,26 +7,24 @@ require 'spec/selenium/home_page'
7
7
  require 'spec/selenium/download_page'
8
8
 
9
9
  module Selenium
10
- context 'basic operation with selenium' do
11
- context_setup do
12
- end
10
+ describe 'basic operation with selenium' do
13
11
 
14
- setup do
12
+ before do
15
13
  @browser = Selenium::SeleniumDriver.new("localhost", 4444, "*iexplore", "http://localhost:2000", 10000)
16
14
  @browser.start
17
15
  @browser.open('http://localhost:2000/index.html')
18
16
  end
19
17
 
20
- specify 'click through menus' do
18
+ it 'click through menus' do
21
19
  #TEST START
22
20
  page = HomePage.new(@browser)
23
- page.download_link.click_wait
21
+ page.menu.download_link.click_wait
24
22
  page = DownloadPage.new(@browser)
25
- page.home_link.click_wait
26
- page = DirectoryListingPage.new(@browser)
23
+ page.assert_page
24
+ page = page.menu.home_link.go
27
25
  page.link_to_entry('index.txt').click_wait
28
26
  page = HomePage.new(@browser)
29
- page.license_link.click_wait
27
+ page.menu.license_link.go
30
28
  #TEST END
31
29
  end
32
30
  end
@@ -7,8 +7,8 @@ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib', 'selenium')
7
7
  require 'selenium_server'
8
8
 
9
9
  module Selenium
10
- context 'selenium server' do
11
- specify 'start and stop server' do
10
+ describe 'selenium server' do
11
+ it 'start and stop server' do
12
12
  server = BuildMaster::ServerManager.new(SeleniumServer.new(4321))
13
13
  puts 'starting server...'
14
14
  server.start
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0.9
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: Selenium
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.1
7
- date: 2007-01-12 00:00:00 -08:00
6
+ version: 1.0.2
7
+ date: 2007-10-14 00:00:00 -07:00
8
8
  summary: A project that wraps selenium API into object-oriented testing style and packages it into a RubyGem.
9
9
  require_paths:
10
10
  - lib
@@ -31,23 +31,27 @@ authors:
31
31
  files:
32
32
  - bin/selenium
33
33
  - lib/selenium
34
- - lib/selenium.rb
35
34
  - lib/selenium/button.rb
36
35
  - lib/selenium/directory_listing_page.rb
36
+ - lib/selenium/html_element.rb
37
37
  - lib/selenium/link.rb
38
38
  - lib/selenium/locator.rb
39
39
  - lib/selenium/openqa
40
+ - lib/selenium/openqa/README
41
+ - lib/selenium/openqa/selenium-server.jar.txt
42
+ - lib/selenium/openqa/selenium.rb
40
43
  - lib/selenium/selenium_server.rb
41
44
  - lib/selenium/server_manager.rb
42
45
  - lib/selenium/text_field.rb
43
46
  - lib/selenium/version
44
- - lib/selenium/openqa/README
45
- - lib/selenium/openqa/selenium-server.jar.txt
46
- - lib/selenium/openqa/selenium.rb
47
+ - lib/selenium/web_page.rb
48
+ - lib/selenium.rb
47
49
  - spec/selenium
48
50
  - spec/selenium/download_page.rb
49
51
  - spec/selenium/home_page.rb
52
+ - spec/selenium/license_page.rb
50
53
  - spec/selenium/menu.rb
54
+ - spec/selenium/selenium_ruby_page.rb
51
55
  - spec/selenium/tc_basic_operation.rb
52
56
  - spec/selenium/tc_selenium_server.rb
53
57
  - README