Loading
Current section: End-to-End Mocking 4 exercises
Problem

Writing Emails to the File System for Test Automation

Loading exercise

Transcript

00:00 So we've got some new tests that Kelly put together for us, but they're not finished. We need to fix a couple of things. So if I run this onboarding test, this is going to go through the onboarding flow, and it's going to get to this check your email piece. But we get stuck here because we actually don't have an email yet. This part is not yet implemented.

00:18 So what we need to do is somehow get this code, this verification code, into our application. But there's not really a way for us to take a look at the terminal output and find that code and all of that. So what we're going to have to do instead is write this email to the file system.

00:36 And then because that's, here's the important point here. Our Playwright tests are running over in this process. Our server is running over in this process. The server is the one that is doing this log, that knows the code and all of that, and sending the email, and then it's being mocked. So the mocks all live in the server process as well, all of that.

00:55 The Playwright process is completely separate. So unless we want to do some process to process communication, which is going to be pretty tricky, what we're going to do instead is this process not only will log to the terminal, that's fine, but it will actually write to disk as well. So then Playwright can read that and then continue on its merry way.

01:14 So that is the task for this step of the exercise. This step is actually really, really simple, just a little bit of code change here. But yeah, then that will get you prepared for the next step too. So let's get this step done, and we'll see you when you're finished.