https://cypress.io logo
Join Discord
Powered by
# i-need-help
  • Is Microsoft Teams integration possible with Cypress 12?
    c

    cuddly-memory-8324

    03/07/2023, 1:01 PM
    By this I mean having test reports automatically posted in a teams chat. I know this was possible with older versions of cypress but has anyone done this with the latest Cypress 12?
    a
    e
    • 3
    • 6
  • iframe won't click button but assertions pass
    t

    thousands-house-85089

    03/07/2023, 1:52 PM
    Hello! I'm having some trouble with iframe behaviour and wonder if anyone could provide some guidance please. The flow should be: * User fills in details and clicks on "Pay with Debit/Credit card" * A window should appear on top which says payment is processing. When done manually it works absolutely fine. However Cypress doesn't work, it finds the button correctly, even asserting that it exists, is visible etc. but trying to get a click on it just causes the button to flicker briefly and then nothing happens. Any help would be greatly appreciated!
    • 1
    • 1
  • Host details in config.js for DB Automation
    c

    colossal-table-38461

    03/07/2023, 2:56 PM
    Hello All, while doing DB Automation using Cypress, if I am using Microsoft SQL Server Management Studio Desktop App, so in that case what would be my "host" details in cypress.config.js file ??? (it is not on localhost)
    • 1
    • 1
  • Test Retries are using the same timestamp for each test
    f

    faint-teacher-38938

    03/07/2023, 3:28 PM
    Hi, I face an issue where test retries are using the same timestamp for each test, after the initial failure. Given the following example: const testTime = `Test_1_${timestamp}`; the const 'testTime' is used in the first test and equals "07.03.2023T12:00:00", which fails, now I would expect the timestamp to change after the first failure to be like "07.03.2023T12:01:14" on the 2nd and "07.03.2023T12:02:04" on the 3rd retry, however the timestamp stays exactly the same. Is there a way I can change the timestamp for each failed test?
  • cypress-parallel
    m

    magnificent-processor-78564

    03/07/2023, 3:53 PM
    Hi, I'm trying to run cypress-parallel in cypress 12. The run keeps failing and i'm sure i've not set something correctly. Has anyone any experience of this and can point me at docs or an example of how to do this so it'll work please?
    r
    • 2
    • 1
  • Testing dataLayer in Cypress E2E with beforeunload
    s

    stocky-insurance-27750

    03/07/2023, 4:23 PM
    I'm trying to assert a dpdEvent after clicking an element. The element refreshes the page so I need to capture the event in a cookie and then access that cookie to assert against. I've tried many ways but it will not work for me. I can make it work in Java/Selenium using javascript executor. Main things I've tried are: https://docs.cypress.io/api/events/catalog-of-events#Test-that-your-application-was-redirected using `cy.on('window:before:unload')`but have also tried ChatGPT's way of
    Copy code
    cy.window().then(win => {
          win.addEventListener('beforeunload', () => {
    I'm getting errors with promises when trying to set the cookie using
    datalayer.find(event => event.dpdItem === 'header-2')
    or if I manage to get to the click - then the cookie is null. Even when I don't try capturing anything and just use a string 'hello' - the cookie is null. Anyone got this working?
    w
    g
    • 3
    • 9
  • API testing, how to assert any value of a response request ?
    b

    bumpy-insurance-8581

    03/07/2023, 4:37 PM
    Hello, I’m trying to make an API assertion that assert that all the
    links
    from the response have a specific value. For example I want to check that they all have status
    isEnabled
    . I know how to do it in C# using
    Assert.IsTrue(response.Any(a => a.isEnabled));
    But I don’t find a way to convert this to Cypress usage, any idea ?
  • Unable to login to Cypress.io
    m

    modern-librarian-14184

    03/07/2023, 5:37 PM
    I signed up using Google with my work email a year or so back but then my work moved email hosting to Outlook and I can't remember my password to Cypress.io. When I try to reset my password it says it will send email with instructions but I never get it (Even checked Spam)
    a
    • 2
    • 2
  • In postman I have response from request but in cypress-plugin-api I don't have
    r

    ripe-fountain-23857

    03/07/2023, 7:16 PM
    Hi, a little context: in the screenshot a test that if successful sends an email to the user with this document, there are fields and data that the document receives. I have such a problem that I can not read the response of this request, when I do the same request in postman, a response is returned to me while using the cypress.api plugin I can't see this response. I tested other enpoints e.g. GET and everything is displayed. Here is a strange issue because the body is empty. Does anyone have any idea?
    n
    • 2
    • 2
  • Proxy Settings Retaining Old Value
    d

    dazzling-horse-31955

    03/07/2023, 10:09 PM
    Greetings, I've been using Cypress off and on since version 7. Recently, I've started running into an issue where I can't run my tests because Cypress is picking up an old proxy server value from somewhere and errors out. I've worked with my IT department to figure out where this value is coming from, but we can't find it: there's no http/https_proxy values or other environment settings, there's nothing set in my cypress config files, there aren't any registry keys that we could find that stored a proxy value. I can sometimes get the tests to run, often for days in a row, but then I'll get stuck for several days waiting for the proxy issue to resolve itself, despite the fact that the value that Cypress sees never changes. Is there anywhere else that I can look to find this value? It's driving me nuts and no one has answers. I'm on 12.4.1, if that helps. Very similar issue to this stackoverflow question: https://stackoverflow.com/questions/65195342/removing-cypress-default-proxy-settings?newreg=34d7f069449e44989520a27ecea1fd4b
    • 1
    • 1
  • Request getting http 500 from server when executed by Cypress
    b

    bulky-sundown-7164

    03/08/2023, 12:52 AM
    Hi guys, i have a code that login in the application, fill some fields and then i submit it clicking in a botton. Is it a easy thing right? no, it doesn't, I'm trying since this morning submit this shit and I'm still getting this http 500 error. it happen only when I'm using Cypress. if i do it manually, it works. if i use postman, it works... Now lets go to the things I guess is the error. When i'm using cypress I saw my request wont sending the origin key on the header. its the only thing different that I found. I tryed a lot of things to workaround it: I change my chrome web security options I tryed to use the cy.origin() function but it always fail with this message """"cy.origin() requires the first argument to be a different domain than top. You passed https://myURL to the origin command, while top is at https://myURL."""" I dont know what I can do anymore. If i don't fix it, I will have to use Robot Framework to automate this project, and guys.... I HATE ROBOT FRAMEWORK. please help me.
    g
    • 2
    • 2
  • I want to mock a hook (component testing)
    a

    alert-tiger-26761

    03/08/2023, 2:30 AM
    import { useGetUsersByCompany } from "@/api/user/use-get-users-by-company"; I have this hook in the component that i'm testing, I want to mock the return value of it. Using cypress component testing
  • can't assert text after clicking to show message button. here is my code
    w

    worried-shampoo-96177

    03/08/2023, 7:12 AM
    @gray-kilobyte-89541 cy.visit("https://demo.seleniumeasy.com/basic-first-form-demo.html") cy.get('[id="get-input"]').within(()=>{ const messageTxt= 'hello' cy.get('[type="text"]').type(messageTxt) cy.contains('button', 'Show Message').click({force:true}) cy.get('[id="display"]').should('have.text', messageTxt) })
    g
    e
    • 3
    • 5
  • Set value for Input directly
    q

    quick-city-89997

    03/08/2023, 11:00 AM
    Hey, i want to set a value directly into an input instead of using
    type
    , because each key stroke triggers a validation function. And it happens often that some requests get stuck in cypress (network tab is showing the correct behavior, cancelled and finished requests). Is there a way to directly set a value into the input, so my validation would only trigger once? Because currently there is an issue with cancelled requests, I just discovered https://github.com/cypress-io/cypress/issues/19326
    g
    • 2
    • 1
  • Scope of "testIsolation"
    f

    famous-secretary-98668

    03/08/2023, 12:21 PM
    Hi all, I have
    testIsolation
    set to true at a global level. I'd like certain describe blocks to run without
    testIsolation
    , so that I can run several
    it
    commands in sequence, each with an assertion. According to the docs, I can define
    testIsolation
    at a
    describe
    level. My interpretation is that is would apply to block only, but it doesn't appear to work like that, or perhaps I'm misunderstanding. Here's an example, for a given spec file
    Copy code
    describe('Some tests', () => {
    
      describe('Test A', { testIsolation: false }, () => {
        it('C1: verifies something', () => {
          // run some assertion
        });
        
        it('C2: verifies something else', () => {
          // run some assertion
        });
      });
      
      describe('Test B', { testIsolation: false } () => {
        it('C3: verifies something', () => {
          // run some assertion
        });
        
        it('C4: verifies something else', () => {
          // run some assertion
        });
      });
    });
    In this case, I'd expect
    testIsolation
    to only be applicable to the "inner"
    it
    commands. That is, "Test A" and "Test B" would run in isolation of each other. In practice, I'm observing "Test B" doesn't clear the browser session, etc. Thanks!
    i
    e
    • 3
    • 12
  • multiple origin cookies
    c

    calm-megabyte-76235

    03/08/2023, 12:23 PM
    I'm trying to test my Auth0 universal login page auth I'm using remix.run and the flow goes like this: 1. A user visit the website 2. The user is being redirect to a login proxy 3. The user is getting csrf cookie 4. The login proxy redirect to auth0 Then I'm using cy.origin with Auth0 address and doing the login flow (email, password, hitting continue) Once I'm logged in, I'm getting redirect from Auth0 back to our page which now needs to verify with the proxy that I'm logged in, using the csrf cookie At this points my test fail since the cookie dones't exists, although when checkin in devtools it is there, so it seems its not being sent over the request or something between the redirects Can someone shed a light on this one? Or more generally about proxy and Auth0 tests Thank you
  • Cucumber and TS issue: Types of property 'setup' are incompatible.
    h

    helpful-coat-87654

    03/08/2023, 12:27 PM
    I'm trying to migrate our project to TS and I have this error Type 'import("e2e-cypress/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin' is not assignable to type 'import("e2e-cypress/node_modules/esbuild/lib/main").Plugin'. Types of property 'setup' are incompatible.
    g
    • 2
    • 2
  • Canvas testing - github actions
    s

    straight-rose-89671

    03/08/2023, 2:18 PM
    I'm drawing a shape on a canvas:
    Copy code
    cy.get('canvas').click({position: 'topLeft', force: true, x: 50, y: 50})
    cy.get('canvas').click({position: 'topLeft', force: true, x: 50, y: 50})
    cy.get('canvas').click({position: 'topLeft', force: true, x: 500, y: 500})
    After that i click on the canvas:
    Copy code
    cy.get('canvas').click()
    Everything works local, but on github actions it fails.. So why is it when adding:
    Copy code
    cy.wait(1000)
    before the
    Copy code
    cy.get('canvas').click()
    it doesn't fail on github actions ?
    • 1
    • 1
  • Delete Row By Id in table
    b

    busy-soccer-31234

    03/08/2023, 5:22 PM
    How delete row by id in this angular table? i don't have any field that list the row id.
    Copy code
    ts
    let id;
    it('create_category', () => {
        cy.login();
        cy.visit('/backoffice/communication/category/create');
        
        cy.get('.ng-tns-c22-15 > .ant-form-item-control > .ant-form-item-children > .ant-input').clear();
        cy.get('.ng-tns-c22-15 > .ant-form-item-control > .ant-form-item-children > .ant-input').type('teste');
        cy.get('.ng-tns-c22-4 > .ant-form-item-control > .ant-form-item-children > .ant-input').clear();
        cy.get('.ng-tns-c22-4 > .ant-form-item-control > .ant-form-item-children > .ant-input').type('12');
        cy.get('.ant-switch').click();
        
        cy.intercept('POST', '/api/communication/categories').as('createCategory');
        cy.get('.button-submit').click();
        cy.wait('@createCategory').then((interception) => {
            id = interception.response.body.data[0].id
            console.log(id)
            expect(interception.response.statusCode).to.eq(200)
        });
    
    })
    
    
    it('delete_category', () => {
        cy.login();
        cy.visit('/backoffice/communication/category/list');
        cy.intercept('DELETE', '/backoffice/communication/categories/' + id).as('deleteCategory');
    
        cy.get(':nth-child(1) > .text-right > .options_button').click();
        cy.get('.ant-dropdown-menu > :nth-child(2)').click();
        cy.get('.ant-btn-danger').click();
    
        cy.wait('@deleteCategory').then((interception) => {
            expect(interception.response.statusCode).to.eq(200)
          });
    })
    I try this...
    g
    • 2
    • 7
  • Environment Scope Issue
    e

    enough-summer-50273

    03/08/2023, 5:37 PM
    I'm new to Cypress and I have an issues with scope that I'm not quite understanding. I have a describe block with a beforeEach that runs a custom login command and then visits the application under test. The custom login command sets the token as an environment variable (which gets used by cy.intercept to inject into the header for every request to the baseUrl domain). The token and intercept works fine. I have a test that decodes that token and checks some of the elements. This all works fine until I wanted to move the test into another describe block which doesn't have the beforeEach step. When I do this, the token environment variable isn't available to that block of code and I can't work out why. Sounds like something to do with scope, but not sure what. If I cy.log the variable within the custom command, I know its being set at this point. The new describe block only has one test in it. It repeats the same login step, and visits the home page (which still works, therefore the token is being injected correctly). The next line of code just logs the entire Cypress.Env() and I can see its missing the token value. Why is the available if i use a beforeEach, but not in an indivdual test. This works.
    Copy code
    JavaScript
      beforeEach(() => {
        cy.login();
        cy.visit("/");
      });
    
      it('Correct user is logged in', () => {
           cy.log(JSON.stringify(Cypress.env()));
           // the token set in the cy.login() command is present
      });
    This doesn't.
    Copy code
    JavaScript
      it.only('Correct user is logged in', () => {
          cy.login();
          cy.visit("/");
          cy.log(JSON.stringify(Cypress.env()));
          // the token set in the cy.login() command is not present
          // but all of the hardcoded enviroment variables are
      });
    g
    • 2
    • 5
  • How to define root element in cypress component testing?
    d

    dry-mouse-27611

    03/08/2023, 6:13 PM
    I am trying to integrate cypress component testing in react js. I am also using nx to manage my monorepo But I am getting errors as shown in screenshot and this is my component-index.html my-app Components App
  • How to read and write data to a CSV or XLS file with Cypress?
    s

    some-cartoon-73108

    03/08/2023, 8:28 PM
    I am trying to figure out how to read data from a CSV and XLS file in Cypress and use that into my tests. With fixtures I have no issue since that is out of the box. There is one recipe on the Cypress site but I could not make it work. Any ideas? Any links that can help?
    g
    • 2
    • 2
  • AAD Service Principal or AAD user with MFA login
    s

    stocky-grass-9933

    03/08/2023, 8:53 PM
    Is it possible to use a service principal to login to an application using MSAL? I am trying to write an automated test in cypress to login via a service principal. I need to get a token for the service principal and cache it so that MSAL recognizes a signed in user exists and doesn't redirect me to login, however I still get redirected to login.
    • 1
    • 1
  • How do I access the window object once the origin changes
    c

    cool-businessperson-62347

    03/08/2023, 10:58 PM
    I have a test where when I click on a button which takes me to the new origin. I had set a property on the window object but that isn't carried forward. Would I be able to set if for the new window as well?
  • Cypress BDD style but without cucumber
    c

    curved-agent-32333

    03/08/2023, 11:30 PM
    I want to make my cypress tests as readable as possible with BDD approach. However I don't want to use Cucumber since I believe it comes with an extra layer which you have to also maintain. I came up with this simple solution but I also want to hear other's opinions. I am using page object model and I added
    and()
    and
    'then()'
    functions to my base page object and they only returns the instance of the page object by
    return this;
    . Then I just chain this functions on the test as following. Please let me know about your thought and ideas regarding this. Maybe there is a better way to achieve this
  • Mock Redux store on NextJS Typescript React
    b

    billowy-sandwich-34737

    03/09/2023, 3:23 AM
    Hi guys, I am writing component testing with Cypress, i get difficult about how to setup cypress to mock redux in my tests. I had read document of Cypress and stackover flow, but no one mentioned NextJS Typescript. Please help me. Thank you so much.
  • Hiding third party XHR in logs when testing
    b

    bright-gold-91786

    03/09/2023, 7:33 AM
    Is it possible to hide these XHR requests made by zendesk/pinterest, etc, in the logs when testing for better visibility?
    p
    g
    +2
    • 5
    • 6
  • Cypress Electron dataLayer is not defined
    s

    stocky-insurance-27750

    03/09/2023, 8:31 AM
    I'm confused by this. If I run a
    --headed
    test and turn on developer tools, go to console and enter
    dataLayer
    - I get an error that
    dataLayer is not defined
    . This isn't the case in Chrome with the app running. I've entered
    window.dataLayer = window.dataLayer || []
    and then clicked buttons (that should be firing events into the dataLayer) but it remains blank. I previously had a test that was asserting the dataLayer fine, so this is really puzzling why the dataLayer is now disappeared. Have I done something daft in a config or something?
    Copy code
    cy.window()
          .its('dataLayer')
          .then(dataLayer => {
            const size = Cypress.$(dataLayer).length - 1
            const event = dataLayer[size]
    
            expect(event.event).to.equal(expectedEvents.event)
            expect(event.action).to.equal(expectedEvents.action)
          })
  • It seems cypress 12.7.0 has memory leaks issue
    l

    lively-library-21721

    03/09/2023, 9:14 AM
    after running several spec files via dashboard not CLI, my laptop became lagged. My pc has 16 gb of ram, it should not have issue with cypress. Everything worked fine in version below 12. Then I tried to swtich to cypress 10. This issue gone. Please help to fix this performance issue.
    a
    • 2
    • 2
  • Generate doc given tests
    g

    great-cricket-75245

    03/09/2023, 11:33 AM
    Hi Is there a way to generate a documentation given the test ?
    e
    • 2
    • 1
1...131415...26Latest