Check out a free preview of the full Ember Octane Fundamentals course

The "Acceptance Testing Q&A" Lesson is part of the full, Ember Octane Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

Mike fields questions about other ways to perform acceptance testing, pauseTest vs debugger statements, debugging mode, and inspecting the state during pauseTest.

Preview
Close

Transcript from the "Acceptance Testing Q&A" Lesson

[00:00:00]
>> Student: Do you wanna mention the pause test helper instead of just debugger? Because oftentimes do you wanna interact with the page at a state in your test?
>> Mike North: I think it's included, right? Let's see. I believe it is. Let me see.
>> Student: Often-
>> Mike North: Why don't you tell me what you'd like me to do?

[00:00:19]
>> Student: [LAUGH]
>> Mike North: It's pause test, right?
>> Student: Yeah, and then instead of debugger, put a wait pause test.
>> Mike North: Interesting.
>> Student: And then, and above two.
>> Mike North: Above?
>> Student: Where the other debugger is, just take it out.
>> Mike North: [CROSSTALK]
>> Student: And then, you can show the difference. Does something very similar as you know.

[00:00:37]
And in the console, you'll see a little message.
>> Mike North: So yeah, this is a relatively new thing. So what pause test does, it's kind of like a debugger. You can still inspect the page with debugger, right? We were able to pluck out DOM elements. But I couldn't have gone in here and started to type stuff.

[00:00:57]
So this is the live app. I'm able to sort of poke at it and do whatever I need to do. And to resume, instead of hitting play in my debugger, we're not really paused here, you just run resume test. And that should go to the next screen. And then we resume test again.

[00:01:16]
So two different ways, but yeah, thank you for pointing that out. This is another valuable thing that sort of, it'll level up from debugger. Yes?
>> Student2: One more slight addition to that is that you don't have to import it. You can just use this stop pauseTest. Because oftentimes, you don't actually wanna use that long term use of it, so you can just drop into the debugger here.

[00:01:35]
>> Mike North: Yes, good point there, right? You don't wanna leave this import hanging around.
>> Student: And if you click development mode, I think it fixes all the weird zooming.
>> Mike North: I think, when I get rid of all my test runner UI, I would. I don't get to see my test passing or failing.

[00:01:51]
To me, that's kind of a valuable thing. Especially when I'm writing the test. I want to know is it green or not. But absolutely, if we were to run through this, and leave pause test in place, now it's sort of two units UI's completely hidden from you. And you'll just sort of see things like flashing on the screen as the tests are run on a full size app.

[00:02:15]
Which, when used in combination with pause test, this would be great for maybe debugging something. But for writing it from scratch, I kinda want to know about the status. It's a top level thing. Great additions, please don't hesitate to chime in with more if you have other insights.

[00:02:33]
>> Student3: Can you still inspect state when using pause test similar to debugger? Or it's on pause, so you don't have the frozen state for-
>> Mike North: When you talk about state, you mean you want to be able to see what's in all of the closures at a particular stack frame.

[00:02:49]
You cannot because this is an ember construct. And just think of it like you're waiting for a promise that doesn't resolve until you call resume test. That's it. So the benefit is you can interact with your app. The cost is you can't really see a stack frame. So if you were, for example, counting invocations of something, make sure this action is fired once or twice, and you're gonna assert on that later, debugger might be the right tool for the job.

[00:03:19]
Because you care about this closure right here. But we don't any variables in this closure right now. So I wouldn't put a lot of value on pausing. Sorry, I wouldn't put a lot of value in using debugger here. Pause test is probably the right tool for the job.

[00:03:38]
But if you wanted to pause within application code, right, like in an action handler of some sort or something else, there, I would not use pause test, I would use debugger. Because you could tempt out a race condition that's gonna radically alter the way your code is gonna work.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now