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

    magnificent-finland-58048

    06/23/2022, 3:20 PM
    at function/command level, you got { timeout } you want a la carte, you got it/context/describe blocks? defaultCommandTimeout and then there is the config file, that's the entire suite
  • g

    gray-kilobyte-89541

    06/23/2022, 3:24 PM
    we had something like this in the cypress-example-recipes repo I believe
  • g

    gray-kilobyte-89541

    06/23/2022, 3:43 PM
    @bland-pharmacist-88362 here is an alternative solution that should work with dynamic panels. I am using cypress-recurse

    https://www.youtube.com/watch?v=s2_467yUF2Y▾

    (see the spec in https://github.com/bahmutov/cypress-recurse/blob/main/cypress/integration/accordion-spec.js
  • a

    able-gold-91287

    06/23/2022, 3:53 PM
    does anyone know why a post request in the middle of an might cause the beforeEach to run again in the middle of an
    it
    method?
  • g

    gray-toothbrush-44079

    06/23/2022, 3:57 PM
    Anyone know why I am getting this and what to do with it when trying to load a separate config file? cypress open --env envname=cbay_prod --config-file config/client.production.js
  • f

    flaky-airport-12178

    06/23/2022, 3:59 PM
    Thanks. But I want to add the configuration for total time out for each (it, context). That means it's total running time instead of defaultCommandTimeout...etc
  • m

    magnificent-finland-58048

    06/23/2022, 4:12 PM
    an impure function in the beforeEach
    a
    • 2
    • 10
  • m

    magnificent-finland-58048

    06/23/2022, 4:13 PM
    oh I see now this is what Gleb mentioned https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/fundamentals__timeout
  • b

    bland-pharmacist-88362

    06/23/2022, 4:13 PM
    Great tips! Thank you for your help. I came up with something like this. Its ugly but it works 😄 Yours is cleaner will definitely use it 🙂
    Copy code
    var found = false
        function checkButton() {     
          cy.wait(500) 
          cy.get('body').then(($body) => {
            if ($body.find('.startButton').filter(':visible').length) {
              found = true
            }
        })
          console.log(found)
          return found;
      };
    
        cy.get('mat-panel-title').should('be.visible')
        .then(
          each(
            ($el) => {
              console.log(found)
              if (found === false) {
                cy.wrap($el).click();
              }
            },
            () => checkButton() === true,
          ),
        )
  • m

    magnificent-finland-58048

    06/23/2022, 4:16 PM
    I'll have to figure this out too, next week
  • g

    gray-toothbrush-44079

    06/23/2022, 4:17 PM
    Glad I'm not alone. If I figure something out I'll put it here.
  • m

    magnificent-finland-58048

    06/23/2022, 4:18 PM
    me too
  • s

    swift-kitchen-62493

    06/24/2022, 6:21 AM
    how can i hover with mouse for 2 sec and then click? 💀
  • t

    tall-thailand-5343

    06/24/2022, 7:15 AM
    Heyo, I was wondering if there's a nice way to do this in Cypress, but haven't found a solution to conditionally check it: 1. If an element exists, wait for it to disappear (this works, code example below) 2. if the same element is not found initially, DO NOT wait for its existence on the first place and skip point 1
    Copy code
    Cypress.Commands.add("checkWaitNoSkeletonLoaders", (timeout = undefined) => {
      cy.get(
    .react-loading-skeleton`, { timeout }).then(($elements) => { if ($elements.length < 1) return true; cy.wrap($elements, { timeout }).each(($el) => { cy.wrap($el, { timeout }).should("not.exist"); }); }); });` Why I would need point 2 at the same time? Because on CI for some weird reason some tests fail at this command (timeout waiting for the element). When running locally but using the same url where our CI tests, it always passes.
  • f

    fresh-doctor-14925

    06/24/2022, 8:13 AM
    I've seen some weirdness when running in CI because the tests run slightly faster in headless mode. Could be that? As for your use case, that can be a tricky one. It can be that the
    .get(".react-loading-skeleton").should("not.exist")
    assertion will pass before the loader element has even appeared Is there another element that will appear when the loader appears, but will remain after? You could assert on that one, then do the check for the loader
  • t

    tall-thailand-5343

    06/24/2022, 8:45 AM
    Thanks Liam. That was my assumption also yeah. There's no other element that would appear with the loader and remain after. unfortunately.
  • q

    quaint-airplane-96634

    06/24/2022, 8:54 AM
    Could anyone have a look on my question, Please?
  • f

    fresh-doctor-14925

    06/24/2022, 9:01 AM
    I guess another way to approach this would be to ask if you really need to do the check for the loader element? Does the app's behaviour change depending on whether that element appears?
  • l

    lemon-grass-56782

    06/24/2022, 9:18 AM
    Hey there
  • l

    lemon-grass-56782

    06/24/2022, 9:21 AM
    I have an issue about my dashboard. In fact, my runs dont show up on it, but on my github action only. Dunno why, cause I merged on master yesterday, and it doesnt work anymore... Any answer about that? Thanks
  • m

    millions-analyst-19851

    06/24/2022, 9:28 AM
    Hi. I have problem with loop in this command. Increment does not stop at 4 (PRODUCTS_AMOUNT). Anyone have idea why? Thanks Cypress.Commands.add("addRandomProductToCart", () => { let producsCounter = 0; const PRODUCTS_AMOUNT = 4; const MAX_AMOUNT = 15; const addToCart = () => { ProductCard.availableQuantity.should("be.visible") ProductCard.quantityInput.should("be.visible") ProductCard.quantityMinus.should("be.visible") ProductCard.quantityPlus.should("be.visible") ProductCard.addToCartButton.should("be.visible") ProductCard.addToCartButton.click() } for(let i = 0; i < MAX_AMOUNT; i++) { cy.visit(getRandomItem(productCardsUrls)); cy.get("body").then(body => { if (body.find(".showavailability > p").length > 0) { addToCart(); producsCounter++ } else { ProductCard.notifyIfAvailable.should("contains.text", "Powiadom mnie gdy produkt będzie dostępny") } }) if (producsCounter === PRODUCTS_AMOUNT) { break; } } })
  • a

    astonishing-electrician-44897

    06/24/2022, 10:39 AM
    You might fix it by doing this
    Copy code
    if (producsCounter === PRODUCTS_AMOUNT) {
                i = MAX_AMOUNT+1;
            }
  • c

    cuddly-thailand-33926

    06/24/2022, 12:47 PM
    I have this method, it runs well in CLI but crashes Test Runner GUI
  • f

    fresh-painter-19247

    06/24/2022, 12:57 PM
    Hi, Can anyone please help me ? my Cypress is not getting open after running command , it is keep loading on this screen.
  • b

    bitter-fountain-36713

    06/24/2022, 2:28 PM
    That is quite a bit of .each and .then nested commands. That could be the reason.
  • c

    cuddly-thailand-33926

    06/24/2022, 2:46 PM
    It's quite process heavy, but was working fine with previous version of Cypress
  • l

    late-twilight-22806

    06/24/2022, 3:27 PM
    Hi team. code coverage report keeps giving me unknown reports. could anyone give me an idea?
  • s

    square-pilot-83868

    06/24/2022, 6:22 PM
    hi guys, i have a problem with readFile, i used this method a few times in specs, and only in one have a problem, after export an excel file the new page opening (which shouldn't)
  • c

    curved-zebra-35162

    06/24/2022, 6:31 PM
    Hello everyone. I am trying to run Cypress and execute the URL with an ID (eg: 1). However, I cannot manage to do so and I am always getting an undefined instead in the url. How can I actually access that path? I use a custom page loader and I am not sure if that changes anything Here is the .cy.tsx file:
    Copy code
    typescript
    describe('CompanyDetails.cy.ts', () => {
      it('should render', () => {
        cy.mount(<CompanyDetails />, '/company/1')
      })
    })
    And here is component.tsx file:
    Copy code
    typescript
    Cypress.Commands.add('mount', (Component, initialRoute = '/company/1', path, options = {}) => {
      const wrapped = <MemoryRouter initialEntries={['companies/1']}> {Component} </MemoryRouter>
      return mount(wrapped)
    })
    Do you have any idea what am I doing wrong? Thanks!
  • h

    high-optician-91398

    06/24/2022, 9:03 PM
    I have cypress in an angular project (using angular cli). It has a
    cypress
    folder in the root (which contains a
    tsconfig.json
    ) and a
    cypress.config.ts
    at root level. There I am trying to import a file from my angular app which sits at
    ./src/app/foo
    . If I try to import that, I get a
    TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts"
1...959697...252Latest