Hi Aidy/Charley/John,

Thanks for helping me out :). It was such a stupid typo.

I am using Notepad to write my scripts and at times I use SciTE.

Now I am getting one more issue and am not understanding the reason for it. It 
was working last week. I extended it and created more modules.

I am getting an error:
NoMethodError: undefined method `assert' for Login:Module

I have attached Login module and a test program that invokes its signin method.

Thanks again,
Natasha

aidy lewis <[EMAIL PROTECTED]> wrote: 
Natasha,

Lower case you 'I' in 'If'

Also dont underscore your module names.

What editor you using?

Aidy

On 26/11/2008, Natasha  wrote:
>
>  Hi All,
>
>  Please could you help me understand the fix for a syntax error in the
>  following code:
>
>  
> ----------------------------------------------------------------------------------------------------
>  require 'watir'   # the controller
>  require 'test/unit'
>
>  module UpsellPage_Sticker
>
>  def SelectQuantity(qty)
>         If qty > 0 and qty <=5
>                 # assert
>                 begin
>                         
> assert($ie.select_list(:id,"ddlQuantity").includes?(/#{qty}
>  pack/),"No option for #{qty} " + $ie.url)
>                         puts 'UpsellPage_Sticker :: SelectQuantity - 
> Assertion passed'
>
>                 rescue StandardError => ex
>                         print "\n\nUpsellPage_Sticker :: SelectQuantity => " 
> + ex + "\n\n"
>                         raise
>                         $ie.close
>                 end
>
>                 # execute
>
>                 $ie.select_list(:id,"ddlQuantity").select_value(/#{qty} pack/)
>                 puts "UpsellPage_Sticker:: SelectQuantity - #{qty} qty 
> selected on
>  Upsell Page \n"
>         end
>
>  end
>  end  # end of module
>
>  
> ----------------------------------------------------------------------------------------------------
>
>  If I remove IF construct from the method, it works fine. Other wise it
>  gives an error " syntax error, unexpected kEND, expecting $end
>  (SyntaxError)". Am I missing something here?
>
>  Please help me.
>
>  Thanks,
>
> Natasha
>  >
>



  
       
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

require 'watir'   # the controller
require 'test/unit' 

module Login

def signin(user,password)


      begin
        # assert
        assert($ie.text_field(:id,"txtLogin").exists?)
        assert($ie.text_field(:id,"txtPassword").exists?)
        assert($ie.button(:index,"1").exists?)
        puts 'Login:: signin - Assertion passed'
      rescue StandardError => ex
        print "\n\nLogin:: signin => " + ex + "\n\n"
        raise
        $ie.close
      end
			# execute

			$ie.text_field(:id,"txtLogin").set(user)
			$ie.text_field(:id,"txtPassword").set(password)
			$ie.button(:index,"1").click
			puts 'Login:: signin - login successful on Sign In Page'
			sleep 10
		
end


def signout
	# assert
		assert($ie.link(:title,"Sign out of MOO").exists?)	
		puts 'Login:: signout - Assertion passed'
	# execute
		$ie.link(:title,"Sign out of MOO").click
		puts 'Login:: signout - Logout link clicked'
end

end
require 'watir'   # the controller
require 'test/unit' 

require 'Login'

include Login

Watir.options_file = 'C:/natasha/RubyScripts/FinalAutomatedTests/options.yml'

$ie = Watir::Browser.new

class SB < Test::Unit::TestCase

def test_a_orderPlacement
  
  test_site = "www.moo.com"
  user = $ARGV[0]
  pwd = $ARGV[1]
  
 $ie.goto(test_site)
 $ie.link(:text,"Manage your orders").click
 
 assert($ie.text_field(:id,"txtLogin").exists?)
 
 Login.signin(user,pwd)
 
 end
 
 end

Reply via email to