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

    mysterious-belgium-25713

    10/18/2022, 3:24 PM
    Yeah that's why I said contains. What happens with cy.get is it will get the state of the application at the moment it is called so i don't think it will wait for the refresh. But i might be wrong.
  • g

    gentle-mechanic-42608

    10/18/2022, 3:26 PM
    Okay, then I need to use contains. Is there a way to do something like this:
    Copy code
    cy.contains('.Mui-selected.MuiTableRow-root')
                .children()
                .find('p')
                .should('have.text', 'Neue Position');
  • b

    boundless-camera-50857

    10/18/2022, 3:37 PM
    yes that's what I figured, I just hoped there was a hidden way to serve the component somehow 😛 thanks
  • a

    acceptable-hamburger-48790

    10/18/2022, 3:45 PM
    Cant you use cy.contains('.Mui-selected.MuiTableRow-root p', 'Neue Position').should("be.visible")
  • g

    gentle-mechanic-42608

    10/18/2022, 3:50 PM
    Thank you, this seems to work. But how does this selector works? It looks for a tag with class "Mui-selected" and "MuiTableRow-root" ? If this work this way this couldn't work, because these both classes are in a some levels above.
  • b

    better-engineer-26463

    10/18/2022, 4:08 PM
    does anyone know why cypress install would install version 9.6.1 instead of 10.10 ?
  • a

    acceptable-hamburger-48790

    10/18/2022, 4:09 PM
    the selector is searching for child p inside Mui-selected" and "MuiTableRow-root
  • r

    refined-raincoat-56329

    10/18/2022, 4:19 PM
    Hi, Can someone please help me resolve this promise code, as cypress is asynchronous code like this is not working in headless mode, can someone please make it usable for cypress.
    Copy code
    type NewAccountCredentials = {
        username: string,
        password: string,
        vcode: number,
        uid: string
    };
        credentials = await new Promise<NewAccountCredentials>((resolve) => {
                cy.request(serverUrl + '/test-accounts/free').then(response => {
                    expect(response.body).to.have.property("username");
                    resolve(response.body);
                })
    
            });
    
      await new Promise<void>((resolve, reject) => {
                cy.request("DELETE", `${serverUrl}/test-accounts/uid/${credentials.uid}`).then(response => {
                    expect(response.status).to.be.equal(200);
                    resolve();
                })
            });
  • a

    adorable-smartphone-87280

    10/18/2022, 4:26 PM
    This code is pretty readable, but just so you know, it's prefereable to wrap code in triple-backtick blocks for readability.
    Copy code
    so your code looks like this {
      even across multiple lines
    }
  • r

    refined-raincoat-56329

    10/18/2022, 4:35 PM
    is it fine now ?
  • m

    mysterious-belgium-25713

    10/18/2022, 4:43 PM
    Thx @acceptable-hamburger-48790 that you answered the question on the cy.contains. i was traveling home so couldn't finish my answer
  • r

    refined-raincoat-56329

    10/18/2022, 5:18 PM
    any help on this, as I am only stuck at this stage
  • n

    narrow-artist-87113

    10/18/2022, 5:49 PM
    Referring to this documentation, can someone clue me in on in which folder should i place my .env file?
  • n

    narrow-artist-87113

    10/18/2022, 5:50 PM
    like there can be node_modules or cypress folder etc
  • s

    stale-optician-85950

    10/18/2022, 6:29 PM
    @narrow-artist-87113 we discussed this a few days ago here: https://discord.com/channels/755913899261296641/763105090679865354/1030826544597311519 "It is placed at the root of your project." So in your image its the same level as
    cypress.config.js
  • n

    narrow-artist-87113

    10/18/2022, 6:34 PM
    yes @stale-optician-85950 thank you again!
  • s

    stale-optician-85950

    10/18/2022, 6:36 PM
    @narrow-artist-87113 have you added the
    .env
    file and installed the cypress-dotenv package, and then tried to call env vars in your code? Actually, I can see the 'configure' notes in that package README are out of date for Cypress v10. So you can do this if you are using v10: In your
    cypress.config.js
    add to the top of file:
    import cypressDotenv from 'cypress-dotenv';
    Then within
    e2e > setupNodeEvents
    section add:
    Copy code
    e2e: {
        setupNodeEvents: async (on, config) => {
          // Use .env file to load local environment variables
          config = cypressDotenv(config, {});
    Then follow the example in `What does this thing do?' section as that is still relevant.
  • b

    brave-river-4142

    10/18/2022, 8:12 PM
    Hi guys its me again Lol I need help about drag-and-drop: I'm automating an application from scratch and also don't have much knowledge/experience with Cypress. I'm trying to use the cy.trigger method to move a card to the next column (kanban), but I believe it's not able to go to the object in the next kanban column by scrolling down. I will show the error and code first img: cypress drag the card but its on the top second img: cypress identify de column the last img: the error
  • s

    stale-optician-85950

    10/18/2022, 9:23 PM
    As there seems to be no one-size-fits-all for Drag & Drop, for me the trick to getting drag and drop working was monitoring my Dev Tools > Sources > Event Listeners * Add event breakpoints by ticking the checkbox for all Drag/drop and Mouse actions. * Then in your application start manually doing your actions. * The event listener will stop once you reach a breakpoint i.e. action that has a tick * You then make a note of that action, untick the action and press the 'Resume script execution' button, and carry out your next manually move And you soon get a mapping of what the application is really doing when you drag and drop. Obviously then code those steps using
    .trigger()
    I just moved a card on a Trello board now and the sequence was: - mouseover - mousemove - mouseout - mousedown - mouseup Here's a custom command I have in previous project:
    Copy code
    const buttonAttributes = [{
      button: 0,
      force: true,
    }];
    
    Cypress.Commands.add('dragAndDrop', (subject, target, toElPositionX, toElPositionY) => {
      Cypress.log({
        name: 'Drag & Drop',
        message: 'Performing drag and drog',
      });
    
      cy.get(target.get(0)).then(($target) => {
        cy.get(subject.get(0)).then(($subject) => {
          cy.wrap($subject)
            .trigger('mousedown', 'center', buttonAttributes)
            .trigger('mousemove', 'center', buttonAttributes);
          cy.wrap($target)
            .trigger('mousemove', toElPositionX, toElPositionY, buttonAttributes)
            .click(toElPositionX, toElPositionY, { force: true });
        });
      });
    });
  • w

    wonderful-whale-44360

    10/19/2022, 12:29 AM
    Hi ,Im learning Cypress i stuck in middle while trying Cypress API using Formdata/multipart .Can you guys help me out to sort this thing
  • g

    gray-kilobyte-89541

    10/19/2022, 2:24 AM
    can you provide more details
  • r

    refined-raincoat-56329

    10/19/2022, 2:40 AM
    https://stackoverflow.com/questions/74114450/how-to-refractor-promise-code-for-cypress
  • b

    bland-football-57990

    10/19/2022, 4:22 AM
    Cypress opening blank page
  • b

    bland-football-57990

    10/19/2022, 4:22 AM
    Can someone please help
  • w

    wonderful-whale-44360

    10/19/2022, 5:05 AM
    @gray-kilobyte-89541 First i tried that API using Formdata thing in Postman application ,i will explain what exactly i done in that postman app.I selected method as 'POST' and some required URL and for BODY content i selected formdata .In that i give 2 key,values . 1st key as files for attachments and 2nd key as request for some descriptions and i sent it .i got response as 200 . I needed the same function in Cypress
  • a

    ancient-tailor-59288

    10/19/2022, 7:43 AM
    If my team has more than 40 members, but does less than 10000 tests a year, approximately what would be the cost per year? Say I have a team of 100.
  • b

    bitter-dress-1440

    10/19/2022, 7:51 AM
    Hi there, sorry really n00b question but for the new cypress component testing can the tests live with the components rather than under the cypress directory?
  • a

    acceptable-hamburger-48790

    10/19/2022, 7:57 AM
    Yes it can and you check this repo for example https://github.com/cypress-io/cypress-realworld-app/tree/develop/src/components
  • f

    fresh-doctor-14925

    10/19/2022, 8:18 AM
    Yeah, and it'll make your life much easier when it comes to component imports, etc
  • b

    bitter-dress-1440

    10/19/2022, 8:29 AM
    Lovely thank you!!!
1...180181182...252Latest