Cannot Login to Angular App that uses Angular 13 ERROR TypeError: Cannot read properties of undefined (reading 'digest')
See original GitHub issueWhat is your Scenario?
We upgraded to angular 13 from angular 9 and we are no longer able to reach our login page.
What is the Current behavior?
An error is displayed in the console just trying to login
//console error = hammerhead.js:15
// ERROR TypeError: Cannot read properties of undefined (reading ‘digest’)
// at JwtWindowCryptoService.calcHash (vendor.js:221136:74)
// at JwtWindowCryptoService.generateCodeChallenge (vendor.js:221123:17)
// at UrlService.createUrlCodeFlowAuthorize (vendor.js:222609:40)
// at UrlService.getAuthorizeUrl (vendor.js:222295:19)
// at SafeSubscriber._next (vendor.js:226686:23)
// at SafeSubscriber.__tryOrUnsub (vendor.js:64444:16)
// at SafeSubscriber.next (vendor.js:64383:22)
// at Subscriber._next (vendor.js:64333:26)
// at Subscriber.next (vendor.js:64310:18)
// at Observable._subscribe (vendor.js:69185:20)
What is the Expected behavior?
To be able to get to the login page
What is your public website URL? (or attach your complete example)
https://testcafe.fleetcommand.biz/
What is your TestCafe test code?
import { Selector } from “testcafe”;
fixtureHome Test
.pagetestcafe.fleetcommand.biz
;
test(‘Can I Login’, async controller => {
const button = Selector('button').withText('Login');
await controller
.typeText('#Username', 'user')
.typeText('#Password', 'password')
.click(button);
Your complete configuration file
{ “browsers”: “edge”, “concurrency”: 1, “skipJsErrors”: true, }
Your complete test report
//console error = hammerhead.js:15
// ERROR TypeError: Cannot read properties of undefined (reading ‘digest’)
// at JwtWindowCryptoService.calcHash (vendor.js:221136:74)
// at JwtWindowCryptoService.generateCodeChallenge (vendor.js:221123:17)
// at UrlService.createUrlCodeFlowAuthorize (vendor.js:222609:40)
// at UrlService.getAuthorizeUrl (vendor.js:222295:19)
// at SafeSubscriber._next (vendor.js:226686:23)
// at SafeSubscriber.__tryOrUnsub (vendor.js:64444:16)
// at SafeSubscriber.next (vendor.js:64383:22)
// at Subscriber._next (vendor.js:64333:26)
// at Subscriber.next (vendor.js:64310:18)
// at Observable._subscribe (vendor.js:69185:20)
× Can I Login
-
The specified selector does not match any element in the DOM tree.
| Selector(‘#Username’)
Browser: Microsoft Edge 99.0.1150.39 / Windows 10
5 | 6 |test('Can I Login', async controller => { 7 | 8 | const button = Selector('button').withText('Login'); 9 | await controller
10 | .typeText(‘#Username’, ‘Username’) 11 | .typeText(‘#Password’, ‘Password’) 12 | .click(button); 13 |//console error = hammerhead.js:15
14 | // ERROR TypeError: Cannot read properties of undefined (reading ‘digest’) 15 | // at JwtWindowCryptoService.calcHash (vendor.js:221136:74)at <anonymous> (D:\Git\TestCafeTools\tests\pagetests\Angular13-Tests.ts:10:6) at <anonymous> (D:\Git\TestCafeTools\tests\pagetests\Angular13-Tests.ts:8:71) at __awaiter (D:\Git\TestCafeTools\tests\pagetests\Angular13-Tests.ts:4:12) at <anonymous> (D:\Git\TestCafeTools\tests\pagetests\Angular13-Tests.ts:6:40)
Screenshots
No response
Steps to Reproduce
- Run the test script that will
- Navigate to the site
- Enter username
- Enter password
- Click login button
TestCafe version
1.18.4
Node.js version
16.14.0
Command-line arguments
testcafe .\tests\pagetests\Angular13-Tests.ts
Browser name(s) and version(s)
edge
Platform(s) and version(s)
Window 10
Other
Ill be sending the user name and password to the email stated above
Issue Analytics
- State:
- Created a year ago
- Comments:23 (1 by maintainers)
Top GitHub Comments
Not as bad as I thought after implementing I just added a parameter to the node argument. For those with the same issue I did this:
node testCafeRunner.ts pathToTests
Looks good. Well done.