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

    brave-doctor-62978

    12/12/2022, 4:28 PM
    yep, getting a running version was a pain so your repo helped a lot
  • b

    brave-doctor-62978

    12/12/2022, 4:28 PM
    thanks so much
  • b

    brave-doctor-62978

    12/12/2022, 4:34 PM
    now just got to figure out why this is throwing a max callstack received
    Copy code
    const customMount = (component, options) => {
    
      return cy.mount(
        <DndContext>
          <IntlProvider locale="en-US">
              <Intl>
                { component }
              </Intl>
          </IntlProvider>
        </DndContext>
        , options);
    };
    
    Cypress.Commands.add('mount', customMount);
  • b

    brave-doctor-62978

    12/12/2022, 4:37 PM
    ah i see
  • b

    brave-doctor-62978

    12/12/2022, 5:03 PM
    is there a way to setup a testSetup like jest allows that would provide a singular place to provide some default mocks (for auth stuff)
  • b

    bland-airport-64599

    12/12/2022, 5:35 PM
    Is there some way to convert csv to json but that csv contains special characters as well, example : customer comment could be one column which contains [hello! ***”welcome back”]
  • k

    kind-photographer-81911

    12/12/2022, 8:57 PM
    anyone know how to assert on a URL using cypress and the typescript URL function that's in node_modules? I have this typescript error:
    Copy code
    cy.intercept(
          'POST',
          `**/${Cypress.env('API_BASE_URL')}/v2/sessions`,
          (res) => {
            const { host } = new URL(res.headers.referer);
            const urlchain = host.split('.');
            const subdomain = urlchain[0];
            const targetDomain = session.user.site_entity.subdomain;
            const statusCode = targetDomain === subdomain ? 200 : 418;
            const body = statusCode === 200 ? session : 'redirect';
    
            res.reply({
              statusCode,
              host: `http://${session.user.site_entity.subdomain}.localhost"`,
              token: session.token,
              body,
            });
          },
        ).as('postSessions');
      });
    });
    Because it says on res.headers.referer
    Type 'string[]' is missing the following properties from type 'URL': hash, host, hostname, href, and 9 more.ts(2345)
    I tried to add req to the parameter and test on that since it seems like it would be request and not reply, and then i tried to format the param passed to URL in a way that would. make typescript happy, but I just kept running into more and more typescript issues no matter how I wrote it. Just trying to get rid of this linting error, it's not failing.
  • g

    gray-kilobyte-89541

    12/12/2022, 9:57 PM
    It is URL function from node_modules, it is a browser standard API function https://developer.mozilla.org/en-US/docs/Web/API/URL I have a bonus lesson 56 showing it in action in my (paid) course https://cypress.tips/courses/network-testing
  • s

    straight-chef-47891

    12/12/2022, 11:07 PM
    Thanks Gleb. Is there a more generic way of using
    // @ts-ignore
    so I don't need to include it in every spec files having the grep tags?
  • g

    gray-kilobyte-89541

    12/12/2022, 11:36 PM
    you could probably tweak tsconfig maybe to exclude this type of errors, but I doubt it
  • w

    worried-lifeguard-15953

    12/13/2022, 12:00 AM
    I have a table with some draggable
    <tr>
    elements. I'm trying to tests rearranging them in Cypress following what the docs say here https://docs.cypress.io/api/commands/trigger#jQuery-UI-Sortable. The test passes, but it's not actually dragging & dropping the
    <tr>
    that I'm indicating. Am I missing something?
  • c

    cool-businessperson-62347

    12/13/2022, 1:22 AM
    I have a basic question which I couldn't find the answer for anywhere Say I have fetched an element, which has uppercase text (ORANGE for example) am I able to convert it to lowercase for an assertion? I usually use this
    Copy code
    cy.get('[data-cy="test-id"]').should(
      'have.text',
      'orange',
    )
    Is there anywhere I can change the case for the text I am fetching?
  • g

    gray-kilobyte-89541

    12/13/2022, 1:27 AM
    I would suggest using
    cy.contains
    instead, which can ignore case https://glebbahmutov.com/cypress-examples/9.7.0/commands/querying.html#cy-contains With Cypress v12 queries and
    cypress-map
    plugin you can also do
    cy.get('...').map('innerText').invoke('toUpperCase').should('equal', ['ORANGE'])
    or if there is just one element
    cy.get('...').first()...
  • c

    cuddly-jordan-61375

    12/13/2022, 8:51 AM
    Hi all, I am a beginner to typescript. I would like to know how cypress identifies which files to compile from TS to JS? Is there a way to configure this?
  • f

    fresh-doctor-14925

    12/13/2022, 9:10 AM
    I believe that any file ending in
    TS
    will be compiled into javascript, as browsers don't read typescript This free course helped me to get a better understanding of how TS works when used in conjunction with cypress https://testautomationu.applitools.com/cypress-with-typescript/
  • c

    cuddly-jordan-61375

    12/13/2022, 9:15 AM
    thanks.
  • d

    delightful-waiter-56869

    12/13/2022, 12:46 PM
    #763105090679865354 I am having a search page and then the dashboard page but in between there is loading screen which is attached. The loading screen takes around 1m to load the dashboard page is there any way in cypress i can open the page without loading again between test.Even if i hit the dashboard url it will still load the loader screen first.
  • s

    swift-spoon-76449

    12/13/2022, 1:04 PM
    Hello to all, can I terminate a test case via cypress command? Example: If element not exists stop test case run (do not run the rest it()
    v
    • 2
    • 5
  • r

    rough-oxygen-26641

    12/13/2022, 1:20 PM
    Cypress Studio selects inner SVG tags
    • 1
    • 1
  • s

    square-shampoo-53343

    12/13/2022, 1:45 PM
    Hi, I'm trying to use .type('{ctrl}a') when i want to select all text , clear it and replace with something else. althogh in cypress doc. that should be the syntax, in reality, cypress type the letter 'a' , clear it and than type the expected text. is the use of {ctrl} changed ? here is the code: .type('{ctrl}a').type('replace text')
  • s

    swift-spoon-76449

    12/13/2022, 1:50 PM
    .type('{selectall}{del}expected text')
  • s

    square-shampoo-53343

    12/13/2022, 1:53 PM
    thanks a lot, will try
  • r

    refined-architect-49921

    12/13/2022, 2:58 PM
    Hello everyone ! I need some help in my cypress journey. I am creating some tests for an app in angular but I have randomly different issue. Sometimes the tests work sometimes not... 🤯 I don't understand why... Thank you if you read me, sorry for my english, I'm french speaker
  • c

    cuddly-jordan-61375

    12/13/2022, 3:06 PM
    Hi, does @cypress/webpack-preprocessor support typescript?
  • c

    cuddly-jordan-61375

    12/13/2022, 3:08 PM
    What I actually want to do is to compile some .ts files which are located in a parent folder outside the cypress root folder and call them inside tests. Do i need to use a preprocessor of my own or is there a way to do this with the default one that comes with cypress?
  • b

    bitter-fountain-36713

    12/13/2022, 3:25 PM
    .clear() will clear the value of an input or textarea. Have you given that a try? https://docs.cypress.io/api/commands/clear
  • m

    many-salesclerk-22087

    12/13/2022, 3:51 PM
    Hi everyone! I'm trying to intercept every call to a service to add an authorization header I've come to find out that if a request returns 302 for a redirect, cypress doesn't pass through the interception on the redirect request. I have the following:
    Copy code
    cy.intercept(`${root}/**`, (req) => {
        req.headers['Authorization'] = `Bearer ${bearerToken}`;
        req.on('before:response', (res) => {
            res.headers['cache-control'] = 'no-store';
            console.log(res)
        });
        console.log(req)
    });
    Only the first
    console.log(req)
    from the request before the redirect is called. It should be called twice. Am I doing something wrong? How could make this work?
  • q

    quick-wolf-87390

    12/13/2022, 4:00 PM
    Hey guys! Can anyone help me out with following: I have a table and it has a edit functionality. When i edit i have to check whether I am getting the updated data or not from graphql file.
  • c

    cold-cat-63632

    12/13/2022, 4:14 PM
    hi guys .. one very small question .. how can we run chrome in incognito mode while executing in headless mode?
  • c

    cold-cat-63632

    12/13/2022, 4:15 PM
    if i do npx cypress run --spec 'spec.cy.js' --browser chrome .. it runs in regular mode not incognito
1...227228229...252Latest