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

    green-microphone-25998

    09/09/2021, 2:35 AM
    Hi everyone. SRR If I will be bull in a china shop. I try test my bot on Discord. But when I try log in to Discord I am stopped on "load screeen" Code: const name = '******@gmail.com' const pass = '******' describe('My First Test', () => { it('Visits the Kitchen Sink', () => { cy.visit('h ttps://discord.com/login') cy.get('input[name="email"]').type(name) cy.get('input[name="password"]').type(pass) cy.contains('button', /Login/i).click() cy.wait(5000) cy.visit('h ttps://discord.com/channels/****** ') }) }) What I messed up? TNX all...
  • r

    rich-businessperson-57314

    09/09/2021, 8:03 AM
    Hello Cypress fam. I have another issue with Cypress in that I require to do some mysql connects and asserts on the returned values. Things i've tried: 1: Setting up a simple mysql connect and calling it in my test (Got a NET.Mysql error) Something about mysql not being able to be executed from a browser. 2: Setting up a mysql task with mysql.req, getting a weird message about having to declare my task(which I already have, same name and everything) Anybody here that connects to a dockerised mysql with cypress? Thanks a lot!
  • n

    narrow-beach-37684

    09/11/2021, 6:08 PM
    Whoops, there is no test to run.
  • n

    narrow-beach-37684

    09/11/2021, 6:08 PM
    /// it('test', function(){ cy.visit('url'); })
  • n

    narrow-beach-37684

    09/11/2021, 6:09 PM
    how to solve this issue
  • b

    bulky-sundown-74498

    09/11/2021, 7:45 PM
    Hello @User can you share the console log you get both in the terminal and in the chrome console? Very often this happens if there are 2 cypress applications running at the same time
  • n

    narrow-beach-37684

    09/11/2021, 9:08 PM
    @User
  • n

    narrow-beach-37684

    09/11/2021, 9:16 PM
    @User chrome log
  • b

    bulky-sundown-74498

    09/11/2021, 9:17 PM
    Thank you @User this helps
  • b

    brief-kite-35331

    09/13/2021, 10:58 PM
    I have read this article https://dev.to/dgreene1/don-t-use-fixtures-in-cypress-and-unit-tests-use-factories-5cnh and would like to go in that direction (using Typescript factory instead of cypress fixture files) but I don't have any idea how to make this concept work with different environments (dev, staging ....) Can you please give advice on it or maybe point me in some direction to make this work somehow? Any thoughts would be very much appreciated 🙂 Thanks!
  • f

    fancy-printer-64240

    09/14/2021, 8:03 AM
    What do you want to achieve? Return a different object based on the environment? If this is the case I would set a Cypress Environment variable and then create a factory that simply returns different object reading that variable, something like
    Copy code
    ts
    function userFactory() {
      if (Cypress.env('environment') === 'dev') {
        return { ... }:
      } else if (Cypress.env('environment') === 'staging') {
        return { ... }
      }
    This should probably go inside
    cypress
    folder since it's using Cypress features. Usually I put these factories inside the
    cypress/fixtures
    folder even if I don't use them with the
    cy.fixture
    command
  • b

    brief-kite-35331

    09/14/2021, 9:28 AM
    @User thanks for the reply. But how would you then use it with overwrites (like mentioned in the article)? If u override the seed object, then the overwrite needs to be somehow aware of the environment as well. Right? I can't wrap my head around it 🙂
  • f

    fancy-printer-64240

    09/14/2021, 10:56 AM
    Yes, I don't know exactly what you want to achieve but you can use the same principle in theory:
    Copy code
    ts
    function userFactory() {
    if (Cypress.env('environment') === 'dev') {
        return makeFakeUser({ ... }):
      } else if (Cypress.env('environment') === 'staging') {
        return makeFakeUser({ ... });
      }
    }
    You can have one function that creates a test data object with overwrites and another function that calls the function with different values based on the env
  • b

    brief-kite-35331

    09/15/2021, 10:27 PM
    @User I am trying to solve this problem: I have cypress tests (same code base) written for 2 apps (lets say for the sake of an example Cats and Dogs). Currently I have the following setup with fixtures:
    Copy code
    cypress
    --fixtures
    ----dev
        users.json
    ----stage
        users.json
    Each user.json file contains data for both apps in the following format:
    Copy code
    {
    "cats": {
      user1: {
        name: 'Marijana',
        age: 18
      },
      user2: {
        name: 'John',
        age: 45
      }
    },
    "dogs": {
      user1: {
        name: 'Laura',
        age: 18
      },
      user2: {
        name: 'Kevin',
        age: 45
      },
      user3: {
        name: 'I don't exist for cats app',
        age: 66
      }
    }
    }
    I am trying to convert that structure to use the principle described in the article (so basically Typescript factory instead of those fixture files). And I can't come to an idea how to do this nicely. 🙃 Do you have some thoughts on how can this be achieved?
  • k

    kind-minister-59159

    09/16/2021, 4:25 PM
    I'm writing some tests for a project that uses an Iframe. The domain it's self is still the same. I added a custom command function getIframeBody() { return cy.get('.summaryiframe').its('0.contentDocument').its('body') .then(cy.wrap) } and then in my test file I'm calling it. cy.getIframeBody().find('.table-body-container').should('contain', 'Add/Subtract Numbers (No Regrouping)').click({force:true}); cy.wait(lessonActivites); //WAIT FOR EXPANDED LESSON My question is. Why do I have to use the .find instead of .get I tried using .get but I'm getting errors when calling it. I tried searching for the issue but couldn't really find an answer thanks!
  • u

    user

    09/20/2021, 6:44 AM
    hi there i'm trying to invoke text of an element after searching and getting the exact single result i want. but i'm getting every single element instead of the one i found so i cannot assert the element properly is there any solution for that?
  • i

    important-river-75795

    09/20/2021, 7:04 AM
    Are you trying to assert the first result element that comes up? You might be looking for first() cy.get('result').first()
  • u

    user

    09/20/2021, 7:07 AM
    for example i have a list of products with codes: 1 2 3 4 i search for 3 and find it but when i invoke the product-code it gaves me 1234 but i only got the 3 as result and the value i see is 3 so i guess it's giving me back all of the DOM elements
  • i

    important-river-75795

    09/20/2021, 7:09 AM
    :filter(":visible")
  • i

    important-river-75795

    09/20/2021, 7:09 AM
    Will filter out only the visible elements
  • u

    user

    09/20/2021, 7:10 AM
    thx alot ❤️
  • b

    bumpy-belgium-34184

    09/23/2021, 7:00 PM
    Question is anyone here good at using the clientCertficate option for DOD sites by any chance, because I am running out of options?
  • s

    silly-tailor-98571

    09/24/2021, 1:40 PM
    Hi I am having an issue with cypress/webpack-preprocessor and logging my webpack stats using
    DEBUG=cypress:webpack:stats
    . I am running this example repo (https://github.com/cypress-io/cypress/tree/master/npm/webpack-preprocessor/examples/use-babelrc). If I upgrade to webpack@5 in that repo I no longer see stats logged in the console.
    • 1
    • 1
  • r

    rhythmic-dress-50185

    09/25/2021, 1:56 AM
    What am I supposed to use to use cypress + vue? I tried generating a vue 3 project via vue-cli + cypress but end up with error after error on the generated project. Should I be using or is that the same thing?
  • w

    wonderful-match-15836

    09/25/2021, 3:46 PM
    The
    @cypress/vue
    package is used for component testing, so it depends on your goals. You can learn about that here: https://www.cypress.io/blog/2021/04/06/getting-start-with-cypress-component-testing-vue-2-3/ If you are just doing E2E tests, you don't need it. Without seeing your errors, I would guess you maybe have run into this problem: The current stable Vue CLI installs a pretty old version of Cypress (version 3, and we are now on 8.4!) so you may need to update Cypress if you installed it by choosing the option provided by Vue CLI. There are one or two other potential sources of errors with a fresh Vue CLI scaffolded app, let me know what you are seeing if upgrading Cypress did not get you all the way there.
  • r

    rhythmic-dress-50185

    09/25/2021, 4:14 PM
    Hey thanks for the reply. My goal is both e2e testing and component testing with Cypress if possible, but honestly even getting e2e working would satisfy me at the moment. I will give it another go and then let you know.
  • r

    rhythmic-dress-50185

    09/25/2021, 5:02 PM
    Ok I did everything and am still at the same error as yesterday (albiet past a different error I was also having): I have the default test:
    Copy code
    describe('My First Test', () => {
      it('Visits the app root url', () => {
        cy.visit('/')
        cy.contains('h1', 'Welcome to Your Vue.js App')
      })
    })
    It works great when ran in the UI, but when ran with
    npx cypress run --headless
    , the pass fails with a "404 not found" on the
    /
    path. I'm running in headless because eventually I would like to run this in CI/CD, and I assume (maybe wrongly) that this is how that will happen, so I just wanted to see that work.
    w
    • 2
    • 14
  • w

    wonderful-match-15836

    09/25/2021, 5:21 PM
    getting started issue
  • n

    nice-soccer-53564

    09/27/2021, 6:01 PM
    Hello everyone, I'm very new to cypress.js and I've been trying to get the cypress working with my app. When I visit the page using cypress, it shows an
    uncaught exception
    and the page doesn't load. However, when I do this manually everything works fine. Is this a bug with cypress or am I missing some configuration? I've created a stackoverflow post with details: https://stackoverflow.com/questions/69350833/issue-with-cypress-js-and-uncaught-exceptions Please kindly help!!
  • i

    important-river-75795

    09/27/2021, 8:17 PM
    @User does visiting with https help?
1...323334...252Latest