I am working on salesforce , I need to load the website but everytime I hit
describe('empty spec', () => {
it('passes', () => {
cy.visit('https://rtbadev1-rtbaonline.cs114.force.com/rtbaonline/s/n')
})
})
I am getting a blank website with the recaptcha(V3)
I tried couple os solutions but did not work
Related
Is it possible to save requests made during Cypress test as curls to be reviewed later? E.g. for importing them in Postman.
Network tab, of DevTools of Cypress application, logs request from Cypress app, not from application under test itself.
The network tab will show requests from the AUT, but if you want to find all the requests use intercept
const requests = []
cy.intercept('/api/*', (request) => {
console.log(request.url) // get them from the console
requests.push(request.url) // or save them to a file at end of spec
})
...
after(() => {
cy.writeFile('cypress/fixtures/requests.json', requests)
})
To gain detailed information about the request and response including the response time, you can utilize the HAR file format (http://www.softwareishard.com/blog/har-12-spec/). To generate a HAR file on the fly during the execution of your Cypress tests you can use the cypress-har-generator.
describe('my tests', () => {
before(() => {
// start recording
cy.recordHar();
});
after(() => {
// save the HAR file
cy.saveHar({ waitForIdle: true });
});
it('does something', () => {
cy.visit('https://example.com');
// ...
});
});
This plugin will generate a HAR file that can be imported to the network panel of developer tools (https://developer.chrome.com/blog/new-in-devtools-76/#HAR) or Postman (https://blog.postman.com/postman-now-supports-importing-har-files/), for further analysis.
I am trying to test my website from cypress.io, but i am constantly getting above error.
I am facing issue will Signing in with google. I am using the cy.origin() method.
/// <reference types="cypress" />
describe('Basic tests', () => {
it.only('Login should happen', ()=>{
// cy.viewport(1280, 720)
cy.visit('https://internetcomputerservices.com')
cy.contains('Dashboard').click()
cy.contains('Sign in with Google').click()
cy.origin('https://accounts.google.com/o/oauth2/auth', ()=>{
cy.get('[aria-label="Email or phone"]').click().type('haswrfbi20#gmail.com')
});
})
})
Please help me
Although I haven't able to find the solution for testing google login, i have connected with team and they will most likely resolve this issue in cypress 10.10.0.
For meanwhile, you can use token to directly login, by-pass the google-login and test the website.
you can find the token by going to developer tools and there you will find Application, click on it, there you will find the token, copy it and paste it in below code.
Make sure to install the package before hand:
npm i cypress-localstorage-commands
Code:
describe("Basic tests", () => {
before(() => {
cy.visit("---your-website-url---", {
onBeforeLoad(win) {
win.localStorage.setItem(
"token",
"---token-here---"
);
},
});
});
it.only("should be able to run test 1", async () => {
// write your first test here ----
});
});
I'm trying to automate a login process for our site which uses Auth0 & Google Sign in. On the login page if you click Google sign in you get sent to an Auto0 page with a form and another Google sign in link, the page contains a URL something like:
https://OURDOMAIN.auth0.com/login?state=*REMOVED*
It's the first time I'm trying to use cy.origin() In my test I'm trying this:
cy.get("a[testid='googleSignInButton']").click()
cy.origin('https://OURDOMAIN.auth0.com/', () => {
cy.get("input[type='email']").type('anEmail#me.com')
})
The problem is whatever I try to do in the origin block just returns a timeout trying to find the element.
I've set experimentalSessionAndOrigin: true is there something I'm doing wrong? Unfortuantly the way we are using Auth0 and Google Sign in means it's not possible to do it via API calls.
try without cy.origin()
I had the same problem, and it was fixed by removing the cy.origin()
Try this one:
Cypress.Commands.add('loginSession', (email, password) => { cy.session([email, password], () => {
cy.visit('/').then(() => {
//cy.origin('auth0.com', { args: [email, password] }, ([email, password]) => {
cy.get('#username').type(email)
cy.get('#password').type(password)
cy.get("button[type='submit']").click({ force: true })
// })
})
cy.get('[data-cy="logo"]').should('be.visible')
})
});
everyone! My test runs without any problems locally, but fails on the auth2 after redirect in CI. As I think it's connected with losing cookies, because it works when I intercept the request of redirect and add such lines in code:
cy.getCookies().then((cookies) => {
cy.intercept('*redirect.html*', (req) => {
const cookiesToSend = ['machineid'];
req.headers['Cookie'] = cookies
.filter(({ name }) => cookiesToSend.some((el) => el.toLowerCase() == name.toLowerCase()))
.map((cookie) => cookie.name + '=' + cookie.value)
.join(';');
})
}
);
Cypress version is 9.7.
Do you have any ideas why it can happen?
I have a very basic Cypress test, per below
describe("Tests for Site users Page", () => {
beforeEach(() => {
cy.login();
});
it("visits the manage users page", () => {
cy.visit("/sites/2/users");
cy.contains("Contact Name").should("exist");
});
For some reason, Cypress does not visit /sites/2/users and instead goes to /sites/2/global (even though I did not request that). Can someone please tell me what is going on and how this issue can be resolved? In my cypress.json i have the baseUrl set to http://localhost:3002. Note, in the screenshot I have seen it says (new url) http://localhost:3002/sites/2/global directly after attempting to visit /sites/2/users
This is a bit of wild-guess territory, but maybe the login is not successful, and /sites/2/global is the default page for not-logged-in.
To test it, check where do you go with cy.visit('/') and with cy.login() commented out for the moment.
If it's /sites/2/global, then cy.login() is the problem.