[DON'T MERGE - POC] IBX-11739: Added playwright tests for Trash#1947
[DON'T MERGE - POC] IBX-11739: Added playwright tests for Trash#1947pawlakadrian wants to merge 7 commits into
Conversation
|
| on: | ||
| push: | ||
| branches: | ||
| - main |
| export class ContentManagementPage extends AdminUiPage { | ||
| readonly udw: UniversalDiscoveryWidget; | ||
|
|
||
| constructor(page: Page) { |
There was a problem hiding this comment.
I would add all css locators to the constructor, so they can be reused and code looks cleaner.
On the other hand - sometimes getBy locators are used, is it possible to switch completely to getBy locators? Copilot suggests something like:
Element | Preferred locator
Button | getByRole()
Link | getByRole()
Checkbox | getByRole()
Text field | getByLabel()
Image | getByAltText()
Static text | getByText()
Custom component | getByTestId()
Loading spinner | CSS
Overlay | CSS
Toast | CSS or getByTestId()
Animation | CSS
There was a problem hiding this comment.
This page file seems like a mix of different pages and components in Behat notation and some code overlaps with https://github.com/ibexa/cohesivo-playwright/blob/5.0/src/pages/admin/AdminUiPage.ts - .ie https://github.com/ibexa/cohesivo-playwright/blob/5b13038a8e17b0b0e01c99d9d67b765f9e69ff12/src/pages/admin/AdminUiPage.ts#L22 and https://github.com/ibexa/admin-ui/pull/1947/changes#diff-46711842a811d22853c02fa9e2fee52d5502bf751dcae9f71e6994d45139d23eR87 do the same thing.
My recommendation is to scrap https://github.com/ibexa/cohesivo-playwright/blob/5.0/src/pages/admin/AdminUiPage.ts (leave maybe login stuff in ibexa/cohesivo-playwright as login stuff is also implemented in ibexa/behat) and to break this file into proper pages (as in behat admin-ui pages https://github.com/ibexa/admin-ui/tree/6.0/src/lib/Behat/Page).
| this.udw = new UniversalDiscoveryWidget(page); | ||
| } | ||
|
|
||
| async open(): Promise<void> { |
There was a problem hiding this comment.
Navigation between tabs should be done in specific page/component.
|
|
||
| async searchInTrash(query: string): Promise<void> { | ||
| const url = this.page.url().split('?')[0]; | ||
| await this.page.goto(`${url}?trash_search[content_name]=${encodeURIComponent(query)}`); |
There was a problem hiding this comment.
Does this code work the same as in behat? Is seems like it bypasses UI interaction by using page.goto()
In behat it looked like:
$this->trashSearch->submitSearchText($searchQuery); $this->trashSearch->confirmSearch();
so, add text to the input -> click search.


Related PRs:
Description:
Sets up Playwright testing for the admin-ui package using the shared cohesivo-playwright library.
For QA:
Documentation: