React Testing Library Tutorial #11 - Integration Tests

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ก.ค. 2021
  • Check out Laith's TH-cam channel for more tutorials:
    / @laithacademy
    🐱‍💻 Access the course files on GitHub:
    github.com/harblaith7/React-T...
    🐱‍👤 Get access to extra premium courses on Net Ninja Pro:
    netninja.dev
    🐱‍💻 Full React Course:
    • Full React Tutorial #1...
    🐱‍💻 Social Links:
    Facebook - / thenetninjauk
    Twitter - / thenetninjauk
    Instagram - / thenetninja

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

  • @DGronki
    @DGronki 3 ปีที่แล้ว +64

    I like entire course, not because framework but because we have situation like "oh this was unexpected", "it should work". It feels real and not like idealized presentation.

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

    I just want to thank you for acknowledging when something doesn't go right and you do a quick troubleshoot of it. I think it's important for newer developers to see that things often don't go as we expect no matter how much experience you have.

  • @anass6625
    @anass6625 2 ปีที่แล้ว +22

    To be honest i was a little sceptical about this course, because shawn was not the host, but it turns out really good

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

    Loved this course.. great job man!!!

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

    I tried few Unit testing tutorials and i only get hooked by this one. Comment for algorithm, nice1. I checked your website For extensive Unit testing course but i haven´t found one. I would be up for it with this instructor, Testing some large application while developing features, or sth like this

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

    More technically speaking, if both of your components are running in the same service, and you are testing their cooperation, then this is a "narrow integration" test. In case if these 2 units of functionalities are in separate autonomous services this can be now called an "integration" test. Please correct me if I am wrong.

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

    Amazing videos!~Watching on 1.5x speed, but great!

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

    very helpful, thank you!

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

    Wonderful content! I learned a lot with the course, thanks a lot for this and great job!

  • @Nellak2011
    @Nellak2011 2 ปีที่แล้ว +13

    I got to say, at first I was intimidated by the idea of Testing my Code, but after seeing this series, it really isn't that hard after all.

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

    Great content. Please, in the course of following the tutorial, I noticed my tests stopped giving me any output and my VS Code kept flickering. I guess there is a memory leakage or issue somewhere as it runs indefinitely with no progress. Any idea on how I can resolve this?

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

    isn't it better if the last test you put there has a separate unit test specifically for the TodoList component?

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

    You’re all doing the Lord’s work.

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

    Great course! Quick question - usually when I write tests I just use 'strings' to identify elements and check values, placeholders, etc. What are the advantages of using regular expressions instead?

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

      Probably that in case the casing etc has changed maybe through css or maybe in future this will be immune to that.

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

    aha Second !.
    Thank u Sir.
    When will u start react native app Testing tutorial

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

    thanks laith n shaun.

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

    is very good.
    Thanks for your very good tutorial 😍

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

      You're welcome 😊

  • @ratishjain2718
    @ratishjain2718 9 หลายเดือนก่อน

    Thats why he is the GOAT!! The GOATTT!

  • @mitchell4217
    @mitchell4217 4 หลายเดือนก่อน

    Why was I not able to find this easy work around to on the RTL docs? I feel like there's so much missing from it.

  • @user-vj5fk6hb3j
    @user-vj5fk6hb3j 3 หลายเดือนก่อน +1

    Better and more safe - use instead of fireEvent - userEvent

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

    I am curious why you are using regular expressions over just a string. Is it better in terms of something?

    • @alessandro2092
      @alessandro2092 3 ปีที่แล้ว +4

      Once you start learning regular expressions, you won't go back to strings.

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

      regex allows for case insensitive matching

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

    This one is so clear but one doubt is if that text actually brings some array of data asynchronously through api then how to wait for to complete??

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

      You will mock the incoming data using a hard coded value, you are testing the functionality of the component, not if it connects to the API. You use an end-to-end test for testing api connections.

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

    why are the `it` blocks inside describe async? we are not using any find methods right

    • @mitchell4217
      @mitchell4217 4 หลายเดือนก่อน

      Good point. We aren't making any calls or firing any events for the async to be relevant.

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

    Does anyone here know what he is using to make is so when he clicks a component, it takes you right into that folder. It would save me a lot of time. Thanks
    Edited :He explained it in the video. You simply press Ctrl and click it. It is an incredibly handy trick.

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

      And for mac, it's press option + click component.
      Also while holding down option and hovering over component, it will give more details about the component.

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

    NICE!!

  • @daniellyaparecidamoreira4943
    @daniellyaparecidamoreira4943 11 หลายเดือนก่อน

    i did one diferent test and for one hour i has stocking because give me one error, than i check the code and realize the test is ok the code is wrong ...

  • @pazfelipe
    @pazfelipe 3 ปีที่แล้ว +6

    First heeeeeere!!! 6:26 am from brazil

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

      15:46 from India!

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

    At 15:15 we can check for multiple todo items at once:
    it('should not have todo-item-active class for a todo-item initially', () => {
    render();
    // We're adding 4 tasks via addTask()
    addTask(["Go to Store", "Go to Gym", "Do Yoga", "Code all day long"])
    const todoItemElements = screen.getAllByTestId('todo-item');
    todoItemElements.forEach(todoItemElement => {
    expect(todoItemElement).not.toHaveClass('todo-item-active');
    })
    });

  • @Saurabhkumar-ps5zp
    @Saurabhkumar-ps5zp ปีที่แล้ว

    Thank you

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

    Thanks!

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

    I watch at 2x but thats how I watch most of the videos, so dont waste time. Laith and Shawn are awesome instuctors ;)

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

      Wow, you must be really smart or something

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

    Man !! this a awesome great video tutorial series, but i have a question ..if i have for example a E-comerce website with 3 pages: products list, product details and a shopping cart page , and i would do 1 integration test for each page ?...im trying figure this out 🤔 thankx 👍

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

      By the way, the videos tutorials on your youtube channel, help me a lot !! Thankx for your great tutorials !!

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

      Seems you got to be more specific about what it actually is that you want to test, something like: "When I do this And then do that But the global state is ... then I want this to happen: ..." Going that road will clarify a lot---whether you need an integration test or even an E2E-Test and how the test should be written.

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

    Washing hands is really important, because of COVID! 😁
    Sadly it is true! 😞

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

    Replace forEach loop with for..of loop if you are using an asynchronous userEvent() instead of fireEvent(). And await the addTask function like shown below
    const addTask = async (tasks) => {
    const inputElement = screen.getByPlaceholderText(/Add a new task here.../i);
    const buttonElement = screen.getByRole("button", { name: /Add/i });
    const user = userEvent.setup();
    for (const task of tasks) {
    await user.type(inputElement, task);
    await user.click(buttonElement);
    }
    };
    ....
    await addTask(["Go Grocery Shopping", "Wash Hands", "Clean pet"]);
    .....

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

    Why don't you just pause the video making for some time and " Go Grocery Shopping" once.
    This is something in your Todos since years now.😏

  • @oubaidaawaw7271
    @oubaidaawaw7271 4 หลายเดือนก่อน

    wash your hands bro 🤣

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

    Why are you testing for class presence? Why should user care whether some divs in source code have a specific class? I don't know much about testing (that's why I'm watching this), but I have a feeling that this is a crap tutorial.

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

      The class he's testing is the class that makes the text crossed out. It tells the user that this todo task has been completed and they can see that visually if the class is present. So it's a valid thing to test for.