From the course: Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

UI testing app login

UI testing app login

For this test, we'll use this login form in a sample app, and what it says is that for a successful login, you pass in a non-empty username, and pwd as password. So let's go ahead and do that. So and username, password as pwd, hit login, you can see we get welcome dan message, which means a successful login. Now we can go ahead and simulate a fail login, that is if I just enter any username and any gibberish as password, hit login, we get this error message. So we'll go ahead and simulate the same. So I'll go ahead and quickly add a test hook which visits the test site and because we'll have two pages or two test functions. I have just done the same. So first of all, we'll test successful login. And then I will go ahead and locate these elements, which is our user input. Now you can see it has a placeholder, which we can use to locate the same. So let's do it so our username input and we can use page get by placeholder and the placeholder is username similarly we can select the…

Contents