I am not sure if this is a bug or a different matter, but this is how it goes:
I am currently writing a script that is performing a check if all of the URL types meet the company’s guidelines.
Everything behaves as expected, buuuut… except for the main page. Here’s the algorithm:
- I define an array for different URLs
- I invoke an ‘incorrect’ URL that must be redirected to a correct one
- I use WebUI.getUrl() to get the de facto URL
- I check it using a regex
Everything was neat, until I stumbled upon this issue:
- I have a de facto URL of https://www.something.lv
- I check it with a wildcard (with Groovy slashes around)
/https\:\/\/www\..*\.lv/
- I get a fail on the check (because it has to be true)
unless - I change it to
/https\:\/\/www\..*\.lv\//
The step 4 does not meet with our guidelines, but, in any browser, I don’t see the ending slash which is found by Katalon.
Possibly, this is a question for a webmaster, but I’m just curious if you guys can give me some insight for the matter.
P.S. Googling didn’t bring me no results, so I had to try it the empirical way.
Your thoughts?
P.P.S. The code itself (I’m just testing it in alpha, so don’t laugh (but really, laugh if you feel like it))
// Define a $testUrlArray variable with Urls that we need to address and check afterwards
String[] testUrlArray = [
‘http://somesite.lv’, // [0] 1.1.1
‘http://www.somesite.lv’, // [1] 1.1.2
‘http://somesite.lv/lat/elektronika-1/tv-un-video/?manufacturer=219&screen_resolution=25217’, // [2] 1.2
‘https://www.somesite.lv/’, // [3] 2.1
‘https://www.somesite.lv/eng’, // [4] 2.2.1
‘https://www.somesite.lv/lat/bernu-mode/meitenem-1/dzhinsu-apgerbi’, // [5] 2.2.3
‘https://www.somesite.lv/rus/warranty-and-returns/14-days-return’, // [6] 2.2.4
‘https://www.somesite.lv/rus/sadzives-tehnika/iebuvejama-tehnika/ledusskapji?manufacturer=1161&price=2000-5000’, // [7] 2.3.1
‘https://www.somesite.lv/eng/catalog/product/view/id/558422/s/lg-49sk8000-49sk8000plb-aee.html/’, // [8] 2.4.1
‘https://www.somesite.lv/rus/catalog/product/view/id/520191/s/chairman-9801-ergo-7015599.html/?adwords=test’ // [9] 2.4.2
]
assert testUrlArray instanceof String[]
WebUI.openBrowser(’’)
// First we type a ‘wrong’ category URL into the address bar and go
WebUI.navigateToUrl(testUrlArray[0])def currentUrl = WebUI.getUrl()
// Then we perform a check on the wildcard. We continue if it fails
WebUI.verifyMatch(currentUrl, /https://www…*.lv/, true, FailureHandling.CONTINUE_ON_FAILURE)