0

I'm testing the step of Mink: Then the url should match "pattern"

My url is some like "/test/34kUñlj" and this is a _blank target. This means that when I click on a link, then it open a new windows and the url is "/test/34kUñlj".

I'm using sahi driver. The pattern after /test/ is a random hash.

The first problem is: the step the url should match is marked as undefined. I looked at the api of Mink and saw that this step wasn't "" so I tried this: Then the url should match /test/ñljñl23 and still marking it as undefined.

The second: why I follow the new windows that is open?

And finally: how is the pattern of that url "/test/342lñasjf". I use "/test/\d+"

Thanks

Biruwon
  • 394
  • 1
  • 4
  • 18

1 Answers1

1

a) The mink step is defined with "", so you should use Then the url should match "url"

b) Do you mean "how do I follow the new window that is opened?". If that is what you mean, it cannot be done. It is a problem of testing with sahi: when you open another window, this is not tracked by Mink and the url that Mink sees is the one in the original window. What I did in a similar case is that if the environment is 'test', then I don´t add the "_blank" target so that it opens in the same window. Not a perfect solution, I know

c) The step should be

Then the url should match "/test/\w+"

not "/test/\d+" as this only matches numbers

Carlos Granados
  • 11,273
  • 1
  • 38
  • 44
  • a)Work for me without "". I don't know if this is for me Behat/Mink version. I'm testing pay with paypal and after solved the problem with automatically accept certification, Sahi works fine. Thanks! – Biruwon Sep 18 '12 at 11:06