You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is ultimately more of a question than anything else, but could potentially be an issue.
When initially running LTS against our LMS, many of the tests failed due to a timeout while waiting for this action in getResults inside lts/lib/helpers.js: await page.waitForSelector("#result");
When looking at the content manually in a browser, however, I found that the element the tests were searching for was present, but it was inside an iframe. For whatever reason, puppeteer wasn't finding any elements within the iframe on the page.
I modified the getResults function to this implementation which waits for the iframe, then gets the frame and checks it for the results element. If that fails, it reverts back to the original implementation and checks the main page for the results element, and if that fails, it reports the exception.
The question is -- was that OK to do, or should the original implementation not have had any issues with finding the results, and if it does then that's a problem with our LMS? I always have to assume that getting tests to pass by changing details of the test is not typically the right thing to do.
Below is my implementation of the getResult function, complete with wonky try/catch inside a catch 😅
getResult: async()=>{letresultElement;constframeElement=awaitpage.waitForSelector("iframe"),frame=awaitframeElement.contentFrame();try{resultElement=awaitframe.waitForSelector("#result");}catch(ex){try{resultElement=awaitpage.waitForSelector("#result");}catch(ex2){thrownewError(`Failed to get result from content:\n Outer Ex: ${ex};\n\t inner ex: ${ex2}`);}}constjsonString=awaitresultElement.evaluate(el=>el.textContent);letresult;try{result=JSON.parse(jsonString);}catch(ex){thrownewError(`Failed to parse JSON from string: '${jsonString}'`);}returnresult;},
The text was updated successfully, but these errors were encountered:
An addition -- I also noticed that we were timing out on the test for content 003-launchMethod-OwnWindow, even with my changes. Loading and launching the content manually resulted in this result:
So I think this is another case where helpers.js would need to be updated to check for a popup window as well (again - assuming my changes were correct in the first place).
This is ultimately more of a question than anything else, but could potentially be an issue.
When initially running LTS against our LMS, many of the tests failed due to a timeout while waiting for this action in
getResults
insidelts/lib/helpers.js
:await page.waitForSelector("#result");
When looking at the content manually in a browser, however, I found that the element the tests were searching for was present, but it was inside an iframe. For whatever reason, puppeteer wasn't finding any elements within the iframe on the page.
I modified the
getResults
function to this implementation which waits for the iframe, then gets the frame and checks it for the results element. If that fails, it reverts back to the original implementation and checks the main page for the results element, and if that fails, it reports the exception.The question is -- was that OK to do, or should the original implementation not have had any issues with finding the results, and if it does then that's a problem with our LMS? I always have to assume that getting tests to pass by changing details of the test is not typically the right thing to do.
Below is my implementation of the getResult function, complete with wonky try/catch inside a catch 😅
The text was updated successfully, but these errors were encountered: