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

    stale-optician-85950

    10/11/2022, 8:25 AM
    @best-window-49967 I responded on this yesterday https://discord.com/channels/755913899261296641/763105090679865354/1029032554306752623
  • m

    mysterious-belgium-25713

    10/11/2022, 8:30 AM
    For cypress you don't need the launch.json. Also the proxy can be the issue in your case. Is cypress seeing the proxy being set correctly
  • b

    best-window-49967

    10/11/2022, 8:37 AM
    Thank you, I will dig deep into to see how I can setup baseURL and I will share launching commands
  • s

    stale-optician-85950

    10/11/2022, 8:38 AM
    @best-window-49967 follow this approach https://docs.cypress.io/guides/end-to-end-testing/writing-your-first-end-to-end-test
  • b

    best-window-49967

    10/11/2022, 8:39 AM
    I am sure it has some thing to do with proxy, but no idea how to solve it, first I thought local host is not allowed in my work laptop but than I tried Jenkins and it worked on local host 8080
  • m

    mysterious-belgium-25713

    10/11/2022, 8:43 AM
    Can you check if you have cypress open that you also see in settings the proxy server
  • r

    rich-jewelry-26348

    10/11/2022, 8:43 AM
    Hi, I'm using cypress component testing in angular 14 but every assets does a 404, I've tried the
    <base href="/__cypress/src/" />
    but it doesn't fix the problem any idea how I can make Cypress load my assets ?
  • s

    stale-optician-85950

    10/11/2022, 8:44 AM
    It's also possible that your organisation has CI server sitting on a different server than your work laptop network, or behind a differnt WAF or firewall. But start debugging locally and follow @mysterious-belgium-25713 advice.
  • b

    best-window-49967

    10/11/2022, 8:47 AM
    I believe this is inside test runner, these settings project settings and device settings, etc, I am unable to get to this point since my test runner is not launching
  • m

    mysterious-belgium-25713

    10/11/2022, 9:05 AM
    Can you remove the proxy from the file and set the proxy like this. https://docs.cypress.io/guides/references/proxy-configuration#Set-a-proxy-on-Windows
  • c

    careful-tent-30457

    10/11/2022, 11:00 AM
    Hi, I'm using
    @cypress#8954/code-coverage
    but ran in to an interesting issue. on my local machine I get higher coverage numbers than I get in our CI (Azure DevOps Pipelines). Anyone have any suggestions where I even begin to look to make sense of this?
  • c

    creamy-train-56346

    10/11/2022, 11:49 AM
    Thanks for the demo! But only now do I realise that my question was a bit misleading. Let me clarify this a "bit". FIrst of all I have
    describe
    block with multiple
    it
    blocks in it. I want to use
    intercept
    alias
    combination to intercept request, wait for it to be done (200 status code) before I start doing something else with the page. Something like:
    cy.intercept(url).as('awaitStuff');
    Pretty basic stuff I presume. Only last test requires this
    wait
    , this is important. My debugging: 1. I placed
    intercept
    in
    before
    hook. Then for the last (crucial) test Cypress tells me that there are no aliases whatsoever and test fails. 2. I placed
    intercept
    in
    beforeEach
    hook. It works fine, but it's run for all tests so not the ideal solution and doesn't solve the core issue to me. 3. I placed
    intercept
    in
    before
    hook and switch tests order. Now this crucial test is first in line. It works fine, but again it's just a workaround and "fishy" one. To me it's obvious that
    before
    hook contents are relevant for the first test only which is not fine. Or I am doing something wrong which also valid option 😄
  • s

    stale-optician-85950

    10/11/2022, 11:57 AM
    It's hard to advise without running your test code locally. Are you able to share the URL you are testing and your test code?
  • c

    creamy-train-56346

    10/11/2022, 12:04 PM
    I undertand. Since it's work-related I am unable to share basically anything sadly. I can try to reproduce the issue on some random page in a few hours and get back to you. Sounds good?
  • s

    stale-optician-85950

    10/11/2022, 12:08 PM
    One question in the meantime: are all of your it() blocks visiting the same URL as you visited in the before() hook or they are have different URL paths?
  • c

    creamy-train-56346

    10/11/2022, 12:15 PM
    I'm visiting different url in each test. why?
  • s

    stale-optician-85950

    10/11/2022, 12:22 PM
    Your aliased request probably doesn't exist once your 2nd test changes URL. The new URL will have new DOM, new requests etc and the requests might be getting cleared. You could find out by stepping through your code with
    cy.pause()
    in your before() hook and watching your Dev Tools > network request at the same time. Somewhere in there is your problem I bet. You could also test this by ensuring it() blocks use just 1 URL for spec.
  • s

    stale-optician-85950

    10/11/2022, 12:30 PM
    Actually I can reproduce it like this:
    Copy code
    describe('Cypress Alias', () => {
      before(() => {
        cy.visit('https://discord.com/');
        cy.request('https://catfact.ninja/fact').then(resp => {
          cy.wrap(resp.allRequestResponses[0]['Response Status']).as('responseStatus');
        });
      });
    
      it('Validates stuff 1', () => {
        cy.get('@responseStatus').then(r => {
          cy.log('in Test 1', r);
        });
      });
    
      it('Validates stuff 2', () => {
        cy.get('@responseStatus').then(r => {
          cy.log('in Test 2', r);
        });
      });
    });
    The alias is lost after 1 test even on same URL.
  • s

    stale-optician-85950

    10/11/2022, 12:33 PM
    I don't know why before() hook behaves like that, as I would have expected the same behaviour as you. Does anyone else here know?
  • f

    fresh-doctor-14925

    10/11/2022, 12:37 PM
    > I don't know why before() hook behaves like that As far as I'm aware, that's how the
    before()
    hook should behave. Any aliases should be set in the
    beforeEach()
    > "Note: all aliases are reset before each test. A common user mistake is to create aliases using the before hook. Such aliases work in the first test only!" (https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Requests)
  • s

    stale-optician-85950

    10/11/2022, 12:39 PM
    I looked up the docs here https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Aliases and this sentence "but what happens when you're running code in hooks like before or beforeEach?" made me believe it was possible.
  • s

    stale-optician-85950

    10/11/2022, 12:40 PM
    Good man @fresh-doctor-14925 🥳
  • c

    creamy-train-56346

    10/11/2022, 12:40 PM
    kudos to both of you guys! thanks ❤️
  • l

    limited-barista-33480

    10/11/2022, 1:31 PM
    thank you very much for your help and comments!
  • g

    gray-kilobyte-89541

    10/11/2022, 2:50 PM
    all aliases are reset after the test
  • c

    careful-tent-30457

    10/11/2022, 4:37 PM
    Hi I m using
    cypress8954code coverage
  • t

    thousands-gpu-36872

    10/11/2022, 7:46 PM
    Hello ! I have a problem with cypress using a plugin tedious in version 10 after update. I don´t know how to configure correctly. I tried using the examples but i got a error running my specs
  • m

    mysterious-belgium-25713

    10/11/2022, 7:54 PM
    So pre version 10 all tasks where in the plugin file. From 10 and onwards you have to set your tasks in the cypress.config.js or cypress.config.ts file.
    Copy code
    js
    module.exports = defineConfig({
      e2e: {
        setupNodeEvents(on, config) {
          on("task", {
            async YourTask() {
              
             }
           })
        },
      },
    });
  • t

    thousands-gpu-36872

    10/11/2022, 7:59 PM
    this is my older index.js in cypress version 9, do you know how can i transform this in cypress.config.js ?
  • h

    happy-megabyte-98400

    10/11/2022, 8:43 PM
    Hello, is it possible to disable the XHR and fetch network logs?
1...171172173...252Latest