Class: Blogger

Inherits:
BasePage show all
Defined in:
lib/sakai-cle-test-api/page_objects/blogger.rb

Overview

The top page of a Site’s Blogger feature.

Instance Method Summary collapse

Methods inherited from BasePage

basic_page_elements, frame_element

Methods inherited from PageMaker

element, expected_element, expected_title, #initialize, #method_missing, page_url

Constructor Details

This class inherits a constructor from PageMaker

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PageMaker

Instance Method Details

#create_new_postObject

Clicks the Create New Post link and instantiates the CreateBloggerPost Class.



29
30
31
32
# File 'lib/sakai-cle-test-api/page_objects/blogger.rb', line 29

def create_new_post
  frm.link(:text=>"Create new post").click
  CreateBloggerPost.new(@browser)
end

#open_post(post_title) ⇒ Object

Clicks on the specified post title, then instantiates the ViewBloggerPost Class.



35
36
37
38
# File 'lib/sakai-cle-test-api/page_objects/blogger.rb', line 35

def open_post(post_title)
  frm.link(:text=>post_title).click
  ViewBloggerPost.new(@browser)
end

#post_private?(post_title) ⇒ Boolean

Returns true if the specified post title exists in the list. Otherwise returns false.

Returns:

  • (Boolean)


24
25
26
# File 'lib/sakai-cle-test-api/page_objects/blogger.rb', line 24

def post_private?(post_title)
  frm.table(:class=>"tableHeader").row(:text=>/#{Regexp.escape(post_title)}/).image(:alt=>"p").exist?
end

#post_titlesObject

Returns an array containing the displayed post titles (as string objects).



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/sakai-cle-test-api/page_objects/blogger.rb', line 41

def post_titles
  titles = []
  if frm.table(:class=>"tableHeader").exist?
    table = frm.table(:class=>"tableHeader")
    table.rows.each do |row|
      if row.link(:class=>"aTitleHeader").exist?
        titles << row.link(:class=>"aTitleHeader").text
      end
    end
  end
  return titles
end

#view_allObject

Clicks the View All button, then reinstantiates the Class.



11
12
13
14
# File 'lib/sakai-cle-test-api/page_objects/blogger.rb', line 11

def view_all
  frm.link(:text=>"View all").click
  Blogger.new(@browser)
end

#view_members_blogObject

Clicks the View Members Blog link, then instantiates the ViewMembersBlog Class.



18
19
20
21
# File 'lib/sakai-cle-test-api/page_objects/blogger.rb', line 18

def view_members_blog
  frm.link(:text=>"View member's blog").click
  ViewMembersBlog.new(@browser)
end