Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to test multiple browser windows (for display of inner .tt documents) #288

Closed
dhemutton opened this issue Dec 2, 2020 · 0 comments

Comments

@dhemutton
Copy link
Contributor

Description:

The current method of opening a new tab to display inner .tt documents cannot be tested using testcafe. Somehow the test runs on firefox, firefox:headless and chrome but fails on chrome:headless when trying to detect the child iframe.
photo6210994504039771004

This is because at present, TestCafe doesn't support work with sites whose code contains the window.open call for the main browser window. The issue can be found here.

Following the discussion, an issue was added to TestCafe and is still open at the moment.

Current testcode

test("New tabs ", async (t) => {
  await uploadDocument("./fixture/doc-inner-tt-json-ropsten.json");

  const TabDefault = Selector("[data-testid='default']");
  const TabAttachment = Selector("[data-testid='tab-attachment']");

  const AttachmentNumber = Selector("[data-testid='attachment-number']");
  const AttachmentDownloadLink = Selector("[data-testid='attachment-download-link']");
  const OpenLink = Selector("[data-testid='attachment-open-link']");

  const AttachmentLink0OpenLink = Selector("[data-testid='attachment-open-link']").nth(0);
  const AttachmentLink1OpenLink = Selector("[data-testid='attachment-open-link']").nth(1);

  // tabs number should tally
  await TabDefault.with({ visibilityCheck: true })();
  await t.expect(TabAttachment.textContent).contains("Attachments");
  await t.expect(AttachmentNumber.textContent).contains("3");

  // pdf tabs content should render (pdf rendering is slow on ci causing flaky test, await specifically for pdf spans to render before text validation checks)
  await t.click(TabAttachment);
  await TabAttachment.with({ visibilityCheck: true })();

  // check file download
  await t.expect(AttachmentDownloadLink.count).eql(3);

  //open-link only for .tt and .json OA files
  await t.expect(OpenLink.count).eql(2);
  await t.click(AttachmentLink0OpenLink);
  const currWindow = await t.getCurrentWindow();
  await validateIframeTexts(["INVOICE"]); //failing here possibly due to iframe not being detected in new tab

  //close new tab and go back to parent window
  await t.closeWindow(currWindow);

  await t.click(AttachmentLink1OpenLink);
  await validateIframeTexts(["INVOICE"]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants