WebTester Locator Argument Accessor

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

WebTester Locator Argument Accessor

Joel Turnbull-2

I was wondering what the contributors to WebTester think about adding an accessor for argument to WtSeleniumLocator?

The reason I ask is I'd like to, in setUp, do something like this...

    input := self textFieldByXPath: '//span[ @class = "TextInPlaceEditor" ]/input'.

and then in my test do this...

    ( self link: 'an in-place editor' ) click.
    self waitForElementPresent: input locator argument.
    input text: 'some input'

Joel

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WebTester Locator Argument Accessor

Bart Gauquie
Go ahead :-)

Grzt

Bart

On Mon, Feb 28, 2011 at 4:06 AM, Joel Turnbull <[hidden email]> wrote:

I was wondering what the contributors to WebTester think about adding an accessor for argument to WtSeleniumLocator?

The reason I ask is I'd like to, in setUp, do something like this...

    input := self textFieldByXPath: '//span[ @class = "TextInPlaceEditor" ]/input'.

and then in my test do this...

    ( self link: 'an in-place editor' ) click.
    self waitForElementPresent: input locator argument.
    input text: 'some input'

Joel

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WebTester Locator Argument Accessor

Joel Turnbull-2

Hey, have you found a good way introduce a small pause into a WebTester test?

Something similar to waitForPageToLoad, but for jquery actions that change the page without reloading it. Something other that waitForElementPresent.

I tried sending the selenium 'pause' command, but selenium server 2.0b2 didn't seem to recognize it...

'Could not execute command pause with params: #(''20000'') result was: ERROR: Unknown command: ''pause'''







On Wed, Mar 2, 2011 at 12:59 PM, Bart Gauquie <[hidden email]> wrote:
Go ahead :-)

Grzt

Bart

On Mon, Feb 28, 2011 at 4:06 AM, Joel Turnbull <[hidden email]> wrote:

I was wondering what the contributors to WebTester think about adding an accessor for argument to WtSeleniumLocator?

The reason I ask is I'd like to, in setUp, do something like this...

    input := self textFieldByXPath: '//span[ @class = "TextInPlaceEditor" ]/input'.

and then in my test do this...

    ( self link: 'an in-place editor' ) click.
    self waitForElementPresent: input locator argument.
    input text: 'some input'

Joel

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WebTester Locator Argument Accessor

Bart Gauquie
Have not tried it, but does this:
serve your needs?

Grtz

Bart



On Thu, Mar 3, 2011 at 3:46 AM, Joel Turnbull <[hidden email]> wrote:

Hey, have you found a good way introduce a small pause into a WebTester test?

Something similar to waitForPageToLoad, but for jquery actions that change the page without reloading it. Something other that waitForElementPresent.

I tried sending the selenium 'pause' command, but selenium server 2.0b2 didn't seem to recognize it...

'Could not execute command pause with params: #(''20000'') result was: ERROR: Unknown command: ''pause'''








On Wed, Mar 2, 2011 at 12:59 PM, Bart Gauquie <[hidden email]> wrote:
Go ahead :-)

Grzt

Bart

On Mon, Feb 28, 2011 at 4:06 AM, Joel Turnbull <[hidden email]> wrote:

I was wondering what the contributors to WebTester think about adding an accessor for argument to WtSeleniumLocator?

The reason I ask is I'd like to, in setUp, do something like this...

    input := self textFieldByXPath: '//span[ @class = "TextInPlaceEditor" ]/input'.

and then in my test do this...

    ( self link: 'an in-place editor' ) click.
    self waitForElementPresent: input locator argument.
    input text: 'some input'

Joel

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WebTester Locator Argument Accessor

Joel Turnbull-2

I failed, but I think somebody with javascript skills might be able to create a pause within a waitForCondition js block.

I tried executing, within it, a do-while loop that did some time comparisons. That gave me strange results when the times increased.

I also tried to execute a javascript setTimout() within it. But it didn't seem to honor that at all.

It's ok...I can use waitForElement. It's just strange in the cases where, in order to test that an element appeared, I first have to wait for it to appear ;)

I'll keep thinking about it.

Thanks
Joel


On Thu, Mar 3, 2011 at 2:17 AM, Bart Gauquie <[hidden email]> wrote:
Have not tried it, but does this:
serve your needs?

Grtz

Bart



On Thu, Mar 3, 2011 at 3:46 AM, Joel Turnbull <[hidden email]> wrote:

Hey, have you found a good way introduce a small pause into a WebTester test?

Something similar to waitForPageToLoad, but for jquery actions that change the page without reloading it. Something other that waitForElementPresent.

I tried sending the selenium 'pause' command, but selenium server 2.0b2 didn't seem to recognize it...

'Could not execute command pause with params: #(''20000'') result was: ERROR: Unknown command: ''pause'''








On Wed, Mar 2, 2011 at 12:59 PM, Bart Gauquie <[hidden email]> wrote:
Go ahead :-)

Grzt

Bart

