I'm making some tests in Protractor and encountered a little problem:
I made a test to register a new user, when I finish registering it the url will be something like this:
#/user/592/profile
So, my question is, how can I manage to get the ID of the new user to get a true in my test? Something like this:
expect(browser.getCurrentUrl()).toEqual(browser.baseUrl+#/user/ID_OF_NEW_USER/profile);
How can I do this? If it's possible of course.
The below code will work for any number of digits in User id.
browser.getCurrentUrl().then(function(url){
var user_id=url.split("user/")[1].replace("/profile","");
//it will return exactly user_id value
expect(browser.getCurrentUrl())
.toEqual(browser.baseUrl+"#/user/"+user_id+"/profile");
});