https://cypress.io logo
Join Discord
Powered by
# e2e-testing
  • m

    mysterious-psychiatrist-29678

    12/21/2022, 5:15 PM
    hi again. what would you suggest, how can I pass env variable to Cypress if I need to run tests locally, on CI (github actions) and on kubernetes also? I thought of creating docker image and use CLI
    env
    for passing them. do you know better and more flexible solutions?
  • l

    little-kitchen-65586

    12/21/2022, 5:39 PM
    Hello, I have a problem.I want to compare number from Cart(top right corner) with num next to add to cart
  • l

    little-kitchen-65586

    12/21/2022, 5:39 PM
    let notificationNum; cy.get('#topcartlink').then((value) => { notificationNum = value[0].innerText }).then(() => { cy.get('#add-to-cart-button-1').click().then(() => { cy.get('#product_enteredQuantity_1').then((item) => { expect(item).to.be.eq(Number(notificationNum)); }) }) })
  • l

    little-kitchen-65586

    12/21/2022, 5:41 PM
    expected '' to equal NaN <--- i get this when i start the test
  • g

    gray-kilobyte-89541

    12/21/2022, 5:47 PM
    can you provide any more details?
  • g

    gray-kilobyte-89541

    12/21/2022, 5:52 PM
    🙂 are you sure the top cart link has a text that is a number? Tip: it is not. You can find a similar example by searching https://cypress.tips/search examples for "total parse". If I have time today, I will record a video explaining your example and how I would write a test for it. Follow at youtube.com/@gleb to get notified
  • l

    little-kitchen-65586

    12/21/2022, 5:55 PM
    😄
  • l

    little-kitchen-65586

    12/21/2022, 5:56 PM
    thank you, i will check
  • l

    little-kitchen-65586

    12/21/2022, 6:05 PM
    i don't know how to check, the type
  • g

    gray-kilobyte-89541

    12/21/2022, 6:27 PM
    I would suggest looking at examples https://glebbahmutov.com/cypress-examples/commands/assertions.html while my video is processing
  • l

    little-kitchen-65586

    12/21/2022, 6:27 PM
    Thank you i will check now
  • g

    gray-kilobyte-89541

    12/21/2022, 6:59 PM
    Ok, here is the finished video "Writing A Shopping Cart Test Example"

    https://youtu.be/2cwq9iQR54Y▾

    I would write this test as
    Copy code
    js
    cy.visit('/build-your-own-computer')
    cy.contains('#topcartlink', 'Shopping cart (0)')
    cy.get('select#product_attribute_2').select(3)
    cy.get('input#product_attribute_3_6').check()
    cy.get('[aria-label="Enter a quantity"]').clear().type(5)
    cy.contains('button', 'Add to cart').click()
    cy.contains('#topcartlink', 'Shopping cart (5)')
  • s

    some-lifeguard-48779

    12/21/2022, 10:00 PM
    Guys I met cypress this week. thank you for existing Cypress 🙏
  • s

    some-lifeguard-48779

    12/21/2022, 10:00 PM
    I would like to test if inside my .vue or .ts file there is any div. If any div exists, I would like to know if it has the id filled in.
  • s

    some-lifeguard-48779

    12/21/2022, 10:00 PM
    where should i start?
  • g

    gifted-vase-76896

    12/21/2022, 10:23 PM
    Hello folks, I am pretty new to cypress. I have a case here where I click a link, and the next page load always times out. Cannot figure out why. Example: Original URL: https://www.myparkingservices.com/ Then I want to click any of the circles to get to the login page. This is the code:
    Copy code
    it('can click to get into residential parking', ()=>{
        cy.get('a[href*="oauth/authorize"]').click({ multiple: true })
        cy.location('pathname', {timeout: 60000})
            .should('include', '/signin');
        cy.contains('h1', 'Login')
      })
    Any ideas how I can improve this? Thank you.
  • l

    late-planet-4481

    12/22/2022, 3:09 AM
    Any particular reason for using
    { multiple: true }
    here? From your description you want to click a link, not all links, right? If you're clicking multiple links one guess is that the site isn't handling the rapid-fire input very well. Your site won't load for me, so it's hard to provide much more feedback. Seems like a straightforward test otherwise.
  • i

    incalculable-telephone-16405

    12/22/2022, 5:03 AM
    hi how to handle recaptcha & image validation through cypress
  • i

    incalculable-telephone-16405

    12/22/2022, 5:03 AM
    ?
  • c

    colossal-table-38461

    12/22/2022, 5:45 AM
    Hello All, I am doing the E2E Email link validation, after getting the Link, I am passing the same url in cy.visit command but I am getting below error. Error: cy.visit() must be called with a url or an options object containing a url as its 1st argument. Any idea how to resolve it?
  • r

    rapid-river-77010

    12/22/2022, 5:46 AM
    Somewhere you're calling cy.visit with nothing or a null/undefined variable.
  • c

    colossal-table-38461

    12/22/2022, 5:55 AM
    I am storing the link in passwordresetlink & then same variable using in cy.visit(passwordresetlink) prior to that I am logging that url also
  • d

    dazzling-pillow-26039

    12/22/2022, 6:25 AM
    the variable you are using to store is not getting resolved and passing undefined. the total code snippet would help to fix the issue. You can also try cy.wrap(passwordresetlink) to wait till it is resolved.
  • d

    damp-sugar-90044

    12/22/2022, 6:50 AM
    When I write npx cypress open in the terminal it starts and crashes immediately
  • n

    nice-lifeguard-81070

    12/22/2022, 7:28 AM
    hey I have to integrate cypress code coverage in nuxt js . I sucessfully generate the code coverage report but my UI is disturbed. I don't know why , can someone help me how can I avoid this problem vite: { build: { sourcemap: true }, plugins: [ istanbul({ exclude: ["node_modules", "test/", "coverage/", "cypress/"], extension: [".js", ".ts", ".vue"], cypress: true }) ] },
  • c

    colossal-table-38461

    12/22/2022, 10:07 AM
    Thanks for your inputs @rapid-river-77010 & @dazzling-pillow-26039 Yes its resolved!!!
  • s

    strong-football-17493

    12/22/2022, 10:35 AM
    Depends what you need from your env file, but let's say you want your
    envUrl
    value, you should write it this way (to be tested)
    Copy code
    typescript
    describe('TEST PLAN', { failFast: { enabled: true }, browser: 'electron', env:{ envUrl: Cypress.env('dev').service1MS.envUrl } },  () => {})
  • m

    millions-restaurant-84199

    12/22/2022, 11:33 AM
    hey, i am following tutorials, i am on the lesson How to test user journeys, wrote the code describe("User Journey", () => { it("a user can find a course on the home page and complete the course lessons", () => { cy.visit("http://localhost:3000") cy.getByData("course-0").find("a").eq(3).click() cy.location("pathname").should("eq", "/testing-your-first-application") cy.getByData("next-lesson-button").click() }) }) and i am getting this, anybody can help?
  • m

    mysterious-house-15448

    12/22/2022, 12:31 PM
    After getting html reports on Jenkins CI, it shows blank page when opened but json report contains the contents. And same html file will load with all the contents including css and images properly when opened locally. How to open the html report properly in Jenkins server?
  • a

    acceptable-hamburger-48790

    12/22/2022, 4:39 PM
    Jenkins blocks couple of resources as security threat - You need to execute relevant script within jenkins server. To confirm open Developer tool in browser and reload that HTML file and you will see errors
1...173174175...192Latest