mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Previously these tests would run automatically when Angular DevTools lived in another repo. These files have continued to live here but have not been running automatically on each PR. Now, these test files have been revived to run properly with our changes since the repo merge. This is a first step to reviving our e2e testing. Next steps include writing cypress tests for new features like Injector Graph, Router tree, signals visualizations, etc. PR Close #61972
30 lines
959 B
JavaScript
30 lines
959 B
JavaScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
|
|
/**
|
|
* Selects an Iframe and returns its body when it's done loading.
|
|
* @param {string} selector - The selector for the iframe.
|
|
* @returns {Function} A function that returns the wrapped body of the iframe.
|
|
*/
|
|
function enterIframe(selector) {
|
|
return cy.get(selector, {log: false}).then({timeout: 30000}, async (frame) => {
|
|
const contentWindow = frame.prop('contentWindow');
|
|
|
|
while (
|
|
contentWindow.location.toString() === 'about:blank' ||
|
|
contentWindow.document.readyState !== 'complete'
|
|
) {
|
|
await new Promise((resolve) => setTimeout(resolve));
|
|
}
|
|
|
|
// return the body of the iframe wrapped in cypress
|
|
return () => cy.wrap(contentWindow.document.body);
|
|
});
|
|
}
|
|
|
|
Cypress.Commands.add('enterIframe', enterIframe);
|