question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hammerhead.js __get$(document, "location").ancestorOrigins returns <unreadable>

See original GitHub issue

What is your Scenario?

Fuse Microform iframes should be shown in given div containers. See this doc: https://developer.cybersource.com/docs/cybs/en-us/digital-accept-flex/developer/all/rest/digital-accept-flex/microform-integ/microform-integ-getting-started/setting-up-client-side.html

What is the Current behavior?

When I test it manually all works fine, when I run the test script I get the issue that __get$(document, "location").ancestorOrigins returns value unreadable as per screenshot below 1

What is the Expected behavior?

__get$(document, "location").ancestorOrigins returns ‘http://localhost:12345

What is your public website URL? (or attach your complete example)

https://flex-microform-hammerhead-issue.azurewebsites.net/

What is your TestCafe test code?

import { Selector } from 'testcafe';

fixture('Azure')
    .page('about:blank');

test('Azure', async t => {    
    await t
        .maximizeWindow()        
        .navigateTo('https://flex-microform-hammerhead-issue.azurewebsites.net/');

    var mainWindow = await t.getCurrentWindow() 

    try {
        await t
            .typeText('#cardholderName', 'Tester')
            .wait(1000);
        
        await t.debug();

        await t
            .switchToIframe('#number-container > iframe')
            .typeText('[name="number"]', '4111111111111111')
            .switchToWindow(mainWindow);
        
        await t
            .switchToIframe(`#securityCode-container > iframe`)
            .typeText('[name="securityCode"]', '123')
            .switchToWindow(mainWindow);

        await t
            .click('#pay-button');    

        await t
            .wait(1000)
            .click('#pay-button');    
    } catch (ex) {
        console.error(ex);
    }

    await t.debug();
});

Your complete configuration file

.testcaferc.json { "skipJsErrors": true, "hostname": "localhost", "port1": 12345, "port2": 12346 }

Your complete test report

No response

Screenshots

1 3 2

Steps to Reproduce

  1. Run automated script in chrome
  2. When script stops open dev tools
  3. Switch to Console
  4. Unclock the page and press Mount Security Code button
  5. Expected error should be
correlationId: undefined
details: undefined
informationLink: "https://www.cybersource.com/products/payment_security/secure_acceptance"
message: "You have not supplied a valid capture context."
name: "MicroformError"
reason: "CAPTURE_CONTEXT_INVALID"
  1. Open iframe.min.js and format it it so that it’s not minified, add breakpoint in line 2772 as per screenshot below 4
  2. Press Mount Security Code button again and in debug inspect document and __get$(document, "location") variables

TestCafe version

1.18.6

Node.js version

v14.17.6

Command-line arguments

testcafe chrome azure.js

Browser name(s) and version(s)

Chrome 101.0.4951.54 / Windows 10

Platform(s) and version(s)

Windows

Other

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
Aleksey28commented, May 17, 2022

We will research this issue and update this thread as soon as we have any news.

0reactions
github-actions[bot]commented, Nov 3, 2022

Release v2.1.0-rc.1 addresses this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

location.ancestorOrigins - Web APIs - MDN Web Docs
You can use location.ancestorOrigins in the script for a document to determine, for example, whenever the document is being framed by a site ......
Read more >
Change window.location.ancestorOrigins - Stack Overflow
Under Firefox, if the <iframe> is pointing to another <iframe> , it solves the issue. But under Chrome, it's still detecting the main...
Read more >
Javascript Get URL info with document.location | Pitayan Blog
Using the location api is quite easy. What we use most frequently is perhaps the href property. This returns us the string url...
Read more >
Location origin Property - W3Schools
Window location.origin ... let origin = location.origin; ... The origin property returns the protocol, hostname and port number of a URL.
Read more >
window.location Cheatsheet | SamanthaMing.com
The window.location object can be used to get information on the current page address (URL). You can also use its method to do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found