Re: [wtr-general] Re: best practice for modal that may pop up

2011-10-21 Thread Joe Fleck
Hi Chuck,

I have thought of that but these scripts will be run in a production
environment so hitting the back end might not be a wise solution.

Thank you,
Joe

On Thu, Oct 20, 2011 at 4:41 PM, Chuck van der Linden sqa...@gmail.comwrote:

 Potentially, is there some way to query the back-end directly to see
 the user's status relative to that community and thus be able to
 predict what SHOULD happen, and thus be able to both deal with it
 properly, and also verify the system is behaving as expected??

 On Oct 20, 12:12 pm, Joe Fl joeflec...@gmail.com wrote:
  Hi,
 
  In my app a modal could pop up whenever a user enters a community and
  there isn't way to know which one they have been in before.  I am
  currently using the exists? method but it seems to crash once in a
  while.
 
  Error:
 
  /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/
  gems/watir-webdriver-0.3.4/lib/watir-webdriver/wait.rb:24:in `until':
  timed out after 30 seconds, waiting for
  {:tag_name=a, :id=prompt_enter_as_admin_yes} to become present
  (Watir::Wait::TimeoutError)
  from /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/
  gems/1.8/gems/watir-webdriver-0.3.4/lib/watir-webdriver/wait.rb:80:in
  `method_missing'
  from /Users/josephfleck/Sites/within3/qa_automation/discussion/
  add_multiple_discussion.rb:92
  from /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/
  gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in `each'
  from /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/
  gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in `each'
  from /Users/josephfleck/Sites/within3/qa_automation/discussion/
  add_multiple_discussion.rb:38
 
  My code looks like this:
 
  #Enter as admin confirmation modal
  if
  $browser.div(:id,'enter_as_admin_confirmation_modal_content').exists?
 
#Click Yes to be admin of community
 
 
 $browser.div(:id,'enter_as_admin_confirmation_modal_inner_content').link(:id,
  'prompt_enter_as_admin_yes').when_present.click
 
#Call wait with counter value
w = 400
helper.wait_counter(w)
 
  end
 
  #if terms of use display
  if $browser.div(:id,'terms_of_use_modal_content').exist?
 
#Click 'Accept' link on TOU
$browser.link(:id,'accept_terms_of_use').click
 
#Call wait with counter value
w = 400
helper.wait_counter(w)
 
  end
 
  #if guidelines window displays
  if $browser.div(:id,'approve-community-guidelines').exists?
 
guide_checkboxes =
  $browser.div(:class,'guidelines').div(:class,'guidelines').checkboxes
 
puts guide_checkboxes.length
 
guide_checkboxes.each do |checkbox|
 
  puts checkbox_loc = checkbox.id
 
  $browser.checkbox(:id,checkbox_loc).set
 
end
 
$browser.link(:class,'continue').click
 
#Call wait with counter value
w = 400
helper.wait_counter(w)
 
  end
 
  Is this the best practice for this scanerio?
 
  Thank you,
  Joe

 --
 Before posting, please read http://watir.com/support. In short: search
 before you ask, be nice.

 watir-general@googlegroups.com
 http://groups.google.com/group/watir-general
 watir-general+unsubscr...@googlegroups.com


-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: best practice for modal that may pop up

2011-10-20 Thread Chuck van der Linden
Potentially, is there some way to query the back-end directly to see
the user's status relative to that community and thus be able to
predict what SHOULD happen, and thus be able to both deal with it
properly, and also verify the system is behaving as expected??

On Oct 20, 12:12 pm, Joe Fl joeflec...@gmail.com wrote:
 Hi,

 In my app a modal could pop up whenever a user enters a community and
 there isn't way to know which one they have been in before.  I am
 currently using the exists? method but it seems to crash once in a
 while.

 Error:

 /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/gems/1.8/
 gems/watir-webdriver-0.3.4/lib/watir-webdriver/wait.rb:24:in `until':
 timed out after 30 seconds, waiting for
 {:tag_name=a, :id=prompt_enter_as_admin_yes} to become present
 (Watir::Wait::TimeoutError)
         from /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/
 gems/1.8/gems/watir-webdriver-0.3.4/lib/watir-webdriver/wait.rb:80:in
 `method_missing'
         from /Users/josephfleck/Sites/within3/qa_automation/discussion/
 add_multiple_discussion.rb:92
         from /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/
 gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in `each'
         from /Users/josephfleck/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/
 gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:696:in `each'
         from /Users/josephfleck/Sites/within3/qa_automation/discussion/
 add_multiple_discussion.rb:38

 My code looks like this:

 #Enter as admin confirmation modal
     if
 $browser.div(:id,'enter_as_admin_confirmation_modal_content').exists?

       #Click Yes to be admin of community

 $browser.div(:id,'enter_as_admin_confirmation_modal_inner_content').link(:id,
 'prompt_enter_as_admin_yes').when_present.click

       #Call wait with counter value
       w = 400
       helper.wait_counter(w)

     end

     #if terms of use display
     if $browser.div(:id,'terms_of_use_modal_content').exist?

       #Click 'Accept' link on TOU
       $browser.link(:id,'accept_terms_of_use').click

       #Call wait with counter value
       w = 400
       helper.wait_counter(w)

     end

     #if guidelines window displays
     if $browser.div(:id,'approve-community-guidelines').exists?

       guide_checkboxes =
 $browser.div(:class,'guidelines').div(:class,'guidelines').checkboxes

       puts guide_checkboxes.length

       guide_checkboxes.each do |checkbox|

         puts checkbox_loc = checkbox.id

         $browser.checkbox(:id,checkbox_loc).set

       end

       $browser.link(:class,'continue').click

       #Call wait with counter value
       w = 400
       helper.wait_counter(w)

     end

 Is this the best practice for this scanerio?

 Thank you,
 Joe

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com