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

redirect after iFrame dosen't happening #1825

Closed
sebokgabor84 opened this issue Apr 17, 2018 · 8 comments
Closed

redirect after iFrame dosen't happening #1825

sebokgabor84 opened this issue Apr 17, 2018 · 8 comments
Assignees
Labels
STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Milestone

Comments

@sebokgabor84
Copy link

Are you requesting a feature or reporting a bug?

Maybe it is a bug, I'm not sure, I just want to try testcafe...

What is the current behavior?

I want to build a login script, after login via iFrame the redirect dosen't happening and I will get a 404 page, this is my test script:
import { Selector } from 'testcafe';
import {ClientFunction} from 'testcafe'

fixture Getting Started// declare the fixture
.page https://www.aboutyou.de/; // specify the start page

//then create a test and place your code there
test('Login test with new User', async t => {
const getLocation = ClientFunction(() => window.location.href);

	// NOTE: the ClientFunction will be executed in TOP window's context
	console.log(await getLocation());
await t
    .click('button.login_8b49da')
    .switchToIframe('.iframe_1k7bcr7')
    .typeText('body > main > div > div.login-section.fade-in-out-transition > form > div:nth-child(1) > div > input', '[email protected]')
    .typeText('body > main > div > div.login-section.fade-in-out-transition > form > div.form-wrapper > div > div > div:nth-child(2) > input', '12345')
    .click('body > main > div > div.login-section.fade-in-out-transition > form > button')
    .switchToMainWindow()
    .expect(Selector('#app > section > div.navigation_1ie55wv > div.topWrapper_17208h5 > div > div.logoContainer_9563j8 > a > div > div.youWrapper_pzivoe > div.text_1apmb75-o_O-nick_ay4wjb').innerText)
        .eql('vorname');

});

What is the expected behavior?

I should be redirected to the main page.
If I'm doing a manually log in after the iFrame I will go trough this redirects:

Status Code URL IP Page Type Redirect Type Redirect URL
302 https://checkout.aboutyou.de/oauth/success ...* server_redirect temporary https://www.aboutyou.de/oauth?state=*
200 https://www.aboutyou.de/oauth?state=* ...* client_redirect javascript https://www.aboutyou.de/
200 https://www.aboutyou.de/ ...* normal none none

How would you reproduce the current behavior (if this is a bug)?

please try my provided script

Provide the test code and the tested page URL (if applicable)

it is in the "What is the current behavior?" section
Tested page URL:
https://www.aboutyou.de/
Test code

import { Selector } from 'testcafe';
import {ClientFunction} from 'testcafe'

fixture `Getting Started`// declare the fixture
    .page `https://www.aboutyou.de/`;  // specify the start page


//then create a test and place your code there
test('Login test with new User', async t => {
	const getLocation = ClientFunction(() => window.location.href);

    	// NOTE: the ClientFunction will be executed in TOP window's context
    	console.log(await getLocation());
    await t
        .click('button.login_8b49da')
        .switchToIframe('.iframe_1k7bcr7')
        .typeText('body > main > div > div.login-section.fade-in-out-transition > form > div:nth-child(1) > div > input', '[email protected]')
        .typeText('body > main > div > div.login-section.fade-in-out-transition > form > div.form-wrapper > div > div > div:nth-child(2) > input', '12345')
        .click('body > main > div > div.login-section.fade-in-out-transition > form > button')
        .switchToMainWindow()
        .expect(Selector('#app > section > div.navigation_1ie55wv > div.topWrapper_17208h5 > div > div.logoContainer_9563j8 > a > div > div.youWrapper_pzivoe > div.text_1apmb75-o_O-nick_ay4wjb').innerText)
            .eql('vorname');
});

Specify your

  • operating system: mac 10.13.4 (17E199)
  • testcafe version: 0.19.2
  • node.js version: v9.10.1
@AndreyBelym AndreyBelym self-assigned this Apr 18, 2018
@AndreyBelym
Copy link
Contributor

AndreyBelym commented Apr 18, 2018

Hi @sebokgabor84, I've reproduced the issue, and need some time to investigate it. Now it looks like a bug in TestCafe.

@sebokgabor84
Copy link
Author

@AndreyBelym Thanks for the feedback!

@macdonaldr93
Copy link

Hey @AndreyBelym, I'm having the same issue where the state param is being dropped in the roundtrip for oauth. We're in the same boat as @sebokgabor84 where we're inside an iFrame. I'm wondering if there is any progress on debugging/solution for this?

@miherlosev miherlosev self-assigned this Sep 14, 2018
@miherlosev
Copy link
Contributor

I'm working on this

@macdonaldr93
Copy link

Just curious if there's an update on this issue. I would love to start using TestCafe again on my project :)

@miherlosev
Copy link
Contributor

Hi @macdonaldr93

You can start using TestCafe in your project. The case described in the issue is not related to iframes. I am investigating this now and can say that this scenario is quite rare.
Probably, the cause of the problem is in cascading cookie updates on redirecting through several pages.

@macdonaldr93
Copy link

yeah.... that's exactly our problem :\ it's a auth redirect flow through an iFrame

@AndreyBelym AndreyBelym transferred this issue from DevExpress/testcafe Nov 12, 2018
@miherlosev miherlosev added this to the Sprint #21 milestone Nov 12, 2018
@LavrovArtem LavrovArtem modified the milestones: Sprint #21, Sprint #22 Nov 19, 2018
@LavrovArtem LavrovArtem modified the milestones: Sprint #22, Sprint #23 Nov 29, 2018
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Dec 12, 2018
@miherlosev miherlosev modified the milestones: Sprint #23, Sprint #24 Dec 12, 2018
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Dec 13, 2018
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Dec 19, 2018
LavrovArtem added a commit to LavrovArtem/testcafe-hammerhead that referenced this issue Dec 21, 2018
AndreyBelym pushed a commit to AndreyBelym/testcafe-hammerhead that referenced this issue Feb 28, 2019
…DevExpress#1864)

* fix `redirect after iFrame doesn't happening` (close DevExpress#1825)

* part2

* fix tests

* add test

* fix errors

* fix returned value
@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked Issues that were automatically locked by the Lock bot label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Projects
None yet
Development

No branches or pull requests

5 participants