1

In the process of migrating a legacy app to Angular we have a setup where the legacy app loads the new up in an iframe. We want to test this integration with Protractor. The legacy app is not an Angular app.

We'd be able to test if the legacy app had Angular, but it doesn't, so Protractor has trouble switching context into the iframe where the Angular app lives.

How should this be done?

Edit: Protractor fails as follows.

After the iframe comes up and doing

browser.switchTo().frame(...);

Protractor is unable to find controls that are inside the iframe. We've tested the case outside the iframe and Protractor finds the buttons and links and fields just fine in the Angular app. But when the same page is loaded in an iframe it acts as though they weren't there.

tempoc
  • 377
  • 3
  • 7

1 Answers1

0

Once I had a similar situation, but upside down - there was a non-angular page opened on click:

I hope the same idea would work here also. Set ignoreSynchronization to false right before switching to a frame. Set ignoreSynchronization back to true in the afterEach() function:

browser.ignoreSynchronization = false;
// switch to frame
Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • This gets me as far as bringing up the iframe that contains my Angular app. But then Protractor is unable to switch into the iframe and resume from there. I'm blaming it on Angular not being part of the root frame. – tempoc Mar 20 '15 at 20:16
  • @tempoc could you please share how does it fail? Also, is the site public so that I can try reproducing the problem? Thanks. – alecxe Mar 20 '15 at 20:18
  • I've commented above on how Protractor fails. The app is not accessible by the public while in development due to company policy. – tempoc Mar 20 '15 at 20:25
  • @tempoc thank you for the information. May be a stupid idea, can you access the iframe content by navigating to the iframe src url directly?.. – alecxe Mar 20 '15 at 20:27
  • @alexce It's definitely a workaround in most situations, but the point of our tests is to emulate real user interaction, including some post messaging that occurs between frames. – tempoc Mar 20 '15 at 20:29
  • This looks like an old post, but I have the exact same issue. Have you found a solution? – Frederic Morin Apr 05 '16 at 15:06