Cypress CT 8/8 - Better Type Safety, cy.mount & CT at Cypress

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ม.ค. 2025

ความคิดเห็น • 14

  • @LachlanMiller
    @LachlanMiller  2 ปีที่แล้ว

    Note: Looks like the Cypress types changed a bit, I had to update my code in cypress/support/component.ts like this:
    ```
    import type { MountingOptions } from 'cypress/vue/dist/@vue/test-utils';
    function mount(comp: any, payload: MountingOptions = {}) {
    const _props: T = {
    ...payload.props,
    } as any;
    return _mount(comp as any, {
    ...payload,
    props: _props,
    global: {
    plugins: [
    pinia,
    createNewRouter(createWebHashHistory())
    ]
    }
    });
    }
    ```

    • @tymurberezhnyi
      @tymurberezhnyi ปีที่แล้ว

      Hi, Lachlan. I tried this solution but I got an error on this line:
      import type { MountingOptions } from "cypress/vue/dist/@vue/test-utils";
      It says "Cannot find module 'cypress/vue/dist/@vue/test-utils' or its corresponding type declarations."

  • @ragura
    @ragura 2 ปีที่แล้ว +3

    This has been one of the best testing courses I’ve ever had the pleasure to learn from, thank you very much for creating it. Implementing cypress component testing in a production project this week and looking forward to it. Can’t wait for the e2e side of things too!

    • @LachlanMiller
      @LachlanMiller  2 ปีที่แล้ว +1

      Great, glad you found it useful!
      Cypress does a *lot* of things - I'd love to make a full length course at some point.

    • @johanrama
      @johanrama 2 ปีที่แล้ว +1

      I second this comment. Thank you Lachlan!

    • @LachlanMiller
      @LachlanMiller  2 ปีที่แล้ว

      @@johanrama Thanks a lot! I appreciate it!

  • @ezzeldienrashad8374
    @ezzeldienrashad8374 ปีที่แล้ว +1

    This tutorial was really awesome! Thanks.

  • @holgertewis8343
    @holgertewis8343 ปีที่แล้ว

    Hi @LachlanMiller,
    thanks for the great course.
    At the end you say you will be talking about end-to-end tests in the next lecture.
    Are there actually any videos about that? Where can I find them?
    Thanks, Holger

    • @LachlanMiller
      @LachlanMiller  ปีที่แล้ว

      Hey Holger, I did not end making the E2E videos, sorry! Maybe soon.

  • @rubenhoek3421
    @rubenhoek3421 2 ปีที่แล้ว +1

    Hi Lachlan,
    I'm stuck, i try to make it work in my own local instance but i'm missing something.
    I copied the cypress directory from your git.
    Also the tests i copied and the FormInput.vue + PostWriter.vue files i copied.
    But those two tests (for the FormInput and PostWriter) keep failing.
    Also there is nothing on the test page, so somehow the Parent doesn't mount it looks like (when i setup the component with defineComponent).
    Because this only happens in those 2 test, do you know what the problem can be?
    Should i configure or install something else?

    • @rubenhoek3421
      @rubenhoek3421 2 ปีที่แล้ว

      It's private but i added you to have access

    • @LachlanMiller
      @LachlanMiller  2 ปีที่แล้ว +1

      Hey, I sent you a PR: github.com/RubenHoek/vue3-app/pull/1.
      Thanks for checking out my content!

    • @rubenhoek3421
      @rubenhoek3421 2 ปีที่แล้ว

      @@LachlanMiller It is working now! Thank you so much, you are the best!!