A predicate function is a function that returns a boolean value—that is, it returns true or false depending on whether a condition is satisfied.
In other words, a predicate tests something.
function isEven(number) {
return number % 2 === 0;
}| xcode-select -p && xcodebuild -version | |
| # returned example | |
| # path/to/xcode | |
| # Xcode 16.4 | |
| # Build version 16F6 |
| git log --patch | |
| git log -p | |
| git log -p app/\(features\)/beacon-money-account/info/free-activation/components/FreeActivationHero.tsx | |
| git log -p ec60ac4 #using commit hash | |
| # or using https://github.com/jonas/tig | |
| tig | |
| test("Dropdown should be sorted in alphabetical order", async ({ page }) => { | |
| await page.goto(PAGE_URL); | |
| const dropdown = page.getByRole("combobox").and(page.locator("#country")); | |
| const options = await dropdown.locator("option").all(); | |
| const optionValues = await Promise.all(options.map(option => option.textContent())); | |
| const sortedOptionValues = [...optionValues].sort(); | |
| expect(optionValues).toEqual(sortedOptionValues); | |
| }); |
| // adding --headed option | |
| npx playwright test tests/singleSelectDropdown.spec.ts --headed |
| Selects one or multiple options in the <select> element with locator.selectOption(). You can specify option value, or label to select. Multiple options can be selected. | |
| // Single selection matching the value or label | |
| await page.getByLabel('Choose a color').selectOption('blue'); | |
| // Single selection matching the label | |
| await page.getByLabel('Choose a color').selectOption({ label: 'Blue' }); | |
| // Multiple selected items | |
| await page.getByLabel('Choose multiple colors').selectOption(['red', 'green', 'blue']); |
| // list all commit on this file. Also in case of merge or squash it allow to see the commit inside of it | |
| tig path/to/file |
| // It is possible using .and locator https://playwright.dev/docs/api/class-locator#locator-and | |
| import { test, expect } from "@playwright/test"; | |
| test(" Text input actions", async ({ page }) => { | |
| await page.goto("https://testautomationpractice.blogspot.com/"); | |
| const textBox = page.getByRole('textbox').and(page.locator("#name")); | |
| await textBox.fill("Playwright"); | |
| await expect(textBox).toHaveValue("Playwright"); | |
| }); |