I have an angular app which has to authorize to gitlab and signIn the user with userName and pass in order to fetch some data/information from gitlab and display it in the UI.
The first test case fails before the browser can redirect to the gitlab login-form (https://gitlab.com/users/sign_in):
Spec Code:
it('Visits the home page', () => {
cy.visit('/', {
onBeforeLoad(win) {
cy.stub(win.navigator, 'cookieEnabled', false).as('cookieEnabled');
},
})
})
Error:
Checking your browser before accessing gitlab.com.
Please enable Cookies and reload the page.
This process is automatic. Your browser will redirect to your requested content shortly.
Please allow up to 5 seconds…
I have been searching and trying couple of other options/implementation based on cypress official doc etc., but still facing the same issue. Some kind of similar questions here in SO, but none for the hints/answers provide the fix.
Also I am not 100% sure that it's really an issue related to cypress test implementation. Could it be an issue affecting gitlab itself?
Any ideas how to fix such issue?
Cypress: 10.7.0
Angular: 14.x
Node: v16.13.1
Related
My site is Netlify App and my domain is www.kimiee-kreates.com. I am currently trying to integrate stripe into my website which is already on the live web. My issue is every time I am trying to checkout an item it bring me to a messages stating “Bad Request, missing form”. It worked when I made the local host but it’s not working now on the live site. Can someone explain a way to fix this?
The stripe server is located in server.js under service/public folder I am trying to access that but don't know how:
redirect
[/* /create-checkout-session]
package.json
{
“dependencies”: {
“dotenv”: “^16.0.3”,
“express”: “^4.18.2”,
“stripe”: “^10.17.0”
},
“devDependencies”: {
“nodemon”: “^2.0.20”
}
}
netlify.toml
[[redirects]]
from =“/server.js”
to = “/create-checkout-session”
status = 303
I was hoping one of you could help me out here. I ran out of ideas already.
I have a script with Cypress.io that basically access a website and clicks on a link for LOGIN. I have reduced the code to only access the LOGIN page directly, which was working perfectly for the past 1-2 months, but in the past week I ran the script and it's no longer working.
When it tries to access the URL https://sso.tce.sp.gov.br/cas-server/login it gives the error below.
The most weird thing is that I can access this URL manually from the other non-automated (EDGE, Chrome), but when I try to do it with the Cypress automated browser it doesn't work.
cy.visit() failed trying to load:
https://sso.tce.sp.gov.br/cas-server/login
We attempted to make an http request to this URL but the request
failed without a response.
We received this error at the network level:
Error: Parse Error: Duplicate Content-Length
Common situations why this would fail:
you don't have internet access
you forgot to run / boot your web server
your web server isn't accessible
you have weird network configuration settings on your computer
Apparently it's doesn't look like a proxy thing nor a code thing, do you guys have any idea of what it could be?
Code:
describe('Test', () => {
it('Access AUDESP Website', function () {
Cypress.config('chromeWebSecurity',false);
//cy.visit('https://www.tce.sp.gov.br/audesp')
//cy.get('.menu-superior-itens > [href="https://sso.tce.sp.gov.br/cas-server/login"]').click()
cy.visit('https://sso.tce.sp.gov.br/cas-server/login')
})
})
Any ideas would be very helpful!!
Thank you!
UPDATE:
Guys, I'm still with this error, but I have found out that the website is sending a duplicate header, but cypress is not able to process it. The browser, outside of Cypress, ignores it apparently... any ideas on how to fix it on Cypress?
I am trying to implement MEAN app for which I made node server
app.get("/posts",(req,res)=>{
posts=[{"title":"a","context":"b"},{"title":"c","context":"d"}]
res.send(posts); // tried even with res.status(200).json(posts)
});
when it checked with api tester it works well output snapshot
output snapshot with apitester
when i try to access with angular services
getposts()
{
var url='http://localhost:3000/posts';
this.http.get<post[]>(url).subscribe(data=>this.posts=data);
console.log(this.posts);
return this.posts;
}
when i do console.log(posts) it returning []
can someone please help i am struggling from last 2 days?
As you have not added the screenshot from the Browser's Inspector => Network Tab, I am guessing this answer will help you in case my guess is right.
Try setting the below in your front-end project (Angular in your case):
Try setting the below in your back-end project (Node in your case):
Also, verify your updates as in the below screengrab in the Browser's Inspector (Chrome in my case):
Please Note: - The mentioned response headers have special meaning, so kindly look for more info with a simple Google search. Use these settings during your development phase on localhost.
I need help using Google Sign-In when testing my Angular 6 app with Cypress. It can't use the sign-in popup, and so I'm trying to follow Cypress' advice to "always use cy.request() to talk to 3rd party servers via their APIs." That's from https://docs.cypress.io/guides/references/best-practices.html#Visiting-external-sites which then points us to this example: https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/logging-in__single-sign-on/cypress/integration/logging-in-single-sign-on-spec.js - more info on how to do this is seen at minute 23 in a presentation by the Cypress author: https://www.youtube.com/watch?v=5XQOK0v_YRE
I'm taking the video solution and trying to modify it for Firebase Auth according to https://firebase.google.com/docs/auth/web/google-signin#advanced-authenticate-with-firebase-in-nodejs but I'm getting stuck on how to obtain the proper id_token and so far I have this code in my commands.js file:
Cypress.Commands.add('login', () => {
var id_token = ___?____;
cy.request({
method: 'POST',
url: 'https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key=[API_KEY]',
body: {
"requestUri": "http://localhost:3500",
"postBody": `id_token=${id_token}&providerId=google.com`,
"returnSecureToken": true,
"returnIdpCredential": true
}
})
})
I believe I need to use a different API to initiate the login and request user credentials, which will include the id_token, and so I tried https://firebase.google.com/docs/auth/web/google-signin#advanced-authenticate-with-firebase-in-nodejs but am not yet skilled enough to pull in external js files (https://apis.google.com/js/platform.js) into Node (This is probably not possible in js files the way it is in html). Using this package: https://github.com/google/google-auth-library-nodejs may be my next attempt. Is there anyone who can pick it up from here?
Similar question at Is it possible to use Cypress e2e testing with a firebase auth project? - but they are signing in with user and pass.
Google Wallet seems to get stuck at the loading screen and doesn't show the form
google.load('payments', '1.0', {
packages: ['sandbox_config'],
callback: cbk})
Callback is
goog.payments.inapp.buy({
jwt: getToken,
success: function() {
console.log("success");
},
failure: function() {
console.log("fail");
}
});
Console shows
Uncaught Error: SecurityError: DOM Exception 18 5F00.cache.js:23
com_google_checkout_inapp_client_gwt_init_init
This is on Google Chrome - Version 25.0.1337.0 dev. It works for me on the demo page, but not on my own pages.
EDIT:
Installed Google Chrome Canary - Version 25.0.1347.2 canary
Seems to not be an issue, works perfectly in Canary - is this just a Google Chrome dev glitch or has anyone else seen this?
EDIT 2:
Now it doesn't work in canary either (1348) I have also tested in Chrome stable, where it works.
Actually it doesn't seem to be related to the browser version, as reinstalling Canary and wiping Application Support data files makes it work again
Is there a way to get support via email from Google somehow? I know it's Google and they don't talk to people, but maybe there is some way?
Based off of your experiences it seems like a Chrome dev glitch.
Sidenote: I'm not sure if testing your app in dev/canary releases is the best way to catch potential bugs. Are you also testing in IE/FF/Chrome stable?