https://cypress.io logo
Join Discord
Powered by
# help
  • m

    magnificent-finland-58048

    05/12/2022, 5:11 PM
    Tests and source code are in different repos, you want Cypress Dashboard to know about the source code repo? Hard one. I have no answers. How would Cypress Dashboard even know about the source code repo?
  • g

    gifted-boots-63851

    05/12/2022, 6:15 PM
    try with the code I wrote, it should cover your use case
  • g

    gray-kilobyte-89541

    05/12/2022, 7:43 PM
    are these resources cached by the browser?
  • h

    hundreds-father-43644

    05/12/2022, 7:48 PM
    I use clear cache before each test: Cypress.Commands.add('clearCache', () => { cy.clearCookies() cy.clearLocalStorage() cy.window().then((window) => { window.sessionStorage.clear(); window.localStorage.clear(); }); });
  • p

    polite-painting-51763

    05/12/2022, 7:58 PM
    Hi, sometimes JavasScript a bit tricky to understand Here I am trying to print first object 'vendorData' then it's Keys and then it's values
  • p

    polite-painting-51763

    05/12/2022, 7:59 PM
    In object 'vendorData' I see 14 entries
  • p

    polite-painting-51763

    05/12/2022, 8:00 PM
    but in keys and values i only see 8 entries
  • p

    polite-painting-51763

    05/12/2022, 8:08 PM
    Let me explain first what I am trying to achieve. I am trying to use mutability of JavaScript Object. I have written cypress command StoreDataFromUItoObject which accepts an array. Each element of an array is delimited by pipe separator. Left side of the pipe is the object name and it's value I am trying to store in the key which is mention right side of the pipe and these keys i don't see when I logged object keys, but I see key value is displayed correctly when I logged the vendorData object
  • p

    polite-painting-51763

    05/12/2022, 8:10 PM
    Here is the implementation the action
  • p

    polite-painting-51763

    05/12/2022, 8:11 PM
    am seeking help how to get that data in VendorData object which am using for further validations
  • g

    gray-kilobyte-89541

    05/12/2022, 8:57 PM
    No, the browser cache, not the session storage and other things. The cache that is controlled by "cache" headers
  • b

    bored-school-78265

    05/13/2022, 2:19 AM
    Any idea what might be causing this?
    Copy code
    GET /__cypress/tests?p=cypress/integration/a1/quote/landlord.spec.ts 200 2558.074 ms - -
    GET /__cypress/iframes/integration%2Fa1%2Fquote%2Flandlord.spec.ts 304 2.182 ms - -
    GET /__cypress/iframes/integration%2Fa1%2Fquote%2Flandlord.spec.ts 304 3.185 ms - -
    GET /__cypress/runner/popper.js.map 404 3.957 ms - 136
    [BABEL] Note: The code generator has deoptimised the styling of /Users/jason/src/goodcover/core/e2e/protobuf/basic.proto.js as it exceeds the max of 500KB.
    Webpack Compilation Error
    [ERROR] Failed to read file: `/Users/jason/src/goodcover/core/e2e/cypress/screenshots/a1/quote/landlord.spec.ts`.
    [ERROR] Compilation failed.
    I have made some webpack modifications which I am sure am relevant. I just can't find where the "Failed to read file" is coming from. It happens repeatedly with
    cypress open
    but with
    cypress run
    it only happens every now and then so maybe some kind of race condition?
  • l

    limited-keyboard-75773

    05/13/2022, 3:39 AM
    Does this helps? https://stackoverflow.com/a/36880182/9884190
  • b

    bored-school-78265

    05/13/2022, 3:42 AM
    Hmm I don't think that is the issue. It's the "Failed to read file" one. Debugging the cypress webpack-preprocessor and it checks
    stats.hasErrors()
    . That has the "Failed to read file" error in it and so the preprocessor logs "Webpack Compilation Error". I didn't see the Babel one there so that must just be a warning like that SO answer says.
  • b

    bored-school-78265

    05/13/2022, 3:53 AM
    Ah it seems like it is coming from the Relay webpack plugin
  • b

    bored-school-78265

    05/13/2022, 4:02 AM
    Doh I just realised, that path was in screenshots. Relay is trying to compile the screenshot. Good one...
  • n

    nutritious-florist-21582

    05/13/2022, 5:29 AM
    Hello there! Loving cypress with
    cypress-cucumber-preprocessor
    Question: Can you have optional and alternate text in your step definitions? Example optional text:
    Copy code
    //my.feature
    Given I am 1 year old
    Given I am 30 years old
    
    //steps.js
    Given(/^I am {int} year(s) old$/, (age) => {
    ...
    }
    Example alternate text:
    Copy code
    //my.feature
    When I click that like button
    When I smash that like button
    When I tap that like button
    
    //steps.js
    When(/^I (click|smash|tap) that like button$/, ()=> {
    ...
    }
    Note that these currently didn't match the cucumber feature file to any of my steps, but demonstrate the question.
  • s

    sparse-insurance-21987

    05/13/2022, 9:23 AM
    Yes, both options are available
  • n

    nutritious-florist-21582

    05/13/2022, 9:24 AM
    thats great! Can you show me an example step as mine are not matching with the above syntax
  • s

    sparse-insurance-21987

    05/13/2022, 9:26 AM
    When(/^I (click|smash|tap) that like button$/, function (act) { functionxyz(act) });
  • h

    hundreds-father-43644

    05/13/2022, 11:39 AM
    How can i see this? I don't know so much about the headers cache.
  • c

    creamy-train-56346

    05/13/2022, 11:57 AM
    Probably I'm not getting something. I think I used modules instead of inheritance below, but final output is still the same (
    When I try to invoke jQuery text method on each element only one (again the last one) return some string. Subsequent text attempt fails with following error:
    )
  • g

    gray-kilobyte-89541

    05/13/2022, 12:10 PM
    1. take my Cypress networking course, it has some lessons about that https://cypress.tips/courses 2. read about it https://glebbahmutov.com/blog/cypress-intercept-problems/#cached-response
  • g

    gray-kilobyte-89541

    05/13/2022, 12:11 PM
    https://docs.cypress.io/guides/core-concepts/introduction-to-Cypress#Commands-Are-Asynchronous
  • h

    hundreds-father-43644

    05/13/2022, 12:12 PM
    Wow. You are cypress god. Thanks a lot. I'll study and test.
  • c

    creamy-train-56346

    05/13/2022, 12:34 PM
    I'm aware of that, but don't know much about asynchronous code. Do you think defining
    getAll()
    function as a promise and using it like
    getAll().then()
    could be solution here?
  • g

    gray-kilobyte-89541

    05/13/2022, 12:46 PM
    cy.then
    is not a promise and it would not work to use your promise to "collect" Cypress command results. Are you just trying to get some text from elements on the page?
  • c

    creamy-train-56346

    05/13/2022, 12:54 PM
    No.
    invoke(text)
    is just for debugging purposes. I want to return an array of elements in order to perform common actions for each of them. The catch is in order to follow POM I also want to separate selectors (logic) with actual tests performed for elements.
  • c

    creamy-train-56346

    05/13/2022, 12:57 PM
    I explained my case here a bit better @gray-kilobyte-89541
  • g

    gray-kilobyte-89541

    05/13/2022, 1:20 PM
    i really do not recommend caching element references, what if the page re-renders part of it?
1...636465...252Latest