Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
astonishing
Browse files Browse the repository at this point in the history
  • Loading branch information
seren5240 committed Dec 6, 2023
1 parent 4b279c5 commit f92eb0b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .grit/patterns/codecept_to_playwright.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ pattern convert_locators($page) {
`locate($locator).as($_)` => `$page.locator($locator)`,
`locate($locator).find($sub)` => `$page.locator($locator).locator($sub)`,
`locate($locator)` => `$page.locator($locator)`,
`$locator.withDescendant($descendant)` => `$locator.filter({ has: $page.locator($descendant) })`,
`I.waitInUrl($url)` => `await $page.waitForURL(new RegExp($url))`,
`I.waitForLoader()` => `await this.waitForLoader()`,
`I.waitForText($text, $timeout, $target)` => `await expect($target).toHaveText($text, {
Expand Down Expand Up @@ -167,6 +168,7 @@ pattern convert_locators($page) {
`I.attachFile($target, $file)` => `await $target.setInputFiles($file)`,
`I.clearFieldValue($field)` => `await $field.clear()`,
`I.grabNumberOfVisibleElements($target)` => `await $target.count()`,
`I.seeNumberOfVisibleElements($locator, $count)` => `expect(await $locator.count()).toEqual($count)`,
}
}
Expand Down Expand Up @@ -303,6 +305,8 @@ export default {
open: true,
'grit-label': 'nice',
});
let lines = I.grabNumberOfVisibleElements(locate('div').withDescendant('p'));
I.seeNumberOfVisibleElements(locate('div').withDescendant('p'), lines);
},
};
```
Expand Down Expand Up @@ -330,6 +334,16 @@ export default class Test extends BasePage {
await expect(this.studio).toHaveCSS('display', 'flex');
await expect(this.studio).toHaveAttribute('open', 'true');
await expect(this.studio).toHaveAttribute('grit-label', 'nice');
let lines = await this.page
.locator('div')
.filter({ has: this.page.locator('p') })
.count();
expect(
await this.page
.locator('div')
.filter({ has: this.page.locator('p') })
.count(),
).toEqual(lines);
}
}
```
Expand Down

0 comments on commit f92eb0b

Please sign in to comment.