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

    mysterious-belgium-25713

    09/29/2022, 2:04 PM
    I think your code should look a bit like this.
    Copy code
    js
    cy.visit("www.toto.com")
    cy.get("username").type("username")
    cy.get("password").type("password")
    cy.get("submitbutton").click()
    
    cy.origin('www.titi.com', () => {
        // Now you can do stuff inside the login origin
        cy.get('h1').contains('ACME CORP')
    })
  • m

    mysterious-belgium-25713

    09/29/2022, 2:04 PM
    You login on the first page right and then after you press submit then it will go to titi.com
  • s

    salmon-kite-6386

    09/29/2022, 2:05 PM
    yep
  • m

    mysterious-belgium-25713

    09/29/2022, 2:05 PM
    On what cypress version are you?
  • s

    salmon-kite-6386

    09/29/2022, 2:06 PM
    10.6.0
  • m

    mysterious-belgium-25713

    09/29/2022, 2:10 PM
    And the example i gave is not working for your case?
  • s

    salmon-kite-6386

    09/29/2022, 2:13 PM
    not... got (new url)chrome-error://chromewebdata/
  • m

    mysterious-belgium-25713

    09/29/2022, 2:15 PM
    Maybe one important thing i forgot to ask. Did you enable this settings in your config file. experimentalSessionAndOrigin flag to true
  • s

    salmon-kite-6386

    09/29/2022, 2:17 PM
    yes enabled yet, maybe i have to get the token from the cookie end past it to the final url ?
  • c

    chilly-queen-22182

    09/29/2022, 7:35 PM
    Hi guys, Is there any way to validate pdf? For Report I am checking Date and ID are different every time. Pls Help or advise.
  • s

    stale-optician-85950

    09/29/2022, 9:15 PM
    Here's a @gray-kilobyte-89541 special for you https://glebbahmutov.com/blog/cypress-pdf/
  • p

    plain-garden-5374

    09/29/2022, 9:37 PM
    curious if anyone has used cypress in conjunction with feature flags as implemented by aws cloudwatch evidently? https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently.html wondering which of the a/b strategies in the cypress docs on conditional testing would be best with the way evidently works
  • c

    chilly-queen-22182

    09/29/2022, 9:53 PM
    Thanks , but issue with the report pdf is there is date and Code which will change every time I run the tests, so I am not sure how to set up the expected result?
  • m

    mysterious-belgium-25713

    09/29/2022, 10:01 PM
    You mean in the PDF there will be a new date every time you test. Maybe you need to discuss with a developer that for your environment you have a special pdf that always have the same date. Or if the pdf is generated by your system time you could try to use cy.clock and manipulate the time. But i dont know if this will work. https://docs.cypress.io/api/commands/clock#Function-names
  • c

    chilly-queen-22182

    09/29/2022, 10:40 PM
    Thanks @mysterious-belgium-25713 Its the date coming from db, I can go use the visual testing option, but I will encounter the same pblm again as the date will be new every time.
  • r

    rough-night-37887

    09/30/2022, 3:44 AM
    Hi Everyone, I need some help with some cy.requests and promises, willing to pay via paypal and would prefer to screenshare, anyone care to help?
  • s

    stale-optician-85950

    09/30/2022, 7:45 AM
    It is not clear if your test requirement is to verify that the date and ID exist and are correct? Or do you want those elements ignored so that your visual test is not highlighting them every day (that is possible in both Percy and Applitools)? If this was my UI test I would do the following steps: * query the DB for both the latest date and ID * download the pdf and convert it to html * assert the DB date against the PDF date * assert the DB code against the PDF code
  • g

    great-answer-57072

    09/30/2022, 7:49 AM
    Hi, I got a question. I want to get the Google Analytics
    dataLayer
    object using Cypress. For now, I can use
    cy.window.its('dataLayer')
    to get the data, but in my test cases, there are a lot of button clicks with routing to other pages. The dataLayer object will be refreshed. Therefore, my question: is there any way to get the data after button clicks but before routing to the designated page?
  • g

    gray-kilobyte-89541

    09/30/2022, 10:28 AM
    I think you can follow these examples https://glebbahmutov.com/blog/test-feature-flags/ and https://glebbahmutov.com/blog/cypress-and-launchdarkly/
  • a

    acceptable-tailor-43291

    09/30/2022, 12:04 PM
    Hello folks, My app is little bit slow to load it's initial content. It tooks almost 40-50 second range in time. Is it better to hardcode the wait value for 50 or 60sec to load it's initial content even if I run this tests in CI? At initial load there is lot of api is running at BE which I am not aware of it. We are planning to improve our app later.
  • g

    gray-kilobyte-89541

    09/30/2022, 12:11 PM
    Use https://github.com/bahmutov/start-server-and-test or https://github.com/jeffbski/wait-on#readme to ping your app until it responds, then run Cypress
  • s

    salmon-kite-6386

    09/30/2022, 12:11 PM
    Hi guys, a little bit dissapointed today, is cypress really better then Selenium, ranorex etc.... have an issue, googling and find people with same issue in 2020 and no fix.... Firefox "Whoops, we can't run your tests."
  • g

    gentle-accountant-4760

    09/30/2022, 12:24 PM
    Hello people! How do I return a
    .then
    response of something like this:
    Copy code
    ts
    import MessageSignerHelper from '../plugins/sales/MessageSignerHelper';
    
    /**
     * Sub page containing specific selectors and methods for a specific page
     *
     * @class
     */
    
    class BarryApi{
      static itemLists(requestUrl: string): any {
        let itemList;
    
        const signatureHeaders = [
          { name: 'override', value: 'hello_world' },
        ];
    
        cy.task('Signature', { pathToSign, headers: signatureHeaders }).then((signature) => {
          cy.request({
            url: requestUrl,
            method: 'GET',
            headers: {
              'signature': signature,
            },
            failOnStatusCode: false,
            log: true,
          })
            .then((response) => {
              itemList = JSON.stringify(response.body);
            });
        });
        return itemList ;
      }
    }
    
    export default BarryApi;
    When I call BarryApi.itemLists('https://barrythrill.com') it returns undefined but if I add a console.log inside the
    .then((response)
    then I can see the values so my question is how can I get the return value by doing something like
    Copy code
    ts
    let testing;
    testing = BarryApi.itemLists('https://barrythrill.com');
    console.log(testing);
    ?
  • a

    acceptable-hamburger-48790

    09/30/2022, 12:27 PM
    You should be using Aliases. You cant return value in cypress like above as every command is chained.
  • a

    acceptable-hamburger-48790

    09/30/2022, 12:28 PM
    and then use cy.get("@alias") to fetch the value
  • g

    gentle-accountant-4760

    09/30/2022, 12:29 PM
    Hmm how would that work in my case? would it be that I set the cy.request as alias?
  • a

    acceptable-tailor-43291

    09/30/2022, 12:31 PM
    What if my app is taking 50 sec after login to my app? Does
    wait-on
    will also work?
    cypress.exec("wait-on https://myapp.com/")
    Copy code
    js
    cy.visit('/');
    //Simulated the login 
    // After login
    // My app takes 40-50 sec time to load
    cypress.exec("wait-on https://myapp.com/");
    //Will that be correct?
  • g

    gentle-accountant-4760

    09/30/2022, 12:31 PM
    But in that case that still wouldnt work as I call a function that does multiple stuff before it returns 🤔🤔
  • a

    acceptable-hamburger-48790

    09/30/2022, 12:33 PM
    .then((response) => { cy.wrap(JSON.stringify(response.body)).as("someName"); });
  • g

    gentle-accountant-4760

    09/30/2022, 12:34 PM
    Oh right and then in my test I call? Because I still need to call itemLists() function first, dont I?
1...110111112...192Latest