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

    cuddly-kitchen-97815

    10/26/2022, 6:07 PM
    lol, thanks! I appreciate you reaching out as well. I hope you have a good day :)
  • m

    millions-raincoat-21090

    10/26/2022, 6:45 PM
    Am I correct in that Cypress will clear out all local storage, sessions, and cookies between tests by default?
  • f

    fresh-doctor-14925

    10/26/2022, 6:52 PM
    kinda šŸ™‚ That's what they're working toward, but it isn't always the case right now. If you have the
    experimentalSessionAndOrigin
    flag, it will. Some reading material: https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests#Test-Isolation
  • m

    millions-raincoat-21090

    10/26/2022, 6:52 PM
    Ah okay! I thought I was losing my mind there for a bit, some "stuff" was definitely getting left behind
  • m

    millions-raincoat-21090

    10/26/2022, 7:34 PM
    Ah okay I thought I was losing my mind
  • f

    future-gold-77198

    10/26/2022, 8:11 PM
    Hi, I would like to use the cy.screenshot clip option to clip EVERY edge of the shot, but the given example says it only clips the left and top. So to be clear, I want to clip a few pixels off the top, bottom, left and right. What is the syntax for that, or is it not possible...?
  • c

    cuddly-kitchen-97815

    10/26/2022, 8:29 PM
    This can be solvable with some math! What is the dimensions of the window you're working with?
  • f

    future-gold-77198

    10/26/2022, 8:33 PM
    two different examples. One is 700px x 800px and the other 1400px x 900px. Are you implying that if I wanted to take 5 pixels off each side I could do something like { x: 5, y: 5, width: 890, height:1390 } ?
  • c

    cuddly-kitchen-97815

    10/26/2022, 8:33 PM
    Yes, exactly!
  • f

    future-gold-77198

    10/26/2022, 8:34 PM
    cool, I'll try it out and report back how it goes
  • c

    cuddly-kitchen-97815

    10/26/2022, 8:34 PM
    Because the x and y are increasing from the top-left corner, we can assume the height and width also stretch down and to the right, so adjusting that height to stop just shy of the bottom and right should allow you to manipulate the size of the image as a whole. I hope it works!
  • f

    future-gold-77198

    10/26/2022, 8:35 PM
    thanks
  • h

    hundreds-spoon-43121

    10/26/2022, 9:24 PM
    Hello, is it possible to access local storage in different origins? For example I’m on www.google.com and I want to access ogs.google.com in my local storage. I tried the localStorage.getItem() command and looks like it only gets items from the main origin (www.google.com in this example)
  • h

    hundreds-spoon-43121

    10/26/2022, 9:28 PM
    Nevermind, using cy.origin to access the local storage of another domain works.
  • l

    little-quill-7630

    10/27/2022, 2:33 AM
    Hello, I am obviously doing something very stupid here, but I can't figure out what.. Here you can see in the code below, I setup an intercept, assert that sortOrder equals Decending in the request body, and log "tested" (for my own sanity) This ALL happens, and works perfectly.. (yay me)..
    Copy code
    ts
    it('should correctly parse sort order when loading existing aqs', () => {
      cy.intercept('api/aqs/join*', (req) => {
        cy.wrap(req).its('body.aqs.properties.sortInfo.sortOrder').should('equal', 'Descending');
        cy.log('tested');
      }).as('aqsJoinIntercept');
    
      openDataExplorer(); // Gets to correct place in UI
      loadSavedQuery(); // Searches for existing aqs and initalises the aqs join ajax request to the api and then ensures the search dialog has been removed.
    
      // cy.wait('@aqsJoinIntercept');
    });
    But, you will see I have commented out
    cy.wait('@aqsJoinIntercept')
    .. When I have this in my code, the test fails with the error (attached image). And I have no idea what it means or what I am supposed to do about it. The reason I have added this
    cy.wait
    is because originally I messed up the intercept and only checked for
    api/aqs/join
    and not considered the query strings. But the test 'passed' because it NEVER intercepted the request. Which was BAD... After reading, I
    believed
    the solution was to
    cy.wait()
    the request had been intercepted.. Any advice would be welcome.
  • e

    echoing-painting-40909

    10/27/2022, 5:26 AM
    Hi, use fake users. You should not use real users data.
  • b

    billowy-smartphone-68952

    10/27/2022, 5:43 AM
    Hello. I have a question regarding assertions. When I run the following code the assertion is done properly:
    Copy code
    cy.on('window:confirm', (str) => {
      expect(str).to.equal('Hello , Are you sure you want to confirm?')
    })
    But I get an error if I use should instead of expect, like this:
    Copy code
    cy.on('window:confirm', (str) => {
      expect(str).to.equal('Hello , Are you sure you want to confirm?')
    })
    Why is the 2nd one throwing an error?
  • b

    billowy-smartphone-68952

    10/27/2022, 5:43 AM
    This is the error I am getting
  • g

    gray-father-52711

    10/27/2022, 5:47 AM
    @billowy-smartphone-68952 https://docs.cypress.io/guides/references/assertions
  • b

    billowy-smartphone-68952

    10/27/2022, 5:55 AM
    Thank you, but I didn't find any mentions of my second example, which I saw here: https://www.chaijs.com/guide/styles/
  • m

    miniature-architect-15391

    10/27/2022, 6:47 AM
    Hi, Can someone please help me with this issue I'm having https://github.com/cypress-io/cypress/discussions/24336
  • l

    little-quill-7630

    10/27/2022, 7:43 AM
    cy.wrap(str).should('equal', 'Blarblar');
  • e

    echoing-painting-40909

    10/27/2022, 8:35 AM
    Hi, I just commented the discusion on GitHub šŸ™‚
  • s

    stale-optician-85950

    10/27/2022, 9:00 AM
    Hello, is there a trick / hack / official way to allow Chrome in headless mode to successfully show as Full Screen? Worked fine in Chrome headed i.e. Cypress open and with Electron. I have prepared a example code block:
    Copy code
    it.only('Highcharts full screen', () => {
        cy.setCookie(
          'CookieConsent',
          '{stamp:%274iW40LjHSz/vj5fF4Rso58eW1qHOn0GOA3PGSfLSi1hIkls0jI1BdA==%27%2Cnecessary:true%2Cpreferences:true%2Cstatistics:true%2Cmarketing:true%2Cver:3%2Cutc:1666859233865%2Cregion:%27hu%27}'
        );
        cy.visit('/');
        cy.get('[title="Chart context menu"]').click();
        cy.get('[class="highcharts-menu-item"]').contains('View in full screen').realClick();
        cy.screenshot();
      });
    Run
    npx cypress run --browser electron --config baseUrl=https://www.highcharts.com/demo/line-basic
    and the screenshot chart will show as Full Screen. But run
    npx cypress run --browser chrome --config baseUrl=https://www.highcharts.com/demo/line-basic
    and the screenshot shows that Full Screen was ignored. I'm wondering if there is a browser argument that disabling this! šŸ¤”
  • w

    wooden-megabyte-23794

    10/27/2022, 9:02 AM
    Hi Team, Is there any way to print broswer name & browser version information during the cypress execution, in order to integrate with the report?
  • s

    stale-optician-85950

    10/27/2022, 9:07 AM
    Yip, all info here https://docs.cypress.io/api/cypress-api/browser Example:
    cy.log('Browser info', Cypress.browser);
    for the browser object. Then you can use:
    Copy code
    cy.log('Browser name', Cypress.browser.name);
    cy.log('Browser version', Cypress.browser.majorVersion);
  • i

    incalculable-nightfall-21641

    10/27/2022, 9:35 AM
    Hi i am using CRA, context api i have installed cypress in src directory, the application has many files/components, most of the files have dependent components which are referenced using absolute imports/paths like instead of this import foo from '../../src/foo.js' currently being referenced like this import bar from '/bar.js' whenever i try to import any component for unit testing in cypress, the dependent components doesn't load, it throws an error
  • i

    incalculable-nightfall-21641

    10/27/2022, 9:35 AM
    Copy code
    js
    Error: Webpack Compilation Error
    ./views/Pages/Login.js
    Module not found: Error: Can't resolve 'NewContext.js.js' in 'C:\Arun\Main\current_apps\src\views\Pages'
    resolve 'NewContext.js.js' in 'C:\Arun\Main\current_apps\src\views\Pages'
      Parsed request is a module
      using description file: C:\Dori\Main\current_apps\package.json (relative path: ./src/views/Pages)
        Field 'browser' doesn't contain a valid alias configuration
        resolve as module
          C:\Arun\Main\current_apps\src\views\Pages\node_modules doesn't exist or is not a directory
          C:\Arun\Main\current_apps\src\views\node_modules doesn't exist or is not a directory
          C:\Arun\Main\current_apps\src\node_modules doesn't exist or is not a directory
          C:\Arun\Main\node_modules doesn't exist or is not a directory
          C:\Arun\node_modules doesn't exist or is not a directory
          C:\node_modules doesn't exist or is not a directory
          looking for modules in C:\Dori\Main\current_apps\node_modules
            using description file: C:\Dori\Main\current_apps\package.json (relative path: ./node_modules)
              Field 'browser' doesn't contain a valid alias configuration
              using description file: C:\Dori\Main\current_apps\package.json (relative path: ./node_modules/NewContext.js.js)
                no extension
                  Field 'browser' doesn't contain a valid alias configuration
                  C:\Dori\Main\current_apps\node_modules\NewContext.js.js doesn't exist
                .js
    how to change path configuration , so cypress can point to src directory
  • p

    prehistoric-plastic-4224

    10/27/2022, 9:57 AM
    Hello everyone! When installing Cypress Windows machines, i'm not able to open it using 'npx Cypress open' command I get the following error: [19228:1027/115214.438:ERROR:network_service_instance_impl.cc(470)] Network service crashed, restarting service. ERR_FAILED (-2) loading 'http://localhost:57944/__launchpad/index.html' Error: ERR_FAILED (-2) loading 'http://localhost:57944/__launchpad/index.html' at rejectAndCleanup (node:electron/js2c/browser_init:161:7647) at EventEmitter.stopLoadingListener (node:electron/js2c/browser_init:161:8022) at EventEmitter.emit (node:events:526:28) at EventEmitter.emit (node:domain:475:12) I couldn't google anything helpful. Would you be able to help?
  • i

    incalculable-rainbow-43330

    10/27/2022, 10:29 AM
    What is the problem in asking same question if it was not answered in proper way there is a good chance that people in other channel will try to respond and also i think we asking ppl to restrict their posts will loose interest bro
1...188189190...252Latest