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

    wide-hospital-71307

    07/27/2022, 10:37 AM
    i found this https://github.com/cypress-io/cypress/issues/22368 which seems to be what I want.
  • w

    wide-hospital-71307

    07/27/2022, 10:40 AM
    i think the new cy.session thing was designed for people who have large its with a lot of actions in them, and not for the people that have multiple smaller its
  • f

    fresh-doctor-14925

    07/27/2022, 10:48 AM
    In that case, you're running up against a Cypress design principle. As much as possible, Cypress will try to clear state between the
    it()
    blocks > don't want to tell the app where to go on every step, it goes to the page it is supposed to go to It sounds a lot like one
    it()
    block will rely on the actions performed in the previous one? This isn't a good pattern to follow
  • w

    wide-hospital-71307

    07/27/2022, 10:49 AM
    Ah so that's the issue ok. Yeah was hoping it's more readable. But then with the changes from the ticket above, would it not be the same as it is now?
    f
    • 2
    • 9
  • w

    wide-hospital-71307

    07/27/2022, 10:50 AM
    Cause the only breaking change is the blank page on each it
  • w

    wide-hospital-71307

    07/27/2022, 10:52 AM
    Also what you are saying goes against it retries right? A few weeks ago I solved an issue by isolating certain actions, creating a separate it step for them and repeating those
  • w

    wide-hospital-71307

    07/27/2022, 10:58 AM
    That and the session thing hmm..
  • g

    green-book-63455

    07/27/2022, 12:35 PM
    @gray-kilobyte-89541 - I agree that the cypress test is updating a different window instance to what the svelte app is running in. Used https://github.com/cypress-io/cypress-example-recipes/blob/master/examples/logging-in__single-sign-on/cypress/e2e/logging-in-single-sign-on-spec.cy.js as a guide, I used the follwoing code cy.request('POST', Cypress.env('api')+'users/login', { email: "johnny@email.com", password: "12345678" }).its('body').then((body) => { cy.window().then(win =>{ cy.visit(
    /
    , { onBeforeLoad(win) { win.authorised =true win.emailName = "johnny@email.com" win.fred = "Johnny" win.authToken = body.token win.userId = body.userId }, }) }) cy.get('h1').should('contain', 'Svelte To-Do List') }) Now running this works and in the svelte app, I have some console logging and that shows what I expected / hoped. Do I need the cy.window? Or can I just use the visit with onBeforeLoad? Many thanks for this - though being able to authenticate with request is not an essential (the time saving is minimal), this has been frustrating me for a while.
  • g

    gray-kilobyte-89541

    07/27/2022, 12:44 PM
    no you don't since you never use it 🙂
  • b

    brash-magazine-98754

    07/27/2022, 3:28 PM
    how to override the baseUrl in cypress version 10 , from cypress.config.js through commandline
  • g

    gray-kilobyte-89541

    07/27/2022, 3:54 PM
    https://cypress.tips/search same applies in v10
  • a

    abundant-eve-90571

    07/28/2022, 1:05 AM
    Hi, anyone knows how to allow only image upload in a cypress test? i saw cypress-file-upload lib and it has attachfile function where we can specify file type in mimeType, but i want to allow any kind of image file, not just one type like it should support jpg, png, etc, any clues on this would be nice, thanks
  • a

    abundant-eve-90571

    07/28/2022, 1:06 AM
    Copy code
    When('I choose 1 non image file', () => {
        cy.get("input[type=file").attachFile( {
            filePath: "example.json"
            mimeType: image/jpg || image/png
        })
    })
    here i want to write a test to check if a non image file is being uploaded, can i do this?
  • m

    mysterious-motherboard-13344

    07/28/2022, 6:05 AM
    @abundant-eve-90571 I think you will have to include all image type extensions that you want to allow in the above code. There cannot be generic type for checking image types.
  • a

    abundant-eve-90571

    07/28/2022, 6:17 AM
    how to do that? using the or symbole in mimeType?
  • a

    abundant-eve-90571

    07/28/2022, 6:17 AM
    or set an array with all possible types
  • a

    abundant-eve-90571

    07/28/2022, 6:33 AM
    how to do that? using the or symbole in mimeType? or set an array with all possible types
  • a

    acceptable-hamburger-48790

    07/28/2022, 10:29 AM
    did you try image/*
  • a

    acceptable-hamburger-48790

    07/28/2022, 10:30 AM
    But its always advised to explicitly mention the types though
  • a

    acceptable-hamburger-48790

    07/28/2022, 10:30 AM
    https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc737070(v=ws.10)?redirectedfrom=MSDN
  • m

    mysterious-motherboard-13344

    07/28/2022, 10:57 AM
    how to do that using the or symbole in
  • w

    wooden-teacher-96595

    07/28/2022, 3:23 PM
    So I am trying to verify that an intercept returns a specific status code in the response. Now the response is coming back as an object and I can see the desired status code inside yet my assertions keep giving one form of error or another. Do I need to somehow convert the object or use a specific '**Should**' command for it?
  • q

    quaint-butcher-3955

    07/28/2022, 3:41 PM
    Hey guys, I am struggeling with something and need some assistance #763105090679865354 #755913900024791046 Anyone know how to click on on a button that is in the last col of the first row of a table with cypress ?
    Copy code
    it('Should Click the edit button on the table', () => {
        cy.url().should('contain', '/profile');
        cy.get('[data-cy="profile-table"] > :nth-child(2) > :nth-child(8) > :nth-child(8)').invoke('text').as('data');
        cy.get('@data').then((data) => {
          cy.get(`[data-cy="edit_${data}"]`).click();
        });
      });
    The cy on the button element
    Copy code
    cy={`edit_${row.original.profileId}`}
  • c

    curved-father-48262

    07/28/2022, 5:09 PM
    I am seeing in the v10 cypress apparently some of my graphql calls keep swirling even after the test completes? Do i need to worry about that? https://gyazo.com/df8d86d7d388d8b755f43feec20045a9
  • g

    gray-kilobyte-89541

    07/28/2022, 5:52 PM
    so the table has the tbody and inside there is the first tr element and it has bunch of td cells, and you want the last cell and click on the cell?
  • l

    loud-city-40050

    07/28/2022, 9:45 PM
    Error Is Being Covered By Another Element
    • 1
    • 4
  • a

    alert-parrot-29600

    07/29/2022, 11:19 AM
    Hi, I am noticing a strange issue in our cypress CI, the react component doesn't load in CI, however when we are using cypress locally pointing to review app, it loads fine. All api's are working fine checked via intercepts.
  • p

    powerful-vr-28259

    08/01/2022, 1:19 AM
    Hi, is there a way to set/mock a datastore object’s value within Cypress? I am working on an Angular app that has get/set methods for objects in the datastore file. I am having trouble accessing the object inside Cypress.
  • g

    gray-kilobyte-89541

    08/01/2022, 12:03 PM
    Can you make a small repo with a typical app that you want to access?
  • p

    plain-garden-5374

    08/01/2022, 11:18 PM
    question on multiple `cy.intercept()`s: - our app makes multiple different requests to a
    /graphql
    endpoint - each request has the same method (POST) and endpoint url; they differ only in their request bodies, in particular the
    operationName
    . so the naive
    cy.intercept('POST', '/endpoint')
    matches all of them, and i have to implement the aliasing methods from https://docs.cypress.io/guides/end-to-end-testing/working-with-graphql to have a hope of disambiguating them - i would like to stub all of these requests inside the same test, replacing their responses with mock data stored as fixtures is this even possible? gleb's blog post https://glebbahmutov.com/blog/cypress-intercept-problems/#multiple-matchers seems to suggest there's no way for me to
    cy.wait()
    on more than one `cy.intercept()`s with the same method and endpoint in the same test context, and that my only solution is to not have tests that require more than one of the intercepts.
    g
    • 2
    • 2
1...757677...192Latest