Ben Fellows
Yeah, for sure. So one of the things I cover when it comes to page objects. So here's like a kind of a demo app that I play with. It's just something that I like, I built myself. That's how I kind of try to manage a bunch of my relationships and stuff like that. Your traditional way you're going to approach this situation is you're gonna open it, you're to go through the DOM, right? You're going either have a framework for this or you're go through yourself and you're basically going to write all your locators. Depending on the circumstance, more and more I'm pushing for QA teams to have direct access to their repos because you don't even really need to open the DOM anymore. Let's start by assuming that the QA team has access to their repo. In this repo, we have a test folder with a Playwright suite in it, and then you have your code base. Let's assume that I'm a QA person being told I want to write my page object model for the dashboard. We're going to go over to the prompt. We're going to say add a palm file for the dashboard. And we're going to give it some context of what the actual dashboard component is that we want to do it for and we can go and we'll pull it in here. Oops wrong file. Here. And what it's going to do is it's gonna add a page object file from a dashboard. And what this is, is this is taking what is something that's probably two to three to four hours worth of work, and it's gonna do it in probably two minutes, right? And we're not even opening the browser, which is amazing. We're actually just literally having, we're pointing Cursor at the component. It's going go read the component, and it is going to write a page object model file that is actually fairly good. Now, we could add a lot more context. We could do stuff like Cursor rules, but you can see this is a 5-word prompt. Like a lot of people think, Oh, we need perfect prompts. And actually like, to me, what I tell people is as long as you have an engineer who understands what the output should be, and they're evaluating the output against it, the prompt doesn't really matter nearly as much. We could make this probably better, but just for the sake of this demo. And what I always start off with is basically giving this, this doesn't say Playwright. This doesn't say anything about best practices. This doesnât say anything about how you want to do it. And for the most part, it's going to do a very, very good job. We could offer it more context. We could put in the Playwright, locators URL. We could do some of these other things. And these are all things I try to cover in the workshop about how these things go. But what the output is going to be pretty good. And so you can see it wrote 529 lines. We're going to open this and you can it has a dashboard page class which is exactly what I would expect. It's got all your locator read-only is defined and here you have your constructor. This is exactly how I would write test automation. Now, some of these things I don't love off the bat looking at this. I don't really love the use of dot first here, so that would be something that I would immediately call out. I'd go through and we can go and start to review this and edit this. But the fact is, if I tried to sit down and just write out this code, I mean, you're talking hours of work. And it's done and it started to add methods. It's out of the method for get total contacts count, get needs attention count, all of these different things that I would need to use if I was writing test automation, right? If you think about interacting with this page. And we can take it a step further though. And while it works, and I'll turn it back to you to ask a question, we can actually take it to step further and we can not just say, okay, not only have we gotten this productivity boost from this, we're much faster. Let's go ahead and let's tell it, add test IDs to the component. And update the palm. And so this is the thing that's really happened in the last three, four months is the AI is actually good enough now to update a front-end component without breaking it. If I had given this prompt six months ago to this, it would have broken the entire front-end component. Now, I can give this prompt a 99 out of a hundred times. It's just gonna update the front-end component with test IDs, update the Palm to use it and the front-end component will not be updated in the least. Now, not only have we been much more productive, we're actually going to have a significantly less flaky set of test automation as well, because we have test IDs that are independent of locators changing and anything else. So I'll pause there because it was a lot of information, kind of what questions, thoughts, concerns come to mind so far.