I have implemented an angular2 routerLink that allows users to navigate to the editComponent by passing the userId as a parameter.
<a [routerLink]="['/edit',user._id]" (click)="returnUser(user._id)" id="redirect" class="btn" name="user-{{i}}">
<i class="fa fa-eye fa-fw"></i>
</a>
I am trying to test this functionality using Protractor, but after executing the click event, the link does not redirect to the editComponent as expected.
Below is my testing code:
it('should redirect to edit', () => {
element(by.id("redirect")).evaluate("user._id").then(
function (userId) {
browser.get('/edit/' + userId);
browser.waitForAngular();
}, function (err) {
console.log(err);
})
});
Additionally, I am encountering the following error:
asynchronous script timeout: result was not received in 30 seconds
Can anyone point out what mistake I might be making here?
Any suggestions or insights would be greatly appreciated. Thank you!