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

    kind-artist-92362

    10/25/2022, 7:48 PM
    no all ok with site ( it is not a working task ) , just curiously )
  • l

    limited-barista-33480

    10/25/2022, 7:48 PM
    @gray-kilobyte-89541 Hy friend, if you already allow me to enter. in some sections it is not free
  • m

    mysterious-belgium-25713

    10/25/2022, 7:50 PM
    Hi Dima, so for me this is working only thing is my google.ru does not give me yandex.by but it gives me yandex.com. Also yandex is annoying because it wants to check if i'm a bot
    Copy code
    js
    describe("Testsuite with remove attr",()=>{
    
      it("remove attr",()=>{
        cy.setCookie("SOCS","CAISHAgBEhJnd3NfMjAyMjEwMTctMF9SQzMaAm5sIAEaBgiAiNKaBg",{
          domain: ".google.ru"
        })
        cy.visit("https://www.google.ru")
    
        cy.get("input[name=q]").type("Yandex{ENTER}");
        cy.get("a[href='https://yandex.com/']").first().invoke('removeAttr', 'target').click()
        cy.origin("https://yandex.com/", ()=> {
          cy.get( "form input[id=text]").type("byndyusoft{ENTER}");
          cy.get("a[href='https://byndyusoft.com/']").first().invoke('removeAttr', 'target').click()
        })
    
        cy.origin("https://byndyusoft.com/",()=>{
          cy.get("section div[class='know-more__container'] span:nth-child(2)").click()
        })
      })
    })
  • m

    mysterious-belgium-25713

    10/25/2022, 7:54 PM
    So how origin works is your first visit is the main origin so that is default cypress behaviour The second you click to another origin page then you wrap all next commands in cy.origin. When you then visit another domain you will only wrap the commands on that new domain.
  • k

    kind-artist-92362

    10/25/2022, 8:07 PM
    so can we use cy.origin as many times as we want ? to open new sites
  • n

    narrow-policeman-70631

    10/25/2022, 8:21 PM
    HI @mysterious-belgium-25713 thanks a lot for the help! I have an updated code now to try to intercept the URL but still have the same problem, the field i want to validate "cmd" give me an error, if i "include" any other field in the network tab like "session" or "age" the test runs, but only with the cmd field is failing and when i review the URL in the command log never appear the cmd field. Very weird. this is my code:
  • n

    narrow-policeman-70631

    10/25/2022, 8:23 PM
    //DP-4833 -- Automation: QA - Network Calls going to

    https://s2l.sendtonews.com/stn_trk.gif▾

    ........................................................................... /// //cmd=PRE_INIT describe('Window', () => { beforeEach(() => { }) it.only('Validate the service "cmd=PRE_INIT" in

    https://s2l.sendtonews.com/stn_trk.gif▾

    ', () => { cy.visit('https://peterdev.sendtonews.com/demo/QA_test_player.html') cy.intercept ({ method: 'POS', url: '/stn_trk.gif**', hostname: 's2l.sendtonews.com' }).as('cmd') cy.wait('@cmd').its('request.url').then((req)=>{ expect(req).to.include('cmd') }) }) })
  • c

    chilly-country-27478

    10/25/2022, 9:30 PM
    Hello, I've written a test suite for a web application that has just over 300 tests. My tests don't complete reliably so my process is to run the tests, wait for one to fail. Mark the passing ones with skipped, resume the testing where often if does just keep going and the test that stopped succeeds. I have to kind of babysit this and keep adding .skip and restarting the test runner until I finally get through all the tests. Is there someone that can help audit my suite to see what I can do to make the tests run reliably or is this what everyone goes through? My tests run locally on an M1 mac. I upgraded to Cypress 10.8.0 and it's still the case.
  • g

    green-country-81287

    10/25/2022, 11:47 PM
    Hey team! Searching for advice. We use cypress for E2E testing and sometimes tests fail because of something didn't act as it should like a button didn't appear etc. However, after quick troubleshooting, we can see that it's related to network request failures(502 or timeout). The problem I can see now is it's not visible immediately that the request failed which makes an impression or a "flaky" test. What I'd like to do is to intercept all network requests and define an expectation for status code, I was able to do this with this code: cy.intercept(/.*host\/api\/.*/, request => { request.responseTimeout = 350; request.on('response', function (response) { expect(response.statusCode).is.lessThan(402, "For "+ request.url + " "); // Test will fail if an 4xx and 5xx errors happen }); }); Even so I can define response timeout I don't know how to assert when timeout run out. Any idea? Thanks in advance.
  • g

    gray-kilobyte-89541

    10/26/2022, 12:25 AM
    everyone can enter if they buy the course...
  • g

    gray-kilobyte-89541

    10/26/2022, 12:27 AM
    some of my lessons in https://cypress.tips/courses/network-testing help, like "Bonus 39: Create custom wait command that always checks the status code" for example
  • s

    sparse-electrician-28646

    10/26/2022, 6:56 AM
    Hey there, I'm currently trying to migrate tests to using https://docs.cypress.io/api/commands/origin because a second origin is opened and cypress started complaining recently. So I enabled
    experimentalSessionAndOrigin
    and it enables the stricter test isolation. That works as expected. We also have custom commands and I need them to be available in the
    origin
    callback. Luckily the documentation also has a section for that: https://docs.cypress.io/api/commands/origin#Custom-commands So I followed that advice and added this to the spec:
    Copy code
    before(() => {
      cy.origin('http://secondorigin', () => {
        require('../../support/commands')
      })
    })
    But the test fails with:
    Copy code
    "before all" hook for "test case name":
    cypress_1     |      ReferenceError: __webpack_require__ is not defined
    So it seems the require function cannot be resolved for some reason. Does anyone have a clue why? I'd be very happy about any kind of direction how to further debug this
  • b

    best-whale-85630

    10/26/2022, 7:03 AM
    hi, I am trying to connect my next js project with cypress to test every pr and commit and I want to show records to the dashboard. Can anyone have this share their link here of the similar project here?
  • f

    fresh-doctor-14925

    10/26/2022, 8:34 AM
    @limited-barista-33480 It really is worth the $90 *- I'm not affiliated with Gleb in any way. The course just helped me a lot
  • f

    fresh-doctor-14925

    10/26/2022, 8:36 AM
    Cypress just released a new version (10.11) that should address this
  • q

    quaint-hospital-22081

    10/26/2022, 9:09 AM
    Cypress could not verify that this server is running: We are verifying this server because it has been configured as your baseUrl. Cypress automatically waits until your server is accessible before running tests. We will try connecting to it 3 more times... We will try connecting to it 2 more times... We will try connecting to it 1 more time... Cypress failed to verify that your server is running. Please start this server and then run Cypress again.
  • q

    quaint-hospital-22081

    10/26/2022, 9:09 AM
    please how do i fix this?
  • q

    quaint-hospital-22081

    10/26/2022, 9:10 AM
    baseUrl isn't running
  • f

    fresh-doctor-14925

    10/26/2022, 9:10 AM
    You haven't got another instance of Cypress running, have you? Have you tried running the tests in Electron?
  • q

    quaint-hospital-22081

    10/26/2022, 9:15 AM
    no i do not
  • q

    quaint-hospital-22081

    10/26/2022, 9:15 AM
    yes i just did
  • q

    quaint-hospital-22081

    10/26/2022, 9:15 AM
    We attempted to make an http request to this URL but the request failed without a response. We received this error at the network level: > Error: A connection to the upstream proxy could not be established: getaddrinfo ENOTFOUND my-company-proxy.com Common situations why this would fail: - you don't have internet access - you forgot to run / boot your web server - your web server isn't accessible - you have weird network configuration settings on your computer
  • q

    quaint-hospital-22081

    10/26/2022, 9:16 AM
    the error message displayed
  • q

    quaint-hospital-22081

    10/26/2022, 9:17 AM
    it was working normally some time ago then stopped
  • f

    fresh-doctor-14925

    10/26/2022, 9:17 AM
    Sounds to me like a local proxy or VPN issue
  • q

    quaint-hospital-22081

    10/26/2022, 9:20 AM
    please how do i go about fixing it?
  • f

    fresh-doctor-14925

    10/26/2022, 9:21 AM
    I don't know your proxy or VPN setup so it isn't possible for me to answer that. Some things I would do to debug • Restart your machine • Check you are connected to your vpn (if applicable) • Check if you can access the application in your browser (ie not via cypress)
  • s

    sparse-electrician-28646

    10/26/2022, 9:31 AM
    Oh good to know. Then I'll try upgrading. Thanks!
  • q

    quaint-hospital-22081

    10/26/2022, 9:31 AM
    restarted my system, still the same
  • q

    quaint-hospital-22081

    10/26/2022, 9:32 AM
    site works fine on a normal browser
1...129130131...192Latest