The “Hello, World!” of test automation
The test-automation equivalent of Hello, World!
is usually a test that checks for the presence of a simple element on a web page, such as a heading or a paragraph of text. This can involve writing a test that does the following:
- Navigates to a web page
- Locates an element on the page using an XPath or CSS selector method
- Verifies that the element is present and displayed on the page
In our first example, we have the following five simple steps to perform a login:
- Navigate to a simulated login screen.
- Enter the username.
- Enter the password credentials.
- Click the login button.
- Validate that a message appears, indicating the login was successful.
An example can be found in the pageObjects\login.page.ts
file:
await this.inputUsername.setValue(username); await this.inputPassword.setValue(password); await this.btnSubmit.click();
We have already resolved errors that can arise from...