How do I login to salesforce by using cypress?

Viewed 1243

I'm currently using cypress to do some testing. However, I have to do some tests with salesforce and it seems that I'm getting the following issue 'Whoops, there is no test to run.'

context('Salesforce', () => {
    beforeEach(() => {
      cy.request("https://test.salesforce.com/?un=username%40domain_name&pw=user_password&startURL=%2F001")
    })
    it('.click() - click on a DOM element', () => {
      
      // load opportunity page
      cy.visit('https://test.salesfroce.com/lightning/page/home')
      // optional. let's the page load during the test runner
      cy.wait(7000)
      
      //cy.get('#username').type('username')
      //cy.get('#password').type('password')
      //cy.contains('Log In to Sandbox')


    })
})

enter image description here

Does anyone know how to bypass the login page with cypress?

1 Answers

The problem that I had is that I was using a long password where extra characters didn't take into account. For this reason, I decided to change my password for something short, and now is working correctly.

This is the actual URL that you have to request and visit to make sure you can log in to your Salesforce account.

Take into consideration that cy.request is the link above & the cy.visit will be your dashboard URL.

"https://test.salesforce.com/?un=username%40domain_name&pw=user_password&startURL=%2F001

Related