Skip to content

[DON'T MERGE - POC] IBX-11739: Added playwright tests for Trash#1947

Open
pawlakadrian wants to merge 7 commits into
5.0from
ibx-11739
Open

[DON'T MERGE - POC] IBX-11739: Added playwright tests for Trash#1947
pawlakadrian wants to merge 7 commits into
5.0from
ibx-11739

Conversation

@pawlakadrian

@pawlakadrian pawlakadrian commented Jun 23, 2026

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-11739

Related PRs:

Description:

Sets up Playwright testing for the admin-ui package using the shared cohesivo-playwright library.

  • Added tests/playwright-tests/ directory with playwright.config.ts, tsconfig.json, and package.json
  • Implemented TrashPage and ContentManagementPage page objects
  • Added Trash.spec.ts with 6 tests covering: empty trash, move to trash, restore, restore under new location, delete from trash, and search
  • Added .github/workflows/playwright-tests.yml calling the reusable workflow for all four editions (oss/headless/experience/commerce)

For QA:

Documentation:

@pawlakadrian pawlakadrian changed the title IBX-11739: Added playwright tests for Trash [DON'T MERGE - POC] IBX-11739: Added playwright tests for Trash Jun 23, 2026
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

💡 Need a hand with PR review? Try Gitar by Sonar!

on:
push:
branches:
- main

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed

export class ContentManagementPage extends AdminUiPage {
readonly udw: UniversalDiscoveryWidget;

constructor(page: Page) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)}`);

@tomaszszopinski tomaszszopinski Jul 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants