Skip to content

Commit

Permalink
a few more items
Browse files Browse the repository at this point in the history
  • Loading branch information
dnotes committed Oct 14, 2024
1 parent 24428ba commit 2fe5e5c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
35 changes: 33 additions & 2 deletions packages/playwright/src/outcomes.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,38 @@ Then('I should not see a(n)/the {string} {word}', async function (world:Playwrig
await expect(locator).not.toBeVisible()
})


Then('a/an/the {string} should be disabled', async function (world:PlaywrightWorld, identifier) {
let locator = await getLocator(world.page, identifier, 'element')
await expect(locator).toBeDisabled()
})
Then('a/an/the {string} should be enabled', async function (world:PlaywrightWorld, identifier) {
let locator = await getLocator(world.page, identifier, 'element')
await expect(locator).toBeEnabled()
})
Then('a/an/the {string} should be checked', async function (world:PlaywrightWorld, identifier) {
let locator = await getLocator(world.page, identifier, 'element')
await expect(locator).toBeChecked()
})
Then('a/an/the {string} should be unchecked', async function (world:PlaywrightWorld, identifier) {
let locator = await getLocator(world.page, identifier, 'element')
await expect(locator).not.toBeChecked()
})
Then('a/an/the {string} should be focused/active', async function (world:PlaywrightWorld, identifier) {
let locator = await getLocator(world.page, identifier, 'element')
await expect(locator).toBeFocused()
})
Then('a/an/the {string} should be unfocused/blurred', async function (world:PlaywrightWorld, identifier) {
let locator = await getLocator(world.page, identifier, 'element')
await expect(locator).not.toBeFocused()
})
Then('a/an/the {string} should be visible', async function (world:PlaywrightWorld, identifier) {
let locator = await getLocator(world.page, identifier, 'element')
await expect(locator).toBeVisible()
})
Then('a/an/the {string} should be hidden/invisible', async function (world:PlaywrightWorld, identifier) {
let locator = await getLocator(world.page, identifier, 'element')
await expect(locator).not.toBeVisible()
})
Then('a/an/the {string} {word} should be disabled', async function (world:PlaywrightWorld, identifier, role) {
let locator = await getLocator(world.page, identifier, role)
await expect(locator).toBeDisabled()
Expand All @@ -58,7 +89,7 @@ Then('a/an/the {string} {word} should be checked', async function (world:Playwri
let locator = await getLocator(world.page, identifier, role)
await expect(locator).toBeChecked()
})
Then('a/an/the {string} {word} should be unchecked', async function (world:PlaywrightWorld, identifier, role) {
Then('a/an/the {string} {word} should be unchecked', async function (world:PlaywrightWorld, identifier, role) {
let locator = await getLocator(world.page, identifier, role)
await expect(locator).not.toBeChecked()
})
Expand Down
2 changes: 1 addition & 1 deletion packages/playwright/tests/playwright.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Basic tests of Playwright browser and steps
When I click on the "Form" link
Then the url should contain "#form"
When I click on "Message:"
Then the active element should be a "textarea"
Then the "textarea" should be focused

@concurrent
Rule: Playwright should support testing with multiple browsers
Expand Down

0 comments on commit 2fe5e5c

Please sign in to comment.