sakai-cle-test-api 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,6 +33,8 @@ sakai = SakaiCLE.new(:chrome, "https://cle-1.qa.rsmart.com/xsl-portal")
33
33
  workspace = sakai.login("username", "password")
34
34
  ````
35
35
 
36
+ For much more extensive examples of using this API, please see the CLE Cucumber directory in this repo.
37
+
36
38
  ## Contribute
37
39
 
38
40
  * Fork the project.
@@ -3,30 +3,33 @@ require 'watir-webdriver'
3
3
  require 'page-object'
4
4
  require 'cgi'
5
5
 
6
- require 'sakai-cle-test-api/admin_page_elements'
7
6
  require 'sakai-cle-test-api/app_functions'
7
+ require 'sakai-cle-test-api/admin_page_elements'
8
8
  require 'sakai-cle-test-api/common_page_elements'
9
9
  require 'sakai-cle-test-api/site_page_elements'
10
+ require 'sakai-cle-test-api/utilities'
10
11
 
11
12
  # Initialize this class at the start of your test cases to
12
13
  # open the specified test browser at the specified Sakai welcome page URL.
13
14
  #
14
15
  # The initialization will return the LoginPage class object as well as
15
- # create the @browser variable used throughout the page classes.
16
+ # create the @browser variable used throughout the page classes
16
17
  class SakaiCLE
17
-
18
- attr_reader :browser
19
-
20
- def initialize(web_browser, url)
21
18
 
22
- @url = url
19
+ #include PageObject
20
+ #include ToolsMenu
21
+
22
+ attr_reader :browser, :page
23
+
24
+ def initialize(web_browser, url)
23
25
  @browser = Watir::Browser.new web_browser
24
26
  @browser.window.resize_to(1400,900)
25
- @browser.goto @url
26
- @browser.button(:id=>"footer_logo_button").wait_until_present
27
-
27
+ @browser.goto url
28
28
  $frame_index = 0 # TODO - Need to remove this and all dependent code.
29
+ end
29
30
 
31
+ # Returns the class containing the welcome page's page elements.
32
+ def page
30
33
  Login.new @browser
31
34
  end
32
35
 
@@ -100,7 +100,7 @@ class Login
100
100
  # specified credentials. Then it
101
101
  # instantiates the MyWorkspace class.
102
102
  def login(username, password)
103
- frame = self.frame(:id, "ifrm")
103
+ frame = @browser.frame(:id, "ifrm")
104
104
  frame.text_field(:id, "eid").set username
105
105
  frame.text_field(:id, "pw").set password
106
106
  frame.form(:method, "post").submit
@@ -0,0 +1,16 @@
1
+ module Utilities
2
+
3
+ # Formats a date string Sakai-style.
4
+ # Useful for verifying creation dates and such.
5
+ #
6
+ # Supplied variable must be of of the Time class.
7
+ def make_date(time_object)
8
+ month = time_object.strftime("%b ")
9
+ day = time_object.strftime("%d").to_i
10
+ year = time_object.strftime(", %Y ")
11
+ mins = time_object.strftime(":%M %P")
12
+ hour = time_object.strftime("%l").to_i
13
+ return month + day.to_s + year + hour.to_s + mins
14
+ end
15
+
16
+ end
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'sakai-cle-test-api'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
  s.summary = %q{Sakai-CLE functional testing API for the rSmart Collaborative Learning Environment}
5
5
  s.description = %q{The Sakai-OAE gem provides an API for interacting with pages and page elements in rSmart's deployment of the Sakai Collaborative Learning Environment.}
6
6
  s.files = Dir.glob("**/**/**")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sakai-cle-test-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-12 00:00:00.000000000 Z
12
+ date: 2012-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: page-object
@@ -88,6 +88,7 @@ files:
88
88
  - lib/sakai-cle-test-api/app_functions.rb
89
89
  - lib/sakai-cle-test-api/common_page_elements.rb
90
90
  - lib/sakai-cle-test-api/site_page_elements.rb
91
+ - lib/sakai-cle-test-api/utilities.rb
91
92
  - lib/sakai-cle-test-api.rb
92
93
  - README.md
93
94
  - sakai-cle-test-api.gemspec