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

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

Closed
ssemrau opened this issue May 11, 2022 · 8 comments · Fixed by #7350
Closed

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

ssemrau opened this issue May 11, 2022 · 8 comments · Fixed by #7350
Assignees
Labels
FREQUENCY: level 1 SYSTEM: hammerhead TYPE: bug The described behavior is considered as wrong (bug).

Comments

@ssemrau
Copy link

ssemrau commented May 11, 2022

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

@ssemrau ssemrau added the TYPE: bug The described behavior is considered as wrong (bug). label May 11, 2022
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 11, 2022
@Aleksey28
Copy link
Collaborator

Hi @ssemrau,

Thank you for your example. I reproduced the issue. Please share your project with the code for further research.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label May 13, 2022
@ssemrau
Copy link
Author

ssemrau commented May 13, 2022

Hi @ssemrau,

Thank you for your example. I reproduced the issue. Please share your project with the code for further research.

Hi @Aleksey28,
what would you like me to share? Code of the application? Code of Microform?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 13, 2022
@Aleksey28
Copy link
Collaborator

Please share the code of your application where you use this microform. I need a complete example that I can use to reproduce the issue locally without complex settings. This will speed up our research.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label May 16, 2022
@ssemrau
Copy link
Author

ssemrau commented May 16, 2022

There is github repository provided by Cybersource which is also provider of Microform
I used this https://github.com/CyberSource/cybersource-flex-samples-dotnet/tree/master/flex-microform-sample as example. It's in .net 4.6 but there are as well node.js examples which are very similar.
I tried as well run testcafe 1.13 and it seems Microform works better, it fails sometimes, but it's more stable. Just a hint.
Of course downgrading to 1.13.0 is not a solution as we would like to use the latest version of testing framework.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label May 16, 2022
@Aleksey28
Copy link
Collaborator

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

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label May 17, 2022
@AndreyBelym AndreyBelym self-assigned this May 31, 2022
@testcafe-build-bot
Copy link
Collaborator

@ssemrau, I prepared a proof-of-concept fix, please try it in your environment. You can install it with the following command:

npm install https://github.com/DevExpress/testcafe/files/8813356/testcafe-1.19.0.tar.gz

You also should add --hostname localhost to TestCafe arguments, otherwise you will get a cryptography error.

testcafe-hammerhead-24.5.19.tar.gz
testcafe-1.19.0.tar.gz

@ssemrau
Copy link
Author

ssemrau commented Jun 2, 2022

I can confirm that fix works as expected.
Thanks a lot for you engagement and effort!

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jun 2, 2022
@AlexKamaev AlexKamaev removed the STATE: Need response An issue that requires a response or attention from the team. label Jun 8, 2022
@AndreyBelym AndreyBelym assigned Aleksey28 and unassigned AndreyBelym Oct 26, 2022
AndreyBelym added a commit that referenced this issue Nov 2, 2022
<!--
Thank you for your contribution.

Before making a PR, please read our contributing guidelines at

https://github.com/DevExpress/testcafe/blob/master/CONTRIBUTING.md#code-contribution

We recommend creating a *draft* PR, so that you can mark it as 'ready
for review' when you are done.
-->
[closes #7022]

## Purpose
Add `--disable-cross-domain` option

## Approach
1. Add handling CLI option `--disable-cross-domain`
2. Add switching cross-domain

## References
#7022
DevExpress/testcafe-hammerhead#2806

## Pre-Merge TODO
- [ ] Write tests for your proposed changes
- [ ] Make sure that existing tests do not fail

Co-authored-by: Andrey Belym <belym.a.2105@gmail.com>
Co-authored-by: Andrey Belym <andrey.belym@devexpress.com>
@github-actions
Copy link

github-actions bot commented Nov 3, 2022

Release v2.1.0-rc.1 addresses this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FREQUENCY: level 1 SYSTEM: hammerhead TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants