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

    refined-raincoat-56329

    10/19/2022, 4:03 PM
    It seems it's an unresolved issue https://github.com/cypress-io/cypress/issues/20682
  • m

    mysterious-belgium-25713

    10/19/2022, 4:09 PM
    This is a different issue from what you stated. You stated that if you have a test failing in the IT state then your after each is not triggered. This issue is about stuff failing in the after each. And do you have code where your test fails and your after each does not work. Because i use my after each step to create screenshots after my test fails so for me everything is working.
  • m

    mysterious-belgium-25713

    10/19/2022, 4:12 PM
    Is the login happening in the beforeEach or in the IT step?
  • r

    refined-raincoat-56329

    10/19/2022, 4:14 PM
    in the It block
  • r

    refined-raincoat-56329

    10/19/2022, 4:16 PM
    Copy code
    {
    import SignInPage from '../../pages/signInPage.cy'
    import ValidateAccountPage from '../../pages/validateAccountPage.cy'
    import DeleteAccount from '../../pages/deleteAccount.cy'
    
    
    type NewAccountCredentials = {
      username: string,
      password: string,
      vcode: number,
      uid: string
    };
    
    
    
    const clientUrl = "http://54.39.177.218:8080";
    const serverUrl = "http://54.39.177.218:3020/api/v2";
    
    const signIn = new SignInPage()
    const validateAccount = new ValidateAccountPage()
    const deleteAccount = new DeleteAccount()
    
    describe('Smoke test', () => {
    
      let credentials
      let value
      beforeEach(() => {
        cy.viewport(390, 844);
    
        cy.fixture('addDebtDetails')
          .then((data) => value = data)
        // create a new non-validated account in the back-end
        cy.request(serverUrl + '/test-accounts/free')
          .then(response => {
            expect(response.body).to.have.property("username");
            credentials = response.body;
          })
    
        cy.visit(clientUrl, {
          onBeforeLoad: (win) => {
            win.sessionStorage.clear();
            win.localStorage.clear();
          }
        });
      });
    
      afterEach(() => {
        /* CLEANUP AFTER EACH TEST */
    
        deleteAccount.DeleteAccountMethod(credentials.password)
        cy.wait(3000)
        // must always delete the created account even if any of the above testing fails
        cy.request("DELETE", `${serverUrl}/test-accounts/uid/${credentials.uid}`)
          .then(response => {
            expect(response.status).to.be.equal(200);
          })
      })
    
      it('verifying a new user is able to login followed by validation being performed', () => {
    
        // sign-in
        signIn.SignInMethod(credentials.username, credentials.password)
    
        // validate account
        validateAccount.validateAccountMethod(credentials.vcode.toString())
    
        cy.wait(3000)
        // verify that we are on the home page and see the correct greeting and workspace name
        cy.get("app-greeting h3").should('have.text', 'Hi QA Test! Primary');
    
    
      })
    
    })}
  • u

    user

    10/19/2022, 4:42 PM
    Hi, trying to use the new component testing in Vue 3/Vite project. When I get to Specs in Cypress UI, I can add my "*.cy.ts" component test file, but when clicking it, i see "Your tests are loading..." forever. When inspecting the Networking tab in Dev Tools, "*.cy.ts" request never finishes. Also it's URL is possibly weird? This is how the URL looks "http://localhost:5003/__cypress/iframes/D:/Downloads/gamers-diary/GamDi/Client/src/components/BMultiSelect.cy.ts"
  • l

    limited-actor-4522

    10/19/2022, 5:06 PM
    Has anybody had a ton of trouble with Ant Design and Cypress? We have fairly simple tests that routinely and intermittently fail cy.get("[data-testid=]") calls for DOM elements like simple buttons that are mounted immediately and have nothing complex about them. I am at my wits end a bit. I am assuming I am doing something wrong, but this is such a simple flow of mount button --> click button that fails intermittently I am really unsure what I could be doing wrong. Has anyone encountered problems like this with Ant and Cypress before?
  • w

    witty-army-1426

    10/19/2022, 5:18 PM
    ¿some news about my question?
  • r

    rhythmic-lizard-86607

    10/19/2022, 7:02 PM
    Hey! We repeatedly receive this error https://github.com/cypress-io/cypress/issues/20813 on our pipeline. Any workaround or a fix?
  • a

    able-winter-6291

    10/19/2022, 7:07 PM
    Hi folks, we are experiencing some issues with performance running in Gitlab CI/CD (tests are failing due to timeout, can't find element or freezing), no issues running locally. Same as this https://github.com/cypress-io/cypress/issues/23830 Is there a way to invite someone into our repository? Our tests are super old from version 8, that was not happening before, we tried all versions until the latest one
  • t

    thousands-gpu-36872

    10/19/2022, 8:46 PM
    Hello Guys, it´s there a way to wait for a especific dynamic change in a response api ? In this example the status change to processing after about 10 seconds, i just wanna know if have another way to wait for this change without using a cy.wait()
  • s

    straight-kilobyte-77939

    10/19/2022, 8:59 PM
    Hi here .. Is there any update on this?
  • a

    ambitious-eye-55281

    10/19/2022, 9:02 PM
    The dev team is looking into it is my understanding, and they will likely work on a fix for the next release. https://github.com/cypress-io/cypress/issues/24290
  • r

    refined-raincoat-56329

    10/20/2022, 3:19 AM
    any solution for this ? I want my delete account code to execute even if the test execution fail in between. delete account code is in afterEach hook
  • e

    early-dinner-41351

    10/20/2022, 7:23 AM
    Cypress opens a new instance on new tab?
    • 1
    • 3
  • m

    mysterious-belgium-25713

    10/20/2022, 8:44 AM
    Cant seem to understand why its not working for you. I just created a sample project. You can run this and see that the after each statement will be run.
    Copy code
    js
    describe('empty spec', () => {
    
      beforeEach(() => {
        cy.log("before Each")
      });
    
      it('passes', () => {
        cy.visit('https://example.cypress.io')
        cy.get("a").contains("getaaa")
      })
    
      afterEach(() => {
        cy.log("I will delete stuff because the test failed")
      });
    })
    Other than that i dont know if your file is correct but did you add 1 extra bracket that is surrounding the full file?
  • m

    mysterious-belgium-25713

    10/20/2022, 9:00 AM
    Also on other thing your page imports are all .cy files. Do is it a real page object class or do you also have test in them?
  • l

    lemon-animal-16490

    10/20/2022, 9:52 AM
    how to fix submit button with click() method doesn't work it said click in log but not thing happen but manual click is working fine
  • s

    stocky-appointment-62574

    10/20/2022, 11:04 AM
    I'm working with an app that when sending down the html from the server will create a global state object to hydrate the app. React then looks at that state object to build its world. I'm trying to find a way before react loads to modify that state data to create different scenarios for the react app. Any ideas of where to look for this? I'm used to this data coming down as an xhr request and that is easily intercepted and modified using fixtures.
  • g

    gray-kilobyte-89541

    10/20/2022, 11:30 AM
    visit onBeforeLoad gives you the window object. You can create a property that will give you the state object when the app sets it and then the test can modify it
  • h

    handsome-lion-1748

    10/20/2022, 11:32 AM
    hi, I'm trying to add a custom command 'login' but I'm getting:
    Argument of type '"login"' is not assignable to parameter of type 'keyof Chainable '.
  • h

    handsome-lion-1748

    10/20/2022, 11:33 AM
    it seems this is my issue: https://stackoverflow.com/questions/73018000/argument-type-string-is-not-assignable-to-parameter-type-keyof-chainable-cyp
  • h

    handsome-lion-1748

    10/20/2022, 11:33 AM
    I'm mixing .js and .ts
  • h

    handsome-lion-1748

    10/20/2022, 11:34 AM
    Although I'm reviewing my files and they are all .ts
  • h

    handsome-lion-1748

    10/20/2022, 11:40 AM
    I had to uncomment
    Copy code
    declare global {
      namespace Cypress {
        interface Chainable {
          login(email: string, password: string): Chainable<void>
        }
      }
    }
    and the error disappeared
  • s

    stocky-appointment-62574

    10/20/2022, 11:43 AM
    Okay I tried that but it seems like the page load is still over riding what I set: So I have a page like this: ... state={data} ...react imports
    • 1
    • 1
  • p

    powerful-orange-86819

    10/20/2022, 11:56 AM
    Anyone know how to add more presets to cy.viewport() ? iphone-6 and 7 arent enough, and 14 has some weird resolution, also i cant make this function work with plain resolution:
    Copy code
    js
    Cypress._.each(["samsung-s10", "428, 926"], (viewport) => {
    
    })
  • h

    handsome-lion-1748

    10/20/2022, 12:06 PM
    I'm getting
    cy.login
    is not a function, I have an empty export {} in the end of the commands.ts file, should I add something to it? I couldn't find anything in the docs
  • h

    handsome-lion-1748

    10/20/2022, 12:16 PM
    I just remembered that I added the export {} by hand because I had an error showing before I had the need to add a custom command, now I removed it and I'm getting other errors:
    TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.
  • h

    handsome-lion-1748

    10/20/2022, 12:29 PM
    I tried following: https://github.com/cypress-io/cypress/issues/1065#issuecomment-351769720 and changed the namespace declaration like this:
    Copy code
    declare namespace Cypress {
      interface Chainable<Subject> {
        login(email: string, password: string): Chainable<void>
      }
    
    }
    and now I'm getting error on
    declare
    Copy code
    TS1208: 'commands.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module.
1...182183184...252Latest