-
Notifications
You must be signed in to change notification settings - Fork 162
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
Support of the new window simulation into iframe for the login via social networks purposes #1428
Comments
Tried this proposal but I am blocked with few errors: const patchAuth = new ClientFunction(() => { Note that I already have this : import { Selector, Role, ClientFunction } from "testcafe" For this line -- window.open = function (url) { |
Hi @neilmatillano, import { ClientFunction } from 'testcafe';
const patchAuth = ClientFunction(() => {
window['op' + 'en'] = function (url) {
var iframe = document.createElement('iframe');
iframe.style.position = 'fixed';
iframe.style.left = '200px';
iframe.style.top = '150px';
iframe.style.width = '400px';
iframe.style.height = '300px';
iframe.style['z-index'] = '99999999';;
iframe.src = url;
iframe.id = 'auth-iframe';
document.body.appendChild(iframe);
};
});
fixture `fixture`
.page `your site`
test('test', async t => {
await patchAuth();
await t
.click('.btn.btn-big.btn-fb')
.switchToIframe('#auth-iframe')
.typeText('#email', 'email***')
.typeText('#pass', 'pass***')
.click('#u_0_0')
.wait(30e3);
}); But you also should find the |
I followed all the steps including updating the transforms js, but I am getting this error when running testcafe locally regarding the #auth-iframe
|
@neilmatillano test('test', async t => {
await patchAuth(); // <<<<<<<<< this
await t
.click('.btn.btn-big.btn-fb')
.switchToIframe('#auth-iframe')
.typeText('#email', 'email***')
.typeText('#pass', 'pass***')
.click('#u_0_0')
.wait(30e3);
}); |
@LavrovArtem yeah i forgot, added now but get another error. Request failed with status code 500
I also get these errors: Failed to load resource: the server responded with a status of 400 (Bad Request) |
Hi @neilmatillano, |
@LavrovArtem , is there anyway to remember in the browser the login for facebook that I previously did so I don't need to login again when I run testcafe? I tried using chrome:userProfile but it didnt help. |
Hi @neilmatillano, |
@LavrovArtem , yes I tried this one but the problem is I still get redirected to the login page even after I saved the login. |
Or how about session cookies, is it supported in testcafe? |
I've created example with User Roles for you: import { ClientFunction, Role, Selector } from 'testcafe';
const patchAuth = ClientFunction(() => {
window['op' + 'en'] = function (url) {
var iframe = document.createElement('iframe');
iframe.style.position = 'fixed';
iframe.style.left = '200px';
iframe.style.top = '150px';
iframe.style.width = '400px';
iframe.style.height = '300px';
iframe.style['z-index'] = '99999999';;
iframe.src = url;
iframe.id = 'auth-iframe';
document.body.appendChild(iframe);
};
});
const facebookAccUser = Role('<your site url>/login', async t => {
await patchAuth();
await t
.click('.btn.btn-big.btn-fb')
.switchToIframe('#auth-iframe')
.typeText('#email', 'email')
.typeText('#pass', 'pass')
.click('#u_0_0')
.switchToMainWindow();
await Selector('#page-header-top-menu')();
});
fixture `fixture`
.page `<your site url>`
.beforeEach(async t => await t.useRole(facebookAccUser));
test('first test', async t => {
await t.click(Selector('.dashboard-tab').nth(1));
});
test('second test', async t => {
await t.click(Selector('.dashboard-tab').nth(2));
}); |
@LavrovArtem , I'm sorry but I am getting an error with the example but I do appreciate your help in giving me the example.
And I checked the fb login is present. And also just to be clear, in header-transforms.js, I have this skipped option,
|
Hi @neilmatillano, |
@LavrovArtem Thanks for this example. I am also trying to use Test Cafe to test my app with Facebook login (I am using Ionic and the Facebook login plugin as well) When I follow your steps above, I get the following errors:
and
I think this is because the url of the frame opening the FB login is 'http://192.168.1.82:54306/ ...' and my Facebook Login settings do not include that particular URL/port combination in the 'Valid OAuth redirect URIs' settings. But because test cafe generates a new port number every time, I don't see any way to add it...not sure if that's clear but wondering if you have any suggestions? Thanks! |
Hi @viking2917,
#1428 (comment) I will add PR which rid you from a |
Thanks @LavrovArtem I did modify the header-transforms.js to make the change to 'x-frame-options': skip, but it's possible I messed up somewhere along the way... |
I am getting the same popup-blocked error
I have made sure that I skipped the x-frame-options in header-transfor.js: tried jumping into chrome setting and allowing popups before the login button get clicked but no difference. Has anyone found a way around this yet? |
Hi @joshpitzalis, |
I have faced issue while clicking on a #googleSignInn button. It doesn't redirect to the google POPUP page.Below I attached my code Expected Behaviour is to give my credentials in google popup page and then it should redirect to my homesite. Thanks in advance `import { ClientFunction, Role, Selector } from 'testcafe'; const patchAuth = ClientFunction(() => {
}; const googleAccUser = Role('https://merida-web.herokuapp.com/', async t => { await t await Selector('#page-header-top-menu')(); fixture Merida E2E Testing test('first test', async t => { |
Hi @joshpitzalis, |
Hi @MohamedRasool786, |
Hi @LavrovArtem Thanks for your cool reply! Is it possible to do for firebase google authentication in Testcafe. |
@MohamedRasool786 |
@LavrovArtem |
@MohamedRasool786 |
We are developing a public API for operating with multiple windows simultaneously. Track DevExpress/testcafe#912 to be informed about our progress. |
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. |
I've figured out that we have simple way to login via social networks. I've tried to log in to the site from an issue #1385 via a Facebook account and I've got it in two steps:
x-frame-options
header because it disallowed a login page loading in an iframe.testcafe-hammerhead/src/request-pipeline/header-transforms.js
Line 143 in bf87b68
patchAuth
ClientFunction into the test.Final test:
The text was updated successfully, but these errors were encountered: