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

    ripe-plastic-20004

    08/17/2021, 9:54 PM
    instead of invoke('text') you could use 'val', depending on the type of field
  • u

    user

    08/18/2021, 7:59 PM
    Has anyone had issues getting the validation to work on the new session support? I've looked at the docs and am following all the correct syntax, but still get an error when the validation step fails
    existingSession.setup is not a function
  • f

    flaky-island-64947

    08/20/2021, 7:18 AM
    Hi guys, I have the problem when using cypress with form data api as below: cy.fixture('/api/planmanagement/FASHION_distribution.csv', "binary") .then(data => { const fileName = "./FASHION_distribution.csv"; const blob = Cypress.Blob.base64StringToBlob(btoa(JSON.stringify(data)), 'multipart/form-data'); const file = new File([blob], fileName); const formData = new FormData(); formData.append("file", blob, fileName); cy.request({ url: "...........", method: "POST", headers: headers, form: true, body: { min_slot_rm_day: 2, id: planId, file: formData } }).then(response => { //cy.uploadFile('https://test-vanhanh.uat.shopee.vn/flash-sale/backend/api/plans/distribution/update/', formData).as('createANewUser'); cy.log(response.body) console.log("response", response); }) }) }) status code is 200 but my uploaded file is not uploaded as expectation , Could anyone help me ? 😦
  • f

    few-answer-74133

    08/22/2021, 4:40 AM
    Hi everyone, Is there a way to subscribe to this event and get the text shown in cypress logs?
  • f

    few-answer-74133

    08/22/2021, 4:41 AM
    in console this event looks like:
  • f

    few-answer-74133

    08/22/2021, 6:17 AM
    The reason why I need this is the response of the download request does not contain the downloaded file name, which is dynamic. So I can't cy.readFile() from "Downloads" folder for further validation.
  • f

    fancy-toddler-26933

    08/24/2021, 8:09 AM
    Hi everyone, I having issue with Cypress intercept I got 2 POST request with the same URL but different query POST1: query = "product" POST2: query = "filter" Is there any way that I can intercept only filter or product without the other one ?
  • h

    helpful-xylophone-24704

    08/24/2021, 8:24 AM
    maybe like this?
  • h

    helpful-xylophone-24704

    08/24/2021, 8:24 AM
    cy.intercept('POST', '/foobar', { statusCode: 201, body: { query: 'product', }, }) cy.intercept('POST', '/foobar', { statusCode: 201, body: { query: 'filter', }, })
  • l

    loud-policeman-30507

    08/24/2021, 5:14 PM
    Is there a best practice for interacting with Modals?
  • f

    fancy-toddler-26933

    08/24/2021, 11:48 PM
    thanks for the suggestion but it not work, I think that Cypress not support this yet
  • f

    fancy-toddler-26933

    08/26/2021, 3:17 AM
    I solve this by cy.intercept('POST', '/foobar', (req) => { if (req.body.include('filter')) { req.reply( (res)=> { ... })} }).as("getFilter")
  • f

    fancy-toddler-26933

    08/26/2021, 3:18 AM
    similar for product
  • f

    fancy-toddler-26933

    08/26/2021, 3:18 AM
    hope this help others 🙂
  • u

    user

    08/26/2021, 8:21 PM
    hey
  • u

    user

    08/26/2021, 8:21 PM
    what's the problem?
  • u

    user

    08/26/2021, 8:22 PM
    version 4.1 and 8.3
  • c

    cuddly-winter-72122

    08/26/2021, 8:27 PM
    @User in the cy.intercept API, you are looking for the
    statusCode
    property, not
    status
  • c

    cuddly-winter-72122

    08/26/2021, 8:27 PM
    it was renamed
  • u

    user

    08/26/2021, 11:46 PM
    > thanks,
    response.statusCode
    it worked
  • g

    glamorous-byte-70077

    08/30/2021, 4:13 AM
    Hi All, Is there any way to test webhook events using cypress?
  • c

    clean-father-86225

    08/31/2021, 5:03 PM
    Hi all... I'm evaluating Cypress currently as the new framework for a marketplace startup but I'm stuck directly on visiting the main page of our shop app. Meanwhile the angular app works fine... I added blocked hosts because I thought maybe it's a script injected from GTM but that didn't do the trick. Now I don't even know where else to look to solve this
    TypeError Cannot set property name of  which has only a getter
    :/
    Copy code
    "blockHosts": [
        "*google-analytics.com",
        "*googletagmanager.com",
        "*tagmanager.google.com",
        "*googleoptimize.com",
        "*googleadservices.com",
        "*doubleclick.net",
        "*doubleclick.com",
        "*facebook.net",
        "*facebook.com",
        "*hotjar.com",
        "*clarity.ms",
        "*ads.linkedin.com",
        "*bat.bing.com"
      ]
    Interestingly enough, when I click around within the tested page, that weird thing disappears: https://share.vidyard.com/watch/cNt4pwn4EYff6sA4UHBcJ2? Do you have any hint what I might try next or what the culprit might be? You can see the equivalent testing page at https://staging.clearago.de/... (PS: I also posted this in the cypress gitter chat because I didn't really understand if they have different purposes or not – if redundant plz delete, cheers)
  • c

    clean-father-86225

    09/01/2021, 10:00 AM
    After some further research on the topic I've moved on to create a bug https://github.com/cypress-io/cypress/issues/17952 Thanks anyway guys
  • f

    famous-application-51504

    09/02/2021, 10:42 PM
    I've been developing locally using cypress component testing. But now I'm trying to transition to github codespaces and wondering what my options are. How can I get
    cypress open-ct
    working on a remote container like that?
  • f

    famous-application-51504

    09/02/2021, 11:29 PM
    I can run
    cypress open-ct
    locally and remotely, and then when the browser instance opens I can change the address in the address bar to point to the webpack devserver on my remote instance and it seems to run fine. But that means that I need to run the webpack devserver locally to connect to the one remotely which isn't ideal. I can't figure out how to tell it to just create a browser instance and connect to the remote webpack devserver without starting up one locally
  • u

    user

    09/03/2021, 5:14 PM
    Hi Everyone As a JavaScript & PHP software engineer, I am looking for a full-time job using my skills recently. If you have any jobs, please let me know. I hope your business is doing well Thanks for your time.
  • b

    billowy-spoon-30011

    09/03/2021, 7:01 PM
    Any chance of kicking Galois ☝️ for spamming on all channel ?
  • u

    user

    09/03/2021, 7:15 PM
    Sorry
  • u

    user

    09/03/2021, 7:15 PM
    it is my fault
  • u

    user

    09/07/2021, 7:50 AM
    I am having issue with cy.session. What I want is to only call my auth provider once and store that in the session so that tests are already logged in when they run. My code works to login without the cy.session but fails when I have it. If I have, the window.sessionStorage is empty and I am redirect to the login page. What am I missing?
    Copy code
    // using node-msal for azure
    
    Cypress.Commands.add('authenticate', (role) => {
        // TODO: ignore role for now
        const usernamePasswordRequest = {
            scopes: ["user.read"],
            username: 'foo@bar.com',
            password: 'f00'
          };
    
        return new Cypress.Promise((resolve, reject) => {
            // Returns a promise
            return pca.acquireTokenByUsernamePassword(usernamePasswordRequest).then(() => {
                // at this point pca has token and we resolve the getKVStore       
                resolve(pca.getTokenCache().getKVStore());
            }).catch(err => {            
                reject(err);
            });
        });
    });
    
    Cypress.Commands.add('login', (role = 'ADMIN') => {
        // If I comment out cy.session, it works
        cy.session(['login', role], () => {
            cy.authenticate(role).then(token => {
    
                const cacheKeys = Object.keys(token);
    
                cy.window().then(win => {
                    for (let key of cacheKeys) {   
                        win(key, JSON.stringify(token[key]));
                    }
                })
            })
        });
      });
    In my beforeEach hook I call cy.login('ADMIN') and then cy.visit('/some') and in my test window.sessionStorage is empty and hence I am redirected to login page.
1...313233...252Latest