Closed PaniniTheG closed 2 weeks ago
Hello,
We have released testcafe 3.7.0-rc.1, which addresses this issue.
I will close this issue as a duplicate of https://github.com/DevExpress/testcafe/issues/8300.
However, you may face a new issue described here: https://github.com/DevExpress/testcafe/issues/8308
Please take a look and let us know your results.
Hello, my issue is also reproducible with testcafe 3.7.0, and also reproducible with both edge (130) and chrome (130). So i don't think it should be closed since its a different problem.
Hello, We have released testcafe 3.7.0-rc.2, which might address this issue. Please take a look and let us know your results.
What is your Scenario?
I use testcafe to test an angular app, and when I use nativeAutomation the browser connection (chrome/edge) seems lost after I use the navigateTo the second time (does not have to be the same url, just another url from our app), as even if the page is loaded it and it's not frozen, testcafe does not get the handle of it somehow. When this happens, the next script step after navigation is not executed, so everything just stops, and in some cases, if you wait a long time, a java heap memory error is thrown – but this is caused by testcafe looping after. In my case, the workaround is to just to disable native automation. I cannot provide a test url/app and I also tried to reproduce it with the testcafe demo page, but I could not. Instead I was able to get a debug log using the provided steps. (It is attached below) testcafeDebug.log
What is the Current behavior?
test run just hangs
What is the Expected behavior?
no hanging
What is the public URL of the test page? (attach your complete example)
internal angular app
What is your TestCafe test code?
test.only('nav test', async t => { const testcafeURL = 'https://devexpress.github.io/testcafe/example/' const myURL = https://myurl:8443/sfc' // anonymized const waitTime = 2500 let currentURL
currentURL = testcafeURL console.log(
#1 loading page > ${currentURL}
) await t.navigateTo(currentURL) await t.wait(waitTime) console.log(accessed : ${currentURL}
) console.log(await Selector('body').textContent) console.log('next page >') console.log()console.log(
#2 loading page > ${currentURL}
) await t.navigateTo(currentURL) await t.wait(waitTime) console.log(accessed : ${currentURL}
) console.log(await Selector('body').textContent) console.log('next page >') console.log()currentURL = myURL console.log(
#1 loading page > ${currentURL}
) await t.navigateTo(currentURL) await t.wait(waitTime) console.log(accessed : ${currentURL}
) console.log(await Selector('body').textContent) console.log('next page >') console.log()console.log(
#2 loading page > ${currentURL}
) await t.navigateTo(currentURL) // < page is loaded correctly but then it just gets stuck, next steps are no longer executed await t.wait(waitTime) console.log(accessed : ${currentURL}
) console.log(await Selector('body').textContent) console.log('next page >') console.log() });Your complete configuration file
function isWarning(text, warnings) { // identify warnings const warningHeadingRegexp = /Warnings ((\d)):/; const warningSplitRegexp = /--/; const whiteSpaceRegexp = /\s/g; if (warningHeadingRegexp.test(text) || warningSplitRegexp.test(text)) return true; return warnings.some(msg => msg.replace(whiteSpaceRegexp, '') === text.replace(whiteSpaceRegexp, '')); }
function hideWarningsHook(writeInfo) { // hide warnings if (writeInfo.initiator === 'reportWarnings') writeInfo.formattedText = ''; if (writeInfo.initiator === 'reportTaskDone') { const warnings = writeInfo.data.warnings || []; if (!warnings.length) return; if (isWarning(writeInfo.formattedText, warnings)) writeInfo.formattedText = ''; }; }
function msToTime(duration) { // calculate mins and s var seconds = Math.floor((duration / 1000) % 60); var minutes = Math.floor((duration / (1000 * 60)) % 60); return (minutes == 0) ? seconds + "s" : minutes + "m " + seconds + "s"; }
function appendTestDurationHook(writeInfo) { // add TC duration info if (writeInfo.initiator === 'reportTestDone') { const { name, testRunInfo, meta } = writeInfo.data || {}; const testDurationMs = testRunInfo.durationMs; const testDurationMins = msToTime(testDurationMs) writeInfo.formattedText = writeInfo.formattedText + ' (' + testDurationMins + ')'; }; }
function triggerAdjustReportOutputHook(writeInfo) { hideWarningsHook(writeInfo); // trigger to remove warnings from the 'spec' report output appendTestDurationHook(writeInfo); // trigger to add TC duration info }
module.exports = { "skipJsErrors": true, "screenshots": { "pathPattern": "fails/${DATE}/${TEST}/${USERAGENT}${TIME}${QUARANTINEATTEMPT}.png", "takeOnFails": true, "thumbnails": false }, "videoPath": "fails/videos", "videoOptions": { "failedOnly": true, "singleFile": true, "pathPattern": "${DATE}/${USERAGENT}${TIME}_${FILE_INDEX}.mp4" }, "videoEncodingOptions": { "r": 20, "aspect": "4:3" }, hooks: { reporter: { onBeforeWrite: { 'spec': triggerAdjustReportOutputHook, // trigger to adjust 'spec' report output }, }, }, }
Your complete test report
debug log available from edge (also anonymized), as chrome runs are not possible currently for us due to the chrome 130 issue with testcafe
Screenshots
No response
Steps to Reproduce
in our case using the navigateTo function the second time in the same TC
TestCafe version
3.6.2 [or any version above 3.3.0 as for me nativeAutomation worked on this version]
Node.js version
20.15.0
Command-line arguments
npx testcafe edge myScript.js
Browser name(s) and version(s)
edge 130
Platform(s) and version(s)
win 10 pro
Other
No response