On Mon, Feb 28, 2011 at 4:06 AM, Joel Turnbull <[hidden email]> wrote:

I was wondering what the contributors to WebTester think about adding an accessor for argument to WtSeleniumLocator?

The reason I ask is I'd like to, in setUp, do something like this...

    input := self textFieldByXPath: '//span[ @class = "TextInPlaceEditor" ]/input'.

and then in my test do this...

    ( self link: 'an in-place editor' ) click.
    self waitForElementPresent: input locator argument.
    input text: 'some input'

Joel

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




--
imagination is more important than knowledge - Albert Einstein
Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein
Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein
The true sign of intelligence is not knowledge but imagination. - Albert Einstein
However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill
It's not enough that we do our best; sometimes we have to do what's required. - Sir Winston Churchill

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WebTester Locator Argument Accessor

Andrei Chis
Hi Joel,

A very simple way (and perhaps not the best way) in which you could obtain  just a delay is to simply execute a time - comparison loop. You don't have to execute it inside a waitForCondition block. For example you could extend WebTester with the following methods and then in your test just call "self webTester pause: 10000" and then verify your condition using the WtWebTester api.

WtWebTester>>getEval: aScript
self subclassResponsibility

WtWebTester>>pause: waitTimeInMillis
       self subclassResponsibility

WtSeleniumWebTester >>getEval: aScript
^ self processCommand: 'getEval' withParams: (Array with: aScript).

WtSeleniumWebTester >>pause: waitTimeInMillis
self getEval: 'var date = new Date(); var curDate = null;  while (curDate = new Date() - date < ', waitTimeInMillis asString, '){} '.



My 2cents

Andrei

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WebTester Locator Argument Accessor

littleSmalltalker
Sounds like this solution will make most browsers hang.. Why not use a setTimeout ?
Reading your question, it's clear that the reason you use waitForCondition in the first place is to detect the existence of an element. So why doesn't waitForCondition suffice? In the case you want to cascade the assertions, you can just do a waitForCondition that combines both assertions (checking that an element exists, and also checking its value).

Avi.

On Fri, Mar 4, 2011 at 12:03 PM, Andrei Vasile Chis <[hidden email]> wrote:
Hi Joel,

A very simple way (and perhaps not the best way) in which you could obtain  just a delay is to simply execute a time - comparison loop. You don't have to execute it inside a waitForCondition block. For example you could extend WebTester with the following methods and then in your test just call "self webTester pause: 10000" and then verify your condition using the WtWebTester api.

WtWebTester>>getEval: aScript
self subclassResponsibility

WtWebTester>>pause: waitTimeInMillis
       self subclassResponsibility

WtSeleniumWebTester >>getEval: aScript
^ self processCommand: 'getEval' withParams: (Array with: aScript).

WtSeleniumWebTester >>pause: waitTimeInMillis
self getEval: 'var date = new Date(); var curDate = null;  while (curDate = new Date() - date < ', waitTimeInMillis asString, '){} '.



My 2cents

Andrei

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WebTester Locator Argument Accessor

Joel Turnbull-2

Yes, Andrei's solution gives me the same behavior I was getting before.

i.e. If I have a link that does some jquery, and makes a div appear.

jqueryLink click.
self pause: '5000'.
self assert: (self divByXPath: '//div...' ) isPresent.

Seems the pause is actually getting triggered before the jquery click has a chance to change the dom. So the click happens, there is a pause, the div appears and the assert is called too quickly to find it ( I think ).

Indeed, my problem really boils down to the default timeout value slowing down my test suite, so I think calling selenium setTimeout is the right approach. Doing that with a significantly reduced value seems to be doing the trick.

Thanks all,
Joel



On Fri, Mar 4, 2011 at 5:39 AM, Avi Shefi <[hidden email]> wrote:
Sounds like this solution will make most browsers hang.. Why not use a setTimeout ?
Reading your question, it's clear that the reason you use waitForCondition in the first place is to detect the existence of an element. So why doesn't waitForCondition suffice? In the case you want to cascade the assertions, you can just do a waitForCondition that combines both assertions (checking that an element exists, and also checking its value).

Avi.

On Fri, Mar 4, 2011 at 12:03 PM, Andrei Vasile Chis <[hidden email]> wrote:
Hi Joel,

A very simple way (and perhaps not the best way) in which you could obtain  just a delay is to simply execute a time - comparison loop. You don't have to execute it inside a waitForCondition block. For example you could extend WebTester with the following methods and then in your test just call "self webTester pause: 10000" and then verify your condition using the WtWebTester api.

WtWebTester>>getEval: aScript
self subclassResponsibility

WtWebTester>>pause: waitTimeInMillis
       self subclassResponsibility

WtSeleniumWebTester >>getEval: aScript
^ self processCommand: 'getEval' withParams: (Array with: aScript).

WtSeleniumWebTester >>pause: waitTimeInMillis
self getEval: 'var date = new Date(); var curDate = null;  while (curDate = new Date() - date < ', waitTimeInMillis asString, '){} '.



My 2cents

Andrei

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside