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

    user

    05/29/2021, 1:42 AM
    some of the variables...what would they even mean in browser
  • u

    user

    05/30/2021, 1:21 AM
    would love to try
  • h

    helpful-lighter-43246

    05/31/2021, 9:34 AM
    Morning folks! I'm randomly encountering an issue with
    cy.intercept
    along with
    cy.wait
    Basically, we need to wait for a quite long list of initial calls to start up our app and this is what we are doing: We have a custom command that intercepts the list of API calls
    Copy code
    Cypress.Commands.add('interceptInitialLoad', (userKeyName = 'SUPER_USER') => { // possible values: SUPER_USER, FULL_VISIBILITY, CLIENT_CONFIGURATOR
    
      cy.interceptWebSocket({ userKeyName });
    
      initialLoadInterceptors.forEach((interceptor) => {
        return cy.intercept(interceptor.match, interceptor[userKeyName].success).as(`initialLoad-${interceptor.key}`);
      });
    });
    And a custom command to wait for all of those
    Copy code
    Cypress.Commands.add('waitInitialLoad', (userKeyName = 'SUPER_USER') => { // possible values: SUPER_USER, FULL_VISIBILITY, CLIENT_CONFIGURATOR
      const waitKeys = initialLoadInterceptors.map(interceptor => `@initialLoad-${interceptor.key}`);
      return cy.wait(waitKeys.filter(key => {
    
        if (userKeyName !== 'FULL_VISIBILITY') {
          return key !== '@initialLoad-delegation' && key !== '@initialLoad-log' && key !== '@initialLoad-dataConnection';
        }
    
        return key !== '@initialLoad-delegation' && key !== '@initialLoad-log';
      }));
    });
    But we randomly get such errors on CI
    Copy code
    11:05:14      CypressError: Timed out retrying after 5000ms: `cy.wait()` timed out waiting `5000ms` for the 1st request to the route: `initialLoad-version`. No request ever occurred.
  • h

    helpful-lighter-43246

    05/31/2021, 9:34 AM
    Even with retry policy set as
  • h

    helpful-lighter-43246

    05/31/2021, 9:34 AM
    Copy code
    "retries" : {
        "runMode": 1,
        "openMode": 0
      }
  • h

    helpful-lighter-43246

    05/31/2021, 9:35 AM
    Example of a test that fails using those commands
    Copy code
    describe('Initial load', () => {
    
      beforeEach(() => {
        cy.viewport('macbook-15');
        cy.interceptInitialLoad();
      });
    
      it('Loads app', () => {
        cy.visit('/workspace');
        cy.waitInitialLoad();
        // https://github.com/NoriSte/cypress-wait-until
        cy.waitUntil(() => cy.get('section.content[data-loaded="true"]')
          .then($el => {
            return Cypress.$($el).length === 1;
          }));
      });
    });
  • h

    helpful-lighter-43246

    05/31/2021, 9:36 AM
    We are basically mocking something like 20 API calls there
  • h

    helpful-lighter-43246

    05/31/2021, 9:55 AM
    This never fails locally
  • h

    helpful-lighter-43246

    05/31/2021, 9:56 AM
    with
    cypress run
  • h

    helpful-lighter-43246

    05/31/2021, 10:20 AM
    Probably important to add that the
    cy.wait
    timing out is random on different routes, sometimes one sometimes on multiple
  • h

    helpful-lighter-43246

    05/31/2021, 3:54 PM
    Anyone ?
  • s

    stocky-dream-36427

    05/31/2021, 5:01 PM
    @helpful-lighter-43246 sorry it’s a US vacation for us today! Looking now
  • s

    stocky-dream-36427

    05/31/2021, 5:02 PM
    There’s generally a few differences: network configuration, machine specs, and machine dependencies
  • s

    stocky-dream-36427

    05/31/2021, 5:03 PM
    When I start to debug CI-only failures I start by trying to understand where the problem is failing. Are you running your sever on the same box? When you point it at prod or some external site is the issue still there? Things like that.
  • s

    stocky-dream-36427

    05/31/2021, 5:04 PM
    It’s hard to tell you what specifically is wrong, but I can teach you how I debug the general class of problems.
  • h

    helpful-lighter-43246

    05/31/2021, 6:01 PM
    hey @User thanks for the support but I dont want to bother you during holidays. I'll update you on the issue here tomorrow! Have a great day!
  • b

    bitter-fountain-36713

    05/31/2021, 6:36 PM
    Hey @stocky-dream-36427 i would be interested in learning how you debug general class of problems for another day I may need it when I upgrade from v4.12.1. My last attempt, I faced issues in CI and put the upgrade work on hold.
  • h

    helpful-lighter-43246

    06/01/2021, 10:39 AM
    @User So it seems like all some
    cy.intercept
    are not doing their job there, but they alwasy work on local. I'm starting to think that that implmenetation in a
    forEach
    might be the cause. Really all sounds like timing to me.
  • m

    miniature-portugal-41145

    06/01/2021, 12:44 PM
    Hi there, Anyone has struggled with testing that an element is hidden by another ? I'm trying to assert that a sidebar on mobile take the full screen (and so hide other elements behind), but using the
    should("not.be.visible") || should("be.hidden")
    doesn't work as expected (the element hiding behind my drawer is still found by cypress and considered visible)
  • m

    miniature-portugal-41145

    06/01/2021, 12:46 PM
    Funny enough, trying to use the
    click()
    function on my hidden element fail. So Cypress know he can't click on it because it's hidden.
  • m

    miniature-portugal-41145

    06/01/2021, 12:57 PM
    Hum, seems like an old issue: https://github.com/cypress-io/cypress/issues/683
  • m

    miniature-portugal-41145

    06/01/2021, 12:57 PM
    I'll probably reopen it with a MWE
  • a

    acoustic-postman-68669

    06/01/2021, 6:57 PM
    Hey all, i have a very simple test that only opens a backend page. As soon as the page is opened with cypress there are several errors.
    Copy code
    describe('Test TYPO3 Backend', () => {
      it('Should show login', () => {
        cy.wait(1000)
        cy.visit('https://typo3.org/typo3/')
        cy.wait(1000)
        cy.get('#t3-username')
      })
    })
  • t

    thankful-rocket-39348

    06/02/2021, 10:33 AM
    Hi all! I am new to Cypress and I would like to use cypress studio. When opening the demo realworld-app the 'add command to test' button appears when running the test and the settings->configuration list experimentalStudio: true. When I do this in my own project the settings->configuration do take the set projectID but won't get the experimentalStudio: true setting from the cypress.json
  • t

    thankful-rocket-39348

    06/02/2021, 10:33 AM
    What am I missing here?
  • t

    thankful-rocket-39348

    06/02/2021, 10:37 AM
    Had to upgrade cypress to 7.x now it works, nice, thanks
  • h

    handsome-kilobyte-99728

    06/03/2021, 6:07 PM
    Hello everyone 🙂 I posted in the discussions on github but saw the discord and thought I'd drop the link in here as well. Currently, Cypress component testing can't find any tests in my spec file. I'm suspecting it's because of my webpack config, but haven't been able to track down the issue. Any help would be greatly appreciated! https://github.com/cypress-io/cypress/discussions/16784
  • b

    bulky-sundown-74498

    06/03/2021, 8:17 PM
    Hello @User unfortunately we do not yet make a distinction between when "something went wrong before we could determine if you have tests" and "we can't find your tests"
  • b

    bulky-sundown-74498

    06/03/2021, 8:18 PM
    I think you are on the right track but a reproduction repository would go a long way
  • h

    handsome-kilobyte-99728

    06/03/2021, 8:18 PM
    Thanks for the response! I'll work on getting a repro in place and report back.
1...192021...252Latest