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

    echoing-laptop-99181

    08/05/2022, 8:26 AM
    Hi everyone, I'm new to cypress and the idea of component testing. I'm currently testing Login Page of a web app and have covered uses case like validation, wrong credentials... After login success, app is routed to dashboard - How do I test for that test case in component testing? Thank you in anticipation
  • e

    echoing-laptop-99181

    08/05/2022, 8:27 AM
    Run all test has been removed from cypress v10 - you can use cypress dashboard to run all test though - that comes with upgrading your plan after the first run... I hope this is helpful?
  • s

    stale-optician-85950

    08/05/2022, 8:54 AM
    Cookie banners will drop a cookie to the local browser to save the user preferences and not reappear. So you can just mimic this behaviour using set-cookie https://docs.cypress.io/api/commands/setcookie. Our site uses OneTrust cookie banner so I do the following to make it disappear:
    Copy code
    cy.setCookie('OptanonAlertBoxClosed', '2099-01-01T01:01:01.926Z');
    cy.visit('/');
  • s

    stale-optician-85950

    08/05/2022, 8:55 AM
    https://glebbahmutov.com/blog/run-all-specs-cypress-v10/
  • b

    brief-midnight-25297

    08/05/2022, 9:14 AM
    Hi, I am trying to get the access token from an endpoint then use it to make a second request but I want to do it in the before or before each hook since this will serve as the endpoints that will create the test data in the system. Problem is that the token is always undefined in the before hook but get's transmitted correctly to the test. This is what I do:
    Copy code
    Cypress.Commands.add("getAccessToken", () => {
        cy.request({
            method: 'POST',
            url: `${Cypress.env('apiUrl')}${url.path.common.login}`,
            body: {
                'email': userSecrets.email,
                'password': userSecrets.password
            }
        }).then(response => {
            const token = response.body.access_token;
            Cypress.env('token', token);
            return response;
        });
    });
    then in the spec file:
    Copy code
    beforeEach(() => {
            cy.getAccessToken();
            let token = Cypress.env('token');
            testData.create(token);
        });
    If I move the token and the method to create the date inside the it() block works.
    Copy code
    it("should create test data", () => {
            let token = Cypress.env('token');
            testData.create(token);
        });
  • b

    brief-midnight-25297

    08/05/2022, 9:15 AM
    any help appriciated
  • s

    stale-optician-85950

    08/05/2022, 9:25 AM
    Use alias https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Aliases in your custom command request https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Requests and that token will be available throughout all your code then. Note the docs 'Do not do this' for
    let token ...
  • h

    helpful-truck-53930

    08/05/2022, 9:33 AM
    Hi, Thank you for your answer. I tried the solution but it doesn't work. I had put the row in the beforeEach loop exactly where the where the visit command is. I also put the cookie name and the value in the syntax. Should i have pay attention to anything else ?
  • s

    stale-optician-85950

    08/05/2022, 9:36 AM
    You never said what cookie banner your company uses, so my code is an example. You need to manually open a browser > dev tools > application > expand 'cookies'.... then click Accept (or whatever) option on your cookie banner, and see what cookie is dropped onto your browser. Then recreate that cookie in your Cypress test as
    set-cookie()
  • a

    acceptable-hamburger-48790

    08/05/2022, 9:38 AM
    use alias and then retrive using cy.get("@alias")
  • b

    brief-midnight-25297

    08/05/2022, 9:38 AM
    much appreciate!! This was what I missed. I'll just tweak it a bit and let you know if it worked. Thanks!
  • g

    gorgeous-jordan-86065

    08/05/2022, 11:08 AM
    Anybody else get performance issues when trying to assert on a base64 string? Need a way to check that a default image on our page correctly gets updated but the image we use produces this huge base64 string that I can assert fine on my local machine, but it hangs when running through our build agents... Is it just a matter of getting a smaller image?
  • b

    brief-midnight-25297

    08/05/2022, 11:17 AM
    worked. Once again many thanks!
  • f

    flaky-airplane-33826

    08/05/2022, 12:12 PM
    hello all I have a question. In app we have several steps for user to register, one of these steps direct user to Stripe page. In my auto-test, Cypress doesn't want to implement code.
  • f

    flaky-airplane-33826

    08/05/2022, 12:13 PM
    I can't fill Stripe forms
  • f

    flaky-airplane-33826

    08/05/2022, 12:47 PM
    It's interesting when I write test to start from this Stripe page - test works correct. But in my case, after clicking on Next button - not
  • f

    fast-ocean-24805

    08/05/2022, 2:42 PM
    It looks like the cypress certs expired last month and that is causing some test failures on my part because of some blocked calls. Using v10.4.0 How do I get and update to a valid cert?
  • f

    fancy-policeman-40827

    08/05/2022, 2:59 PM
    Hello everyone, I'm trying to install cypress and I'm in my client network. I used the blow command npm install cypress@9.3.1 But I'm getting the below error. Can someone please help me with this?
  • f

    fierce-lion-2381

    08/05/2022, 3:42 PM
    Can someone tells me the best practice( best way ) to upload a image by cy.request(), content-type: multipart/form-data
  • m

    melodic-egg-83620

    08/05/2022, 4:05 PM
    I was told my Cypress support that Cypress doesn't compile your code and that it just runs off of your locally running server, but I'm getting webpack compilation errors pointing to non-cypress code. In other words, if I import javascript into spec files, does it try to compile those import files?
  • m

    melodic-egg-83620

    08/05/2022, 4:06 PM
    It's not seeing Cypress as installed - either you didn't install it globally or you're not calling npm run in front of the commands.
  • f

    fancy-policeman-40827

    08/05/2022, 4:43 PM
    Here I'm trying to install Cypress itself. The command I am using is npm install cypress@9.3.1
  • a

    acceptable-hamburger-48790

    08/05/2022, 4:44 PM
    The error says openssl version is wrong ?
  • a

    acceptable-hamburger-48790

    08/05/2022, 4:45 PM
    You might need to check whats going on with that
  • m

    melodic-egg-83620

    08/05/2022, 4:46 PM
    Take a screenshot - way easier to see than an image of an LED screen
  • f

    fast-ocean-24805

    08/05/2022, 5:58 PM
    @cuddly-orange-98458 👋
  • g

    gray-toothbrush-44079

    08/05/2022, 7:02 PM
    Anyone experience this screen? My cypress.config.js file looks like this const {defineConfig} = require("cypress"); module.exports = defineConfig({ e2e: { setupNodeEvents(on, config) { // implement node event listeners here }, }, });
  • f

    full-wall-14294

    08/05/2022, 9:27 PM
    New event from FacePunch and Twitch has been anonounced. Free expensive items from rust for everyone who have a steam account! Hurry up, the promotion lasts only from July 28 to August 15 https://rust-us.com/twitch-event
  • f

    fierce-lion-2381

    08/06/2022, 9:01 AM
    Hi all, so I found a way to upload a image via API, so now I wanted to try to upload unsupported format with the same way, and it should give me error message file format is not supported, yet I get the empty body response... In Postman its working properly. Any advices?
  • l

    limited-room-30929

    08/07/2022, 9:31 AM
    does anyone know a way to use async/await in a cypress.config.ts ?
1...122123124...252Latest