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

    chilly-vase-64353

    06/07/2022, 11:37 PM
    thanks for the tip
  • c

    chilly-vase-64353

    06/07/2022, 11:38 PM
    all right, so I think I have a little bit of an idea now, thank you very much awesame!
  • a

    abundant-dress-88149

    06/08/2022, 1:30 AM
    @abundant-apple-80156 just to give you an update, I got the chrome
    out of memory
    issue fixed by upgrading the chrome version from 83 to 89.
  • f

    future-action-21047

    06/08/2022, 4:31 AM
    Is there a procedure for resetting the Cypress configuration/migration tool? Or a good place to grab a default copy of a v10
    ./cypress
    file? I had an existing feature branch to test cypress in my repo at a lower version of cypress (9.0). I upgraded to Cypress, but felt that the exiting libraries I had broke the migration. So I deleted the ./cypress directory., with the idea to regenerate the
    ./cypress
    directory and play around with the new stuff. However, when I re-opened Cypress it didn't give me the option to regenerate the ./cypress test files. I also attempted to do clear the cahce via
    npx cypress cache -clear
    and also reinstalling cypress via
    cypress install -f
  • g

    green-book-63455

    06/08/2022, 6:38 AM
    Looking at https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/logging-in__html-web-forms/cypress/e2e/logging-in-html-web-form-spec.cy.js and bypassing the UI to login. When using the UI, the inpiut fields are 'username' and 'password'. But when bypassing the UI, the request uses username/password. cy.request({ method: 'POST', url: '/login', // baseUrl will be prepended to this url form: true, // indicates the body should be form urlencoded and sets Content-Type: application/x-www-form-urlencoded headers body: { username, password, }, }) So the username/password are constants set in the code earlier and if the key and constant are the same then above instead of username: username. But is the key the value of the input field?
  • b

    busy-vegetable-18177

    06/08/2022, 6:45 AM
    you need to do something like
    Copy code
    js
    cy.get("selector for your input").then(input => {
      // use input's value
    })
  • g

    green-book-63455

    06/08/2022, 7:26 AM
    Yes, I have done that using the form to login but would I do that with cy.request when I want to bypass the browser?
  • b

    busy-vegetable-18177

    06/08/2022, 7:27 AM
    well why do you have an input if you're trying to bypass it
  • b

    busy-vegetable-18177

    06/08/2022, 7:27 AM
    you need to have a username&password prepared in that case
  • f

    fresh-doctor-14925

    06/08/2022, 7:33 AM
    I don’t really understand your question here. If you’re confused about how to get cypress to do headless logins with your application, you can try taking a look in your network tab to see the request that gets sent when filling in the login form That should help you to understand what is required for your
    cy.request
  • g

    green-book-63455

    06/08/2022, 8:09 AM
    I agree - I did judt that and it did not show what I was expecting or hoping. This may be a problem with the app I am testing, which is written with mendix.
  • f

    fresh-doctor-14925

    06/08/2022, 8:10 AM
    All I can say is that it's certainly possible. It's how I do all the authentication for the apps I'm testing
  • g

    green-book-63455

    06/08/2022, 8:33 AM
    On a side, issue have you moved to cypress 10?
    f
    • 2
    • 4
  • b

    bland-hospital-64234

    06/08/2022, 8:42 AM
    Hello, I'd like to ask a question dynamically stubbing API after user sends POST request. For example, I have a list of todos that I get from server using
    GET - /todos
    . This api will return the stubbed response(using
    cy.intercept
    ) I already specified, like followings.
    Copy code
    javascript
    [
      { 
        id: 1,
        name: "Buy milk",
        isCompleted: false,
      },
      { 
        id: 2,
        name: "Run Errand",
        isCompleted: false,
      },
      { 
        id: 3,
        name: "Clean house",
        isCompleted: false,
      }
    ]
    But let's say now user visits the todolist website, and adds the todo item using
    POST - /todo
    . So client will send the server data as follows.
    Copy code
    javascript
    { 
      id: 4,
      name: "Go walk",
      isCompleted: false,
    }
    How can I add this data that was sent with POST to the stubbed response I specified above? Eventually I want to return 4 list of todos.
  • r

    rough-magazine-51515

    06/08/2022, 9:05 AM
    Hello, i have a question. How to ignore some Tests when i run in dashboard ?
  • b

    busy-vegetable-18177

    06/08/2022, 9:05 AM
    change it to
    it.skip(...)
  • b

    busy-vegetable-18177

    06/08/2022, 9:06 AM
    or
    describe.skip
  • b

    busy-vegetable-18177

    06/08/2022, 9:06 AM
    and if you only want to run a one test (or a couple) you can isntead do
    it.only
    and
    describe.only
  • r

    rough-magazine-51515

    06/08/2022, 9:08 AM
    Thank you
  • w

    white-gpu-56286

    06/08/2022, 9:16 AM
    Hello, I'm trying to run the example test on Cypress Docs (the Stepper example) I'm using Component Testing with Vue and Webpack (with Laravel mix that I added via: webpackConfig: require("./webpack.mix.js"), inside cypress.config.js) When I run the test, I get: > vue__WEBPACK_IMPORTED_MODULE_0__.defineComponent is not a function
  • w

    white-gpu-56286

    06/08/2022, 9:16 AM
    Is this a webpack config issue?
  • e

    echoing-painting-40909

    06/08/2022, 9:36 AM
    Hello, by expecting a new item to be added, you are no longer testing your UI but your API. By stubbing your API, what's the value of testing this fourth item?
  • g

    green-book-63455

    06/08/2022, 11:25 AM
    With network in browser tools, it shows the network requests to get the login page. I complete the page, press enter, then it shows the network requests to get the home page. But I can't get the request that login page sent. Is that normal? Presumably I don't have to use something like wireshark do I?
  • g

    gray-kilobyte-89541

    06/08/2022, 12:09 PM
    you can stub the same route but return different data for different calls. My "Cypress Network Testing Exercises" course has lessons about it https://cypress.tips/courses Tip: use
    { times: ... }
    option when defining an intercept
  • f

    fresh-doctor-14925

    06/08/2022, 12:21 PM
    I wouldn’t have thought you’d need to use wireshark, but I’m only experienced in the way my company’s app handles auth
  • p

    purple-kilobyte-85592

    06/08/2022, 12:46 PM
    how do i pick date from calender in cypress? Please help
  • h

    hallowed-monkey-93167

    06/08/2022, 12:57 PM
    which calendar? do you mean default input date.
  • w

    white-gpu-56286

    06/08/2022, 1:19 PM
    downgraded to 9.7.0 and it worked
  • g

    gentle-dress-1046

    06/08/2022, 1:39 PM
    Hey, Im trying to override the .as command. long story short, I also override the get command so if I test an Iframe it will get from the Iframe, but when I use alias it doesnt work(because of the getting from iframe logic). so Im trying to override the .as to save the selector/element in an object.
    Copy code
    Cypress.Commands.overwrite("as", (originalFn, alias) => {
      debugger;
      return originalFn(alias);
    })
    alias contains the selector and the element but not the provided name I give it , does someone know how can I get it?
  • g

    gentle-dress-1046

    06/08/2022, 1:44 PM
    This is the alias object, I need the name it got, like @searchbar
1...798081...252Latest