discourse/spec/system/page_objects/modals
Joffrey JAFFEUX b6aad28ccf
DEV: replace selenium driver with playwright (#31977)
This commit is replacing the system specs driver (selenium) by
Playwright: https://playwright.dev/

We are still using Capybara to write the specs but they will now be run
by Playwright. To achieve this we are using the non official ruby
driver: https://github.com/YusukeIwaki/capybara-playwright-driver

### Notable changes

- `CHROME_DEV_TOOLS` has been removed, it's not working well with
playwright use `pause_test` and inspect browser for now.

- `fill_in` is not generating key events in playwright, use `send_keys`
if you need this.

### New spec options

#### trace

Allows to capture a trace in a zip file which you can load at
https://trace.playwright.dev or locally through `npx playwright
show-trace /path/to/trace.zip`

_Example usage:_

```ruby
it "shows bar", trace: true do
  visit("/")

  find(".foo").click

  expect(page).to have_css(".bar")
end
```

#### video

Allows to capture a video of your spec.

_Example usage:_

```ruby
it "shows bar", video: true do
  visit("/")

  find(".foo").click

  expect(page).to have_css(".bar")
end
```

### New env variable

#### PLAYWRIGHT_SLOW_MO_MS

Allow to force playwright to wait DURATION (in ms) at each action.

_Example usage:_

```
PLAYWRIGHT_SLOW_MO_MS=1000 rspec foo_spec.rb
```

#### PLAYWRIGHT_HEADLESS

Allow to be in headless mode or not. Default will be headless.

_Example usage:_

```
PLAYWRIGHT_HEADLESS=0 rspec foo_spec.rb # will show the browser
```

### New helpers

#### with_logs

Allows to access the browser logs and check if something specific has
been logged.

_Example usage:_

```ruby
with_logs do |logger|
  # do something

  expect(logger.logs.map { |log| log[:message] }).to include("foo")
end
```

#### add_cookie

Allows to add a cookie on the browser session.

_Example usage:_

```ruby
add_cookie(name: "destination_url", value: "/new")
```

#### get_style

Get the property style value of an element.

_Example usage:_

```ruby
expect(get_style(find(".foo"), "height")).to eq("200px")
```

#### get_rgb_color

Get the rgb color of an element.

_Example usage:_

```ruby
expect(get_rgb_color(find("html"), "backgroundColor")).to eq("rgb(170, 51, 159)")
```
2025-05-06 10:44:14 +02:00
..
admin_search.rb UX: display search input and open modal on click (#32508) 2025-05-01 10:12:12 +08:00
anonoymous_flag.rb FEATURE: setting allowing tl0/anonymous flag illegal content (#30785) 2025-01-17 08:57:44 +11:00
avatar_selector.rb FIX: Serialize uploaded_avatars_allowed_groups check on current user (#25515) 2024-02-02 09:32:45 +10:00
badge.rb DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
base.rb DEV: Modernize the post menu from widgets to Glimmer components (#28670) 2024-11-11 15:36:08 -03:00
bookmark.rb DEV: replace selenium driver with playwright (#31977) 2025-05-06 10:44:14 +02:00
bulk_user_delete_confirmation.rb DEV: replace selenium driver with playwright (#31977) 2025-05-06 10:44:14 +02:00
change_owner.rb DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
create_color_palette.rb FEATURE: Add color palette list selection to new UI (#32379) 2025-05-05 05:12:50 +03:00
create_invite.rb FIX: Add back the option to create invite without emailing (#29641) 2024-11-08 07:59:24 +03:00
delete_themes_confirm.rb UX: refactor .d-modal to use BEM and improve styling (#23967) 2023-11-15 10:14:47 +00:00
discard_draft.rb FEATURE: add drafts dropdown menu (#30277) 2025-01-13 13:33:57 +04:00
dismiss_new.rb DEV: replace selenium driver with playwright (#31977) 2025-05-06 10:44:14 +02:00
flag.rb DEV: Simplify "Admin Flags Page" system test to reduce runtime duration (#32431) 2025-04-24 15:47:22 +08:00
insert_table.rb DEV: Attempt to fix flaky test by using click_button instead of click (#25070) 2023-12-29 14:39:37 +08:00
install_theme.rb UX: Tweaks to the theme/component pages when using admin sidebar (#30953) 2025-03-13 15:34:17 +03:00
penalize_user.rb FIX: Don't show silence button on staff users and display similar users (#28423) 2024-08-20 15:27:29 +03:00
private_message_invite.rb DEV: convert PrivateMessageMap widget to glimmer components (#25837) 2024-03-04 10:24:25 +08:00
private_message_remove_participant.rb DEV: convert PrivateMessageMap widget to glimmer components (#25837) 2024-03-04 10:24:25 +08:00
reject_reason_reviewable.rb UX: refactor .d-modal to use BEM and improve styling (#23967) 2023-11-15 10:14:47 +00:00
scrub_rejected_user.rb FEATURE: Allow rejected user details to be scrubbed (#31987) 2025-03-31 12:40:35 +11:00
sidebar_edit_categories.rb DEV: replace selenium driver with playwright (#31977) 2025-05-06 10:44:14 +02:00
sidebar_edit_navigation_modal.rb DEV: replace selenium driver with playwright (#31977) 2025-05-06 10:44:14 +02:00
sidebar_edit_tags.rb FIX: Loading more tags in edit nav menu tags modal not working (#22770) 2023-07-25 13:44:25 +08:00
sidebar_section_form.rb DEV: replace selenium driver with playwright (#31977) 2025-05-06 10:44:14 +02:00
topic_bulk_actions.rb FEATURE: Add more bulk dismiss buttons with confirmation (#29331) 2024-11-08 15:59:12 +08:00