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

    victorious-father-41976

    10/31/2022, 3:00 PM
    Hello I have some tests that are passing
  • r

    rhythmic-lizard-86607

    10/31/2022, 3:38 PM
    Hi! We have an onboarding wizard in our app and set the flag of this wizard to true in the login command (we use Auth0 official cypress implementation). We receive a bunch of 429 errors in our pipeline. The solution we thought is to move login to e2e.ts file and run it only once before all test suites. I am not sure if it's optimal. Any suggestions on improving it?
  • h

    hundreds-author-68171

    10/31/2022, 5:14 PM
    Hello! Was wondering how folks are implementing visual testing on cypress. The specific situation I'm running across is building the test suite through github actions with Linux Ubuntu, however I'm using Mac (mainly because its cost effective). How would I go about capture a base image that is from Linux Ubuntu?
  • h

    happy-megabyte-98400

    10/31/2022, 6:45 PM
    Wait for arbitrary number of API calls
  • s

    stale-optician-85950

    10/31/2022, 8:48 PM
    This is exactly what Percy and Applitools do. Running in CI with
    os:ubuntu
    makes no difference as you're still visually testing Chrome for example.
  • n

    numerous-breakfast-11722

    10/31/2022, 9:52 PM
    Hello guys! Does anyone know why this error is happening when running the tests?
  • g

    gorgeous-insurance-14811

    11/01/2022, 6:38 AM
    Hi trying to run Cypress in an Azure Devops Pipeline. Tried a couple of methods to get any version of 10 to run in the pipeline like it runs locally. But it gets stuck on the third image where it is just opening cypress and stays there till time out. Any advice?
  • m

    mysterious-belgium-25713

    11/01/2022, 7:07 AM
    Your command is running Cypress open. Not cypress run so it's not running your test headless. It's just opening cypress
  • m

    mysterious-belgium-25713

    11/01/2022, 7:08 AM
    Change the command to npx cypress run
  • g

    gorgeous-insurance-14811

    11/01/2022, 7:18 AM
    It works now Thanks @mysterious-belgium-25713
  • b

    bright-twilight-69276

    11/01/2022, 2:50 PM
    Anyone have any idea why setupNodeEvents wouldn't be working on a github CI?
  • a

    able-elephant-41059

    11/01/2022, 6:23 PM
    is there a specific help channel for cypress-component testing? Should I post questions about component testing here or in #755921564108587038 ?
  • m

    mysterious-belgium-25713

    11/01/2022, 6:51 PM
    You can just ask it in component testing
  • r

    red-honey-44438

    11/02/2022, 10:00 AM
    Hello , Need some help in testing application in Mobile Web like tests Our application is responsive but for one Calender UI component it behaves differently when opened in mobile view (used chrome Device Toolbar) Behaviour#1 - With Touch Device browser -> calender doesn't have date picker icon and textbox for date is actually clickable button which opens a different UI (Check touch_device_mode.png and touch_device_mode2.png attached) Behaviour#2 - With Desktop Mode -> calender have date picker and that date textbox is editable directly. (Check desktop_browser_mode.png and desktop_browser_mode2.png ) if we use viewport change to resize for Ipad like screen resolution.. cy.viewport(768,1024) It doesn't give the exact same functional behaviour. seeing Behaviour#1 Trying to find way to see Behaviour#2 through cypress.. Tried Options till now - Option#1 - cy.viewport(768,1024) cy.visit(url , { onBeforeLoad: (win) => { //@ts-ignore win.ontouchstart = true }, }); Option#2 - by using setting userAgent cy.viewport(768,1024) cy.visit( url, { onBeforeLoad: (win) => { console.log("onBeforeLoad calling"); Object.defineProperty(win.navigator, "userAgent", { value: "Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1", }); console.log( "userAgent property set beforeLoad " + win.navigator.userAgent ); }, onLoad: (win) => { console.log("onLoad calling"); console.log( "userAgent property value onLoad " + win.navigator.userAgent ); }, } ); Note using "cypress": "^9.6.1"
    • 1
    • 2
  • s

    stale-optician-85950

    11/02/2022, 10:28 AM
    You'll need to launch your test using a mobile user agent, I followed Gleb's tutorial here: https://glebbahmutov.com/blog/mobile-tests/ Now I have a dedicated mobile config file
    cypress.mobile.config.ts
    which overrides any mobile specific values from `cypress.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',
          },
        },
        defaultConfig
      )
    );
    Run command:
    "test:cy:run:mobile": "cypress run --browser chrome --config-file cypress/configs/cypress.mobile.config.ts",
  • r

    red-honey-44438

    11/02/2022, 10:31 AM
    Thanks Checking 🙂
  • s

    stale-optician-85950

    11/02/2022, 10:34 AM
    You can verify this in the way you are launching your test now, and then calling
    cy.viewport()
    > check your network tab and you'll see that the browser still has a desktop UserAgent values. That's why you're not getting the mobile specific behaviour.
  • r

    red-honey-44438

    11/02/2022, 10:48 AM
    I reversed the flow -> cy.visit(url , { onBeforeLoad: (win) => { console.log("onBeforeLoad calling"); Object.defineProperty(win.navigator, "userAgent", { value: "Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1", }); console.log( "userAgent property set beforeLoad" + win.navigator.userAgent ); }, then cy.viewport(768,1024) but you were right in cy console not seeing the ipad UserAgent values. let me check again by passing header to visit.
  • r

    red-honey-44438

    11/02/2022, 11:03 AM
    @stale-optician-85950 Do you have any idea why UserAgent might not be getting set properly for me?
  • s

    stale-optician-85950

    11/02/2022, 11:08 AM
    Simplify your approach (remove all the onBeforeLoad code) and pass the UserAgent in your run command i.e.
    Copy code
    yarn cypress open --config viewportWidth=768,viewportHeight=1024,userAgent='Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15'
    Then
    cy.visit(url)
    your page, is set correctly then?
  • s

    stale-optician-85950

    11/02/2022, 11:12 AM
    Doing the above I get: User-Agent: Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15
  • r

    red-honey-44438

    11/02/2022, 11:43 AM
    Thanks for looking into this. 🙂 ok. through command line i was getting error to parse --config for userAgent='Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1' Note :- for this value in chrome dev tools able to see the changes behaviour so going with this. So, added these in cypress.json file , after this running test { "viewportWidth": 768, "viewportHeight": 1024, "userAgent": "Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1" } With this change now able to get the correct value for User-Agent if checked in network / console (Check the screenshot) User-Agent: Mozilla/5.0 (iPad; CPU OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1 but Not the expected UI Change 😦 Note - Application is build with Angular Material UI (don't know if this helps)
  • s

    stale-optician-85950

    11/02/2022, 11:49 AM
    Try a smaller screen size like mobile, to see if it triggers the behaviour. But that's all the time I can help with for now.
  • r

    red-honey-44438

    11/02/2022, 12:06 PM
    Our app doesn't support Mobile sizes (screen distorts..), currently supporting only tab sizes.. there aren't much changes in UI till now this is the only use case where i observed this. and trying to find solution. in Future releases mobile support is coming where there will be drastic UI changes. need to get this working somehow. Thanks @stale-optician-85950 for spending time 🙂
  • b

    better-carpenter-28878

    11/02/2022, 1:15 PM
    WSL Challenge with Cypress: * Running Ubuntu (non-UI) * building code there * Cypress runs, but Electron only, wanting Chrome and Edge for testing * Tried desktop Cypress, but it cannot see the WSL folders Ideas???
  • b

    better-carpenter-28878

    11/02/2022, 1:16 PM
    Does anyone know why that tool cannot see the Linux folders that show up in the Windows file manager? Even copied the file path from the file manager ( \\wsl.localhost\Ubuntu-20.04\home\dojo\projects\learn\supabase-vue-3\cypress ) and that didn't work either.
  • f

    full-postman-68262

    11/02/2022, 2:25 PM
    Hey, I'm trying to run the
    cypress/included
    docker image, but with a read-only container. Currently I'm having an issue where the Cypress binary is running a smoke test (
    npx cypress verify
    basically) and that's timing out. I'm not 100% clear on what the smoke test is trying to do, or why setting it to read-only prevents it from doing what it needs to do. Anyone able to shed any light?
  • b

    bright-twilight-69276

    11/02/2022, 2:40 PM
    Did you install chrome and edge on the WSL side?
  • s

    stale-optician-85950

    11/02/2022, 2:43 PM
    Ask your devs; apart from the UserAgent value is there another browser attribute being checked to ensure
    tablet
    gets the touch functional behaviour you are expecting. Also, I would recommend you relaunch Cypress from scratch with that tablet UserAgent and even clear the Cypress browser cache and rerun (just to be sure).
  • m

    mysterious-belgium-25713

    11/02/2022, 3:20 PM
    If you want a headed cypress in wsl and your not in Windows 11 you need to use a virtual buffer. Look at this tutorial. https://techcommunity.microsoft.com/t5/windows-dev-appconsult/running-wsl-gui-apps-on-windows-10/ba-p/1493242
1...191192193...252Latest