https://cypress.io logo
Join Discord
Powered by
# i-need-help
  • Timeout for getting element on Gitlab CI/CD
    e

    elegant-insurance-66438

    05/24/2023, 12:44 PM
    This is bit of a weird one, and I'm hoping someone may have a suggestion as the possible cause. I made a feature branch with several tests and an updated
    .gitlab-ci.yml
    - the tests were running fine locally and also as part of the CI/CD pipeline after pushing. I merged the feature branch into the dev branch but now there are timeout errors regarding elements not being found. The output video and screenshots show that the element that can't be found is actually there and can be seen - I checked that the selector is correct. I pulled the dev branch with the merged feature branch changes and the tests are running without issue locally. I also tried changing the timeout threshold to 60000 but it didn't help. This maybe more of a Gitlab issue rather than Cypress, but any pointers would be appreciated.
  • how to specify host with port in cypress
    f

    faint-pilot-48554

    05/24/2023, 1:18 PM
    Hi all, i am trying to run cypress test on local environment. When we start our app locally. We start chrome by mapping some domains with ip and port. Something like this. Image 1 Now when i run my test in cypress and points to this dev-local domain by giving 8000 port in baseurl. I am able to load the page but some of the js calls still calls the domain without using the port like this _ image 2 How can i specify port to internal calls?
    f
    g
    • 3
    • 4
  • Cypress intercepts flakes
    f

    fresh-van-73810

    05/24/2023, 1:46 PM
    Hey, I have recently swapped from arbitrary waits to intercepts. This shaved about 30 percent of my testing time off which is awesome. Sadly i do experience more dom related flakes. Especially in my search components. I do wait for the request to be fetched but in about 20 percent of runs the table is not rerendered yet and cypress will therefore find multiple matching elements. Now i can just put another assertion like cy.contains() but first of all i dont like the idea of a "useless" assertion which is true anyway and also that wont work if i have an inline editable input which has to be invoked. Any ideas are welcome !
    g
    • 2
    • 5
  • Tests management tools
    f

    fast-france-24144

    05/24/2023, 2:58 PM
    Hello everyone, I would like to know if you indicate free software test management tools.
    m
    • 2
    • 1
  • Pushing code changes to any branch creates two runs and I can't figure out why
    c

    cold-island-71759

    05/24/2023, 3:14 PM
    Hi All, First off thanks for reading my message. The problem I'm having is; when I make a change and commit it to any branch, the suite runs twice putting two entries into the latest runs table. I must have something in my config telling it to do this but I can't for the life of me figure out where. I guess a good place to start is in my cypress.yml file. Apologies if this post is too vague, I'm not exactly sure how to find the solution to my problem! https://cdn.discordapp.com/attachments/1110948975890149496/1110948976238272632/cypress.yml
    m
    • 2
    • 6
  • want to stop incoming and outgoing API/service calls in the application within cypress execution
    f

    freezing-activity-66869

    05/24/2023, 4:41 PM
    Currently because of fast execution of refresh operation my page gets refreshed so fast with additional calls so that tool not able to do any assertion , as call from the application refresh the page. Need assistance to see if there is the way we can pause the calls so that cypress can do stuff in between
    f
    • 2
    • 2
  • Dashboard Url/runUrl in reporter
    s

    swift-tiger-94189

    05/24/2023, 7:50 PM
    Hello, I'm trying to make a reporter that include the runUrl in the report. I'm hoping to get a link from the report directly to the run in cypress dashboard. Is there any way to retrieve that variable for a reporter? I haven't been able to find it. Specifically: at the end of a run, there's a console log line that says
    Recorded Run: https://cloud.cypress.io/projects/{projectId}/runs/{runNumber}
    . I would like to put that url in my report. E.G.:
    Copy code
    class MyCustomReporter {
        constructor(runner, options) {
            runner.once(EVENT_RUN_BEGIN, () => {
                console.log('start');
                // I'd like to log it here.  If I know how to log it here, I can put it where i need it to go.
                            console.log(`RunUrl:${SomeRunUrl}`);
            })
        }
    }
    m
    • 2
    • 2
  • Variable Issue
    p

    powerful-camera-26936

    05/25/2023, 2:35 AM
    Hello! I'm quite new to Cypress, but I'm working hard to learn! I'm trying to build out tests for APIs, but am getting stuck at getting the authorize token into the test from my custom command. I am able to see it in the alias I created, but the variable on the actual test says it isn't defined. Would someone please show me what's wrong? I'm so interested in learning and am frustrated at getting stuck on this! I covered up some confidential things in the screenshots, but I don't think it will hinder people from seeing the code . The first screenshot is the custom command and the second is the test.

    https://cdn.discordapp.com/attachments/1111120414022832158/1111122195641553016/image.png▾

    https://cdn.discordapp.com/attachments/1111120414022832158/1111122195951923261/image.png▾

    d
    h
    g
    • 4
    • 4
  • Using Cypress for continuous E2E testing on a production server
    c

    cuddly-room-47340

    05/25/2023, 3:55 AM
    Hi. We have a production server using the forms of a third-party provider. It happened that some of those forms stopped working for various reasons. Due to the partial failure it took too long until the problem was detected and localized. Our idea is now to continuously test all forms at least once a day, fully automated. And for various reasons I would love to use Cypress for that. But, there are two challenges. 1. Running Cypress on an external Node server: It would be an excellent workflow to develop the tests locally and publish them through Node on a testing server. But, for instance, Heroku seems incapable of running Cypress fully. Is there a Node server we can use that fully supports Cypress? 2. After each test, we would like to send the results to a number of people. Is there a way to send such a report, ideally the test results as text and with a link to the video recordings? Maybe using Selenium is the better choice for this task. What do you think? I really would prefer Cypress, as it has become my No. 1 testing tool.
    m
    g
    • 3
    • 20
  • Using Cypress.intercept with `pathname` and `query` options ignores the `query` option
    c

    careful-terabyte-63440

    05/25/2023, 8:07 AM
    Hey everyone 👋 I'm using
    cy.intercept
    to intercept a route that contains some
    query
    parameters, but it is not behaving as I am expected. It is intercepting all the routes defined by
    pathname
    , but not
    query
    . I experience the issue with the following scenario: I have the following url which I am intercepting -
    /json-api/demo/tasks
    This url can have 2 different query parameters: -
    filter[status]: open
    -
    filter[completed]: true
    I want to intercept all the route for
    /json-api/demo/tasks?filter[status]=open
    (
    /json-api/demo/tasks?filter%5Bstatus%5D=open
    ) I
    intercept
    the route using the following options 👇
    Copy code
    cy.intercept({
            pathname: '/json-api/demo/tasks',
            query: { 'filter[status]': 'open' },
          }).as('openTasks');
    Looking at the E2E test and the Cypress console, the alias
    @openTasks
    gets attached to the following URLs -
    /json-api/demo/tasks?filter%5Bstatus%5D=open
    -
    /json-api/demo/tasks?filter%5Bcompleted%5D=true
    The problem with this behavior is that when I invoke
    cy.wait(@openTasks)
    , it waits for the wrong request to complete before continuing Replacing the
    pathname
    and
    query
    with
    path
    seems to work, the following options aliases routes properly
    Copy code
    cy.intercept({
            path: /\/json-api\/demo\/tasks\?.*filter%5Bstatus%5D=open/,
          }).as('openTasks');
    I did find a Github issue that resembles the problem I run into (https://github.com/cypress-io/cypress/issues/16686), but it is a ~so-so quality ticket. I would like to be able to intercept the route using
    pathname
    and
    query
    , where am I messing up? 😅 Thank you 🙏
  • Authorization for API testing
    c

    cold-bird-96191

    05/25/2023, 9:47 AM
    in order to test the API - I need to log in using the API key. Where can I enter this key when creating an API autotest?

    https://cdn.discordapp.com/attachments/1111229023180312596/1111229023406796841/Screenshot_60.png▾

    f
    • 2
    • 1
  • reverse proxy and custom certificate
    p

    polite-glass-8571

    05/25/2023, 10:31 AM
    Hello, I have been stumbling around trying to get this to work for the last couple days and still with no luck. I'll describe my setup and my needs: I have a custom url
    www.mysite.com
    I have a ssl certificate for this website that I have installed on my mac I have a local reverse proxy that uses a trusted certificate, I can visit
    www.mysite.com
    on a regular browser and it will show that the connection is trusted and secure ( green lock) Due to cypress using its own proxy, it provides its own certificate when connecting to
    www.mysite.com
    which is not installed on my mac, therefore the connection is marked as non-secure (red lock). I have a script that runs on the app that I cannot modify and relies on being on that particular domain (
    www.mysite.com
    ) and having a secure connection ( green lock ). Now, I am trying to separate requests that need to be proxied by cypress and the ones that don't through a PAC file, supplied as an option on
    before:browser:launch
    but I only managed to have Cypress show a message "This browser was not launched through Cypress. Tests cannot run.". Do you have any suggestions on how to solve this? I'm banging my head trying to make it work
    g
    • 2
    • 16
  • Component testing with font awesome icons not loading
    e

    echoing-forest-11433

    05/25/2023, 12:46 PM
    I'm using tailwindcss and fontawesome icons. I'm not sure why but the icons appear as small squares and when i inspect the icons, they have the correct names. This is the code:
    Copy code
    describe('<CategorySelector />', () => {
      it('renders', () => {
        cy.mount(<CategorySelector />)
    
        // Wait for Font Awesome icons to load
        cy.get('.fa-users', { timeout: 10000 }).should('have.length.gt', 0)
      })
    })
    I appreciate any and all help with this!!
  • Login SalesForce using Cypress E2E
    v

    victorious-television-13561

    05/25/2023, 1:18 PM
    Hello, I'm having trouble logging into SalesForce using cypress. I put user and password and when I click to enter the left side of the execution just loading and it doesn't go ahead. Follow images Code: context('SalesForce Login', () => { it('Login', () => { cy.visit('https://duratexcrm--qa.sandbox.my.salesforce.com/') cy.get('#username') .type(Cypress.env('username')) cy.get('#password') .type(Cypress.env('password'), { log: false }) cy.get('#Login').click() cy.get("//button[@aria-label='Pesquisar']").should('be.visible') }); }); Thanks!

    https://cdn.discordapp.com/attachments/1111282230610899054/1111282230912884746/Screenshot_2023-05-25_101454.png▾

    https://cdn.discordapp.com/attachments/1111282230610899054/1111282231219077120/Screenshot_2023-05-25_101430.png▾

  • How can I test Remember Me Functionality without using Session?
    g

    great-furniture-24480

    05/25/2023, 2:09 PM
    hi, all have a test scenario where I want to verify the functionality of "Remember Me". In the first test case, I perform a login after checking the "Remember Me" checkbox and then redirect to the dashboard. In the second test case, my intention is to directly access the dashboard without performing another login, relying on the "Remember Me" feature. I expected it to work similarly to a session. However, I don't want to manually create a session for this test, as I have already implemented session management in my other tests. Is there any suggestion on how I can achieve this without creating a session? It's worth noting that the session handling in the browser is done internally by Firebase, and there is no direct access to session cookies. Here is the code: it('should remember login and load dashboard when "Remember Me" is checked', () => { cy.visit('/login'); cy.get('#username').type('your_username'); cy.get('#password').type('your_password'); cy.get('#rememberMe').check(); cy.get('#loginButton').click(); cy.url().should('include', '/dashboard'); }); it('should load dashboard without login if remember me is enabled', () => { cy.visit('/'); cy.url().should("include", "/dashboard"); })
    g
    e
    • 3
    • 12
  • Cannot load __cypress/iframes/{pathtotest}
    b

    brave-doctor-62978

    05/25/2023, 2:13 PM
    Anytime i start component testing i see it trying to request http://localhost:8055/__cypress/iframes//Users/mypath/app/scheduler/dialogs/spec/EmployeeSortDialog.cy.spec.tsx but that request never finishes it's pending status, is there something im missing?
  • Parser can work only with string streams
    w

    wide-quill-11523

    05/25/2023, 4:48 PM
    Copy code
    describe(
        "description",
        () => {
            it("Login", () => {
                cy.visit('https://url.company.com/sites/test_regression/members/Preferences/ContactInformationStep')
                    cy.get('#Username').type('someUser')
                    cy.get('#Password').type('somepassword')
                    cy.get('button.button-submit').click()
                
            });
        }
    );
    Have the following test case. Navigation to the visit site redirects to a login site on the same domain, which then redirects back to the original page. After doing so I get about 2 seconds of the ContactInformationSetup page before cypress crashes. It gives a stack trace where the first lines are Parser can work only with string streams. TypeError: Parser can work only with string streams. at a._transform (:4614:132981) None of this stack references anything in my code, and the test case is as trimmed down as I can get it. Let me know if the full stack would help further?
    • 1
    • 1
  • How to pause all incoming call of single page application within cypress
    f

    freezing-activity-66869

    05/25/2023, 6:47 PM
    I want to pause a application call that is not API/service which triggers to load of a new page with the application, like to stop it so that so that i can do the assertions in validate it. As Cy.wait or cy.intercept not working out because they are not APIs or service calls hence they reload are happening irrespective of putting these. Need suggestion how to handle single page application load to pause for such cases
  • How to pass database long query in test?
    w

    wooden-kitchen-45804

    05/25/2023, 7:23 PM
    Currently i’m trying to do database testing in cypress, i have established the db connection in cypress. But now i’m facing issue while passing lengthy query in test. Most of the query lines have more than 10 lines. i can’t pass those lengthy queries in test its showing syntax errors. Please give me a solution for this.
    c
    • 2
    • 1
  • getting help on flaky tests
    a

    ambitious-monkey-72386

    05/26/2023, 3:27 AM
    I have a smoke test with a set of 14 tests and these test are flaky due to various reasons . I find a few things that I can do to improve the robustness of the test. 1. Separate tests logically to make them independent of each other 2. Smooth handover of test 1 to test 2, currently if test 1 is looking for an element which if does not find or stuck the test suite is just hanging and not completing ( any suggestions ) 3. Currently the test suite is using css selectors , I am planning to change it to the data- cy attribute ( any suggestions )
    p
    e
    • 3
    • 7
  • image comparison test
    a

    ambitious-monkey-72386

    05/26/2023, 3:30 AM
    I want to currently validate the logo image which is a jpeg , to see if it is matching the expected image in fixture folder in cypress . Any help to compare images.
    h
    • 2
    • 2
  • (uncaught exception) Reference Error: userAgent is not defined
    p

    proud-engine-17504

    05/26/2023, 7:46 AM
    I just started using cypress and wrote a simple test to visit my site. I got the above error. This doesn't happen when I try it on other sites like google. I provided a screenshot of my config file, if it helps

    https://cdn.discordapp.com/attachments/1111560914810970122/1111560915045842945/Screenshot_2023-05-26_at_3.45.39_PM.png▾

  • How to test HTML5 built in validation popup? Cypress TypeScript
    c

    calm-translator-52

    05/26/2023, 10:31 AM
    Hi, I'm new to cypress automation and I want to know how to write a test for HTML5 built-in popup validation error in Cypress TypeScript. This is the message I get when I click on the submit button: I tried to add the below code, but then I got an error like this. Email field code (inspect):

    https://cdn.discordapp.com/attachments/1111602492149596160/1111602492170571816/Screenshot_2023-05-26_135811.png▾

    https://cdn.discordapp.com/attachments/1111602492149596160/1111602493449846834/Screenshot_2023-05-26_135715.png▾

    p
    g
    • 3
    • 7
  • "Choose browser" stage freezing then crashing Webstorm
    b

    brash-appointment-91676

    05/26/2023, 12:31 PM
    I just run
    cypress open
    . Operating System: Fedora Linux 38 KDE Plasma Version: 5.27.5 KDE Frameworks Version: 5.106.0 Qt Version: 5.15.9 Kernel Version: 6.2.15-300.fc38.x86_64 (64-bit) Graphics Platform: Wayland Processors: 8 × Intel® Core™ i5-9300H CPU @ 2.40GHz Memory: 15.4 GiB of RAM Graphics Processor: NVIDIA GeForce GTX 1650/PCIe/SSE2
    p
    • 2
    • 3
  • find() method is finding an element that doesn't exist
    a

    alert-translator-5029

    05/26/2023, 12:39 PM
    I have the following code it( 'test', () => { cy.get( '[data-test="test"]' ) .should( 'be.visible' ) .find( '[data-test="test-text"]' ) .should( kicker => expect( kicker.text().trim() ).to.equal( '' ) ); }); So, I want to verify if that element doesn't have text but in my code I don't have the code write [data-test='test-text'] for it and I am expecting for the test to fail, instead it pass whatever I put in find() method. Do you have any ideea? Cypress version: 10.11.0
    g
    • 2
    • 1
  • Getting cypress:server:browsers:browser-cri-client error when trying to run in windows container
    t

    thousands-refrigerator-44194

    05/26/2023, 1:03 PM
    Hi! I'm trying to run cypress test in a windows docker container (have to be Windows, I know...) and I'm getting the error attached (in debug mode). This error would eventually time out the request, as seen in the second photo. The configuration works if it's not on the Windows container, but on my desktop. I've setup so that npm run cy:run will run npx cypress run --headless --browser chrome script. What I haven't tried is verifying that Chrome exists, but it should be if I'm able to use it in the command right? Thanks for the help in advance.

    https://cdn.discordapp.com/attachments/1111640807955513484/1111640808416878673/image.png▾

    https://cdn.discordapp.com/attachments/1111640807955513484/1111640808765014107/image.png▾

    • 1
    • 2
  • Ads are not loading when launching test with cypress run commands
    b

    bumpy-insurance-8581

    05/26/2023, 1:52 PM
    When I launch my test using
    cypress open
    commands, ads are loading on the page. But when I use
    cypress run
    ads are not loading (so my test to check if ads appear or not fail)
  • "Cannot redefine property" when stubbing module exports
    b

    brash-appointment-91676

    05/26/2023, 3:25 PM
    index.ts:
    Copy code
    ts
    export const testConstant = "initial"
    test file:
    Copy code
    ts
    import * as testExports from "./index.ts";
    it("changes the module", () => {
      cy.stub(testExports, "testConstant")
        .value("VALUE")
      expect(testExports.testConstant).to.eq("VALUE")
    })
    Result:
    Copy code
    js
    TypeError: Cannot redefine property: testConstant
        at Function.defineProperty (<anonymous>)
        at Object.value (/__cypress/runner/cy…runner.js:129024:16)
        at proto.<computed> [as value] (/__cypress/runner/cy…runner.js:128601:12)
        at Function.<anonymous> (/__cypress/runner/cy…runner.js:128594:46)
        at runnable.fn (/__cypress/runner/cy…runner.js:160854:19)
        at callFn (/__cypress/runner/cy…runner.js:114387:21)
        at ../driver/node_modules/mocha/lib/runnable.js.Runnable.run (/__cypress/runner/cy…_runner.js:114374:7)
        at <unknown> (/__cypress/runner/cy…runner.js:167842:30)
        at PassThroughHandlerContext.finallyHandler (/__cypress/runner/cy…_runner.js:15298:23)
        at PassThroughHandlerContext.tryCatcher (/__cypress/runner/cy…_runner.js:18744:23)
        at Promise._settlePromiseFromHandler (/__cypress/runner/cy…_runner.js:16679:31)
        at Promise._settlePromise (/__cypress/runner/cy…_runner.js:16736:18)
        at Promise._settlePromise0 (/__cypress/runner/cy…_runner.js:16781:10)
        at Promise._settlePromises (/__cypress/runner/cy…_runner.js:16861:18)
        at Promise._fulfill (/__cypress/runner/cy…_runner.js:16805:18)
        at Promise._settlePromise (/__cypress/runner/cy…_runner.js:16749:21)
        at Promise._settlePromise0 (/__cypress/runner/cy…_runner.js:16781:10)
        at Promise._settlePromises (/__cypress/runner/cy…_runner.js:16861:18)
        at Promise._fulfill (/__cypress/runner/cy…_runner.js:16805:18)
        at Promise._resolveCallback (/__cypress/runner/cy…_runner.js:16599:57)
        at Promise._settlePromiseFromHandler (/__cypress/runner/cy…_runner.js:16691:17)
    g
    • 2
    • 9
  • I am creating Cypress project with typescripts, Cucumber and Allure report.
    p

    powerful-byte-16452

    05/26/2023, 7:40 PM
    Currently, report not generate if one test case failed or skipped by using Cucumber tags, also I can see "step" word in the report body as well. I am using Cypress 12.12.0. Its running in Jenkins/ docker image. Also I notice that latest Cypress didn't have the plugin folder as well. I am using node version 18.
    m
    • 2
    • 1
  • Google Authentication
    d

    damp-farmer-22658

    05/26/2023, 8:17 PM
    https://docs.cypress.io/guides/end-to-end-testing/google-authentication trying to set this up for an application test for support user e2e flows. Our organization uses google oauth2 for employee sign in. Is there something that needs to be configured in the tested application itself? I'm having trouble authenticating my test user and getting very little feedback from the stack trace.
1...2223242526Latest