Re: [wtr-general] Browser instance not recognized by other modules

2017-12-08 Thread Jeff Fagot
I appreciate all your comments Chuck. AS you suggested I looked at Test 
Factory gem and you were right, it gives good nice view of how objects can 
be like.
=> I feel like I get the Object usage knowing I'll need practice to master 
it.

I am still undecided on whether or not I will continue with Cucumber or 
switch to RSpec.
=> I think I will trust you guys on that one). Even if as a none technical 
guy, Cucumber was of a great help to get started (Even though I had to 
rewrite several times certain steps to finally get to an acceptable level 
of abstraction, that is the learning curve)

Thanks for all your good advice and enlightening me on new tools, it helps!



On Friday, December 8, 2017 at 12:21:08 PM UTC-5, Chuck van der Linden 
wrote:
>
> On Thursday, December 7, 2017 at 12:19:51 PM UTC-8, Jeff Fagot wrote:
>>
>>
>> So now, I would turn my question in a different angle: why is my Browser 
>> instance @b declared in my *** ENVR.RB *** file known to my *** STEPDEF.RB 
>> *** file?
>> Does it mean that Modules or Class are segregated from the "rest of the 
>> world" (== ENVR, STEPDEFS...) and that the "rest of the world" can be seen 
>> as a unique big Class?
>>
>> Thanks for helping me thru the process of sorting things out!
>>
>> Titus thanks for the advice on BDD, when I started I did not know about 
>> RSpec and spec_helper, but I will definitely take your advice !
>>
>>>
>
> I second what Titus said about BDD..  while you can build a test framework 
> from cucumber, if you are not also using it for BDD then you are really not 
> getting the full benefit from cucumber, and in a lot of cases you would be 
> better off with using rspec as a test framework.  You can create re-usable 
> test helper methods that work much the same way as the reusable steps in 
> cucumber.   Writing proper tests in gherkin is a bit of an art, and if you 
> are not using the feature files to drive shared understanding of what the 
> product is supposed to do, then that is mostly just additional overhead, 
> and the same test steps could be expressed directly in the code for your 
> tests. .
>
> As to why things defined in env.rb are available in steps, (as well as 
> things defined in steps usable in other steps), well that's part of the 
> magic of the cucumber 'world'.   It's part of the design in order to make 
> it easy to pass data between steps, create common objects that are used by 
> steps etc.  You can for example make a 'my_account' variable in a given 
> step that establishes the account balance, and then later use the same 
> variable in another step that modifies the balance with a deposit or 
> withdrawal.For more details I would strongly recommend reading 'The 
> Cucumber Book", it's the best way I know of to get off to a good start with 
> Cucumber and avoid a lot of the more common pitfalls I see testers fall 
> into when they first encounter Cucumber. 
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Chrome Headless Browser

2017-12-08 Thread rajagopalanmadasami
This error is due to timeout for pageload, timeout to load the page was set 
to 60 seconds, Is your browser taking more than 60 seconds to load the 
google? 

On Friday, December 8, 2017 at 10:44:42 PM UTC+5:30, 江南 wrote:
>
> Hi,
>
> I have tried the code below but my script just keep loading then I get 
> this message: Net::ReadTimeout: Net::ReadTimeout
>
> @browser = Watir::Browser.new :chrome, headless: true
> @browser.goto "www.google.com"
>
>  Can someone tell me am I missing something?
>
>
> Thanks
>
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Running 2 cucumber feature file in one web session

