Hi all, I developped a first version of a WebTestCase class. It uses SUnit and Zinc to get pages from the internet and test some conditions on them. The main work is actually to offer higher level search facilities inspired from what I saw in Selenium There is an example, that logs in and out of Github (and checks that we logged in and out) --- testLoginAndOutOfGitHub | node | self defaultUrl: 'http://github.com/'. self getDefaultUrl. self assert: (self searchString: 'Sign in') notNil. self clickLinkValue: 'Sign in'. self assert: (self searchString: 'Sign in to GitHub') notNil. "5 fields to inform for login 3 of them have values inside the login page: commit, utf8, authenticity_token" self enter: user forName: 'login'. self enter: pass forName: 'password'. self enterDefaultValueForName: 'commit'. self enterDefaultValueForName: 'utf8'. self enterDefaultValueForName: 'authenticity_token'. "bug in the page, there is a </form> before the real <form ...>" node := self searchNodeTag: 'form' afterNode: (self searchNodeTag: 'form'). self submitForm: node. "similar for signout, submit a form with 2 default values" node := self searchFormOwning: (self searchString: 'Sign out'). self enterDefaultValueForName: 'utf8'. self enterDefaultValueForName: 'authenticity_token'. self submitForm: node. "we are out" self assert: (self searchString: 'Sign in') notNil. --- No configOf or Catalog yet. I am too lazy can be found at: MCSmalltalkhubRepository owner: 'nicolasAnquetil' project: 'WebTest' user: '' password: '' nicolas -- Nicolas Anquetil -- MCF (HDR) Project-Team RMod |
Are you aware of the work that Johan did on Parasol (https://github.com/SeasideSt/Parasol)?
Max
|
nope :-( but it was fun anyway nicolasOn 25/06/2017 16:48, Max Leske wrote:
Are you aware of the work that Johan did on Parasol (https://github.com/SeasideSt/Parasol)? -- Nicolas Anquetil -- MCF (HDR) Project-Team RMod |
Nicolas this is the one I mentioned that wraps selenium
On Sun, Jun 25, 2017 at 4:55 PM, Nicolas Anquetil <[hidden email]> wrote: > nope :-( > > but it was fun anyway > > nicolas > > > On 25/06/2017 16:48, Max Leske wrote: > > Are you aware of the work that Johan did on Parasol > (https://github.com/SeasideSt/Parasol)? > > Max > > On 25 Jun 2017, at 16:45, Nicolas Anquetil <[hidden email]> > wrote: > > > Hi all, > > I developped a first version of a WebTestCase class. > > It uses SUnit and Zinc to get pages from the internet and test some > conditions on them. > > The main work is actually to offer higher level search facilities inspired > from what I saw in Selenium > > There is an example, that logs in and out of Github (and checks that we > logged in and out) > > --- > testLoginAndOutOfGitHub > | node | > self defaultUrl: 'http://github.com/'. > self getDefaultUrl. > > self assert: (self searchString: 'Sign in') notNil. > self clickLinkValue: 'Sign in'. > > self assert: (self searchString: 'Sign in to GitHub') notNil. > "5 fields to inform for login > 3 of them have values inside the login page: commit, utf8, > authenticity_token" > self enter: user forName: 'login'. > self enter: pass forName: 'password'. > self enterDefaultValueForName: 'commit'. > self enterDefaultValueForName: 'utf8'. > self enterDefaultValueForName: 'authenticity_token'. > "bug in the page, there is a </form> before the real <form ...>" > node := self searchNodeTag: 'form' afterNode: (self searchNodeTag: > 'form'). > self submitForm: node. > > "similar for signout, submit a form with 2 default values" > node := self searchFormOwning: (self searchString: 'Sign out'). > self enterDefaultValueForName: 'utf8'. > self enterDefaultValueForName: 'authenticity_token'. > self submitForm: node. > > "we are out" > self assert: (self searchString: 'Sign in') notNil. > --- > > No configOf or Catalog yet. I am too lazy > > can be found at: > > MCSmalltalkhubRepository > owner: 'nicolasAnquetil' > project: 'WebTest' > user: '' > password: '' > > > nicolas > > -- > Nicolas Anquetil -- MCF (HDR) > Project-Team RMod > > > > > -- > Nicolas Anquetil -- MCF (HDR) > Project-Team RMod |
Hi Nicolas,
you can also checkout: http://smalltalkhub.com/#!/~TorstenBergmann/WebDriver This implements the JsonWireProtocol so it is not necessary to install Java/Selenium and is (hopefully) a cleaner implementation together with tests. Pharo only. Simple How to: ============== - The project is currently written and working for Windows platform (but will be platform independent later) - run Metacello new configuration: 'WebDriver'; smalltalkhubUser: 'TorstenBergmann' project: 'WebDriver'; load. to load the project and all dependencies - Download ChromeDriver.exe and put it into the image directory https://chromedriver.storage.googleapis.com/index.html?path=2.30/ You can also set a different location in "WebDriver" -> "Settings" - in the World menu choose "WebDriver" -> "ChromeDriver" -> "Run Chrome Driver" - open a playground and run wd := WDWebDriver new. wd url: 'http://www.pharo.org'. wd screenshotForm inspect which should open a chrome window. It's not yet finished but if you like you can help completing it. Bye T. |
Nicolas, It is still nice to have a thing that helps with web pages testing and that does not requires external libraries in order to work (even if limited in abilities).https://github.com/ericchiang/pup On Tue, Jun 27, 2017 at 10:51 AM, Torsten Bergmann <[hidden email]> wrote: Hi Nicolas, |
Free forum by Nabble | Edit this page |