VWUnit find widget by id?

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

VWUnit find widget by id?

Steve Cline
In the article on GUI testing with VWUnit at http://www.cincomsmalltalk.com/blog/blogView?entry=3236371778, there is an intriguing aside: "(Reinout has added a feature to locate by name or id.)", but I do not see that capability in the version in the Cincom Public Store.  I have published a new version of VWUnitBundle that runs green when selecting the whole bundle, but if I try substituting #ActionButton1 for 'Edit Payment Information' as the argument to "pressButton:" in the method testEnterPersonalInformation, the test fails because the button never gets pressed.  Does anyone have a version of VWUnit that works with ids as well as labels? I am working on a client's app that has two buttons with identical labels (but only one button is visible) in one dialog, and in another dialog the button labels are images, not text, so picking them by id would be great.

Thanks, Steve Cline
Reply | Threaded
Open this post in threaded view
|

Re: VWUnit find widget by id?

davidbuck
It wouldn't be hard to write a locateId: method.  I would suggest
something like this (not tested):

VWUnitUserInterfaceTestingHarness:

locateId: aSymbol
    currentWidget := self tryToLocate:
                    [self allWidgets detect:
                            [:each | (self specWrapperOf: each) spec id
= aSymbol]
                        ifNone: [nil]].
    self fastFlash

VWUnitUserInterfaceAbstractHarness:

specWrapperOf: aWidget

    aWidget parentsDo: [:component |
        (component isKindOf: SpecWrapper)
            ifTrue: [^component]].

    ^nil

Ideally, you would define locateId: in the abstract superclass and the
Reporting Harness as well.

David Buck


Steve Cline wrote:

> In the article on GUI testing with VWUnit at
> http://www.cincomsmalltalk.com/blog/blogView?entry=3236371778, there is an
> intriguing aside: "(Reinout has added a feature to locate by name or id.)",
> but I do not see that capability in the version in the Cincom Public Store.
> I have published a new version of VWUnitBundle that runs green when
> selecting the whole bundle, but if I try substituting #ActionButton1 for
> 'Edit Payment Information' as the argument to "pressButton:" in the method
> testEnterPersonalInformation, the test fails because the button never gets
> pressed.  Does anyone have a version of VWUnit that works with ids as well
> as labels? I am working on a client's app that has two buttons with
> identical labels (but only one button is visible) in one dialog, and in
> another dialog the button labels are images, not text, so picking them by id
> would be great.
>
> Thanks, Steve Cline
>
>
>
> --
> View this message in context: http://forum.world.st/VWUnit-find-widget-by-id-tp4677956.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2013.0.2904 / Virus Database: 2641/6192 - Release Date: 03/20/13
>
>
>  

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: VWUnit find widget by id?

Steve Cline
Following David's suggestions I have added locateId: and pressButtonWithId:, and published to the public store as [7.9] 1.2