https://cypress.io logo
Join Discord
Powered by
# help
  • s

    stale-optician-85950

    11/03/2022, 2:31 PM
    Multiple config files https://docs.cypress.io/api/plugins/configuration-api#Switch-between-multiple-configuration-files is a great way to do it.
  • s

    stale-optician-85950

    11/03/2022, 2:39 PM
    @agreeable-doctor-59104 And even better again is to utilise a clever package like
    defu
    to allow inheritance from our main
    cypress.config.ts
    and only need to list the values you are changing i.e. in your case
    baseUrl
    My code example uses it for a mobile config file
    cypress/configs/cypress.mobile.config.ts
    Copy code
    import { defineConfig } from 'cypress';
    import defu from 'defu';
    
    import defaultConfig from '../../cypress.config';
    
    export default defineConfig(
      defu(
        {
          viewportWidth: 375,
          viewportHeight: 812,
          userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) Mobile/15E148',
          env: {
            device: 'mobile',
          },
          e2e: {
            excludeSpecPattern: ['**/e2e/site-monitoring/*', '**/e2e/keyboard-navigation/*'],
          },
        },
        defaultConfig
      )
    );
    The run command uses
    --config-file
    attribute to specify your config file:
    yarn cypress run --browser chrome --config-file cypress/configs/cypress.mobile.config.ts
  • c

    colossal-agent-50119

    11/03/2022, 2:46 PM
    Trying to get Cypress working with GPU support on an AWS Codebuild GPU instance, but doesn't fly. Don't understand enough of this to figure out where to problem actually lies. As far as I can tell, it still tries to emulate
  • d

    dry-portugal-25841

    11/03/2022, 2:51 PM
    https://glebbahmutov.com/blog/testing-timezones/ this might help
  • f

    flaky-tailor-940

    11/03/2022, 2:59 PM
    very tks, i`ll take a look
  • f

    fresh-belgium-26376

    11/03/2022, 4:12 PM
    good morning, I am testing a component in Vue 2 and the component gets some data from an object in window is there any way to mock that. With e2e I can use the window:before:load event, but that is not supported on components.
  • p

    proud-breakfast-29892

    11/03/2022, 4:37 PM
    How can I modify request URL before the request is being sent? I have a button and it makes a request to a certain URL. How, through cypress, I can make it replace the request URL and make it send to a different one? I know I can use
    cy.intercept
    but
    redirect
    doesn't work.
  • b

    brief-accountant-77319

    11/03/2022, 5:11 PM
    Hello, I am mocking the date with
    cy.clock()
    to test the app at a certain time (e.g. 6 am, 6 pm). It works, the date is changing in those tests, but the problem is that I am also using
    .scrollIntoView()
    on some elements and mocked clock breaks it - it's not scrolling and I have to use
    cy.tick()
    to make it work. It's a bit annoying to put
    cy.tick()
    , especially when I also test some things without mocked clock, then I cannot use
    cy.tick()
    . Every element in my application that animates is broken and I have to put
    cy.tick()
    . Is there some workaround or am I doing something wrong? Is it possible to set the "initial" date and just let it go?
  • g

    gray-kilobyte-89541

    11/03/2022, 5:22 PM
    Using cy.request command you can do all sorts of things like this. For hands on exercises, check out the entire course about it https://cypress.tips/courses/network-testing
  • p

    proud-breakfast-29892

    11/03/2022, 5:24 PM
    I tried to use req.redirect(newUrl) but what I get is the original url, and in the response there's a "location" property with my new url, and the body is empty
  • a

    alert-insurance-63399

    11/03/2022, 5:50 PM
    I am experiencing a weird issue where I have a single POST request with cypress that is resulting in TWO post requests, where the second one doesnt show the body of the request, and its causing a fail. any ideas why this might be?
  • a

    alert-insurance-63399

    11/03/2022, 5:53 PM
    the same request works fine on Postman, btw
  • a

    alert-insurance-63399

    11/03/2022, 6:01 PM
    Ok, I think I figured it out? looks like the endpoint redirects back to itself, but when this happens, cypress doesnt include the body in the redirect. any ideas how to solve this?
  • a

    alert-insurance-63399

    11/03/2022, 6:18 PM
    alright, solved it. wasnt including
    https://
    in the endpoint, so it was redirecting me to that, but not including the body. added it to the url, and its working fine now
  • f

    fierce-match-41873

    11/03/2022, 9:02 PM
    How do I properly call a function from one cy.js file in another? When I try, Cypress runs the entirety of both files, instead of the file I am running and the one function.
  • s

    stale-optician-85950

    11/03/2022, 9:39 PM
    Use custom commands instead https://docs.cypress.io/api/cypress-api/custom-commands to call reusable functions.
  • g

    great-london-82425

    11/03/2022, 9:44 PM
    Anyone know how to access an element (from a dropdown) marked as read only? I have a form with dropdown fields and am trying to select the options and submit. The test only works if I do a force: true on each element but I'm trying to deprecate those from our tests.
  • g

    great-london-82425

    11/03/2022, 10:11 PM
    If you encounter this, there's a chance a parent element is blocking what you're trying to locate. When I ran a .parent() on my element, I can access it not without force: true.
  • g

    gray-kilobyte-89541

    11/03/2022, 10:51 PM
    well, if you describe your test / behavior in more details, I am sure someone can help
  • f

    fancy-mechanic-10638

    11/04/2022, 12:14 AM
    So my e2e for one of my files has like 40 tests in it. 3 of them are failing. How do I rerun just those? I don't want it to auto-retry, I want to go make some fixes and then just have those 3 run. Right now I'm having to go add a
    .only
    to those three specific tests.
  • g

    gray-kilobyte-89541

    11/04/2022, 12:18 AM
    you can use cypress-grep and do it from the devtools console
  • f

    fancy-mechanic-10638

    11/04/2022, 1:01 AM
    Can I do nested gets? I have app-some-component and then multiple levels down I have a single input element. I want to do
    .get('app-some-component input')
    but I'm having to do
    .get('app-some-component').find('input')
    instead.
  • f

    fierce-match-41873

    11/04/2022, 1:57 AM
    @stale-optician-85950 thank you, I am going to try this!
  • a

    agreeable-doctor-59104

    11/04/2022, 6:22 AM
    Thank you so much @stale-optician-85950 , I will definitely try and let you know how it works.
  • d

    delightful-engineer-44693

    11/04/2022, 7:00 AM
    Hello Can anyone here help me with below concern Our requirement is to automate our eCommerce websites We are stuck because we have 100+ web-stores and we want 1 single script with minimal changes which can be executed for all the 100+webstores. Is there any possible way from which we can create script? Our platform is basically Magento2. Frontend theme remains same for all but User design changes as per the client requirement. It would be grateful to us if we get any possible solution for the same
  • h

    hallowed-gold-66187

    11/04/2022, 7:42 AM
    hi im trying to reset my password, but when i submit the request i am not receiving the email to do so...any help please
  • s

    stale-optician-85950

    11/04/2022, 8:35 AM
    Hello
  • a

    ambitious-monkey-72386

    11/04/2022, 10:00 AM
    Hi guys , please help
  • a

    ambitious-monkey-72386

    11/04/2022, 10:01 AM
    I cannot drag and drop an element mainly adivasi into another text box through cypress
  • a

    ambitious-monkey-72386

    11/04/2022, 10:01 AM
    I tried all possible solutions available
1...194195196...252Latest