Class: XXabbrevupperxxPages
- Inherits:
-
Object
- Object
- XXabbrevupperxxPages
- Defined in:
- lib/taft_files/framework/zznamezz/watir/pages/xxabbrevxx_pages.rb
Constant Summary collapse
- @@browser =
nil
- @@pages =
an array of Page objects
[]
- @@page_names =
[]
Class Method Summary collapse
- .add_page(page) ⇒ Object
-
.find(name) ⇒ Object
Retrieves the specific page; raises if it cannot be found Will convert name to a string.
-
.info ⇒ Object
Outputs info on the pages currently stored.
- .make_pages(browser) ⇒ Object
-
.page_known?(name) ⇒ Boolean
Will convert name to a string.
Class Method Details
.add_page(page) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/taft_files/framework/zznamezz/watir/pages/xxabbrevxx_pages.rb', line 73 def self.add_page(page) page.browser = @@browser # set the browser object for each page # TODO have only one browser object (here in XXabbrevupperxxPages), and have each page know how to find it, instead of taking # their own copy of the object @@pages << page @@page_names << page.name end |
.find(name) ⇒ Object
Retrieves the specific page; raises if it cannot be found Will convert name to a string
96 97 98 99 |
# File 'lib/taft_files/framework/zznamezz/watir/pages/xxabbrevxx_pages.rb', line 96 def self.find(name) raise "Could not locate page '#{name}'" unless self.page_known?(name) @@pages[@@page_names.index(name.to_s)] end |
.info ⇒ Object
Outputs info on the pages currently stored
82 83 84 85 86 87 |
# File 'lib/taft_files/framework/zznamezz/watir/pages/xxabbrevxx_pages.rb', line 82 def self.info s = "" s += "#{@@pages.size} pages defined. Names :" @@page_names.each {|f| s += "\n#{f}" } s end |
.make_pages(browser) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/taft_files/framework/zznamezz/watir/pages/xxabbrevxx_pages.rb', line 17 def self.make_pages(browser) @@browser = browser # Nav bar # Not a real page, but is a panel common to many pages # Don't add_page(nav_bar); do page.add_page(nav_bar) = Page.new("xxabbrevxxNavBar", "page_title", "Welcome to ZZnamezz") .add_field("goto_homepage", :link, :id, "xxabbrevxx_home_header_link") .add_field("page_title", :h1, :id, "page_title") # Homepage page = Page.new("xxabbrevxxHomepage", "page_title", "Welcome to ZZnamezz") page.add_field("all_users", :link, :id, "users_header_link") page.add_page() self.add_page(page) # Users page = Page.new("xxabbrevxxUsers", "page_title", "Listing users") page.add_field("users", :table, :id, "view_users_table") page.add_field("new_user", :link, :id, "new_user_link") page.add_page() self.add_page(page) # Create User page = Page.new("xxabbrevxxCreateUser", "page_title", "New user") page.add_field("user_name", :text_field, :id, "user_name") page.add_field("role", :list, :id, "user_role") page.add_field("save", :button, :id, "save") page.add_field("back", :link, :id, "back_link") page.add_page() self.add_page(page) # View User page = Page.new("xxabbrevxxViewUser", "page_title", /^User/) page.add_field("project", :div, :id, "name") page.add_field("version", :div, :id, "roles") page.add_field("edit", :link, :id, "edit_link") page.add_field("back", :link, :id, "back_link") page.add_page() self.add_page(page) end |
.page_known?(name) ⇒ Boolean
Will convert name to a string
90 91 92 |
# File 'lib/taft_files/framework/zznamezz/watir/pages/xxabbrevxx_pages.rb', line 90 def self.page_known?(name) @@page_names.include?(name.to_s) end |