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

    swift-spoon-76449

    12/13/2022, 4:18 PM
    https://stackoverflow.com/questions/68896471/how-to-run-cypress-headed-tests-using-chrome-incognito
  • c

    cold-cat-63632

    12/13/2022, 4:23 PM
    @swift-spoon-76449 i have added those scripts in index.js but that helps only when browser is run in headed mode .. i am looking for help around running chrome incognito in headless mode
  • s

    swift-spoon-76449

    12/13/2022, 4:31 PM
    Ok sorry! I don’t know.
  • c

    cold-cat-63632

    12/13/2022, 4:34 PM
    @swift-spoon-76449 please dont be sorry you tried to help .. thank you for trying .. the issue is that electron cannot run in incognito mode i checked all the CLI args that can be passed .. so i need to run chrome or edge in incognito/inprivate mode
  • b

    brave-doctor-62978

    12/13/2022, 6:27 PM
    am i missing a way to make this not log anything except the 'Get form input by label text`?
  • b

    brave-doctor-62978

    12/13/2022, 6:27 PM
    Copy code
    Cypress.Commands.add('getByLabelText', (label: string) => {
      cy
        .contains('label', label, { log: false })
        .invoke('attr', 'for')
        .should('exist')
        .then(id => {
          cy.get(`#${ id }`, { log: false });
        })
        .should('have.attr', 'name');
    
      const log = Cypress.log({
        name: 'getByLabelText',
        displayName: 'Get form input by label text',
        message: label,
        consoleProps: () => {
          return {
            label: label,
          };
        },
      });
  • r

    rough-oxygen-26641

    12/13/2022, 9:29 PM
    https://discord.com/channels/755913899261296641/763105090679865354/1052213507778691092 Hello, does anyone know why Cypress Studio would select the tags inside of an SVG wrapped in a button instead of stopping at the button? Bubbling? How could I resolve this? Thanks.
  • a

    adorable-vase-67839

    12/14/2022, 12:21 AM
    Hello everyone, I have this problem for setting cy.screenshot({capture: "viewport"}). Basically what happens is that when taking a "snapchot" of pages that have a scroll bar in cypress it always takes the print with a default resolution and not the one that was specified. I noticed that someone had similar to mine. Is there already a solution?
  • a

    adorable-vase-67839

    12/14/2022, 12:22 AM
    Here is the configuration parameters of my test in cypress
  • a

    adorable-vase-67839

    12/14/2022, 12:24 AM
    This is how it loads the page and how the screenshot should be captured
  • a

    adorable-vase-67839

    12/14/2022, 12:26 AM
    Only he takes my screenshot this way
  • a

    adorable-vase-67839

    12/14/2022, 12:27 AM
    can you help me?
  • c

    cool-businessperson-62347

    12/14/2022, 3:40 AM
    awesome thanks @gray-kilobyte-89541
  • p

    powerful-king-41699

    12/14/2022, 7:36 AM
    Hello Everyone, We run our E2E tests against Chrome 70 on windows machine in headed mode using command npm install && cypress run --browser chrome --headed "--config" "baseUrl=http:serveraddress:8080" "--env" "Host=serveraddress". The tests connect to a server url hosted on a Linux machine (hosted on our network). We recently upgraded our cypress version from 7.7.0 to 11.2.0 and the tests started failing where the tests fail at visit step with Failed to construct 'URL': Invalid URL as shown in the img uploaded.
  • p

    powerful-king-41699

    12/14/2022, 7:39 AM
    Here is our jenkins script below:
    Copy code
    env.cypressFFBaseUrl=cypressFFBaseUrl.trim()
         env.FFHost=FFHost.trim()
         bat  script: """
                                     setlocal
                                     set ERRORLEVEL=0
                                     set PATH=C:\\Program Files (x86)\\OpenJDK\\jdk-8.0.262.10-hotspot\\bin;$PATH
                                     set CYPRESS_BASE_URL=${cypressFFBaseUrl};
                                     set Host=${FFHost};
                                     set CYPRESS_RUN_BINARY=C:\\Users\\Admin\\AppData\\Local\\Cypress\\Cache\\11.2.0\\Cypress\\Cypress.exe
                                     cd $WORKSPACE/ui/e2e
                                     npm run cy:run-firefox-headed -- --config baseUrl=${cypressFFBaseUrl} --env Host=${FFHost}  >> e2e_err.log
         """
  • p

    powerful-king-41699

    12/14/2022, 7:39 AM
    cypress.conf.ts:
    Copy code
    import {defineConfig} from "cypress";
    
    export default defineConfig({
      video: true,
      videoCompression: 20,
      viewportWidth: 1680,
      viewportHeight: 1050,
      MOZ_FORCE_DISABLE_E10S: 1,
      numTestsKeptInMemory: 1,
      defaultCommandTimeout: 12000,
      reporter: "junit",
      animationDistanceThreshold: 0,
      reporterOptions: {
        mochaFile: "results/cypress-report[hash].xml",
        toConsole: true,
      },
      retries: {
        runMode: 1,
        openMode: 0,
      },
      env: {
        mlHost: "localhost",
        FAIL_FAST_STRATEGY: "spec",
      },
      e2e: {
        // We've imported your old cypress plugins here.
        // You may want to clean this up later by importing these.
        setupNodeEvents(on, config) {
          return require("./cypress/plugins/index.js")(on, config);
        },
        baseUrl: "http://localhost:8080",
        experimentalRunAllSpecs: true,
        specPattern: ["cypress/e2e/*/*/*.cy.{js,jsx,ts,tsx}", "cypress/e2e/*/*.cy.{js,jsx,ts,tsx}"],
        excludeSpecPattern: [],
      },
    });
    spec:
    Copy code
    describe("Add step ", () => {
      before(() => {
        cy.visit("/");
        cy.contains(Application.title);
        cy.loginAsDeveloper().withRequest();
        LoginPage.postLogin();
        //Saving Local Storage to preserve session
        cy.saveLocalStorage();
      });
    it("Navigating to Customer Match tab", () => {
        toolbar.getToolbarIcon().should("be.visible").click();
      });
    });
  • p

    powerful-king-41699

    12/14/2022, 7:41 AM
    Have been stuck with this for a long time. Please Help!
  • c

    cool-autumn-59000

    12/14/2022, 8:37 AM
    hello there ! πŸ‘‹ I'm trying to run the cypress UI on a distant server and can't get it to work with Nginx, via a reverse proxy for example, can't find any help online too, has anyone managed to do it successfuly here ? I'm launching cypress in supervisor :
    yarn run cypress open --port=58999
    And want to access it via "cypress.myserver.com", with this kind of nginx configuration :
    Copy code
    upstream mydailycypress_upstram {
        server localhost:58999;
        keepalive 64;
    }
    
    server {
        listen 80;
        listen [::]:80;
    
        index index.html;
        server_name cypress.mywebsite.com;
    
        location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $http_host;
    
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
    
            proxy_pass http://mydailycypress_upstram;
            proxy_redirect off;
            proxy_read_timeout 240s;
    
            proxy_pass_header X-Transmission-Session-Id;
        }
    
        access_log off;
        error_log  /var/log/nginx/cypress.mywebsite.com.log error;
    }
  • t

    thankful-wire-37848

    12/14/2022, 8:37 AM
    Does anyone know if it is possible to use a custom path for the
    cypress.env.json
    file (like you can for the
    cypress.config.js
    using the
    --config-file=...
    flag on the CLI) or does it always have to be in your project root?
  • f

    fresh-doctor-14925

    12/14/2022, 8:57 AM
    Hello Everyone We run our E2E tests
  • m

    mysterious-belgium-25713

    12/14/2022, 10:33 AM
    Hmm lets me see if i understand you correct. You want to go to cypress.myserver.com and then if you visit that URL you want to see the Cypress UI on that server. If that is the case why not install VNC server on that machine so that you can connect the UI of that server. I never tried what you did so cannot help you with your reverse Nginx proxy.
  • c

    cool-autumn-59000

    12/14/2022, 10:45 AM
    I don't know about VNC, it needs to be accessed via a web browser, I don't know if that's feasible as if
  • m

    mysterious-belgium-25713

    12/14/2022, 10:46 AM
    Vnc or novnc is a webserver running on a server that exposes the operating system UI. So you can expose that port and i think if you use novnc you can even use the browser to visit that URL and it will load up in the browser
  • c

    cool-autumn-59000

    12/14/2022, 10:48 AM
    thanks, I'll look into it πŸ™‚
  • c

    cool-autumn-59000

    12/14/2022, 10:50 AM
    it might not work because my server is headless
  • g

    gray-kilobyte-89541

    12/14/2022, 11:32 AM
    X server forwarding via reverse proxy back to your host is possible, but completely not worth the trouble
  • t

    thousands-house-85089

    12/14/2022, 12:55 PM
    Does anyone know if it is possible to
  • a

    adamant-toddler-18579

    12/14/2022, 1:13 PM
    Hello. I need some help with trying to use touch events. I managed to get swiping elements work with
    Copy code
    cy.get('.classname')
                .trigger('touchstart', 'right')
                .trigger('touchmove', 'left')
                .trigger('touchend', { force: true });
    But still haven't managed to create a click with touch events
    Copy code
    cy.get('[data-testId="icon-button-flip"]')
                .trigger('touchstart')
                .trigger('touchend');
    I see that it finds the element and tries to touch the center of it but the click doesn't happen.
  • r

    ripe-pager-8687

    12/14/2022, 1:57 PM
    Hi all. I'm doing a e2e with cypress but the test fails when an API call fails, do you known how to avoid this?
  • r

    ripe-pager-8687

    12/14/2022, 1:59 PM
    the API is returning 404 and that is expected
1...228229230...252Latest