Maybe it is a bug, I'm not sure, I just want to try testcafe...
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');
});
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
please try my provided script
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');
});
Hi @sebokgabor84, I've reproduced the issue, and need some time to investigate it. Now it looks like a bug in TestCafe.
@AndreyBelym Thanks for the feedback!
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?
I'm working on this
Just curious if there's an update on this issue. I would love to start using TestCafe again on my project :)
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.
yeah.... that's exactly our problem :\ it's a auth redirect flow through an iFrame
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.
Most helpful comment
I'm working on this