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

    prehistoric-restaurant-72560

    08/24/2022, 3:37 PM
    Hi, anyone knows how to grab this yellow [!] popup message? example from: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_popup_form
  • g

    gray-kilobyte-89541

    08/24/2022, 3:55 PM
    https://glebbahmutov.com/blog/form-validation-in-cypress/
  • f

    fancy-match-96032

    08/24/2022, 5:11 PM
    i think this is what you're looking for https://docs.cypress.io/api/cypress-api/env#From-a-plugin you set it in
    setupNodeEvents
    in your config file
  • f

    fancy-match-96032

    08/24/2022, 5:21 PM
    you'll want to find the root cause of your issue, but for your workaround, the cli uses
    CYPRESS_VERIFY_TIMEOUT
    on
    process.env
    (if specified)
  • s

    some-family-74013

    08/24/2022, 7:04 PM
    thanks @acceptable-hamburger-48790
  • l

    lemon-elephant-47278

    08/25/2022, 5:40 AM
    Hi, My cypress test cases are failing after 5 min. If my test cases are large enough which will take more than 5 min, it will fail after running 5 min. Does anyone know how can I change the default timeout for that file?
  • g

    great-furniture-24480

    08/25/2022, 5:58 AM
    @lemon-elephant-47278 I was facing the same issue for my e2e testing, and unfortunately, I didn't find any proper solution for this. My tests are taking more than 30 minutes. I am suggesting you follow things that worked for me. Add these properties in your cypress.config.js file
    Copy code
    defaultCommandTimeout: your custom timeout,
        pageLoadTimeout: your custom timeout,
        numTestsKeptInMemory: 0,
    then try opening the tests. If the tests are still getting failed, you can run tests using cli and all your test cases will get executed no matter how long it'll take.
  • f

    few-telephone-44543

    08/25/2022, 7:37 AM
    Cheers! Works like a charm 🙂
  • b

    breezy-fall-63628

    08/25/2022, 9:39 AM
    Hello, I'm getting this error in my browser console
    Copy code
    js
    cypress_runner.js:175201 Uncaught AssertionError: The following error originated from your test code, not from Cypress.
    
    > The following error originated from your test code, not from Cypress. It was caused by an unhandled promise rejection.
    > expected 0 to be above 2
    
    When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
    When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
    but my test isn't actually failing. The relevant test code looks like this
    Copy code
    js
        cy.intercept(`${transactionsUrl}*`, req => {
          expect(differenceInDays(new Date(req.query.from), new Date())).to.be.greaterThan(2);
        });
    I'm basically trying to make my test fail but I can't... even though the assertion fails.
  • p

    polite-alarm-78904

    08/25/2022, 10:02 AM
    I'm trying to upload a file in cypress, but I get this vuex error which is confusing me. I also have some network requests being intercepted that gets a fixture in response. If I remove the intercepts it works, but I can't seem to figure out why.
    Copy code
    `
    cy.getBySel("editProfile").click()
                    cy.get(".v-dialog--active").should("exist")
                    cy.get('input[type=file]').selectFile('cypress/fixtures/dog.jpeg', { force: true })
                    
                    cy.get(".v-progress-circular").should("not.exist")
    
                    // Submit
                    cy.getBySel("submitBtn")
                        .first()
                        .click({ force: true})
  • g

    great-furniture-24480

    08/25/2022, 10:07 AM
    add this in your script,
    Copy code
    Cypress.on("uncaught:exception", (err, runnable) => {
        // returning false here prevents Cypress from
        // failing the test
        return false;
      });
  • b

    breezy-fall-63628

    08/25/2022, 10:13 AM
    Thanks, but I dont think thats what Im looking for. Even though the assertion fails, my test still passes ... which is not what I want
  • b

    breezy-fall-63628

    08/25/2022, 10:13 AM
    Im essentially trying to make my test fail but I cant 😛
  • b

    breezy-fall-63628

    08/25/2022, 10:43 AM
    This
    Copy code
    js
        cy.intercept(`${transactionsUrl}*`).as("transactions");
        cy.wait("@transactions").should(({ request }) => {
          console.log(request);
          const from = new URL(request.url).searchParams.get("from");
          expect(differenceInDays(new Date(from), new Date())).to.be.greaterThan(2);
        });
    seems to work and the tests fails when the assertion is false, perhaps because I'm using cy.wait? Not sure
  • a

    acceptable-hamburger-48790

    08/25/2022, 10:47 AM
    With intercept - you first intercept and provide alias and then wait for the interception to happen - using cy.wait - once intercept is completed wait asserts - So its the way you need to use the intercept
  • b

    breezy-fall-63628

    08/25/2022, 10:51 AM
    Ah alright, thanks @acceptable-hamburger-48790 ^^
  • s

    swift-kitchen-62493

    08/25/2022, 11:14 AM
    how defuq can i lick a buttom with x,y?
  • s

    swift-kitchen-62493

    08/25/2022, 11:15 AM
    whatever what i type its goes to left, like: .click(15,10) always goes to left
  • s

    stale-optician-85950

    08/25/2022, 12:48 PM
    Have you tried with click position arguments https://docs.cypress.io/api/commands/click#Position ?
    Copy code
    cy.get('img').click('right')
  • g

    glamorous-country-57678

    08/25/2022, 2:40 PM
    Why do I get this TS error thrown by cypress locally? I have a CI running remotely and it does not error so I am guessing something is wrong locally
  • i

    icy-airplane-54497

    08/25/2022, 2:43 PM
    Hi Everyone, I am trying to get component testing running for a day now and it still does not work. My component-index.html is the default file that was created by the cypress auto setup and it contains the data-cy-root attribute, but still I get this error. As you can see the component-index.html is loaded correctly but has empty .. when I tried to put anything into the it was all removed... Any ideas?
  • l

    limited-agency-13286

    08/25/2022, 5:07 PM
    Hello everyone, I am currently using cypress 7.6.0 due this is the only version available in my artifactory. I facing issue for Ee-routing after oauth2 login. Seems like it is issue with the browser settings/ configs, because this functionality working fine when I tested manually in my browser. Is there anyway I can run my cypress test cases on regular browser environment? Any ideas?
  • m

    magnificent-author-81922

    08/25/2022, 6:49 PM
    https://discord.com/channels/755913899261296641/823985226320707584/1012433408691032174 cross posting here, as it's less of an angular-specific issue (or so I believe) than a "how do I add/chain preprocessors" Hey all, I'm trying to add a preprocessor to a typescript Cypress setup. Following the docs works great, but the only problem is that adding the preprocessor prevents the actual compilation of typescript (so then the browser gets raw TS) I don't see any other configurations about Typescript, nor any webhook references in the project, so I'm not sure if there's something I'm supposed to chain and configure. Any advice?
    Copy code
    ts
    
    import * as fs from 'fs'
    import { defineConfig } from "cypress";
    
    
    export default defineConfig({
      e2e: {
        setupNodeEvents(on, config) {
          on('file:preprocessor', (file) => {
            const { filePath, outputPath, shouldWatch } = file
            console.log({ filePath, outputPath, shouldWatch })
            // we need to output something
            const raw = fs.readFileSync(filePath)
            console.log(raw)
            fs.writeFileSync(outputPath, raw, 'utf8')
            return outputPath        
          })
        },
        baseUrl: "http://localhost:4201/",
        specPattern: "cypress/e2e/**/*.spec.{js,jsx,ts,tsx}",
      },
    });
  • f

    fancy-mechanic-10638

    08/26/2022, 12:01 AM
    So I just installed cypress via
    ng add @cypress/schematic
    . When I do a
    yarn run cypress:run
    it sees the one default test that tries to open the initial project page. That fails saying it timed out. I'm able to run the app without issue via
    ng
    . I have the app configured for jest, not karma, if that makes any difference.
  • h

    high-nest-12136

    08/26/2022, 5:13 AM
    Hey guys, have a question
  • h

    high-nest-12136

    08/26/2022, 5:14 AM
    Is it a good practice to add some assertions in custom commands?
  • h

    helpful-truck-53930

    08/26/2022, 6:54 AM
    Hello, i have a weird behavior in cypress code. I want to jump from one site to another via submit button. Sometimes it ist enough to click 1 time on the button but sometimes the system want 2-clicks to reach the next page. Wich would be the best way to solve it? Via if else syntax? Some ideas? Thank you
  • s

    stale-optician-85950

    08/26/2022, 6:58 AM
    I would use Gleb's
    cypress-recurse
    package in that scenario: https://glebbahmutov.com/blog/cypress-recurse/
  • h

    helpful-truck-53930

    08/26/2022, 7:49 AM
    In this case i have to install the recurse npm package right? But what can i do if someone only use the cypress.exe without any IDE etc. ?
  • s

    stale-optician-85950

    08/26/2022, 8:05 AM
    Yes, it's an additional package to install via npm or yarn. I don't understand why you cannot use an IDE for development, how can you even write a test like that?
1...135136137...252Latest