sakai-oae-test-api 0.0.2 → 0.0.3

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/README.md CHANGED
@@ -11,13 +11,9 @@ Ruby and Watir-webdriver--but without needing to know either in detail.
11
11
 
12
12
  ### Ruby 1.9.2 or higher
13
13
 
14
- ### Ruby Gems:
15
- [Watir-Webdriver](http://www.watirwebdriver.com)
16
- [Page-Object](https://github.com/cheezy/page-object)
17
-
18
14
  If you're just going to use the API for testing, then simply install it as you would any other Ruby gem: `gem install sakai-oae-test-api`
19
15
 
20
- This repo is here if you're going to take part in extending the capabilities of the gem.
16
+ This repo is here if you're going to take part in extending the API's capabilities--e.g., adding page elements, custom methods, or new page classes.
21
17
 
22
18
  ## A Basic Usage Example for OAE:
23
19
 
@@ -27,20 +23,60 @@ require 'sakai-oae-test-api'
27
23
 
28
24
  # Create an instance of the SakaiOAE class, specifying your test browser
29
25
  # and the URL of your test site's OAE welcome page.
30
- sakai = SakaiOAE.new(:firefox, "https://nightly.academic.rsmart.com/")
31
-
32
- # Log in to Sakai OAE with "username" and "password"...
33
- dashboard = sakai.login("username", "password") # See the LoginPage class and the HeaderFooterBar module in the RDocs.
34
-
35
- # Go to the course library page for "Econ 101"...
36
- course_library = dashboard.open_course "Econ 101" # See the RDocs for info on the
37
- # MyDashboard and Library classes.
38
-
39
- # Store the contents of the course library in
40
- # an array called "library_contents"...
41
- library_contents = course_library.documents
26
+ sakai = SakaiOAE.new(:firefox, "https://academic.rsmart.com/")
27
+
28
+ # define the LoginPage class object, which allows you to interact with elements
29
+ # on the login page. This is available via the SakaiOAE class, "page" method...
30
+ login_page = sakai.page
31
+
32
+ # Define the browser object using SakaiOAE's 'browser' method. This is Ruby/Watir's
33
+ # representation of the test browser itself and is used by every page class in the
34
+ # Sakai-OAE-test-api, so it *must* be explicitly defined here as "@browser"...
35
+ @browser = sakai.browser
36
+
37
+ # The above code is all necessary for proper setup and usage of the API. Below, we
38
+ # present a short and simple example of how you can use the API to interact with
39
+ # the Open Academic Environment...
40
+ dash = login_page.login("username", "password")
41
+
42
+ # There are two ways to invoke page classes. The first way, hinted at in the code
43
+ # above, will be explained below. The second way uses the "on_page" method,
44
+ # and is most useful when you are going to stay on the given page for a while. It
45
+ # requires that you know the name of the relevant page class..
46
+ on_page MyDashboard do |page|
47
+ page.add_content
48
+ page.upload_file=("filename.doc", "Full/Path/To/File")
49
+ page.file_title="Title"
50
+ page.file_description="This is a file description."
51
+ page.tags_and_categories="document"
52
+ page.add
53
+ page.done_add_collected
54
+ end
55
+
56
+ # So, back to the first way, which is most useful when you're doing lots of quick
57
+ # navigating around the site, not staying on a given page for too long.
58
+ # You'll notice by looking at the available methods in the page classes that those
59
+ # methods involving navigating to new pages will return the target page's page class.
60
+ # So, for example, going from My Dashboard to Explore Content (notice we're using
61
+ # the "dash" object defined earlier, here...
62
+ explore = dash.explore_content
63
+
64
+ # Now we can use the "explore" object to interact with the "Explore Content" page...
65
+ explore.search_for="Title"
66
+
67
+ # A bit of verification code (use your own favorite test framework, here, if
68
+ # writing Ruby conditionals isn't too your liking)...
69
+ if explore.results.include?("Title")
70
+ puts "Passed"
71
+ else
72
+ puts "Failed"
73
+ end
74
+
75
+ # Enjoy!
42
76
  ````
43
77
 
78
+ For much more extensive usage examples, please see the OAE Cucumber directory in this repo.
79
+
44
80
  ## Contribute
45
81
 
46
82
  * Fork the project.
@@ -5,13 +5,13 @@ require 'cgi'
5
5
 
6
6
  PageObject.javascript_framework = :jquery
7
7
 
8
- require 'sakai-oae-test-api/global_methods'
9
8
  require 'sakai-oae-test-api/gem_extensions'
10
- require 'sakai-oae-test-api/cle_frame_classes'
9
+ require 'sakai-oae-test-api/global_methods'
11
10
  require 'sakai-oae-test-api/pop_up_dialogs'
12
11
  require 'sakai-oae-test-api/toolbars_and_menus'
13
12
  require 'sakai-oae-test-api/widgets'
14
13
  require 'sakai-oae-test-api/page_classes'
14
+ require 'sakai-oae-test-api/cle_frame_classes'
15
15
 
16
16
  # Initialize this class at the start of your test cases to
17
17
  # open the specified test browser at the specified Sakai welcome page URL.
@@ -23,14 +23,13 @@ class SakaiOAE
23
23
  attr_reader :browser
24
24
 
25
25
  def initialize(web_browser, url)
26
-
27
- @url = url
28
-
29
26
  @browser = Watir::Browser.new web_browser
30
27
  @browser.window.resize_to(1400,900)
31
- @browser.goto @url
28
+ @browser.goto url
32
29
  @browser.button(:id=>"footer_logo_button").wait_until_present
30
+ end
33
31
 
32
+ def page
34
33
  LoginPage.new @browser
35
34
  end
36
35
 
@@ -1,10 +1,4 @@
1
1
  # coding: UTF-8
2
- require 'sakai-OAE/gem_extensions'
3
- require 'sakai-OAE/global_methods'
4
- require 'sakai-OAE/toolbars_and_menus'
5
- require 'sakai-OAE/pop_up_dialogs'
6
- require 'sakai-OAE/widgets'
7
- require 'sakai-OAE/cle_frame_classes'
8
2
 
9
3
  # The Login page for OAE.
10
4
  class LoginPage
@@ -1,12 +1,12 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'sakai-oae-test-api'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
  s.summary = %q{Sakai-OAE functional testing API for rSmart Academic}
5
5
  s.description = %q{The Sakai-OAE gem provides an API for interacting with the web pages and page elements in rSmart's deployment of the Sakai Open Academic Environment.}
6
6
  s.files = Dir.glob("**/**/**")
7
7
  s.test_files = Dir.glob("test/*test_rb")
8
8
  s.authors = ["Abraham Heward"]
9
- s.email = %w{"aheward@rsmart.com"}
9
+ s.email = %w{'aheward@rsmart.com'}
10
10
  s.homepage = 'https://github.com/aheward/Kuali-Sakai-Functional-Test-Automation-Framework/tree/Sakai-CLE/Sakai/OAE/API'
11
11
  s.add_dependency 'page-object', '>= 0.6.6'
12
12
  s.add_dependency 'watir-webdriver', '>= 0.5.5'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sakai-oae-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
@@ -78,7 +78,7 @@ dependencies:
78
78
  description: The Sakai-OAE gem provides an API for interacting with the web pages
79
79
  and page elements in rSmart's deployment of the Sakai Open Academic Environment.
80
80
  email:
81
- - ! '"aheward@rsmart.com"'
81
+ - ! '''aheward@rsmart.com'''
82
82
  executables: []
83
83
  extensions: []
84
84
  extra_rdoc_files: []