2017-12-08 Thread Chuck van der Linden
one other thing (see below

On Friday, December 8, 2017 at 1:54:15 AM UTC-8, 江南 wrote:
>
> Thanks for your suggestion. 
>
> I'm testing a website and I have various data to test but I don't want to 
> create duplicate steps in different feature files so I want to do is put 
> the test steps e.g. Login page in one feature file and Account page in 
> another then pull the input data from a spreadsheet. 
> I think this way will make easier to maintain the feature file that is 
> all.
>
> Dangit, hit send too quickly on prior response.  I also meant to add this 
regarding spreadsheet use with cucumber.

If you are working with cucumber but want to pull in data from a 
spreadsheet, that is most often a sign that cucumber may not be the right 
tool for you.When using cucumber your test data should be defined in 
the feature files.   There are a number of ways that cucumber supports 
this, from steps that can take a table to process, to using scenario 
outlines where the scenario is defined with replaceable parameters that are 
pulled from a table of 'examples'  and the scenario is repeated for each 
row in the table. 

Putting test data in a spreadsheet obscures it from view, making it harder 
to understand what tests are doing when reading feature files, which 
defeats the main purpose (common understanding) of using feature files in 
the first place.   If 'it doesn't matter because nobody else reads the 
feature files' then you should not be using cucumber, use instead rspec and 
just code the test steps directly in code, not in a feature file.  Then if 
you want to have data files in spreadsheets, you can just make use of some 
of the common gems for reading and writing common spreadsheet format files. 

Cucumber is a great tool, but it is also primarily a collaboration tool, 
not a test tool.  Yes testing is a part of what cucumber does, but that is 
not its primary purpose.  Suggested 
reading: 
https://cucumber.io/blog/2014/03/03/the-worlds-most-misunderstood-collaboration-tool

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Running 2 cucumber feature file in one web session

2017-12-08 Thread Chuck van der Linden
On Friday, December 8, 2017 at 1:54:15 AM UTC-8, 江南 wrote:
>
> Thanks for your suggestion. 
>
> I'm testing a website and I have various data to test but I don't want to 
> create duplicate steps in different feature files so I want to do is put 
> the test steps e.g. Login page in one feature file and Account page in 
> another then pull the input data from a spreadsheet. 
> I think this way will make easier to maintain the feature file that is 
> all.
>
>
While well intentioned you are heading in a direction that doesn't work 
very well..  Also your question seems to tell me you don't understand the 
basic concepts of how cucumber works (or you are not good at expressing 
your understanding) 

By design, steps are re-usable  so it is completely normal to see the same 
steps used in multiple feature files.
By design, there is only a single definition for a given step.. you can't 
have two steps with the same phrasing such as "When I login as " that 
do different things, that will result in an error.
Feature files should be created in a way that documents and describes the 
operation of the product.  Think of it like portions of a book that tells 
what your product does.
Step files, where steps are defined do not have to (and usually should not) 
parallel your feature files.   Rather the most common thing is to group 
common steps together.  For example a login_steps.rb file might have steps 
to login, self-register a new user, logout, etc.   You might have another 
step file that deals with steps that navigate around your site "when I 
click the xxx tab" for example

For anyone new to Cucumber I strongly recommend reading "the Cucumber 
Book"   it's the best way to gain an understanding of what cucumber is for, 
and how to best use it most effectively. 

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Chrome Headless Browser

2017-12-08 Thread Chuck van der Linden

On Friday, December 8, 2017 at 9:14:42 AM UTC-8, 江南 wrote:
>
> Hi,
>
> I have tried the code below but my script just keep loading then I get 
> this message: Net::ReadTimeout: Net::ReadTimeout
>
> @browser = Watir::Browser.new :chrome, headless: true
> @browser.goto "www.google.com"
>
>  Can someone tell me am I missing something?
>
>
> Thanks
>
>
Do you have the latest chromedriver installed in a directory that is 
included in your PATH?   (from a command line in any directory on your 
system you should be able to type "chromedriver,exe -v" and it will display 
the version of chromedriver.. (also verifies it can be found on the path)  

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Browser instance not recognized by other modules

2017-12-08 Thread Chuck van der Linden
On Thursday, December 7, 2017 at 12:19:51 PM UTC-8, Jeff Fagot wrote:
>
>
> So now, I would turn my question in a different angle: why is my Browser 
> instance @b declared in my *** ENVR.RB *** file known to my *** STEPDEF.RB 
> *** file?
> Does it mean that Modules or Class are segregated from the "rest of the 
> world" (== ENVR, STEPDEFS...) and that the "rest of the world" can be seen 
> as a unique big Class?
>
> Thanks for helping me thru the process of sorting things out!
>
> Titus thanks for the advice on BDD, when I started I did not know about 
> RSpec and spec_helper, but I will definitely take your advice !
>
>>

I second what Titus said about BDD..  while you can build a test framework 
from cucumber, if you are not also using it for BDD then you are really not 
getting the full benefit from cucumber, and in a lot of cases you would be 
better off with using rspec as a test framework.  You can create re-usable 
test helper methods that work much the same way as the reusable steps in 
cucumber.   Writing proper tests in gherkin is a bit of an art, and if you 
are not using the feature files to drive shared understanding of what the 
product is supposed to do, then that is mostly just additional overhead, 
and the same test steps could be expressed directly in the code for your 
tests. .

As to why things defined in env.rb are available in steps, (as well as 
things defined in steps usable in other steps), well that's part of the 
magic of the cucumber 'world'.   It's part of the design in order to make 
it easy to pass data between steps, create common objects that are used by 
steps etc.  You can for example make a 'my_account' variable in a given 
step that establishes the account balance, and then later use the same 
variable in another step that modifies the balance with a deposit or 
withdrawal.For more details I would strongly recommend reading 'The 
Cucumber Book", it's the best way I know of to get off to a good start with 
Cucumber and avoid a lot of the more common pitfalls I see testers fall 
into when they first encounter Cucumber. 

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Chrome Headless Browser

2017-12-08 Thread 江南
Hi,

I have tried the code below but my script just keep loading then I get this 
message: Net::ReadTimeout: Net::ReadTimeout

@browser = Watir::Browser.new :chrome, headless: true
@browser.goto "www.google.com"

 Can someone tell me am I missing something?


Thanks

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Browser instance not recognized by other modules

2017-12-08 Thread Chuck van der Linden
On Thursday, December 7, 2017 at 12:19:51 PM UTC-8, Jeff Fagot wrote:
>
> Did not get a chance to dive into creating my first Class but I will do 
> asap.
> I quite understand the concept of the Page Object (I will still need 
> practice to get to the understanding of where exactly should I use it and 
> how) and that is why I was looking into Classes yesterday.
>
> I guess what I am still confused about is what makes the difference?
> To me it looks like by doing so (create class Login) I would only do a 
> translation of my problem to a sub-level.
>  Why would I be able to use more easily (from anywhere) an instance of 
> "Login" than an instance of "Browser"?
>
> I mean, I understand I can use the instance from where it's been 
> instantiated, but how do I use it from elsewhere ?
> (I hope my question makes sense)
>
> Things are starting to make sense as I am typing and trying to even myself 
> understand my problem.
> So now, I would turn my question in a different angle: why is my Browser 
> instance @b declared in my *** ENVR.RB *** file known to my *** STEPDEF.RB 
> *** file?
> Does it mean that Modules or Class are segregated from the "rest of the 
> world" (== ENVR, STEPDEFS...) and that the "rest of the world" can be seen 
> as a unique big Class?
>
> Thanks for helping me thru the process of sorting things out!
>
> Titus thanks for the advice on BDD, when I started I did not know about 
> RSpec and spec_helper, but I will definitely take your advice !
>

Rather than a login class, I would suggest you create what I call a 'Domain 
Object' class, in this case a User class.  You can then put methods like 
Login, Logout, Register, Update_Profile, etc.

What objects to create depends on the nature of the business domain..   In 
a retail setting you might have a shopping cart class, (an instance of 
which could be included in your user class).  When working at one company 
that made a site for farmers I had domain objects (defined as classes) for 
the user, and their fields, etc.  

Have a look at the Test Factory gem  it is a simple approach to both page 
objects and domain objects and is designed to work with watir. 

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Running 2 cucumber feature file in one web session

2017-12-08 Thread 江南
Thanks for your suggestion. 

I'm testing a website and I have various data to test but I don't want to 
create duplicate steps in different feature files so I want to do is put 
the test steps e.g. Login page in one feature file and Account page in 
another then pull the input data from a spreadsheet. 
I think this way will make easier to maintain the feature file that is 
all.

On Wednesday, 6 December 2017 18:19:09 UTC, Arik Jones wrote:
>
> You could create a browser session in `features/support/env.rb` and assign 
> it to an instance variable
> and then use that session in your feature files. Its basically a global 
> hook, but you'll need to end that session properly with an `at_exit` method.
>
> More info here: 
> https://github.com/cucumber/cucumber/wiki/Hooks#global-hooks
>
> Personally I don't recommend running your features that way.  Can I ask 
> why you need to do it this way?
>
> On Wednesday, December 6, 2017 at 8:32:35 AM UTC-6, 江南 wrote:
>>
>> Hi,
>>
>> I am using Watir Ruby + Cucumber for my testing. 
>>
>> Can you tell me how to run two feature files in one web session?
>>
>> Thanks
>>
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.