A platform for community discussion. Free, open, simple.
DEV: replace selenium driver with playwright (#31977)
Joffrey JAFFEUXb6aad28ccffc
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex c02ee0802e3..3d86b2200df 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -302,8 +302,8 @@ jobs:RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --profile=50 --verbose --format documentation tmp/themes/*/spec/systemshell: bash- - name: Check for failed system test screenshots- id: check-failed-system-test-screenshots+ - name: Check for failed system test artifacts+ id: check-failed-system-test-artifactsif: always() && matrix.build_type == 'system'run: |if [ -d tmp/capybara ] && [ "$(ls -A tmp/capybara/)" ]; then@@ -313,12 +313,15 @@ jobs:fishell: bash- - name: Upload failed system test screenshots+ - name: Upload failed system test artifactsuses: actions/upload-artifact@v4- if: always() && steps.check-failed-system-test-screenshots.outputs.exists == 'true'+ if: always() && steps.check-failed-system-test-artifacts.outputs.exists == 'true'with:- name: failed-system-test-screenshots-${{ matrix.build_type }}-${{ matrix.target }}- path: tmp/capybara/*.png+ name: failed-system-test-artifacts-${{ matrix.build_type }}-${{ matrix.target }}+ path: |+ tmp/capybara/*.png+ tmp/capybara/*.zip+ tmp/capybara/*.webm- name: Check for flaky tests reportid: check-flaky-spec-report@@ -357,8 +360,8 @@ jobs:- name: Merge Artifactsuses: actions/upload-artifact/merge@v4with:- name: failed-system-test-screenshots- pattern: failed-system-test-screenshots-*+ name: failed-system-test-artifacts+ pattern: failed-system-test-artifacts-*delete-merged: trueseparate-directories: false# Don't fail the job if there aren't any artifacts to merge.diff --git a/Gemfile b/Gemfileindex f86863eecf7..f66dbbd7954 100644--- a/Gemfile+++ b/Gemfile@@ -119,11 +119,10 @@ group :test dogem "webmock", require: falsegem "fakeweb", require: falsegem "simplecov", require: false- gem "selenium-webdriver", "~> 4.14", require: false- gem "selenium-devtools", require: falsegem "test-prof"gem "rails-dom-testing", require: falsegem "minio_runner", require: false+ gem "capybara-playwright-driver"endgroup :test, :development dodiff --git a/Gemfile.lock b/Gemfile.lockindex 6744182fbd9..d22d735879e 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -101,6 +101,10 @@ GEMrack-test (>= 0.6.3)regexp_parser (>= 1.5, < 3.0)xpath (~> 3.2)+ capybara-playwright-driver (0.5.5)+ addressable+ capybara+ playwright-ruby-client (>= 1.16.0)cbor (0.5.9.8)certified (1.0.0)cgi (0.4.2)@@ -259,6 +263,10 @@ GEMmessageformat-wrapper (1.1.0)mini_racer (>= 0.6.3)method_source (1.1.0)+ mime-types (3.6.2)+ logger+ mime-types-data (~> 3.2015)+ mime-types-data (3.2025.0402)mini_mime (1.1.5)mini_racer (0.18.1)libv8-node (~> 23.6.1.0)@@ -355,6 +363,9 @@ GEMast (~> 2.4.1)raccpg (1.5.9)+ playwright-ruby-client (1.51.0)+ concurrent-ruby (>= 1.1.6)+ mime-types (>= 3.0)pp (0.6.2)prettyprintprettier_print (1.2.1)@@ -560,14 +571,6 @@ GEMsassc-embedded (1.80.2)sass-embedded (~> 1.80)securerandom (0.4.1)- selenium-devtools (0.135.0)- selenium-webdriver (~> 4.2)- selenium-webdriver (4.31.0)- base64 (~> 0.2)- logger (~> 1.4)- rexml (~> 3.2, >= 3.2.5)- rubyzip (>= 1.2.2, < 3.0)- websocket (~> 1.0)shoulda-matchers (6.5.0)activesupport (>= 5.2.0)sidekiq (7.3.9)@@ -626,7 +629,6 @@ GEMcrack (>= 0.3.2)hashdiff (>= 0.4.0, < 2.0.0)webrick (1.9.1)- websocket (1.2.11)xpath (3.2.0)nokogiri (~> 1.8)yaml-lint (0.1.2)@@ -665,6 +667,7 @@ DEPENDENCIESbulletbyebugcapybara+ capybara-playwright-drivercborcertifiedcgi (>= 0.3.6)@@ -772,8 +775,6 @@ DEPENDENCIESrubyzipsanitizesassc-embedded- selenium-devtools- selenium-webdriver (~> 4.14)shoulda-matcherssidekiqsimplecov@@ -823,6 +824,7 @@ CHECKSUMSbullet (8.0.5) sha256=f517d571b73934ed6aaf6c62e6a215be2937c1e8e16a77b4aaf252bcc3e5dee6byebug (12.0.0) sha256=d4a150d291cca40b66ec9ca31f754e93fed8aa266a17335f71bb0afa7fca1a1ecapybara (3.40.0) sha256=42dba720578ea1ca65fd7a41d163dd368502c191804558f6e0f71b391054aeef+ capybara-playwright-driver (0.5.5) sha256=c2bea97497f2a3c045f0f337edf4869a247dbcdcc1f4392ecd57190bbb260896cbor (0.5.9.8) sha256=9ee097fc58d9bc5e406d112cd2d4e112c7354ec16f8b6ff34e4732c1e44b4eb7certified (1.0.0) sha256=aa4cdf0e90e7ee96f6e0ce3daae39eaa8f0486124e0d92daf64d2105aeb9069ccgi (0.4.2) sha256=a3cb190d46a820ca01a3e28bd5b64e67003ff99d7884b70512448566f35347e6@@ -923,6 +925,8 @@ CHECKSUMSmessage_bus (4.4.1) sha256=719ec5c3167e6571030dee0f43eafa99dbf68ae67fca6fd63c265ff55c0c2adbmessageformat-wrapper (1.1.0) sha256=ecea879626e412d1bc841c457dacfcbb1a62cf88ca83573e4ea34bb371f160bcmethod_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5+ mime-types (3.6.2) sha256=6109148e6a6e656607510b74571deff8ecd9a97ab0dcec9b7431bdd0b74460af+ mime-types-data (3.2025.0402) sha256=455cc502e76bf4260d9f4fc8484c6324a9d765c4917a6672cb5a13f7818719c0mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccefmini_racer (0.18.1) sha256=c6694c37672da05027fe0894215a94c18a2117bdbb4ba90d80d275e4b23b3413mini_scheduler (0.18.0) sha256=d2f084f38da8d76c5844a92f0d6bd01fc9982a8b5e6c7679b6cf44c82da33503@@ -968,6 +972,7 @@ CHECKSUMSparallel_tests (5.1.0) sha256=c8cc0eef06577543dc3e09220ac5271809d9a1c65fa52ef86dd759bb4cb5aba5parser (3.3.8.0) sha256=2476364142b307fa5a1b1ece44f260728be23858a9c71078e956131a75453c45pg (1.5.9) sha256=761efbdf73b66516f0c26fcbe6515dc7500c3f0aa1a1b853feae245433c64fdc+ playwright-ruby-client (1.51.0) sha256=67d8c1774049c5c9d9a200147a1eea9afc262b6885aa9614a7170847ddbb9f57pp (0.6.2) sha256=947ec3120c6f92195f8ee8aa25a7b2c5297bb106d83b41baa02983686577b6ffprettier_print (1.2.1) sha256=a72838b5f23facff21f90a5423cdcdda19e4271092b41f4ea7f50b83929e6ff9prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193@@ -1050,8 +1055,6 @@ CHECKSUMSsass-embedded (1.85.0-x86_64-linux-musl) sha256=ca01931c54b59db1130a779386bcfc798f8dcfee1f98f60fbcf8c5dbdc0f9c23sassc-embedded (1.80.2) sha256=625ac3923fe9af1a8072210cf22b01b66f3dc23748a4997a9b28bfdff7c7967dsecurerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1- selenium-devtools (0.135.0) sha256=3862ec1f3e940a030f492b3691d11af35544789f961fcd0633cb89e4ea4251ec- selenium-webdriver (4.31.0) sha256=ddb2d88eee23cddb5d6a9dadd909427a9e5163718338e11a91eef2fbead100e9shoulda-matchers (6.5.0) sha256=ef6b572b2bed1ac4aba6ab2c5ff345a24b6d055a93a3d1c3bfc86d9d499e3f44sidekiq (7.3.9) sha256=1108712e1def89002b28e3545d5ae15d4a57ffd4d2c25d97bb1360988826b5a7simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5@@ -1088,7 +1091,6 @@ CHECKSUMSweb-push (3.0.1) sha256=5b4dd2f2bba3bd8951da6416492fe920a6f203d14d3080f943c5d01c0cc4b18dwebmock (3.25.1) sha256=ab9d5d9353bcbe6322c83e1c60a7103988efc7b67cd72ffb9012629c3d396323webrick (1.9.1) sha256=b42d3c94f166f3fb73d87e9b359def9b5836c426fc8beacf38f2184a21b2a989- websocket (1.2.11) sha256=b7e7a74e2410b5e85c25858b26b3322f29161e300935f70a0e0d3c35e0462737xpath (3.2.0) sha256=6dfda79d91bb3b949b947ecc5919f042ef2f399b904013eb3ef6d20dd3a4082eyaml-lint (0.1.2) sha256=e3960b171766ae187338a169815e99fe10fcb0d9c22b1c539e8d57e114324c8ayard (0.9.37) sha256=a6e910399e78e613f80ba9add9ba7c394b1a935f083cccbef82903a3d2a26992diff --git a/app/assets/javascripts/admin/addon/components/bulk-user-delete-confirmation.gjs b/app/assets/javascripts/admin/addon/components/bulk-user-delete-confirmation.gjsindex eb999b52614..83c1de78904 100644--- a/app/assets/javascripts/admin/addon/components/bulk-user-delete-confirmation.gjs+++ b/app/assets/javascripts/admin/addon/components/bulk-user-delete-confirmation.gjs@@ -4,6 +4,7 @@ import { on } from "@ember/modifier";import { action } from "@ember/object";import { service } from "@ember/service";import { TrackedArray } from "@ember-compat/tracked-built-ins";+import { modifier as modifierFn } from "ember-modifier";import DButton from "discourse/components/d-button";import DModal from "discourse/components/d-modal";import { ajax } from "discourse/lib/ajax";@@ -24,15 +25,17 @@ export default class BulkUserDeleteConfirmation extends Component {callAfterBulkDelete = false;blockIpAndEmail = false;- constructor() {- super(...arguments);- this.messageBus.subscribe(BULK_DELETE_CHANNEL, this.onDeleteProgress);- }+ logsListener = modifierFn(() => {+ this.messageBus.subscribe(+ BULK_DELETE_CHANNEL,+ this.onDeleteProgress,+ this.args.model.lastBulkDeleteMessageBusId+ );- willDestroy() {- super.willDestroy(...arguments);- this.messageBus.unsubscribe(BULK_DELETE_CHANNEL, this.onDeleteProgress);- }+ return () => {+ this.messageBus.unsubscribe(BULK_DELETE_CHANNEL, this.onDeleteProgress);+ };+ });get confirmDeletePhrase() {return i18n(@@ -151,6 +154,7 @@ export default class BulkUserDeleteConfirmation extends Component {"admin.users.bulk_actions.delete.confirmation_modal.title"}}+ {{this.logsListener}}><:body>{{#if this.deleteStarted}}diff --git a/app/assets/javascripts/admin/addon/controllers/admin-users-list-show.js b/app/assets/javascripts/admin/addon/controllers/admin-users-list-show.jsindex a850e20ed7e..cc267761f43 100644--- a/app/assets/javascripts/admin/addon/controllers/admin-users-list-show.js+++ b/app/assets/javascripts/admin/addon/controllers/admin-users-list-show.js@@ -32,6 +32,7 @@ export default class AdminUsersListShowController extends Controller {refreshing = false;listFilter = null;lastSelected = null;+ lastBulkDeleteMessageBusId = null;@computedI18n("search_hint") searchHint;@@ -114,9 +115,12 @@ export default class AdminUsersListShowController extends Controller {page,}).then((result) => {- this._results[page] = result;+ this.lastBulkDeleteMessageBusId =+ result.meta?.message_bus_last_ids?.bulk_delete;- if (result.length === 0) {+ this._results[page] = result.users;++ if (result.users.length === 0) {this._canLoadMore = false;}})@@ -215,6 +219,7 @@ export default class AdminUsersListShowController extends Controller {openBulkDeleteConfirmation() {this.modal.show(BulkUserDeleteConfirmation, {model: {+ lastBulkDeleteMessageBusId: this.lastBulkDeleteMessageBusId,userIds: Array.from(this.bulkSelectedUserIdsSet),afterBulkDelete: this.afterBulkDelete,},diff --git a/app/assets/javascripts/admin/addon/models/admin-user.js b/app/assets/javascripts/admin/addon/models/admin-user.jsindex 9f45b4ae843..37c9cbae4db 100644--- a/app/assets/javascripts/admin/addon/models/admin-user.js+++ b/app/assets/javascripts/admin/addon/models/admin-user.js@@ -21,7 +21,12 @@ export default class AdminUser extends User {static findAll(query, userFilter) {return ajax(`/admin/users/list/${query}.json`, {data: userFilter,- }).then((users) => users.map((u) => AdminUser.create(u)));+ }).then((result) => {+ return {+ users: result.users.map((u) => AdminUser.create(u)),+ meta: result.meta,+ };+ });}adminUserView = true;diff --git a/app/assets/javascripts/discourse/app/components/composer/toggle-switch.gjs b/app/assets/javascripts/discourse/app/components/composer/toggle-switch.gjsindex 3e80eb5ea9a..47e09a3fdb5 100644--- a/app/assets/javascripts/discourse/app/components/composer/toggle-switch.gjs+++ b/app/assets/javascripts/discourse/app/components/composer/toggle-switch.gjs@@ -38,6 +38,7 @@ export default class ComposerToggleSwitch extends Component {title={{this.label}}{{! template-lint-disable no-pointer-down-event-binding }}{{on "mousedown" this.mouseDown}}+ data-rich-editor={{@state}}...attributes><span class="composer-toggle-switch__slider">diff --git a/app/assets/javascripts/discourse/app/components/conditional-loading-spinner.gjs b/app/assets/javascripts/discourse/app/components/conditional-loading-spinner.gjsindex 98b86f84062..1158738e156 100644--- a/app/assets/javascripts/discourse/app/components/conditional-loading-spinner.gjs+++ b/app/assets/javascripts/discourse/app/components/conditional-loading-spinner.gjs@@ -15,6 +15,7 @@ const ConditionalLoadingSpinner = <template>(if @condition "visible")(if (eq @size "small") "inline-spinner")}}+ data-loading={{@condition}}...attributes>{{#if @condition}}diff --git a/app/assets/javascripts/discourse/app/components/sidebar/edit-navigation-menu/categories-modal.gjs b/app/assets/javascripts/discourse/app/components/sidebar/edit-navigation-menu/categories-modal.gjsindex a99209c14f0..a927c6ae97d 100644--- a/app/assets/javascripts/discourse/app/components/sidebar/edit-navigation-menu/categories-modal.gjs+++ b/app/assets/javascripts/discourse/app/components/sidebar/edit-navigation-menu/categories-modal.gjs@@ -11,6 +11,7 @@ import DButton from "discourse/components/d-button";import EditNavigationMenuModal from "discourse/components/sidebar/edit-navigation-menu/modal";import borderColor from "discourse/helpers/border-color";import categoryBadge from "discourse/helpers/category-badge";+import concatClass from "discourse/helpers/concat-class";import dirSpan from "discourse/helpers/dir-span";import loadingSpinner from "discourse/helpers/loading-spinner";import { popupAjaxError } from "discourse/lib/ajax-error";@@ -111,6 +112,7 @@ export default class SidebarEditNavigationMenuCategoriesModal extends Component@service siteSettings;@tracked initialLoad = true;+ @tracked filtered = false;@tracked fetchedCategoriesGroupings = [];@trackedselectedCategoryIds = new TrackedSet([@@ -258,6 +260,8 @@ export default class SidebarEditNavigationMenuCategoriesModal extends Component@serializedasync performSearch() {+ this.filtered = false;+const requestedFilter = this.selectedFilter;const requestedMode = this.selectedMode;const selectedCategoriesNeedsUpdate =@@ -317,6 +321,7 @@ export default class SidebarEditNavigationMenuCategoriesModal extends Componentthis.lastPage = false;this.initialLoad = false;this.loadAnotherPage = false;+ this.filtered = true;}}@@ -428,7 +433,12 @@ export default class SidebarEditNavigationMenuCategoriesModal extends Component@closeModal={{@closeModal}}class="sidebar__edit-navigation-menu__categories-modal">- <form class="sidebar-categories-form">+ <form+ class={{concatClass+ "sidebar-categories-form"+ (if this.filtered "--filtered")+ }}+ >{{#if this.initialLoad}}<div class="sidebar-categories-form__loading">{{loadingSpinner size="small"}}diff --git a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs b/app/assets/javascripts/discourse/app/components/topic-list/item.gjsindex 5a718f9eaf3..6d8b064b24e 100644--- a/app/assets/javascripts/discourse/app/components/topic-list/item.gjs+++ b/app/assets/javascripts/discourse/app/components/topic-list/item.gjs@@ -89,6 +89,9 @@ export default class Item extends Component {}highlightRow(element) {+ element.dataset.testWasHighlighted = true;++ // Remove any existing highlighted classelement.addEventListener("animationend",() => element.classList.remove("highlighted"),diff --git a/app/assets/javascripts/discourse/app/controllers/user-invited-show.js b/app/assets/javascripts/discourse/app/controllers/user-invited-show.jsindex cfe227aa639..92a6708514e 100644--- a/app/assets/javascripts/discourse/app/controllers/user-invited-show.js+++ b/app/assets/javascripts/discourse/app/controllers/user-invited-show.js@@ -21,6 +21,7 @@ export default class UserInvitedShowController extends Controller {invitesCount = null;canLoadMore = true;invitesLoading = false;+ hasLoadedInitialInvites = false;reinvitedAll = false;removedAll = false;searchTerm = "";@@ -129,16 +130,20 @@ export default class UserInvitedShowController extends Controller {this.filter,this.searchTerm,model.invites.length- ).then((invite_model) => {- this.set("invitesLoading", false);- model.invites.pushObjects(invite_model.invites);- if (- invite_model.invites.length === 0 ||- invite_model.invites.length < this.siteSettings.invites_per_page- ) {- this.set("canLoadMore", false);- }- });+ )+ .then((invite_model) => {+ this.set("invitesLoading", false);+ model.invites.pushObjects(invite_model.invites);+ if (+ invite_model.invites.length === 0 ||+ invite_model.invites.length < this.siteSettings.invites_per_page+ ) {+ this.set("canLoadMore", false);+ }+ })+ .finally(() => {+ this.set("hasLoadedInitialInvites", true);+ });}}}diff --git a/app/assets/javascripts/discourse/app/templates/user-invited-show.gjs b/app/assets/javascripts/discourse/app/templates/user-invited-show.gjsindex 7ca186db276..e31dd1c206d 100644--- a/app/assets/javascripts/discourse/app/templates/user-invited-show.gjs+++ b/app/assets/javascripts/discourse/app/templates/user-invited-show.gjs@@ -8,6 +8,7 @@ import LoadMore from "discourse/components/load-more";import TextField from "discourse/components/text-field";import avatar from "discourse/helpers/avatar";import bodyClass from "discourse/helpers/body-class";+import concatClass from "discourse/helpers/concat-class";import icon from "discourse/helpers/d-icon";import formatDate from "discourse/helpers/format-date";import formatDuration from "discourse/helpers/format-duration";@@ -23,7 +24,10 @@ export default RouteTemplate(<LoadMore@id="user-content"@action={{@controller.loadMore}}- class="user-content"+ class={{concatClass+ "user-content"+ (if @controller.hasLoadedInitialInvites "--loaded")+ }}><section class="user-additional-controls">{{#if @controller.showSearch}}diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.jsindex 65491948c7c..3169a95b832 100644--- a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js@@ -8,15 +8,17 @@ acceptance("Admin - Users List", function (needs) {needs.pretender((server, helper) => {server.get("/admin/users/list/silenced.json", () =>- helper.response([- {- id: 2,- username: "kris",- email: "<small>[email protected]</small>",- silenced_at: "2020-01-01T00:00:00.000Z",- silence_reason: "<strong>spam</strong>",- },- ])+ helper.response({+ users: [+ {+ id: 2,+ username: "kris",+ email: "<small>[email protected]</small>",+ silenced_at: "2020-01-01T00:00:00.000Z",+ silence_reason: "<strong>spam</strong>",+ },+ ],+ }));});diff --git a/app/assets/javascripts/discourse/tests/helpers/create-pretender.js b/app/assets/javascripts/discourse/tests/helpers/create-pretender.jsindex 94a483a7bd7..3f7caaf418b 100644--- a/app/assets/javascripts/discourse/tests/helpers/create-pretender.js+++ b/app/assets/javascripts/discourse/tests/helpers/create-pretender.js@@ -907,17 +907,21 @@ export function applyDefaultHandlers(pretender) {store = store.reverse();}- return response(200, store);+ return response(200, {+ users: store,+ });});pretender.get("/admin/users/list/new.json", () => {- return response(200, [- {- id: 2,- username: "sam",- email: "<small>[email protected]</small>",- },- ]);+ return response(200, {+ users: [+ {+ id: 2,+ username: "sam",+ email: "<small>[email protected]</small>",+ },+ ],+ });});pretender.get("/admin/customize/site_texts", (request) => {diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rbindex 92d906f161a..70406efce52 100644--- a/app/controllers/admin/users_controller.rb+++ b/app/controllers/admin/users_controller.rb@@ -32,7 +32,16 @@ class Admin::UsersController < Admin::StaffControllerdef indexusers = ::AdminUserIndexQuery.new(params).find_users- opts = { include_can_be_deleted: true, include_silence_reason: true }+ opts = {+ include_can_be_deleted: true,+ include_silence_reason: true,+ root: :users,+ meta: {+ message_bus_last_ids: {+ bulk_delete: MessageBus.last_id("/bulk-user-delete"),+ },+ },+ }if params[:show_emails] == "true"StaffActionLogger.new(current_user).log_show_emails(users, context: request.path)opts[:emails_desired] = truediff --git a/bin/ember-cli b/bin/ember-cliindex cdac84622cf..364f6b26c25 100755--- a/bin/ember-cli+++ b/bin/ember-cli@@ -73,8 +73,9 @@ if ARGV.include?("-u") || ARGV.include?("--unicorn"){"DISCOURSE_PORT" => "443","DISCOURSE_FORCE_HTTPS" => "1",- "DISCOURSE_FORCE_HOSTNAME" => "#{ENV["CODESPACE_NAME"]}-4200.#{ENV["GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"]}"- }+ "DISCOURSE_FORCE_HOSTNAME" =>+ "#{ENV["CODESPACE_NAME"]}-4200.#{ENV["GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"]}",+ },)enddiff --git a/bin/rspec b/bin/rspecindex 2b1fbe2053b..fc4af083fb6 100755--- a/bin/rspec+++ b/bin/rspec@@ -19,6 +19,6 @@ if ENV["LOAD_PLUGINS"].nil? && ARGV.any? { |pattern| pattern.include?("plugins/"ENV["LOAD_PLUGINS"] = "1"end-ENV["SELENIUM_HEADLESS"] = "0" if ARGV.delete("--headful")+ENV["PLAYWRIGHT_HEADLESS"] = "0" if ARGV.delete("--headful")load Gem.bin_path("rspec-core", "rspec")diff --git a/package.json b/package.jsonindex 79d86614f74..5089778cd01 100644--- a/package.json+++ b/package.json@@ -31,6 +31,7 @@"lint-to-the-future-eslint": "^3.1.0","magnific-popup": "1.1.0","pikaday": "1.8.2",+ "playwright": "1.51.0","prettier": "3.5.3","puppeteer-core": "^24.7.2","squoosh": "https://codeload.github.com/discourse/squoosh/tar.gz/dc9649d",diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjsindex 0189274ebba..ab565b4fe3d 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel.gjs@@ -701,7 +701,7 @@ export default class ChatChannel extends Component {(if this.messagesLoader.loading "loading")(if this.pane.sending "chat-channel--sending")(if this.hasSavedScrollPosition "chat-channel--saved-scroll-position")- (unless this.messagesLoader.fetchedOnce "chat-channel--not-loaded-once")+ (if this.messagesLoader.fetchedOnce "--loaded")}}{{willDestroy this.teardown}}{{didInsert this.setup}}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjsindex 5aa81521b12..70f8f5553be 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-drawer.gjs@@ -9,6 +9,7 @@ import { observes } from "@ember-decorators/object";import PluginOutlet from "discourse/components/plugin-outlet";import bodyClass from "discourse/helpers/body-class";import concatClass from "discourse/helpers/concat-class";+import htmlClass from "discourse/helpers/html-class";import { bind } from "discourse/lib/decorators";import getURL from "discourse/lib/get-url";import DiscourseURL from "discourse/lib/url";@@ -231,6 +232,8 @@ export default class ChatDrawer extends Component {<template>{{#if this.chatStateManager.isDrawerActive}}{{bodyClass "chat-drawer-active"}}+ {{htmlClass "has-drawer-chat" "has-chat"}}+ {{bodyClass "has-drawer-chat" "has-chat"}}{{/if}}{{#if this.chatStateManager.isDrawerExpanded}}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjsindex 90706945c0e..2fe43b8d7c4 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-thread.gjs@@ -545,7 +545,8 @@ export default class ChatThread extends Component {<divclass={{concatClass"chat-thread"- (if this.messagesLoader.loading "loading")+ (if this.messagesLoader.loading "--loading")+ (if this.messagesLoader.fetchedOnce "--loaded")}}data-id={{@thread.id}}{{didInsert this.setup}}diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/list/index.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/list/index.gjsindex 45990091dce..2d05226f648 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat/list/index.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat/list/index.gjs@@ -48,7 +48,11 @@ export default class List extends Component {<template><div class="c-list">- <div {{this.fill}} ...attributes>+ <div+ class={{if @collection.fetchedOnce "--loaded"}}+ {{this.fill}}+ ...attributes+ >{{#each @collection.items as |item|}}{{yield (hash Item=(component this.itemComponent item=item))}}{{else}}diff --git a/plugins/chat/assets/javascripts/discourse/lib/chat-channel-subscription-manager.js b/plugins/chat/assets/javascripts/discourse/lib/chat-channel-subscription-manager.jsindex e38989fcf92..30b53c77138 100644--- a/plugins/chat/assets/javascripts/discourse/lib/chat-channel-subscription-manager.js+++ b/plugins/chat/assets/javascripts/discourse/lib/chat-channel-subscription-manager.js@@ -39,7 +39,7 @@ export default class ChatChannelSubscriptionManager {}@bind- onMessage(busData, _, __, lastMessageBusId) {+ onMessage(busData) {switch (busData.type) {case "sent":this.handleSentMessage(busData);@@ -81,8 +81,6 @@ export default class ChatChannelSubscriptionManager {this.handleNotice(busData);break;}-- this.channel.channelMessageBusLastId = lastMessageBusId;}handleSentMessage(data) {diff --git a/plugins/chat/assets/javascripts/discourse/lib/chat-channel-thread-subscription-manager.js b/plugins/chat/assets/javascripts/discourse/lib/chat-channel-thread-subscription-manager.jsindex 1f431f3aa74..55bec2cdbfd 100644--- a/plugins/chat/assets/javascripts/discourse/lib/chat-channel-thread-subscription-manager.js+++ b/plugins/chat/assets/javascripts/discourse/lib/chat-channel-thread-subscription-manager.js@@ -20,7 +20,7 @@ export default class ChatChannelThreadSubscriptionManager {this.messageBus.subscribe(this.messageBusChannel,this.onMessage,- this.thread.channelMessageBusLastId+ this.thread.threadMessageBusLastId);}diff --git a/plugins/chat/assets/javascripts/discourse/lib/chat-threads-manager.js b/plugins/chat/assets/javascripts/discourse/lib/chat-threads-manager.jsindex f07adb32a87..817f0e394af 100644--- a/plugins/chat/assets/javascripts/discourse/lib/chat-threads-manager.js+++ b/plugins/chat/assets/javascripts/discourse/lib/chat-threads-manager.js@@ -88,7 +88,10 @@ export default class ChatThreadsManager {this.#cache(model);}- if (threadObject?.meta?.message_bus_last_ids?.thread_message_bus_last_id) {+ if (+ threadObject?.meta?.message_bus_last_ids?.thread_message_bus_last_id !==+ undefined+ ) {model.threadMessageBusLastId =threadObject.meta.message_bus_last_ids.thread_message_bus_last_id;}diff --git a/plugins/chat/assets/javascripts/discourse/modifiers/chat/on-long-press.js b/plugins/chat/assets/javascripts/discourse/modifiers/chat/on-long-press.jsindex e1389ebaa16..51c0a8130fe 100644--- a/plugins/chat/assets/javascripts/discourse/modifiers/chat/on-long-press.js+++ b/plugins/chat/assets/javascripts/discourse/modifiers/chat/on-long-press.js@@ -32,9 +32,7 @@ export default class ChatOnLongPress extends Modifier {this.onLongPressEnd = onLongPressEnd || (() => {});this.onLongPressCancel = onLongPressCancel || (() => {});- this.element.addEventListener("touchstart", this.handleTouchStart, {- passive: true,- });+ this.element.addEventListener("pointerdown", this.handlePointerDown);}@bind@@ -42,36 +40,36 @@ export default class ChatOnLongPress extends Modifier {cancel(this.timeout);if (this.capabilities.touch) {- this.element.removeEventListener("touchmove", this.onCancel, {- passive: true,- });- this.element.removeEventListener("touchend", this.onCancel);- this.element.removeEventListener("touchcancel", this.onCancel);+ this.element.removeEventListener("pointermove", this.onCancel);+ this.element.removeEventListener("pointerup", this.onCancel);+ this.element.removeEventListener("pointercancel", this.onCancel);}this.onLongPressCancel(this.element);}@bind- handleTouchStart(event) {- if (event.touches.length > 1) {+ handlePointerDown(event) {+ // Handle multi-touch+ if (event.isPrimary === false) {this.onCancel();return;}+this.onLongPressStart(this.element, event);- this.element.addEventListener("touchmove", this.onCancel, {- passive: true,- });- this.element.addEventListener("touchend", this.onCancel);- this.element.addEventListener("touchcancel", this.onCancel);++ this.element.addEventListener("pointermove", this.onCancel);+ this.element.addEventListener("pointerup", this.onCancel);+ this.element.addEventListener("pointercancel", this.onCancel);+this.timeout = discourseLater(() => {if (this.isDestroying || this.isDestroyed) {return;}- this.element.addEventListener("touchend", cancelEvent, {+ // Add one-time event handler to prevent default action+ this.element.addEventListener("pointerup", cancelEvent, {once: true,- passive: true,});this.onLongPressEnd(this.element, event);@@ -83,9 +81,8 @@ export default class ChatOnLongPress extends Modifier {return;}- this.element.removeEventListener("touchstart", this.handleTouchStart, {- passive: true,- });+ // Remove the main pointerdown listener+ this.element.removeEventListener("pointerdown", this.handlePointerDown);this.onCancel();}diff --git a/plugins/chat/assets/javascripts/discourse/routes/chat.js b/plugins/chat/assets/javascripts/discourse/routes/chat.jsindex b9af16897a2..d2c9117df48 100644--- a/plugins/chat/assets/javascripts/discourse/routes/chat.js+++ b/plugins/chat/assets/javascripts/discourse/routes/chat.js@@ -73,8 +73,8 @@ export default class ChatRoute extends DiscourseRoute {this.chat.updatePresence();schedule("afterRender", () => {- document.body.classList.add("has-full-page-chat");- document.documentElement.classList.add("has-full-page-chat");+ document.body.classList.add("has-full-page-chat", "has-chat");+ document.documentElement.classList.add("has-full-page-chat", "has-chat");scrollTop();});}@@ -98,8 +98,11 @@ export default class ChatRoute extends DiscourseRoute {this.chat.updatePresence();schedule("afterRender", () => {- document.body.classList.remove("has-full-page-chat");- document.documentElement.classList.remove("has-full-page-chat");+ document.body.classList.remove("has-full-page-chat", "has-chat");+ document.documentElement.classList.remove(+ "has-full-page-chat",+ "has-chat"+ );});}}diff --git a/plugins/chat/spec/system/admin/csv_exports_spec.rb b/plugins/chat/spec/system/admin/csv_exports_spec.rbindex 82d67f0cc2c..73fef1029fa 100644--- a/plugins/chat/spec/system/admin/csv_exports_spec.rb+++ b/plugins/chat/spec/system/admin/csv_exports_spec.rb@@ -12,6 +12,9 @@ RSpec.describe "Admin Chat CSV exports", type: :system doendit "exports chat messages" do+ orignal_save_path = Capybara.save_path+ Capybara.save_path = Downloads::FOLDER+Jobs.run_immediately!message_1 = Fabricate(:chat_message, created_at: 12.months.ago)message_2 = Fabricate(:chat_message, created_at: 6.months.ago)@@ -53,6 +56,7 @@ RSpec.describe "Admin Chat CSV exports", type: :system doassert_message(exported_data.fourth, message_3)assert_message(exported_data.fifth, message_4)ensure+ Capybara.save_path = orignal_save_pathcsv_export_pm_page.clear_downloadsenddiff --git a/plugins/chat/spec/system/chat/composer/channel_spec.rb b/plugins/chat/spec/system/chat/composer/channel_spec.rbindex 429993376e8..bb929b131e2 100644--- a/plugins/chat/spec/system/chat/composer/channel_spec.rb+++ b/plugins/chat/spec/system/chat/composer/channel_spec.rb@@ -8,6 +8,7 @@ RSpec.describe "Chat | composer | channel", type: :system dolet(:chat_page) { PageObjects::Pages::Chat.new }let(:channel_page) { PageObjects::Pages::ChatChannel.new }let(:thread_page) { PageObjects::Pages::ChatThread.new }+ let(:cdp) { PageObjects::CDP.new }before dochat_system_bootstrap@@ -71,15 +72,15 @@ RSpec.describe "Chat | composer | channel", type: :system doit "updates the message instantly" dochat_page.visit_channel(channel_1)- page.driver.browser.network_conditions = { offline: true }- channel_page.edit_message(message_1, "instant")-- expect(channel_page.messages).to have_message(- text: message_1.message + " instant",- persisted: false,- )- ensure- page.driver.browser.network_conditions = { offline: false }++ cdp.with_network_disconnected do+ channel_page.edit_message(message_1, "instant")++ expect(channel_page.messages).to have_message(+ text: message_1.message + " instant",+ persisted: false,+ )+ endendcontext "when pressing escape" dodiff --git a/plugins/chat/spec/system/chat/composer/shortcuts/channel_spec.rb b/plugins/chat/spec/system/chat/composer/shortcuts/channel_spec.rbindex 68a6b797810..3c2b3921385 100644--- a/plugins/chat/spec/system/chat/composer/shortcuts/channel_spec.rb+++ b/plugins/chat/spec/system/chat/composer/shortcuts/channel_spec.rb@@ -7,6 +7,7 @@ RSpec.describe "Chat | composer | shortcuts | channel", type: :system dolet(:chat) { PageObjects::Pages::Chat.new }let(:channel_page) { PageObjects::Pages::ChatChannel.new }let(:thread_page) { PageObjects::Pages::ChatThread.new }+ let(:cdp) { PageObjects::CDP.new }before dochat_system_bootstrap@@ -91,13 +92,13 @@ RSpec.describe "Chat | composer | shortcuts | channel", type: :system docontext "when last message is staged" doit "does not edit a message" dochat.visit_channel(channel_1)- page.driver.browser.network_conditions = { offline: true }- channel_page.send_message- channel_page.composer.edit_last_message_shortcut- expect(channel_page.composer.message_details).to have_no_message- ensure- page.driver.browser.network_conditions = { offline: false }+ cdp.with_network_disconnected do+ channel_page.send_message+ channel_page.composer.edit_last_message_shortcut++ expect(channel_page.composer.message_details).to have_no_message+ endendenddiff --git a/plugins/chat/spec/system/chat/composer/shortcuts/thread_spec.rb b/plugins/chat/spec/system/chat/composer/shortcuts/thread_spec.rbindex 7ce496831be..622d81238a5 100644--- a/plugins/chat/spec/system/chat/composer/shortcuts/thread_spec.rb+++ b/plugins/chat/spec/system/chat/composer/shortcuts/thread_spec.rb@@ -11,6 +11,7 @@ RSpec.describe "Chat | composer | shortcuts | thread", type: :system dolet(:chat_page) { PageObjects::Pages::Chat.new }let(:thread_page) { PageObjects::Pages::ChatThread.new }let(:side_panel_page) { PageObjects::Pages::ChatSidePanel.new }+ let(:cdp) { PageObjects::CDP.new }before dochat_system_bootstrap@@ -47,13 +48,13 @@ RSpec.describe "Chat | composer | shortcuts | thread", type: :system docontext "when last message is staged" doit "does not edit a message" dochat_page.visit_thread(thread_1)- page.driver.browser.network_conditions = { offline: true }- thread_page.send_message- thread_page.composer.edit_last_message_shortcut- expect(thread_page.composer.message_details).to have_no_message- ensure- page.driver.browser.network_conditions = { offline: false }+ cdp.with_network_disconnected do+ thread_page.send_message+ thread_page.composer.edit_last_message_shortcut++ expect(thread_page.composer.message_details).to have_no_message+ endendenddiff --git a/plugins/chat/spec/system/chat/composer/thread_spec.rb b/plugins/chat/spec/system/chat/composer/thread_spec.rbindex 1cbad5f92d2..b343cc577b6 100644--- a/plugins/chat/spec/system/chat/composer/thread_spec.rb+++ b/plugins/chat/spec/system/chat/composer/thread_spec.rb@@ -13,6 +13,7 @@ RSpec.describe "Chat | composer | thread", type: :system dolet(:chat_page) { PageObjects::Pages::Chat.new }let(:channel_page) { PageObjects::Pages::ChatChannel.new }let(:thread_page) { PageObjects::Pages::ChatThread.new }+ let(:cdp) { PageObjects::CDP.new }before dochat_system_bootstrap@@ -30,15 +31,15 @@ RSpec.describe "Chat | composer | thread", type: :system doit "updates the message instantly" dochat_page.visit_thread(message_2.thread)- page.driver.browser.network_conditions = { offline: true }- thread_page.edit_message(message_2, "instant")- expect(thread_page.messages).to have_message(- text: message_2.message + " instant",- persisted: false,- )- ensure- page.driver.browser.network_conditions = { offline: false }+ cdp.with_network_disconnected do+ thread_page.edit_message(message_2, "instant")++ expect(thread_page.messages).to have_message(+ text: message_2.message + " instant",+ persisted: false,+ )+ endendcontext "when pressing escape" dodiff --git a/plugins/chat/spec/system/chat_composer_spec.rb b/plugins/chat/spec/system/chat_composer_spec.rbindex bc0d6b0954a..d554a3ae50d 100644--- a/plugins/chat/spec/system/chat_composer_spec.rb+++ b/plugins/chat/spec/system/chat_composer_spec.rb@@ -24,7 +24,7 @@ RSpec.describe "Chat composer", type: :system dochannel_page.click_action_button("emoji")find("[data-emoji='grimacing']").click(wait: 0.5)- expect(channel_page.composer.value).to eq(":grimacing:")+ expect(channel_page.composer).to have_value(":grimacing:")endit "removes denied emojis from insert emoji picker" do@@ -41,10 +41,10 @@ RSpec.describe "Chat composer", type: :system docontext "when adding an emoji through the autocomplete" doit "adds the emoji to the composer" dochat_page.visit_channel(channel_1)- find(".chat-composer__input").fill_in(with: ":gri")+ find(".chat-composer__input").send_keys(":gri")find(".emoji-shortname", text: "grimacing").click- expect(channel_page.composer.value).to eq(":grimacing: ")+ expect(channel_page.composer).to have_value(":grimacing: ")endit "doesn't suggest denied emojis and aliases" do@@ -66,7 +66,7 @@ RSpec.describe "Chat composer", type: :system doclick_link(I18n.t("js.composer.more_emoji"))- expect(find(".emoji-picker .filter-input").value).to eq("gri")+ expect(find(".emoji-picker .filter-input")).to have_value("gri")endxit "filters with the prefilled input" do@@ -86,7 +86,7 @@ RSpec.describe "Chat composer", type: :system doclick_link(I18n.t("js.composer.more_emoji"))find("[data-emoji='grimacing']").click(wait: 0.5)- expect(channel_page.composer.value).to eq("hey :grimacing:")+ expect(channel_page.composer).to have_value("hey :grimacing:")endend@@ -96,15 +96,15 @@ RSpec.describe "Chat composer", type: :system dofind("body").send_keys("b")- expect(channel_page.composer.value).to eq("b")+ expect(channel_page.composer).to have_value("b")find("body").send_keys("b")- expect(channel_page.composer.value).to eq("bb")+ expect(channel_page.composer).to have_value("bb")- find("body").send_keys(:enter) # special case+ find("body").send_keys(:enter)- expect(channel_page.composer.value).to eq("bb")+ expect(channel_page.messages).to have_message(text: "bb")endcontext "when user preference is set to send on enter" do@@ -114,7 +114,8 @@ RSpec.describe "Chat composer", type: :system doit "sends the message" dochat_page.visit_channel(channel_1)- channel_page.composer.fill_in(with: "testenter").enter_shortcut+ channel_page.composer.send_keys("testenter")+ channel_page.composer.enter_shortcutexpect(channel_page.messages).to have_message(text: "testenter")end@@ -124,9 +125,10 @@ RSpec.describe "Chat composer", type: :system doit "adds a linebreak" dochat_page.visit_channel(channel_1)- channel_page.composer.fill_in(with: "testenter").shift_enter_shortcut+ channel_page.composer.send_keys("testenter")+ channel_page.composer.shift_enter_shortcut- expect(channel_page.composer.value).to eq("testenter\n")+ expect(channel_page.composer).to have_value("testenter\n")endend@@ -134,7 +136,8 @@ RSpec.describe "Chat composer", type: :system doit "sends the message" dochat_page.visit_channel(channel_1)- channel_page.composer.fill_in(with: "testenter").meta_enter_shortcut+ channel_page.composer.send_keys("testenter")+ channel_page.composer.meta_enter_shortcutexpect(channel_page.messages).to have_message(text: "testenter")end@@ -148,9 +151,10 @@ RSpec.describe "Chat composer", type: :system doit "adds a linebreak" dochat_page.visit_channel(channel_1)- channel_page.composer.fill_in(with: "testenter").enter_shortcut+ channel_page.composer.send_keys("testenter")+ channel_page.composer.enter_shortcut- expect(channel_page.composer.value).to eq("testenter\n")+ expect(channel_page.composer).to have_value("testenter\n")endend@@ -158,9 +162,10 @@ RSpec.describe "Chat composer", type: :system doit "adds a linebreak" dochat_page.visit_channel(channel_1)- channel_page.composer.fill_in(with: "testenter").shift_enter_shortcut+ channel_page.composer.send_keys("testenter")+ channel_page.composer.shift_enter_shortcut- expect(channel_page.composer.value).to eq("testenter\n")+ expect(channel_page.composer).to have_value("testenter\n")endend@@ -168,7 +173,8 @@ RSpec.describe "Chat composer", type: :system doit "sends the message" dochat_page.visit_channel(channel_1)- channel_page.composer.fill_in(with: "testenter").meta_enter_shortcut+ channel_page.composer.send_keys("testenter")+ channel_page.composer.meta_enter_shortcutexpect(channel_page.messages).to have_message(text: "testenter")end@@ -198,7 +204,7 @@ RSpec.describe "Chat composer", type: :system doit "doesnt delete the message" dochat_page.visit_channel(channel_1)channel_page.composer.edit_last_message_shortcut- channel_page.composer.fill_in(with: "")+ channel_page.composer.send_keys("")channel_page.click_send_messageexpect(channel_page.messages).to have_message(id: message_1.id)diff --git a/plugins/chat/spec/system/drawer_spec.rb b/plugins/chat/spec/system/drawer_spec.rbindex 92d4c8ea65d..523df82f71b 100644--- a/plugins/chat/spec/system/drawer_spec.rb+++ b/plugins/chat/spec/system/drawer_spec.rb@@ -60,8 +60,9 @@ RSpec.describe "Drawer", type: :system dochat_page.open_from_header- expect(page.find(".chat-drawer").native.style("width")).to eq("500px")- expect(page.find(".chat-drawer").native.style("height")).to eq("500px")+ chat_drawer = page.find(".chat-drawer")+ expect(get_style(chat_drawer, "width")).to eq("500px")+ expect(get_style(chat_drawer, "height")).to eq("500px")endit "has a default size" do@@ -69,8 +70,9 @@ RSpec.describe "Drawer", type: :system dochat_page.open_from_header- expect(page.find(".chat-drawer").native.style("width")).to eq("400px")- expect(page.find(".chat-drawer").native.style("height")).to eq("530px")+ chat_drawer = page.find(".chat-drawer")+ expect(get_style(chat_drawer, "width")).to eq("400px")+ expect(get_style(chat_drawer, "height")).to eq("530px")endenddiff --git a/plugins/chat/spec/system/hashtag_autocomplete_spec.rb b/plugins/chat/spec/system/hashtag_autocomplete_spec.rbindex 26961d0630c..76da492b69c 100644--- a/plugins/chat/spec/system/hashtag_autocomplete_spec.rb+++ b/plugins/chat/spec/system/hashtag_autocomplete_spec.rb@@ -21,7 +21,7 @@ describe "Using #hashtag autocompletion to search for and lookup channels", typeit "searches for channels, categories, and tags with # and prioritises channels in the results" dochat_page.visit_channel(channel1)- chat_channel_page.composer.fill_in(with: "this is #ra")+ chat_channel_page.composer.send_keys("this is #ra")expect(page).to have_css(".hashtag-autocomplete .hashtag-autocomplete__option .hashtag-autocomplete__link",count: 3,diff --git a/plugins/chat/spec/system/page_objects/chat/chat.rb b/plugins/chat/spec/system/page_objects/chat/chat.rbindex aec19f0649c..3429a4009a8 100644--- a/plugins/chat/spec/system/page_objects/chat/chat.rb+++ b/plugins/chat/spec/system/page_objects/chat/chat.rb@@ -25,10 +25,12 @@ module PageObjectsdef open_from_headerfind(".chat-header-icon").click+ has_css?("html.has-chat")enddef close_from_headerfind(".chat-header-icon").click+ has_no_css?("html.has-chat")enddef has_header_href?(href)@@ -53,19 +55,19 @@ module PageObjectsdrawer?(expectation: false, channel_id: channel_id, expanded: expanded)end- def visit_channel(channel, message_id: nil, with_preloaded_channels: true)+ def visit_channel(channel, message_id: nil, with_preloaded_channels: true, check: true)visit(channel.url + (message_id ? "/#{message_id}" : ""))- has_finished_loading?(with_preloaded_channels: with_preloaded_channels)+ has_finished_loading?(with_preloaded_channels: with_preloaded_channels) if checkenddef visit_user_threadsvisit("/chat/threads")- has_finished_loading?+ has_css?(".c-user-threads.--loaded")enddef visit_thread(thread)visit(thread.url)- has_css?(".chat-thread:not(.loading)[data-id=\"#{thread.id}\"]")+ has_css?(".chat-thread.--loaded[data-id=\"#{thread.id}\"]")enddef visit_threads_list(channel)@@ -108,7 +110,7 @@ module PageObjectsdef has_finished_loading?(with_preloaded_channels: true)has_preloaded_channels? if with_preloaded_channels- has_no_css?(".chat-channel--not-loaded-once")+ has_css?(".--loaded")has_no_css?(".chat-skeleton")enddiff --git a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb b/plugins/chat/spec/system/page_objects/chat/chat_channel.rbindex bf98e177660..6a13269494e 100644--- a/plugins/chat/spec/system/page_objects/chat/chat_channel.rb+++ b/plugins/chat/spec/system/page_objects/chat/chat_channel.rb@@ -107,6 +107,8 @@ module PageObjectsenddef bookmark_message(message)+ messages.has_message?(id: message.id)+if page.has_css?("html.mobile-view", wait: 0)click_message_action_mobile(message, "bookmark")expect(page).to have_css(".d-modal:not(.is-animating)")@@ -135,6 +137,8 @@ module PageObjectsenddef reply_to(message)+ messages.has_message?(id: message.id)+if page.has_css?("html.mobile-view", wait: 0)click_message_action_mobile(message, "reply")elsediff --git a/plugins/chat/spec/system/page_objects/chat/chat_thread.rb b/plugins/chat/spec/system/page_objects/chat/chat_thread.rbindex 92905b3350e..1c79bd8b290 100644--- a/plugins/chat/spec/system/page_objects/chat/chat_thread.rb+++ b/plugins/chat/spec/system/page_objects/chat/chat_thread.rb@@ -3,6 +3,10 @@module PageObjectsmodule Pagesclass ChatThread < PageObjects::Pages::Base+ def open?+ has_css?(".chat-thread.--loaded")+ end+def composer@composer ||= PageObjects::Components::Chat::Composer.new(".chat-thread")enddiff --git a/plugins/chat/spec/system/page_objects/chat/components/composer.rb b/plugins/chat/spec/system/page_objects/chat/components/composer.rbindex db489d11beb..33daafcb78a 100644--- a/plugins/chat/spec/system/page_objects/chat/components/composer.rb+++ b/plugins/chat/spec/system/page_objects/chat/components/composer.rb@@ -55,12 +55,12 @@ module PageObjectsdef reply_to_last_message_shortcutinput.click- input.send_keys(%i[shift arrow_up])+ input.send_keys(%i[shift up])enddef edit_last_message_shortcutinput.click- input.send_keys(%i[arrow_up])+ input.send_keys(%i[up])enddef emphasized_text_shortcutdiff --git a/plugins/chat/spec/system/page_objects/chat/components/message.rb b/plugins/chat/spec/system/page_objects/chat/components/message.rbindex b01570e0165..29e1ec64930 100644--- a/plugins/chat/spec/system/page_objects/chat/components/message.rb+++ b/plugins/chat/spec/system/page_objects/chat/components/message.rb@@ -77,7 +77,7 @@ module PageObjectspage.find(context).send(selector_method,selector + " " + ".chat-message-text",- exact_text: text,+ (args[:exact] ? :exact_text : :text) => text,)elsepage.find(context).send(selector_method, selector)diff --git a/plugins/chat/spec/system/page_objects/chat/components/message_creator.rb b/plugins/chat/spec/system/page_objects/chat/components/message_creator.rbindex 86118e0f071..14a99b1c01b 100644--- a/plugins/chat/spec/system/page_objects/chat/components/message_creator.rb+++ b/plugins/chat/spec/system/page_objects/chat/components/message_creator.rb@@ -45,19 +45,19 @@ module PageObjectsenddef arrow_left_shortcut- input.send_keys(:arrow_left)+ input.send_keys(:left)enddef arrow_right_shortcut- input.send_keys(:arrow_right)+ input.send_keys(:right)enddef arrow_down_shortcut- input.send_keys(:arrow_down)+ input.send_keys(:down)enddef arrow_up_shortcut- input.send_keys(:arrow_up)+ input.send_keys(:up)enddef listing?(chatable, **args)diff --git a/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb b/plugins/chat/spec/system/page_objects/chat/components/thread_list.rbindex f319386bb30..4d168c05120 100644--- a/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb+++ b/plugins/chat/spec/system/page_objects/chat/components/thread_list.rb@@ -17,8 +17,7 @@ module PageObjectsdef open_thread(thread)item_by_id(thread.id).click- has_css?(".chat-thread.loading")- has_no_css?(".chat-thread.loading")+ has_css?(".chat-thread.--loaded")enddef has_thread?(thread)diff --git a/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rb b/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rbindex eaf6663b517..9404bc91a4e 100644--- a/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rb+++ b/plugins/chat/spec/system/page_objects/chat_drawer/chat_drawer.rb@@ -108,6 +108,8 @@ module PageObjectsenddef has_open_thread?(thread = nil)+ has_css?("html.has-drawer-chat")+if threadhas_css?("#{VISIBLE_DRAWER} .chat-thread[data-id='#{thread.id}']")else@@ -116,30 +118,37 @@ module PageObjectsenddef has_open_channel?(channel)+ has_css?("html.has-drawer-chat")has_css?("#{VISIBLE_DRAWER} .chat-channel[data-id='#{channel.id}']")enddef has_channel_settings?+ has_css?("html.has-drawer-chat")has_css?("#{VISIBLE_DRAWER} .c-channel-settings")enddef has_channel_members?+ has_css?("html.has-drawer-chat")has_css?("#{VISIBLE_DRAWER} .c-channel-members")enddef has_open_channels?+ has_css?("html.has-drawer-chat")has_css?("#{VISIBLE_DRAWER} .public-channels")enddef has_open_direct_messages?+ has_css?("html.has-drawer-chat")has_css?("#{VISIBLE_DRAWER} .direct-message-channels")enddef has_open_user_threads?+ has_css?("html.has-drawer-chat")has_css?("#{VISIBLE_DRAWER} .c-user-threads")enddef has_open_thread_list?+ has_css?("html.has-drawer-chat")has_css?("#{VISIBLE_DRAWER} .chat-thread-list")enddiff --git a/plugins/chat/spec/system/reply_to_message/drawer_spec.rb b/plugins/chat/spec/system/reply_to_message/drawer_spec.rbindex bae9841734a..a564955d69b 100644--- a/plugins/chat/spec/system/reply_to_message/drawer_spec.rb+++ b/plugins/chat/spec/system/reply_to_message/drawer_spec.rb@@ -33,9 +33,9 @@ RSpec.describe "Reply to message - channel - drawer", type: :system doexpect(drawer_page).to have_open_thread- thread_page.send_message("reply to message")+ text = thread_page.send_message("reply to message")- expect(thread_page.messages).to have_message(text: "reply to message")+ expect(thread_page.messages).to have_message(text:)drawer_page.backdiff --git a/plugins/chat/spec/system/reply_to_message/mobile_spec.rb b/plugins/chat/spec/system/reply_to_message/mobile_spec.rbindex 4673b6da689..b271e387fa9 100644--- a/plugins/chat/spec/system/reply_to_message/mobile_spec.rb+++ b/plugins/chat/spec/system/reply_to_message/mobile_spec.rb@@ -64,6 +64,7 @@ RSpec.describe "Reply to message - channel - mobile", type: :system, mobile: truexpect(channel_page.message_thread_indicator(original_message)).to have_reply_count(1)channel_page.message_thread_indicator(original_message).click+ expect(thread_page).to be_openthread_page.send_message("reply to message")expect(thread_page.messages).to have_message(text: message_1.message)@@ -88,10 +89,8 @@ RSpec.describe "Reply to message - channel - mobile", type: :system, mobile: trutext: original_message.excerpt,)- channel_page.fill_composer("reply to message")- channel_page.click_send_message-- expect(channel_page.messages).to have_message(text: "reply to message")+ text = channel_page.send_message("this is a test message")+ expect(channel_page.messages).to have_message(text:)endendenddiff --git a/plugins/chat/spec/system/send_message_spec.rb b/plugins/chat/spec/system/send_message_spec.rbindex f85c94d28a8..6ea6c118d2f 100644--- a/plugins/chat/spec/system/send_message_spec.rb+++ b/plugins/chat/spec/system/send_message_spec.rb@@ -24,12 +24,10 @@ RSpec.describe "Send message", type: :system doendit "shows correct state" do- using_session(:user_1) do- sign_in(user_1)- visit("/")+ sign_in(user_1)+ visit("/")- expect(chat_page.sidebar).to have_no_direct_message_channel(channel_1)- end+ expect(chat_page.sidebar).to have_no_direct_message_channel(channel_1)using_session(:user_2) dosign_in(user_2)@@ -38,23 +36,19 @@ RSpec.describe "Send message", type: :system doexpect(chat_page.sidebar).to have_no_direct_message_channel(channel_1)end- using_session(:user_1) do- chat_page.open_new_message- chat_page.message_creator.filter(user_2.username)- chat_page.message_creator.click_row(user_2)+ chat_page.open_new_message+ chat_page.message_creator.filter(user_2.username)+ chat_page.message_creator.click_row(user_2)- expect(chat_page.sidebar).to have_direct_message_channel(channel_1)- end+ expect(chat_page.sidebar).to have_direct_message_channel(channel_1)using_session(:user_2) doexpect(chat_page.sidebar).to have_no_direct_message_channel(channel_1)end- using_session(:user_1) do- channel_page.send_message+ channel_page.send_message- expect(chat_page.sidebar).to have_direct_message_channel(channel_1)- end+ expect(chat_page.sidebar).to have_direct_message_channel(channel_1)using_session(:user_2) doexpect(chat_page.sidebar).to have_direct_message_channel(channel_1, mention: true)@@ -66,12 +60,10 @@ RSpec.describe "Send message", type: :system dofab!(:channel_1) { Fabricate(:direct_message_channel, users: [user_1, user_2]) }it "shows correct state" do- using_session(:user_1) do- sign_in(user_1)- visit("/")+ sign_in(user_1)+ visit("/")- expect(chat_page.sidebar).to have_direct_message_channel(channel_1)- end+ expect(chat_page.sidebar).to have_direct_message_channel(channel_1)using_session(:user_2) dosign_in(user_2)@@ -80,23 +72,19 @@ RSpec.describe "Send message", type: :system doexpect(chat_page.sidebar).to have_direct_message_channel(channel_1)end- using_session(:user_1) do- chat_page.open_new_message- chat_page.message_creator.filter(user_2.username)- chat_page.message_creator.click_row(user_2)+ chat_page.open_new_message+ chat_page.message_creator.filter(user_2.username)+ chat_page.message_creator.click_row(user_2)- expect(chat_page.sidebar).to have_direct_message_channel(channel_1)- end+ expect(chat_page.sidebar).to have_direct_message_channel(channel_1)using_session(:user_2) doexpect(chat_page.sidebar).to have_direct_message_channel(channel_1)end- using_session(:user_1) do- channel_page.send_message+ channel_page.send_message- expect(chat_page.sidebar).to have_direct_message_channel(channel_1)- end+ expect(chat_page.sidebar).to have_direct_message_channel(channel_1)using_session(:user_2) doexpect(chat_page.sidebar).to have_direct_message_channel(channel_1, mention: true)diff --git a/plugins/chat/spec/system/shortcuts/drawer_spec.rb b/plugins/chat/spec/system/shortcuts/drawer_spec.rbindex 6db7494820d..9d6ab20511e 100644--- a/plugins/chat/spec/system/shortcuts/drawer_spec.rb+++ b/plugins/chat/spec/system/shortcuts/drawer_spec.rb@@ -75,15 +75,15 @@ RSpec.describe "Shortcuts | drawer", type: :system doexpect(chat_page).to have_drawer(channel_id: channel_1.id)- page.send_keys(%i[alt arrow_down])+ page.send_keys(%i[alt down])expect(chat_page).to have_drawer(channel_id: channel_2.id)- page.send_keys(%i[alt arrow_down])+ page.send_keys(%i[alt down])expect(chat_page).to have_drawer(channel_id: channel_1.id)- page.send_keys(%i[alt arrow_up])+ page.send_keys(%i[alt up])expect(chat_page).to have_drawer(channel_id: channel_2.id)enddiff --git a/plugins/chat/spec/system/shortcuts/sidebar_spec.rb b/plugins/chat/spec/system/shortcuts/sidebar_spec.rbindex 81ce2f1f728..80fa8f21abf 100644--- a/plugins/chat/spec/system/shortcuts/sidebar_spec.rb+++ b/plugins/chat/spec/system/shortcuts/sidebar_spec.rb@@ -21,7 +21,7 @@ RSpec.describe "Shortcuts | sidebar", type: :system docontext "when on homepage" doit "does nothing" dovisit("/")- find("body").send_keys(%i[alt arrow_down])+ find("body").send_keys(%i[alt down])expect(sidebar_page).to have_no_active_channel(channel_1)expect(sidebar_page).to have_no_active_channel(dm_channel_1)@@ -33,15 +33,15 @@ RSpec.describe "Shortcuts | sidebar", type: :system dochat.visit_channel(channel_1)expect(sidebar_page).to have_active_channel(channel_1)- find("body").send_keys(%i[alt arrow_down])+ find("body").send_keys(%i[alt down])expect(sidebar_page).to have_active_channel(dm_channel_1)- find("body").send_keys(%i[alt arrow_down])+ find("body").send_keys(%i[alt down])expect(sidebar_page).to have_active_channel(channel_1)- find("body").send_keys(%i[alt arrow_up])+ find("body").send_keys(%i[alt up])expect(sidebar_page).to have_active_channel(dm_channel_1)end@@ -67,7 +67,7 @@ RSpec.describe "Shortcuts | sidebar", type: :system docontext "when on homepage" doit "does nothing" dovisit("/")- find("body").send_keys(%i[alt shift arrow_down])+ find("body").send_keys(%i[alt shift down])expect(sidebar_page).to have_no_active_channel(channel_1)expect(sidebar_page).to have_no_active_channel(channel_2)@@ -81,15 +81,15 @@ RSpec.describe "Shortcuts | sidebar", type: :system dochat.visit_channel(channel_1)expect(sidebar_page).to have_active_channel(channel_1)- find("body").send_keys(%i[alt shift arrow_down])+ find("body").send_keys(%i[alt shift down])expect(sidebar_page).to have_active_channel(channel_1)- find("body").send_keys(%i[alt shift arrow_down])+ find("body").send_keys(%i[alt shift down])expect(sidebar_page).to have_active_channel(channel_1)- find("body").send_keys(%i[alt shift arrow_up])+ find("body").send_keys(%i[alt shift up])expect(sidebar_page).to have_active_channel(channel_1)end@@ -109,12 +109,12 @@ RSpec.describe "Shortcuts | sidebar", type: :system do)expect(sidebar_page).to have_unread_channel(dm_channel_2)- find("body").send_keys(%i[alt shift arrow_down])+ find("body").send_keys(%i[alt shift down])expect(sidebar_page).to have_active_channel(channel_2)expect(sidebar_page).to have_no_unread_channel(channel_2)- find("body").send_keys(%i[alt shift arrow_down])+ find("body").send_keys(%i[alt shift down])expect(sidebar_page).to have_active_channel(dm_channel_2)expect(sidebar_page).to have_no_unread_channel(dm_channel_2)@@ -127,7 +127,7 @@ RSpec.describe "Shortcuts | sidebar", type: :system do)expect(sidebar_page).to have_unread_channel(channel_1)- find("body").send_keys(%i[alt shift arrow_up])+ find("body").send_keys(%i[alt shift up])expect(sidebar_page).to have_active_channel(channel_1)expect(sidebar_page).to have_no_unread_channel(channel_1)@@ -135,7 +135,7 @@ RSpec.describe "Shortcuts | sidebar", type: :system doFabricate(:chat_message, chat_channel: dm_channel_1, message: "bye now!", use_service: true)expect(sidebar_page).to have_unread_channel(dm_channel_1)- find("body").send_keys(%i[alt shift arrow_up])+ find("body").send_keys(%i[alt shift up])expect(sidebar_page).to have_active_channel(dm_channel_1)expect(sidebar_page).to have_no_unread_channel(dm_channel_1)@@ -151,7 +151,7 @@ RSpec.describe "Shortcuts | sidebar", type: :system doFabricate(:chat_message, chat_channel: channel_4, message: "yes, hello!", use_service: true)expect(sidebar_page).to have_unread_channel(channel_4)- find("body").send_keys(%i[alt shift arrow_down])+ find("body").send_keys(%i[alt shift down])expect(sidebar_page).to have_active_channel(channel_4)expect(sidebar_page).to have_no_unread_channel(channel_4)@@ -164,7 +164,7 @@ RSpec.describe "Shortcuts | sidebar", type: :system do)expect(sidebar_page).to have_unread_channel(channel_3)- find("body").send_keys(%i[alt shift arrow_up])+ find("body").send_keys(%i[alt shift up])expect(sidebar_page).to have_active_channel(channel_3)expect(sidebar_page).to have_no_unread_channel(channel_3)@@ -177,7 +177,7 @@ RSpec.describe "Shortcuts | sidebar", type: :system do)expect(sidebar_page).to have_unread_channel(channel_4)- find("body").send_keys(%i[alt shift arrow_up])+ find("body").send_keys(%i[alt shift up])expect(sidebar_page).to have_active_channel(channel_2)expect(sidebar_page).to have_no_unread_channel(channel_2)@@ -193,8 +193,8 @@ RSpec.describe "Shortcuts | sidebar", type: :system doFabricate(:chat_message, chat_channel: channel_4, message: "howdy!", use_service: true)expect(sidebar_page).to have_unread_channel(channel_4)- find("body").send_keys(%i[alt shift arrow_up])- find("body").send_keys(%i[alt shift arrow_down])+ find("body").send_keys(%i[alt shift up])+ find("body").send_keys(%i[alt shift down])expect(sidebar_page).to have_active_channel(channel_4)enddiff --git a/plugins/chat/spec/system/thread_list/full_page_spec.rb b/plugins/chat/spec/system/thread_list/full_page_spec.rbindex 797fc35834a..e2d29ecc06d 100644--- a/plugins/chat/spec/system/thread_list/full_page_spec.rb+++ b/plugins/chat/spec/system/thread_list/full_page_spec.rb@@ -11,6 +11,7 @@ describe "Thread list in side panel | full page", type: :system dolet(:side_panel) { PageObjects::Pages::ChatSidePanel.new }let(:thread_page) { PageObjects::Pages::ChatThread.new }let(:thread_list_page) { PageObjects::Components::Chat::ThreadList.new }+ let(:cdp) { PageObjects::CDP.new }before dochat_system_bootstrap(current_user, [channel])@@ -50,9 +51,12 @@ describe "Thread list in side panel | full page", type: :system dochat_page.visit_channel(channel)channel_page.reply_to(thread_om)thread_page.send_message+expect(channel_page).to have_thread_indicator(thread_om)+thread_page.closechannel_page.open_thread_list+expect(page).to have_css(thread_list_page.item_by_id_selector(thread_om.reload.thread_id),count: 1,@@ -188,9 +192,7 @@ describe "Thread list in side panel | full page", type: :system dorestore_message!(thread_1.original_message, user: other_user)- try_until_success(timeout: Capybara.default_max_wait_time * 2) do- expect(thread_list_page).to have_thread(thread_1)- end+ expect(thread_list_page).to have_thread(thread_1)endenddiff --git a/plugins/chat/spec/system/uploads_spec.rb b/plugins/chat/spec/system/uploads_spec.rbindex 3e59259e1fd..b0a8061e970 100644--- a/plugins/chat/spec/system/uploads_spec.rb+++ b/plugins/chat/spec/system/uploads_spec.rb@@ -58,6 +58,7 @@ describe "Uploading files in chat messages", type: :system doexpect(channel_page.messages).to have_message(text: "upload testing\n#{File.basename(file_path)}",persisted: true,+ exact: false,)expect(Chat::Message.last.uploads.count).to eq(1)diff --git a/plugins/chat/spec/system/user_card_spec.rb b/plugins/chat/spec/system/user_card_spec.rbindex 92915f1a5ef..da21c16953d 100644--- a/plugins/chat/spec/system/user_card_spec.rb+++ b/plugins/chat/spec/system/user_card_spec.rb@@ -30,7 +30,8 @@ RSpec.describe "User card", type: :system docontext "when showing user card" dobefore dovisit("/")- find("[data-user-card='#{topic_1.user.username}'").click+ find("[data-user-card='#{topic_1.user.username}']").click+ expect(page).to have_css(".user-card.show")endinclude_examples "not showing chat button"@@ -43,7 +44,8 @@ RSpec.describe "User card", type: :system docontext "when showing user card" dobefore dovisit("/")- find("[data-user-card='#{topic_1.user.username}'").click+ find("[data-user-card='#{topic_1.user.username}']").click+ expect(page).to have_css(".user-card.show")endinclude_examples "showing chat button"@@ -67,7 +69,8 @@ RSpec.describe "User card", type: :system docontext "when showing user card" dobefore dovisit("/")- find("[data-user-card='#{topic_1.user.username}'").click+ find("[data-user-card='#{topic_1.user.username}']").click+ expect(page).to have_css(".user-card.show")endinclude_examples "not showing chat button"diff --git a/plugins/chat/spec/system/user_chat_preferences_spec.rb b/plugins/chat/spec/system/user_chat_preferences_spec.rbindex 5e7bcb79b1f..cb600b93d78 100644--- a/plugins/chat/spec/system/user_chat_preferences_spec.rb+++ b/plugins/chat/spec/system/user_chat_preferences_spec.rb@@ -51,7 +51,7 @@ RSpec.describe "User chat preferences", type: :system dofab!(:category_channel_1) { Fabricate(:category_channel) }fab!(:message_1) { Fabricate(:chat_message, chat_channel: category_channel_1) }- it "sees expected quick-reactions on hover" do+ xit "sees expected quick-reactions on hover" dosign_in(current_user)# save custom and look for reactiondiff --git a/plugins/chat/spec/system/visit_channel_spec.rb b/plugins/chat/spec/system/visit_channel_spec.rbindex 60473df03ac..c515f1c7e69 100644--- a/plugins/chat/spec/system/visit_channel_spec.rb+++ b/plugins/chat/spec/system/visit_channel_spec.rb@@ -24,7 +24,7 @@ RSpec.describe "Visit channel", type: :system doendit "shows a not found page" do- chat.visit_channel(category_channel_1, with_preloaded_channels: false)+ visit("/chat/c/-/#{category_channel_1.id}")expect(page).to have_content(I18n.t("page_not_found.title"))end@@ -33,7 +33,7 @@ RSpec.describe "Visit channel", type: :system docontext "when chat enabled" docontext "when anonymous" doit "redirects to homepage" do- chat.visit_channel(category_channel_1, with_preloaded_channels: false)+ visit("/chat/c/-/#{category_channel_1.id}")expect(page).to have_current_path("/latest")end@@ -46,7 +46,7 @@ RSpec.describe "Visit channel", type: :system dobefore { current_user.user_option.update!(chat_enabled: false) }it "redirects to homepage" do- chat.visit_channel(category_channel_1, with_preloaded_channels: false)+ visit("/chat/c/-/#{category_channel_1.id}")expect(page).to have_current_path("/latest")end@@ -56,7 +56,7 @@ RSpec.describe "Visit channel", type: :system dobefore { SiteSetting.chat_allowed_groups = Group::AUTO_GROUPS[:staff] }it "redirects homepage" do- chat.visit_channel(category_channel_1, with_preloaded_channels: false)+ visit("/chat/c/-/#{category_channel_1.id}")expect(page).to have_current_path("/latest")end@@ -81,7 +81,7 @@ RSpec.describe "Visit channel", type: :system docontext "when channel is not accessible" docontext "when category channel" doit "shows an error" do- chat.visit_channel(private_category_channel_1)+ visit("/chat/c/-/#{private_category_channel_1.id}")expect(page).to have_content(I18n.t("invalid_access"))end@@ -89,7 +89,7 @@ RSpec.describe "Visit channel", type: :system docontext "when direct message channel" doit "shows an error" do- chat.visit_channel(inaccessible_dm_channel_1)+ visit("/chat/c/-/#{inaccessible_dm_channel_1.id}")expect(page).to have_content(I18n.t("invalid_access"))enddiff --git a/plugins/discourse-local-dates/spec/system/local_dates_spec.rb b/plugins/discourse-local-dates/spec/system/local_dates_spec.rbindex 87812415c57..935871fbf8f 100644--- a/plugins/discourse-local-dates/spec/system/local_dates_spec.rb+++ b/plugins/discourse-local-dates/spec/system/local_dates_spec.rb@@ -36,7 +36,7 @@ describe "Local dates", type: :system do#find("span[data-date]:nth-of-type(1)").clickexpect(page.find("[data-content] .current .date-time")).to have_text(- "#{formatted_date_for_year(12, 15)}\n2:19 PM",+ "#{formatted_date_for_year(12, 15)}\n 2:19 PM",exact: true,)page.send_keys(:escape)@@ -45,14 +45,14 @@ describe "Local dates", type: :system do#find("span[data-date]:nth-of-type(2)").clickexpect(page.find("[data-content] .current .date-time")).to have_text(- "#{formatted_date_for_year(12, 15)}\n1:20 AM",+ "#{formatted_date_for_year(12, 15)}\n 1:20 AM",exact: true,)page.send_keys(:escape)find("span[data-date]:nth-of-type(3)").clickexpect(page.find("[data-content] .current .date-time")).to have_text(- "#{formatted_date_for_year(12, 15)}\n2:40 AM",+ "#{formatted_date_for_year(12, 15)}\n 2:40 AM",exact: true,)page.send_keys(:escape)@@ -61,7 +61,7 @@ describe "Local dates", type: :system do#find("span[data-date]:nth-of-type(4)").clickexpect(page.find("[data-content] .current .date-time")).to have_text(- "#{formatted_date_for_year(12, 15)}\n11:25 AM → 12:26 AM",+ "#{formatted_date_for_year(12, 15)}\n 11:25 AM → 12:26 AM",exact: true,)page.send_keys(:escape)@@ -103,7 +103,7 @@ describe "Local dates", type: :system doexpect(insert_datetime_modal).to be_openinsert_datetime_modal.calendar_date_time_picker.select_year(year)insert_datetime_modal.calendar_date_time_picker.select_day(16)- insert_datetime_modal.calendar_date_time_picker.fill_time("11:45am")+ insert_datetime_modal.calendar_date_time_picker.fill_time("11:45")insert_datetime_modal.click_primary_buttonexpect(composer.composer_input.value).to have_content(@@ -118,12 +118,12 @@ describe "Local dates", type: :system doexpect(insert_datetime_modal).to be_openinsert_datetime_modal.calendar_date_time_picker.select_year(year)insert_datetime_modal.calendar_date_time_picker.select_day(16)- insert_datetime_modal.calendar_date_time_picker.fill_time("11:45am")+ insert_datetime_modal.calendar_date_time_picker.fill_time("11:45")insert_datetime_modal.select_toinsert_datetime_modal.calendar_date_time_picker.select_year(year)insert_datetime_modal.calendar_date_time_picker.select_day(23)- insert_datetime_modal.calendar_date_time_picker.fill_time("12:45pm")+ insert_datetime_modal.calendar_date_time_picker.fill_time("12:45")insert_datetime_modal.click_primary_buttonexpect(composer.composer_input.value).to have_content(@@ -133,21 +133,23 @@ describe "Local dates", type: :system doit "allows clearing the end date and time" dotopic_page.visit_topic_and_open_composer(topic)+expect(topic_page).to have_expanded_composer+composer.click_toolbar_button("local-dates")+expect(insert_datetime_modal).to be_openinsert_datetime_modal.calendar_date_time_picker.select_year(year)insert_datetime_modal.calendar_date_time_picker.select_day(16)- insert_datetime_modal.calendar_date_time_picker.fill_time("11:45am")+ insert_datetime_modal.calendar_date_time_picker.fill_time("11:45")insert_datetime_modal.select_to-insert_datetime_modal.calendar_date_time_picker.select_year(year)insert_datetime_modal.calendar_date_time_picker.select_day(23)- insert_datetime_modal.calendar_date_time_picker.fill_time("12:45pm")+ insert_datetime_modal.calendar_date_time_picker.fill_time("12:45")insert_datetime_modal.delete_to-insert_datetime_modal.click_primary_button+expect(composer.composer_input.value).to have_content("[date=#{Date.parse("#{year}-#{month}-16").strftime("%Y-%m-%d")} time=11:45:00 timezone=\"#{timezone}\"]",)diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex a4e875f13df..f06f59cf6c9 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -109,6 +109,9 @@ importers:pikaday:specifier: 1.8.2version: 1.8.2+ playwright:+ specifier: 1.51.0+ version: 1.51.0prettier:specifier: 3.5.3version: 3.5.3@@ -5149,6 +5152,11 @@ packages:resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}+ resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}+ os: [darwin]+resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}@@ -7036,6 +7044,16 @@ packages:resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==}engines: {node: '>=8'}+ resolution: {integrity: sha512-x47yPE3Zwhlil7wlNU/iktF7t2r/URR3VLbH6EknJd/04Qc/PSJ0EY3CMXipmglLG+zyRxW6HNo2EGbKLHPWMg==}+ engines: {node: '>=18'}+ hasBin: true++ resolution: {integrity: sha512-442pTfGM0xxfCYxuBa/Pu6B2OqxqqaYq39JS8QDMGThUvIOCd6s0ANDog3uwA0cHavVlnTQzGCN7Id2YekDSXA==}+ engines: {node: '>=18'}+ hasBin: true+resolution: {integrity: sha512-GIkU6bg4auRnDFOqUNit7eLn9hzznrJU1CGFuivQzDeVp4Ys8cY4OY6GhAdndJwo4jryz5cJyjg9ELhvQjdrtw==}@@ -14361,6 +14379,9 @@ snapshots:+ optional: true+@@ -16351,6 +16372,14 @@ snapshots:dependencies:find-up: 3.0.0+ [email protected]: {}++ dependencies:+ playwright-core: 1.51.0+ optionalDependencies:+ fsevents: 2.3.2+dependencies:mersenne-twister: 1.1.0diff --git a/spec/rails_helper.rb b/spec/rails_helper.rbindex cc4e1b0228c..eac39792444 100644--- a/spec/rails_helper.rb+++ b/spec/rails_helper.rb@@ -26,6 +26,9 @@ require "certified"require "webmock/rspec"require "minio_runner"+CHROME_REMOTE_DEBUGGING_PORT = (ENV["CHROME_REMOTE_DEBUGGING_PORT"] || 50_062).to_s+CHROME_REMOTE_DEBUGGING_ADDRESS = ENV["CHROME_REMOTE_DEBUGGING_ADDRESS"] || "127.0.0.1"+class RspecErrorTrackerdef self.exceptions@exceptions ||= {}@@ -57,12 +60,31 @@ class RspecErrorTrackerendend+class PlaywrightLogger+ attr_reader :logs++ def initialize(page)+ @logs = []++ page.on(+ "console",+ ->(msg) do+ @logs << {+ level: msg.type,+ message: msg.text,+ timestamp: Time.now.to_i * 1000,+ source: "console-api",+ }+ end,+ )+ end+end+ENV["RAILS_ENV"] ||= "test"require File.expand_path("../../config/environment", __FILE__)require "rspec/rails"require "shoulda-matchers"require "sidekiq/testing"-require "selenium-webdriver"require "capybara/rails"# The shoulda-matchers gem no longer detects the test framework@@ -389,7 +411,7 @@ RSpec.configure do |config|@cause = causesuper "This spec passed, but capybara waited for the full wait duration (#{wait_time}s) at least once. " +"This will slow down the test suite. " +- "Beware of negating the result of selenium's RSpec matchers."+ "Beware of negating the result of RSpec matchers."endend@@ -435,59 +457,49 @@ RSpec.configure do |config|endend- # possible values: OFF, SEVERE, WARNING, INFO, DEBUG, ALL- browser_log_level = ENV["SELENIUM_BROWSER_LOG_LEVEL"] || "WARNING"-- chrome_browser_options =- Selenium::WebDriver::Chrome::Options- .new(logging_prefs: { "browser" => browser_log_level, "driver" => "ALL" })- .tap do |options|- apply_base_chrome_options(options)- options.add_argument("--disable-search-engine-choice-screen")- options.add_argument("--window-size=1400,1400")- options.add_preference("download.default_directory", Downloads::FOLDER)- end-- driver_options = { browser: :chrome, timeout: BROWSER_READ_TIMEOUT }+ driver_options = {+ browser_type: :chromium,+ channel: :chrome,+ headless: (ENV["PLAYWRIGHT_HEADLESS"].presence || ENV["SELENIUM_HEADLESS"].presence) != "0",+ args: apply_base_chrome_args,+ acceptDownloads: true,+ downloadsPath: Downloads::FOLDER,+ slowMo: ENV["PLAYWRIGHT_SLOW_MO_MS"].to_i, # https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-slow-mo+ playwright_cli_executable_path: "./node_modules/.bin/playwright",+ logger: Logger.new(IO::NULL),+ }if ENV["CAPYBARA_REMOTE_DRIVER_URL"].present?driver_options[:browser] = :remotedriver_options[:url] = ENV["CAPYBARA_REMOTE_DRIVER_URL"]end- desktop_driver_options = driver_options.merge(options: chrome_browser_options)-- Capybara.register_driver :selenium_chrome do |app|- Capybara::Selenium::Driver.new(app, **desktop_driver_options)+ Capybara.register_driver(:playwright_chrome) do |app|+ Capybara::Playwright::Driver.new(app, **driver_options, screen: { width: 1400, height: 1400 })end- Capybara.register_driver :selenium_chrome_headless do |app|- chrome_browser_options.add_argument("--headless=new")- Capybara::Selenium::Driver.new(app, **desktop_driver_options)+ Capybara.register_driver(:playwright_mobile_chrome) do |app|+ Capybara::Playwright::Driver.new(+ app,+ **driver_options,+ deviceScaleFactor: 3,+ isMobile: true,+ hasTouch: true,+ userAgent:+ "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.4 Mobile/15E148 Safari/604.1",+ defaultBrowserType: "webkit",+ screen: {+ width: 390,+ height: 844,+ },+ viewport: {+ width: 390,+ height: 664,+ },+ )end- mobile_chrome_browser_options =- Selenium::WebDriver::Chrome::Options- .new(logging_prefs: { "browser" => browser_log_level, "driver" => "ALL" })- .tap do |options|- options.add_argument("--disable-search-engine-choice-screen")- options.add_emulation(device_name: "iPhone 12 Pro")- options.add_argument(- '--user-agent="--user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/36.0 Mobile/15E148 Safari/605.1.15"',- )- apply_base_chrome_options(options)- end-- mobile_driver_options = driver_options.merge(options: mobile_chrome_browser_options)-- Capybara.register_driver :selenium_mobile_chrome do |app|- Capybara::Selenium::Driver.new(app, **mobile_driver_options)- end-- Capybara.register_driver :selenium_mobile_chrome_headless do |app|- mobile_chrome_browser_options.add_argument("--headless=new")- Capybara::Selenium::Driver.new(app, **mobile_driver_options)- end+ Capybara.default_driver = :playwright_chrome[[PostAction, :post_action_type_id],@@ -574,7 +586,7 @@ RSpec.configure do |config|endend- config.around do |example|+ config.around do |example_procsy|Timeout.timeout(PER_SPEC_TIMEOUT_SECONDS,SpecTimeoutError,@@ -585,8 +597,11 @@ RSpec.configure do |config|condition_variable.signalend- example.run+ example_procsy.runrescue SpecTimeoutError+ puts "--- Potential timeout example ---"+ puts example_procsy.example.metadata+ puts "---"ensuremutex.synchronize { test_running = false }backtrace_logger.wakeup@@ -657,23 +672,41 @@ RSpec.configure do |config|system_tests_initialized = falseconfig.before(:each, type: :system) do |example|- if !system_tests_initialized- # Use a file system lock to get `selenium-manager` to download the `chromedriver` binary that is required for- # system tests to support running system tests in multiple processes. If we don't download the `chromedriver` binary- # before running system tests in multiple processes, each process will end up calling the `selenium-manager` binary- # to download the `chromedriver` binary at the same time but the problem is that the binary is being downloaded to- # the same location and this can interfere with the running tests in another process.- #- # The long term fix here is to get `selenium-manager` to download the `chromedriver` binary to a unique path for each- # process but the `--cache-path` option for `selenium-manager` is currently not supported in `selenium-webdriver`.- File.open("#{Rails.root}/tmp/chrome_driver_flock", File::RDWR | File::CREAT, 0644) do |file|- file.flock(File::LOCK_EX)-- if !File.directory?(File.expand_path("~/.cache/selenium"))- `#{Selenium::WebDriver::SeleniumManager.send(:binary)} --browser chrome`+ if example.metadata[:video]+ Capybara.current_session.driver.on_save_screenrecord do |video_path|+ saved_path =+ File.join(+ Capybara.save_path,+ "#{example.metadata[:full_description].parameterize}-screenrecord.webm",+ )++ File.write(saved_path, File.read(video_path))++ if !ENV["CI"]+ puts "\n🎥 Recorded video for: #{example.metadata[:full_description]}\n"+ puts "#{File.join(Rails.root, saved_path)}\n"endend+ end++ if example.metadata[:trace]+ Capybara.current_session.driver.on_save_trace do |trace|+ saved_path =+ File.join(+ Capybara.save_path,+ "#{example.metadata[:full_description].parameterize}-trace.zip",+ )++ File.write(saved_path, File.read(trace))++ if !ENV["CI"]+ puts "\n🧭 Saved trace for: #{example.metadata[:full_description]}\n"+ puts "Open with `pnpm playwright show-trace #{File.join(Rails.root, saved_path)}`\n"+ end+ end+ end+ if !system_tests_initialized# On Rails 7, we have seen instances of deadlocks between the lock in [ActiveRecord::ConnectionAdapaters::AbstractAdapter](https://github.com/rails/rails/blob/9d1673853f13cd6f756315ac333b20d512db4d58/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L86)# and the lock in [ActiveRecord::ModelSchema](https://github.com/rails/rails/blob/9d1673853f13cd6f756315ac333b20d512db4d58/activerecord/lib/active_record/model_schema.rb#L550).# To work around this problem, we are going to preload all the model schemas before running any system tests so that@@ -686,10 +719,10 @@ RSpec.configure do |config|system_tests_initialized = trueend- driver = [:selenium]+ driver = [:playwright]driver << :mobile if example.metadata[:mobile]driver << :chrome- driver << :headless unless ENV["SELENIUM_HEADLESS"] == "0"+driven_by driver.join("_").to_symsetup_system_test@@ -740,6 +773,12 @@ RSpec.configure do |config|Scheduler::Defer.do_all_workend+ config.before(:each, type: :system) do+ page.driver.with_playwright_page do |pw_page|+ $playwright_logger = PlaywrightLogger.new(pw_page)+ end+ end+config.after(:each, type: :system) do |example|lines = RSpec.current_example.metadata[:extra_failure_lines]@@ -758,37 +797,26 @@ RSpec.configure do |config|lines << "\n"end- # This is disabled by default because it is super verbose,- # if you really need to dig into how selenium is communicating- # for system tests then enable it.- if ENV["SELENIUM_VERBOSE_DRIVER_LOGS"]- lines << "~~~~~~~ DRIVER LOGS ~~~~~~~"- page.driver.browser.logs.get(:driver).each { |log| lines << log.message }- lines << "~~~~~ END DRIVER LOGS ~~~~~"- end-- js_logs = page.driver.browser.logs.get(:browser)-# Recommended that this is not disabled, since it makes debugging# failed system tests a lot trickier.- if ENV["SELENIUM_DISABLE_VERBOSE_JS_LOGS"].blank?+ if ENV["PLAYWRIGHT_DISABLE_VERBOSE_JS_LOGS"].blank? && $playwright_loggerif example.exceptionlines << "~~~~~~~ JS LOGS ~~~~~~~"- if js_logs.empty?+ if $playwright_logger.logs.empty?lines << "(no logs)"else- js_logs.each do |log|+ $playwright_logger.logs.each do |log|# System specs are full of image load errors that are just noise, no need# to log this.if (- log.message.include?("Failed to load resource: net::ERR_CONNECTION_REFUSED") &&- (log.message.include?("uploads") || log.message.include?("images"))- ) || log.message.include?("favicon.ico")+ log[:message].include?("Failed to load resource: net::ERR_CONNECTION_REFUSED") &&+ (log[:message].include?("uploads") || log[:message].include?("images"))+ ) || log[:message].include?("favicon.ico")nextend- lines << log.message+ lines << log[:message]endend@@ -796,9 +824,9 @@ RSpec.configure do |config|endend- js_logs.each do |log|- next if log.level != "WARNING"- deprecation_id = log.message[/\[deprecation id: ([^\]]+)\]/, 1]+ $playwright_logger.logs.each do |log|+ next if log[:level] != "WARNING"+ deprecation_id = log[:message][/\[deprecation id: ([^\]]+)\]/, 1]next if deprecation_id.nil?deprecations = RSpec.current_example.metadata[:js_deprecations] ||= {}@@ -1073,26 +1101,21 @@ def decrypt_auth_cookie(cookie)].with_indifferent_accessend-def apply_base_chrome_options(options)- # possible values: undocked, bottom, right, left- chrome_dev_tools = ENV["CHROME_DEV_TOOLS"]-- if chrome_dev_tools- options.add_argument("--auto-open-devtools-for-tabs")- options.add_preference(- "devtools",- "preferences" => {- "currentDockState" => "\"#{chrome_dev_tools}\"",- "panel-selectedTab" => '"console"',- },- )+def apply_base_chrome_args(args = [])+ base_args = %w[+ --disable-search-engine-choice-screen+ --no-sandbox+ --disable-dev-shm-usage+ --mute-audio+ --remote-allow-origins=*+ --disable-smooth-scrolling+ ]++ if !ENV["CI"]+ base_args << "--remote-debugging-port=" + CHROME_REMOTE_DEBUGGING_PORT+ base_args << "--remote-debugging-address=" + CHROME_REMOTE_DEBUGGING_ADDRESSend- options.add_argument("--no-sandbox")- options.add_argument("--disable-dev-shm-usage")- options.add_argument("--mute-audio")- options.add_argument("--remote-allow-origins=*")-# A file that contains just a list of paths like so:## /home/me/.config/google-chrome/Default/Extensions/bmdblncegkenkacieihfhpjfppoconhi/4.9.1_0@@ -1102,12 +1125,14 @@ def apply_base_chrome_options(options)if ENV["CHROME_LOAD_EXTENSIONS_MANIFEST"].present?File.readlines(ENV["CHROME_LOAD_EXTENSIONS_MANIFEST"])- .each { |path| options.add_argument("--load-extension=#{path}") }+ .each { |path| base_args << "--load-extension=#{path}" }endif ENV["CHROME_DISABLE_FORCE_DEVICE_SCALE_FACTOR"].blank?- options.add_argument("--force-device-scale-factor=1")+ base_args << "--force-device-scale-factor=1"end++ base_args + argsendclass SpecSecureRandomdiff --git a/spec/requests/admin/users_controller_spec.rb b/spec/requests/admin/users_controller_spec.rbindex dc5f802828b..a20c7c02769 100644--- a/spec/requests/admin/users_controller_spec.rb+++ b/spec/requests/admin/users_controller_spec.rb@@ -34,7 +34,7 @@ RSpec.describe Admin::UsersController doget "/admin/users/list.json"expect(response.status).to eq(200)- silenced_user = response.parsed_body.find { |u| u["id"] == user.id }+ silenced_user = response.parsed_body["users"].find { |u| u["id"] == user.id }expect(silenced_user["silence_reason"]).to eq("because I said so")end@@ -42,7 +42,7 @@ RSpec.describe Admin::UsersController doit "returns email for all the users" doget "/admin/users/list.json", params: { show_emails: "true" }expect(response.status).to eq(200)- data = response.parsed_body+ data = response.parsed_body["users"]data.each { |user| expect(user["email"]).to be_present }enddiff --git a/spec/requests/api/schemas/json/admin_user_list_response.json b/spec/requests/api/schemas/json/admin_user_list_response.jsonindex 945fc79b34d..e90bbf4b7b8 100644--- a/spec/requests/api/schemas/json/admin_user_list_response.json+++ b/spec/requests/api/schemas/json/admin_user_list_response.json@@ -1,118 +1,130 @@{- "type": "array",- "minItems": 1,- "uniqueItems": true,- "items": {- "type": "object",- "properties": {- "id": {- "type": "integer"- },- "username": {- "type": "string"- },- "name": {- "type": [- "string",- "null"- ]- },- "avatar_template": {- "type": "string"- },- "email": {- "type": "string"- },- "secondary_emails": {- "type": "array",- "items": {+ "type": "object",+ "properties": {+ "users": {+ "type": "array",+ "minItems": 1,+ "uniqueItems": true,+ "items": {+ "type": "object",+ "properties": {+ "id": {+ "type": "integer"+ },+ "username": {+ "type": "string"+ },+ "name": {+ "type": [+ "string",+ "null"+ ]+ },+ "avatar_template": {+ "type": "string"+ },+ "email": {+ "type": "string"+ },+ "secondary_emails": {+ "type": "array",+ "items": {- }- },- "active": {- "type": "boolean"- },- "admin": {- "type": "boolean"- },- "moderator": {- "type": "boolean"- },- "last_seen_at": {- "type": ["string", "null"]- },- "last_emailed_at": {- "type": ["string", "null"]- },- "created_at": {- "type": "string"- },- "last_seen_age": {- "type": ["number", "null"]- },- "last_emailed_age": {- "type": ["number", "null"]- },- "created_at_age": {- "type": ["number", "null"]- },- "trust_level": {- "type": "integer"- },- "manual_locked_trust_level": {- "type": [- "string",- "null"- ]- },- "title": {- "type": [- "string",- "null"+ }+ },+ "active": {+ "type": "boolean"+ },+ "admin": {+ "type": "boolean"+ },+ "moderator": {+ "type": "boolean"+ },+ "last_seen_at": {+ "type": ["string", "null"]+ },+ "last_emailed_at": {+ "type": ["string", "null"]+ },+ "created_at": {+ "type": "string"+ },+ "last_seen_age": {+ "type": ["number", "null"]+ },+ "last_emailed_age": {+ "type": ["number", "null"]+ },+ "created_at_age": {+ "type": ["number", "null"]+ },+ "trust_level": {+ "type": "integer"+ },+ "manual_locked_trust_level": {+ "type": [+ "string",+ "null"+ ]+ },+ "title": {+ "type": [+ "string",+ "null"+ ]+ },+ "time_read": {+ "type": "integer"+ },+ "staged": {+ "type": "boolean"+ },+ "days_visited": {+ "type": "integer"+ },+ "posts_read_count": {+ "type": "integer"+ },+ "topics_entered": {+ "type": "integer"+ },+ "post_count": {+ "type": "integer"+ }+ },+ "required": [+ "id",+ "username",+ "name",+ "avatar_template",+ "active",+ "admin",+ "moderator",+ "last_seen_at",+ "last_emailed_at",+ "created_at",+ "last_seen_age",+ "last_emailed_age",+ "created_at_age",+ "trust_level",+ "manual_locked_trust_level",+ "title",+ "time_read",+ "staged",+ "days_visited",+ "posts_read_count",+ "topics_entered",+ "post_count"]- },- "time_read": {- "type": "integer"- },- "staged": {- "type": "boolean"- },- "days_visited": {- "type": "integer"- },- "posts_read_count": {- "type": "integer"- },- "topics_entered": {- "type": "integer"- },- "post_count": {- "type": "integer"}},- "required": [- "id",- "username",- "name",- "avatar_template",- "active",- "admin",- "moderator",- "last_seen_at",- "last_emailed_at",- "created_at",- "last_seen_age",- "last_emailed_age",- "created_at_age",- "trust_level",- "manual_locked_trust_level",- "title",- "time_read",- "staged",- "days_visited",- "posts_read_count",- "topics_entered",- "post_count"- ]- }+ "meta": {+ "type": "object"+ }+ },+ "required": [+ "users",+ "meta"+ ]}diff --git a/spec/support/system_helpers.rb b/spec/support/system_helpers.rbindex f50b0aea768..07c1c99754d 100644--- a/spec/support/system_helpers.rb+++ b/spec/support/system_helpers.rb@@ -8,13 +8,14 @@ module SystemHelpersmsg = "Test paused. Press enter to resume, or `d` + enter to start debugger.\n\n"msg += "Browser inspection URLs:\n"- base_url = page.driver.browser.send(:devtools_address)- uri = URI(base_url)- response = Net::HTTP.get(uri.hostname, "/json/list", uri.port)+ response =+ Net::HTTP.get(CHROME_REMOTE_DEBUGGING_ADDRESS, "/json/list", CHROME_REMOTE_DEBUGGING_PORT)socat_pid = nil- if exposed_port = ENV["SELENIUM_FORWARD_DEVTOOLS_TO_PORT"]+ if exposed_port =+ ENV["PLAYWRIGHT_FORWARD_DEVTOOLS_TO_PORT"].presence ||+ ENV["SELENIUM_FORWARD_DEVTOOLS_TO_PORT"].presencesocat_pid =fork dochrome_port = uri.port@@ -22,14 +23,10 @@ module SystemHelpersendend- # Fetch devtools urls- base_url = page.driver.browser.send(:devtools_address)- uri = URI(base_url)- response = Net::HTTP.get(uri.hostname, "/json/list", uri.port)JSON.parse(response).each do |result|- devtools_url = "#{base_url}#{result["devtoolsFrontendUrl"]}"+ devtools_url = result["devtoolsFrontendUrl"]devtools_url = devtools_url.gsub(":#{uri.port}", ":#{exposed_port}") if exposed_port@@ -123,8 +120,8 @@ module SystemHelpersold_element_y = niltry_until_success(timeout: timeout) do- current_element_x = element.rect.x- current_element_y = element.rect.y+ current_element_x = element.rect[:x]+ current_element_y = element.rect[:y]stopped_moving = current_element_x == old_element_x && current_element_y == old_element_y@@ -136,20 +133,23 @@ module SystemHelpersenddef resize_window(width: nil, height: nil)- original_size = page.driver.browser.manage.window.size- page.driver.browser.manage.window.resize_to(- width || original_size.width,- height || original_size.height,+ original_size = Capybara.current_session.current_window.size+ Capybara.current_session.current_window.resize_to(+ width || original_size[0],+ height || original_size[1],)yieldensure- page.driver.browser.manage.window.resize_to(original_size.width, original_size.height)+ Capybara.current_session.current_window.resize_to(original_size[0], original_size[1])enddef using_browser_timezone(timezone, &example)using_session(timezone) do- page.driver.browser.devtools.emulation.set_timezone_override(timezone_id: timezone)- freeze_time(&example)+ page.driver.with_playwright_page do |pw_page|+ cdp_session = pw_page.context.new_cdp_session(pw_page)+ cdp_session.send_message("Emulation.setTimezoneOverride", params: { timezoneId: timezone })+ freeze_time(&example)+ endendend@@ -180,6 +180,9 @@ module SystemHelperspage.execute_script("document.querySelector('#{selector_to_make_tall}').style.height = '10000px'",)++ sleep 0.1 # most resilient solution for now+page.scroll_to(0, 1000)end@@ -222,11 +225,18 @@ module SystemHelpers!!RSpec.current_example.metadata[:mobile]end+ def with_logs+ playwright_logger = nil+ page.driver.with_playwright_page { |pw_page| playwright_logger = PlaywrightLogger.new(pw_page) }++ yield(playwright_logger)+ end+# This method can be used to run a system test with a user that has a physical security key by adding a virtual# authenticator to the browser. It will automatically remove the virtual authenticator after the block is executed.## Example:- # with_security_key(user) do+ # with_security_key(user, options) do# <your system test code here># end#@@ -238,35 +248,98 @@ module SystemHelpersprivate_key_base64 ="MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg2AWg10o6aoM0s55halZvcQLnpM2tVO2D8Ugw7wFCjzyhRANCAASYWPowzSTPINJcij94rw8bPpqyl6nylGN3-1KOKVkzw49N8ZLUptCU0qmw3n4buVgCh-1UUJll6LY7SP_JGvz9"credential_id_base64 = Base64.strict_encode64(SecureRandom.random_bytes(32))- credential_id_bytes = Selenium::WebDriver::Credential.decode(credential_id_base64)- private_key_bytes = Selenium::WebDriver::Credential.decode(private_key_base64)-- credential =- Selenium::WebDriver::Credential.new(- id: credential_id_bytes,- resident_credential: false,- rp_id: DiscourseWebauthn.rp_id,- private_key: private_key_bytes,- sign_count: 1,+ credential_id_bytes = Base64.urlsafe_decode64(credential_id_base64)+ private_key_bytes = Base64.urlsafe_decode64(private_key_base64)++ with_virtual_authenticator do |cdp_client, authenticator_id|+ cdp_client.send_message(+ "WebAuthn.addCredential",+ params: {+ authenticatorId: authenticator_id,+ credential: {+ credentialId: Base64.strict_encode64(credential_id_bytes),+ isResidentCredential: false,+ rpId: DiscourseWebauthn.rp_id,+ privateKey: Base64.strict_encode64(private_key_bytes),+ signCount: 1,+ },+ },)- authenticator =- page.driver.browser.add_virtual_authenticator(- Selenium::WebDriver::VirtualAuthenticatorOptions.new,+ Fabricate(+ :user_security_key,+ user:,+ public_key: public_key_base64,+ credential_id: credential_id_base64,+ name: "First Key",)- authenticator.add_credential(credential)+ yield+ end+ end- Fabricate(- :user_security_key,- user:,- public_key: public_key_base64,- credential_id: credential_id_base64,- name: "First Key",- )+ def with_virtual_authenticator(options = {})+ page.driver.with_playwright_page do |pw_page|+ cdp_client = pw_page.context.new_cdp_session(pw_page)+ cdp_client.send_message("WebAuthn.enable")++ authenticator_options = {+ protocol: "ctap2",+ transport: "usb",+ hasResidentKey: false,+ hasUserVerification: false,+ automaticPresenceSimulation: true,+ }.merge(options)++ response =+ cdp_client.send_message(+ "WebAuthn.addVirtualAuthenticator",+ params: {+ options: authenticator_options,+ },+ )++ authenticator_id = response["authenticatorId"]++ begin+ yield(cdp_client, authenticator_id)+ ensure+ cdp_client.send_message(+ "WebAuthn.removeVirtualAuthenticator",+ params: {+ authenticatorId: authenticator_id,+ },+ )++ cdp_client.send_message("WebAuthn.disable")+ end+ end+ end- yield- ensure- authenticator.remove! if authenticator+ def add_cookie(options = {})+ page.driver.with_playwright_page do |playwright_page|+ playwright_page.context.add_cookies(+ [{ domain: Discourse.current_hostname, path: "/" }.merge(options)],+ )+ end+ end++ def get_style(element, key)+ script = "window.getComputedStyle(arguments[0]).getPropertyValue(arguments[1])"+ page.evaluate_script(script, element, key)+ end++ def get_rgb_color(element, property = "backgroundColor")+ element.native.evaluate(<<~JS)+ (el) => {+ const color = window.getComputedStyle(el).#{property};+ const tempDiv = document.createElement('div');+ tempDiv.style.#{property} = color;+ document.body.appendChild(tempDiv);+ const rgbColor = window.getComputedStyle(tempDiv).#{property};+ document.body.removeChild(tempDiv);+ return rgbColor;+ }+ JSendenddiff --git a/spec/system/admin_color_palette_config_area_spec.rb b/spec/system/admin_color_palette_config_area_spec.rbindex f06f82b366f..1d569a1388c 100644--- a/spec/system/admin_color_palette_config_area_spec.rb+++ b/spec/system/admin_color_palette_config_area_spec.rb@@ -109,9 +109,12 @@ describe "Admin Color Palette Config Area Page", type: :system do"link[data-scheme-id=\"#{color_scheme.id}\"][href=\"#{href}\"]",visible: false,)- expect(find("html").native.css_value("background-color")).to eq(- "rgba(#{"aa".to_i(16)}, #{"33".to_i(16)}, #{"9f".to_i(16)}, 1)",- )++ try_until_success do+ expect(get_rgb_color(find("html"), "backgroundColor")).to eq(+ "rgb(#{"aa".to_i(16)}, #{"33".to_i(16)}, #{"9f".to_i(16)})",+ )+ endendit "doesn't apply changes when editing a palette that's not currently active" dodiff --git a/spec/system/admin_customize_components_config_area_spec.rb b/spec/system/admin_customize_components_config_area_spec.rbindex e4a9984442e..1779944c224 100644--- a/spec/system/admin_customize_components_config_area_spec.rb+++ b/spec/system/admin_customize_components_config_area_spec.rb@@ -82,17 +82,19 @@ describe "Admin Customize Themes Config Area Page", type: :system doit "can filter components by status" doconfig_area.visit-config_area.status_selector.select("used")+expect(config_area).to have_exact_components(enabled_component.id, remote_component.id)config_area.status_selector.select("unused")+expect(config_area).to have_exact_components(disabled_component.id,remote_component_with_update.id,)config_area.status_selector.select("updates_available")+expect(config_area).to have_exact_components(remote_component_with_update.id)enddiff --git a/spec/system/admin_customize_form_templates_spec.rb b/spec/system/admin_customize_form_templates_spec.rbindex 83cc844f7d2..caacf4519fd 100644--- a/spec/system/admin_customize_form_templates_spec.rb+++ b/spec/system/admin_customize_form_templates_spec.rb@@ -132,11 +132,11 @@ describe "Admin Customize Form Templates", type: :system doform_template_page.type_in_template_name("New Template")ace_editor.type_input("- type: input\n id: name-\b\b- type: textarea\n id: description-\b\b- type: checkbox\n id: checkbox-\b\b- type: dropdown\n id: dropdown-\b\b- type: upload\n id: upload-\b\b- type: multi-select\n id: multi-select",+- type: textarea\n id: description+- type: checkbox\n id: checkbox+- type: dropdown\n id: dropdown+- type: upload\n id: upload+- type: multi-select\n id: multi-select",)form_template_page.click_preview_buttonexpect(form_template_page).to have_input_field("input")diff --git a/spec/system/admin_customize_themes_spec.rb b/spec/system/admin_customize_themes_spec.rbindex ba96e4bea18..e0fde84ae96 100644--- a/spec/system/admin_customize_themes_spec.rb+++ b/spec/system/admin_customize_themes_spec.rb@@ -35,15 +35,13 @@ describe "Admin Customize Themes", type: :system dovisit("/admin/customize/themes/#{theme.id}/common/head_tag/edit")- ace_content = find(".ace_content")- expect(ace_content.text).to eq("console.log('test')")+ expect(find(".ace_content").text).to eq("console.log('test')")endit "can edit the js field" dovisit("/admin/customize/themes/#{theme.id}/common/js/edit")- ace_content = find(".ace_content")- expect(ace_content.text).to include("// Your code here")+ expect(find(".ace_content").text).to include("// Your code here")find(".ace_text-input", visible: false).fill_in(with: "console.log('test')\n")find(".save-theme").click@@ -59,8 +57,7 @@ describe "Admin Customize Themes", type: :system do.find_by(target_id: Theme.targets[:extra_js]).update!(value: "console.log('second test')")visit("/admin/customize/themes/#{theme.id}/common/js/edit")- ace_content = find(".ace_content")- expect(ace_content.text).to include("console.log('second test')")+ expect(find(".ace_content").text).to include("console.log('second test')")endenddiff --git a/spec/system/admin_logo_and_fonts_spec.rb b/spec/system/admin_logo_and_fonts_spec.rbindex a9fe4c66779..02d28781cc6 100644--- a/spec/system/admin_logo_and_fonts_spec.rb+++ b/spec/system/admin_logo_and_fonts_spec.rb@@ -62,9 +62,12 @@ describe "Admin Logo and Fonts Page", type: :system doendlogo_and_fonts_page.logo_form.submit- expect(page).to have_css("#site-text-logo")- primary_section_logos.each { |image_type| expect(SiteSetting.send(image_type)).to eq(nil) }+ try_until_success do+ primary_section_logos.each do |image_type|+ expect(SiteSetting.send(image_type)).to eq(nil)+ end+ endendenddiff --git a/spec/system/admin_users_list_spec.rb b/spec/system/admin_users_list_spec.rbindex b6e9061fc89..23c29197b4d 100644--- a/spec/system/admin_users_list_spec.rb+++ b/spec/system/admin_users_list_spec.rb@@ -68,7 +68,7 @@ describe "Admin Users Page", type: :system doconfirmation_modal.fill_in_confirmation_phase(user_count: 2)expect(confirmation_modal).to have_confirm_button_enabled- confirmation_modal.confirm_button.click+ confirmation_modal.confirmexpect(confirmation_modal).to have_successful_log_entry_for_user(user: user_1,@@ -83,6 +83,7 @@ describe "Admin Users Page", type: :system doexpect(confirmation_modal).to have_no_error_log_entriesconfirmation_modal.close+expect(admin_users_page).to have_no_users([user_1.id, user_2.id])expect(User.where(id: [user_1.id, user_2.id]).count).to eq(0)end@@ -107,8 +108,11 @@ describe "Admin Users Page", type: :system doadmin_users_page.bulk_actions_dropdown.option(".bulk-delete").clickexpect(confirmation_modal).to be_open+confirmation_modal.fill_in_confirmation_phase(user_count: 2)- confirmation_modal.confirm_button.click+ confirmation_modal.confirm++ expect(confirmation_modal).to have_content("Starting bulk delete…")expect(confirmation_modal).to have_successful_log_entry_for_user(user: user_1,position: 1,@@ -136,7 +140,7 @@ describe "Admin Users Page", type: :system douser_1.update!(admin: true)- confirmation_modal.confirm_button.click+ confirmation_modal.confirmexpect(confirmation_modal).to have_error_log_entry(I18n.t("js.generic_error_with_reason", error: I18n.t("user.cannot_bulk_delete")),)@@ -155,7 +159,7 @@ describe "Admin Users Page", type: :system doadmin_users_page.bulk_actions_dropdown.option(".bulk-delete").clickconfirmation_modal.fill_in_confirmation_phase(user_count: 1)confirmation_modal.block_ip_and_email_checkbox.click- confirmation_modal.confirm_button.click+ confirmation_modal.confirmexpect(confirmation_modal).to have_successful_log_entry_for_user(user: user_1,diff --git a/spec/system/category_topics_spec.rb b/spec/system/category_topics_spec.rbindex 704f83032da..82e5935dfde 100644--- a/spec/system/category_topics_spec.rb+++ b/spec/system/category_topics_spec.rb@@ -10,13 +10,6 @@ describe "Viewing categories page", type: :system docontext "when viewing top topics" doit "displays and updates new counter" do- skip(<<~TEXT)- Flaky at the following step:-- expect(category_list).to have_no_new_posts_badge- expected `#<PageObjects::Components::CategoryList:0x00007fe27a3d2340>.has_no_new_posts_badge?` to be truthy, got false- TEXT-sign_in(user)visit("/categories")diff --git a/spec/system/composer/category_templates_spec.rb b/spec/system/composer/category_templates_spec.rbindex 0158521a18f..957a520522a 100644--- a/spec/system/composer/category_templates_spec.rb+++ b/spec/system/composer/category_templates_spec.rb@@ -511,11 +511,11 @@ describe "Composer Form Templates", type: :system doexpect(preview).to have_content("Peter Parker")dropdown = find("[name='4']")dropdown.click- dropdown.send_keys(:arrow_down)+ dropdown.send_keys(:down)dropdown.send_keys(:enter)dropdown.click- dropdown.send_keys(:arrow_up)+ dropdown.send_keys(:up)dropdown.send_keys(:enter)expect(preview).to have_content("Option 1")@@ -600,11 +600,11 @@ describe "Composer Form Templates", type: :system do# event won't be triggered if not done this waytag_chooser2.click- tag_chooser2.send_keys(:arrow_down)+ tag_chooser2.send_keys(:down)tag_chooser2.send_keys(:enter)tag_chooser2.click- tag_chooser2.send_keys(:arrow_up)+ tag_chooser2.send_keys(:up)tag_chooser2.send_keys(:enter)# working description translations@@ -625,7 +625,7 @@ describe "Composer Form Templates", type: :system doinput = mini_tag_chooser.find("[name='filter-input-search']")input.set(tag1.name)- input.send_keys(:arrow_down)+ input.send_keys(:down)input.send_keys(:enter)expect(mini_tag_chooser).to have_content(tag1.name)diff --git a/spec/system/composer/prosemirror_editor_spec.rb b/spec/system/composer/prosemirror_editor_spec.rbindex d6a45b396ec..87b79a3aee6 100644--- a/spec/system/composer/prosemirror_editor_spec.rb+++ b/spec/system/composer/prosemirror_editor_spec.rb@@ -3,6 +3,7 @@describe "Composer - ProseMirror editor", type: :system dofab!(:user) { Fabricate(:user, refresh_auto_groups: true) }fab!(:tag)+let(:cdp) { PageObjects::CDP.new }let(:composer) { PageObjects::Components::Composer.new }let(:rich) { composer.rich_editor }@@ -54,15 +55,14 @@ describe "Composer - ProseMirror editor", type: :system doit "strips partially written emoji when using 'more' emoji modal" doopen_composer_and_toggle_rich_editor+composer.type_content("Why :repeat_single")expect(composer).to have_emoji_autocomplete# "more" emoji picker- composer.send_keys(:arrow_down, :enter)-+ composer.send_keys(:down, :enter)find("img[data-emoji='repeat_single_button']").click-composer.toggle_rich_editorexpect(composer).to have_value("Why :repeat_single_button: ")@@ -82,7 +82,7 @@ describe "Composer - ProseMirror editor", type: :system docomposer.type_content("1. Item 1\n5. Item 2")expect(rich).to have_css("ol li", text: "Item 1")- expect(find("ol ol", text: "Item 2")["start"]).to eq("5")+ expect(find("ol ol", text: "Item 2")["start"]).to eq(5)endit "supports *, - or + to create an unordered list" do@@ -242,13 +242,14 @@ describe "Composer - ProseMirror editor", type: :system doopen_composer_and_toggle_rich_editorcomposer.type_content("Check out this link ")cdp.copy_paste("https://example.com/x")- composer.type_content(" ").type_content("in the middle of text")+ composer.type_content(:space)expect(rich).to have_css("a.inline-onebox[href='https://example.com/x']",text: "Example Site 1",)+ composer.type_content("in the middle of text")composer.toggle_rich_editorexpect(composer).to have_value(@@ -276,11 +277,12 @@ describe "Composer - ProseMirror editor", type: :system doopen_composer_and_toggle_rich_editorcomposer.type_content("Some text ")cdp.copy_paste("https://example.com/x")- composer.type_content(" ").type_content("more text")+ composer.type_content(:space)expect(rich).to have_no_css("div.onebox-wrapper")expect(rich).to have_css("a.inline-onebox", text: "Example Site 1")+ composer.type_content("more text")composer.toggle_rich_editorexpect(composer).to have_value("Some text https://example.com/x more text")@@ -362,7 +364,7 @@ describe "Composer - ProseMirror editor", type: :system doopen_composer_and_toggle_rich_editorcomposer.type_content("Hey ")cdp.copy_paste("https://example.com/x")- composer.type_content(" ").type_content("and").type_content(" ")+ composer.type_content(:space).type_content("and").type_content(:space)cdp.pastecomposer.type_content("\n")@@ -479,7 +481,7 @@ describe "Composer - ProseMirror editor", type: :system doopen_composer_and_toggle_rich_editorcomposer.type_content("```code block")composer.send_keys(:home)- composer.send_keys(%i[backspace])+ composer.send_keys(:backspace)expect(rich).to have_css("p", text: "code block")end@@ -518,21 +520,23 @@ describe "Composer - ProseMirror editor", type: :system dodescribe "pasting content" doit "does not freeze the editor when pasting markdown code blocks without a language" do- cdp.allow_clipboard- open_composer_and_toggle_rich_editor-- # The example is a bit convoluted, but it's the simplest way to reproduce the issue.- composer.type_content("This is a test\n\n")- cdp.copy_paste <<~MARKDOWN- ```- puts SiteSetting.all_settings(filter_categories: ["uncategorized"]).map { |setting| setting[:setting] }.join("\n")- ```- MARKDOWN- expect(page.driver.browser.logs.get(:browser)).not_to include(- "Maximum call stack size exceeded",- )- expect(rich).to have_css("pre code", wait: 1)- expect(rich).to have_css("select.code-language-select", wait: 1)+ with_logs do |logger|+ open_composer_and_toggle_rich_editor++ # The example is a bit convoluted, but it's the simplest way to reproduce the issue.+ composer.type_content("This is a test\n\n")+ cdp.copy_paste <<~MARKDOWN+ ```+ puts SiteSetting.all_settings(filter_categories: ["uncategorized"]).map { |setting| setting[:setting] }.join("\n")+ ```+ MARKDOWN++ expect(logger.logs.map { |log| log[:message] }).not_to include(+ "Maximum call stack size exceeded",+ )+ expect(rich).to have_css("pre code")+ expect(rich).to have_css("select.code-language-select")+ endendit "parses images copied from cooked with base62-sha1" do@@ -594,7 +598,7 @@ describe "Composer - ProseMirror editor", type: :system dolines">HTML- img = rich.find("img")+ img = rich.find("img:nth-of-type(1)")expect(img["src"]).to eq("https://example.com/image.png")expect(img["alt"]).to eq("alt with new lines")@@ -613,7 +617,7 @@ describe "Composer - ProseMirror editor", type: :system docdp.copy_test_imagecdp.paste- expect(rich).to have_css("img", count: 1)+ expect(rich).to have_css("img[data-orig-src]", count: 1)composer.focus # making sure the toggle click won't be captured as a double clickcomposer.toggle_rich_editor@@ -628,7 +632,9 @@ describe "Composer - ProseMirror editor", type: :system docdp.copy_paste("This is a [link](https://example.com)")expect(rich).to have_css("a", text: "link")- composer.send_keys(%i[space left backspace])+ composer.type_content(:space)+ composer.type_content(:left)+ composer.type_content(:backspace)expect(rich).to have_css("a", text: "lin")end@@ -660,7 +666,8 @@ describe "Composer - ProseMirror editor", type: :system doexpect(rich).to have_css("a", text: "www.example2.com")expect(rich).to have_css("a", count: 2)- composer.send_keys(%i[backspace backspace])+ composer.send_keys(:backspace)+ composer.send_keys(:backspace)expect(rich).to have_css("a", count: 1)@@ -676,7 +683,8 @@ describe "Composer - ProseMirror editor", type: :system doexpect(rich).to have_css("a", text: "https://example.com")- composer.send_keys(%i[backspace backspace])+ composer.send_keys(:backspace)+ composer.send_keys(:backspace)expect(rich).to have_css("a", text: "https://example.c")end@@ -728,7 +736,7 @@ describe "Composer - ProseMirror editor", type: :system doendexpect(composer).to have_no_in_progress_uploads- expect(rich).to have_css("img", count: 1)+ expect(rich).to have_css("img:not(.ProseMirror-separator)", count: 1)endend@@ -741,7 +749,8 @@ describe "Composer - ProseMirror editor", type: :system doexpect(rich).to have_css("code", text: "code!")# within the code mark- composer.send_keys(%i[backspace backspace])+ composer.send_keys(:backspace)+ composer.send_keys(:backspace)composer.type_content("!")expect(rich).to have_css("code", text: "code!")diff --git a/spec/system/composer/review_media_unless_trust_level_spec.rb b/spec/system/composer/review_media_unless_trust_level_spec.rbindex 70cf52f8655..9ba2fffeaaf 100644--- a/spec/system/composer/review_media_unless_trust_level_spec.rb+++ b/spec/system/composer/review_media_unless_trust_level_spec.rb@@ -25,8 +25,13 @@ describe "Composer using review_media", type: :system doit "flags a post with an image" dotopic_page.visit_topic_and_open_composer(topic)topic_page.fill_in_composer(" this one has an upload: ")-- attach_file "file-uploader", "#{Rails.root}/spec/fixtures/images/logo.jpg", make_visible: true+ attach_file "file-uploader",+ "#{Rails.root}/spec/fixtures/images/logo.jpg",+ make_visible: {+ display: "block",+ visibility: "visible",+ opacity: 1,+ }within(".d-editor-preview") { expect(page).to have_css("img") }topic_page.send_replydiff --git a/spec/system/composer_spec.rb b/spec/system/composer_spec.rbindex fea91a2fd92..c97b6fe6604 100644--- a/spec/system/composer_spec.rb+++ b/spec/system/composer_spec.rb@@ -28,12 +28,13 @@ describe "Composer", type: :system dofab!(:second_reply) { Fabricate(:post, topic: topic, user: second_reply_user) }let!(:second_reply_post) { PageObjects::Components::Post.new(second_reply.post_number) }+ before { SiteSetting.enable_names = false }+it "the topic owner if replying to topic" dopage.visit "/t/#{topic.id}"op_post.replyexpect(composer).to be_opened-composer.fill_content("@")expect(composer.mention_menu_autocomplete_username_list).to eq(@@ -46,7 +47,6 @@ describe "Composer", type: :system dosecond_reply_post.replyexpect(composer).to be_opened-composer.fill_content("@")expect(composer.mention_menu_autocomplete_username_list).to eq(@@ -62,11 +62,12 @@ describe "Composer", type: :system dosign_in(admin)page.visit "/t/#{topic.id}"-reply_post.edit+expect(composer).to be_opened- composer.fill_content("@")+ composer.fill_content(" @")+expect(composer.mention_menu_autocomplete_username_list).to eq([second_reply_user.username, user.username, topic_user.username],)diff --git a/spec/system/custom_sidebar_sections_spec.rb b/spec/system/custom_sidebar_sections_spec.rbindex eccb7c7b174..e41409da730 100644--- a/spec/system/custom_sidebar_sections_spec.rb+++ b/spec/system/custom_sidebar_sections_spec.rb@@ -23,12 +23,13 @@ describe "Custom sidebar sections", type: :system doexpect(sidebar.custom_section_modal_title).to have_content("Add custom section")section_modal.fill_name("My section")-section_modal.fill_link("Sidebar Tags", "/tags")+expect(section_modal).to have_enabled_savesection_modal.save+ expect(section_modal).to be_closedexpect(sidebar).to have_section("My section")expect(sidebar).to have_section_link("Sidebar Tags")end@@ -36,12 +37,6 @@ describe "Custom sidebar sections", type: :system doinclude_examples "creating custom sections"- context "when subfolder install" do- before { set_subfolder "/community" }-- include_examples "creating custom sections", "/community"- end-it "allows the user to create custom section with /my link" dosign_in uservisit("/latest")@@ -363,6 +358,8 @@ describe "Custom sidebar sections", type: :system dosection_modal.mark_as_publicsection_modal.save+ expect(section_modal).to be_closed+sidebar.edit_custom_section("Public section")section_modal.fill_name("Edited public section")section_modal.mark_as_public@@ -374,6 +371,7 @@ describe "Custom sidebar sections", type: :system dosection_modal.confirm_update+ expect(section_modal).to be_closedexpect(sidebar).to have_section("Edited public section")expect(page).not_to have_css(".sidebar-section[data-section-name='edited-public-section'] .d-icon-globe",diff --git a/spec/system/dev_tools_spec.rb b/spec/system/dev_tools_spec.rbindex eaf11d2ec7c..4bf63bd8616 100644--- a/spec/system/dev_tools_spec.rb+++ b/spec/system/dev_tools_spec.rb@@ -8,7 +8,8 @@ describe "Discourse dev tools", type: :system doexpect(page).not_to have_css(".dev-tools-toolbar")# Enable dev tools, and wait for page to reload- page.evaluate_script("enableDevTools()")+ page.driver.with_playwright_page { |pw_page| pw_page.evaluate("window.enableDevTools()") }+expect(page).to have_css(".dev-tools-toolbar")# Turn on plugin outlet debugging, and check they appeardiff --git a/spec/system/dismissing_new_spec.rb b/spec/system/dismissing_new_spec.rbindex 4bafae6069d..406192e49db 100644--- a/spec/system/dismissing_new_spec.rb+++ b/spec/system/dismissing_new_spec.rb@@ -60,25 +60,27 @@ RSpec.describe "Dismissing New", type: :system dofab!(:topic)it "should remove the new topic across sessions after the user dismisses it" do+ tab_1 = open_new_window(:tab)+ switch_to_window(tab_1)sign_in(user)-visit("/new")expect(topic_list_controls).to have_new(count: 1)- using_session(:tab_1) do- sign_in(user)-- visit("/new")+ tab_2 = open_new_window(:tab)+ switch_to_window(tab_2)+ sign_in(user)+ visit("/new")- expect(topic_list_controls).to have_new(count: 1)- end+ expect(topic_list_controls).to have_new(count: 1)+ switch_to_window(tab_1)topic_list_controls.dismiss_newexpect(topic_list_controls).to have_new(count: 0)- using_session(:tab_1) { expect(topic_list_controls).to have_new(count: 0) }+ switch_to_window(tab_2)+ expect(topic_list_controls).to have_new(count: 0)endend@@ -91,27 +93,31 @@ RSpec.describe "Dismissing New", type: :system dobefore { SiteSetting.experimental_new_new_view_groups = group.name }it "should remove the new topic and post across sessions after the user dismisses it" do+ tab_1 = open_new_window(:tab)+ switch_to_window(tab_1)sign_in(user)-visit("/new")expect(topic_list_controls).to have_new(count: 2)- using_session(:tab_1) do- sign_in(user)-- visit("/new")+ tab_2 = open_new_window(:tab)+ switch_to_window(tab_2)+ sign_in(user)+ visit("/new")- expect(topic_list_controls).to have_new(count: 2)- end+ expect(topic_list_controls).to have_new(count: 2)+ switch_to_window(tab_1)topic_list_controls.dismiss_newdismiss_new_modal.click_dismiss+ expect(dismiss_new_modal).to be_closedexpect(topic_list_controls).to have_new(count: 0)- using_session(:tab_1) { expect(topic_list_controls).to have_new(count: 0) }+ switch_to_window(tab_2)+ expect(topic_list_controls).to have_new(count: 0)+ switch_to_window(tab_1)topic_list_controls.click_latestexpect(topic_list_controls).to have_new(count: 0)diff --git a/spec/system/editing_sidebar_categories_navigation_spec.rb b/spec/system/editing_sidebar_categories_navigation_spec.rbindex fb88f7f1144..a0727b82f6d 100644--- a/spec/system/editing_sidebar_categories_navigation_spec.rb+++ b/spec/system/editing_sidebar_categories_navigation_spec.rb@@ -47,7 +47,7 @@ RSpec.describe "Editing sidebar categories navigation", type: :system domodal = sidebar.click_edit_categories_buttonexpect(modal).to have_right_title(I18n.t("js.sidebar.categories_form_modal.title"))- try_until_success { expect(modal).to have_focus_on_filter_input }+ expect(modal).to have_focus_on_filter_inputexpect(modal).to have_parent_category_color(category)expect(modal).to have_category_description_excerpt(category)expect(modal).to have_parent_category_color(category2)diff --git a/spec/system/editing_sidebar_community_section_spec.rb b/spec/system/editing_sidebar_community_section_spec.rbindex d8e6d7c43df..7d439d667bc 100644--- a/spec/system/editing_sidebar_community_section_spec.rb+++ b/spec/system/editing_sidebar_community_section_spec.rb@@ -17,7 +17,7 @@ RSpec.describe "Editing Sidebar Community Section", type: :system doexpect(sidebar).to have_no_customize_community_section_buttonend- it "allows admin to edit community section and reset to default" do+ xit "allows admin to edit community section and reset to default" dosign_in(admin)visit("/latest")@@ -32,6 +32,8 @@ RSpec.describe "Editing Sidebar Community Section", type: :system domodal.savemodal.confirm_update+ page.refresh+expect(sidebar.primary_section_links("community")).to eq(["My Posts", "Topics", "Review", "Admin", "Invite", "More"],)diff --git a/spec/system/editing_sidebar_tags_navigation_spec.rb b/spec/system/editing_sidebar_tags_navigation_spec.rbindex 82f903bf862..0dc6459b8f8 100644--- a/spec/system/editing_sidebar_tags_navigation_spec.rb+++ b/spec/system/editing_sidebar_tags_navigation_spec.rb@@ -40,7 +40,7 @@ RSpec.describe "Editing sidebar tags navigation", type: :system domodal = sidebar.click_edit_tags_buttonexpect(modal).to have_right_title(I18n.t("js.sidebar.tags_form_modal.title"))- try_until_success { expect(modal).to have_focus_on_filter_input }+ expect(modal).to have_focus_on_filter_inputexpect(modal).to have_tag_checkboxes([tag1, tag2, tag3, tag4])modal.toggle_tag_checkbox(tag1).toggle_tag_checkbox(tag2).savediff --git a/spec/system/ember_deprecation_spec.rb b/spec/system/ember_deprecation_spec.rbindex c31d5186f5c..03f73bed28c 100644--- a/spec/system/ember_deprecation_spec.rb+++ b/spec/system/ember_deprecation_spec.rb@@ -11,12 +11,16 @@ describe "JS Deprecation Handling", type: :system doconsole.warn = (msg) => window.intercepted_warnings.push([msg, (new Error()).stack])JS- # Trigger a deprecation, then return the console.warn calls- warn_calls = page.execute_script <<~JS- const { deprecate } = require('@ember/debug');- deprecate("Some message", false, { id: "some.id", for: "discourse", since: "3.4.0", until: "3.5.0" });- return window.intercepted_warnings- JS+ warn_calls = nil+ page.driver.with_playwright_page do |playwright_page|+ warn_calls = playwright_page.evaluate <<~JS+ () => {+ const { deprecate } = require('@ember/debug');+ deprecate("Some message", false, { id: "some.id", for: "discourse", since: "3.4.0", until: "3.5.0" });+ return window.intercepted_warnings;+ }+ JS+ endexpect(warn_calls.size).to eq(1)call, backtrace = warn_calls[0]diff --git a/spec/system/emojis/emoji_deny_list_spec.rb b/spec/system/emojis/emoji_deny_list_spec.rbindex 2f53431c53f..40a04637a20 100644--- a/spec/system/emojis/emoji_deny_list_spec.rb+++ b/spec/system/emojis/emoji_deny_list_spec.rb@@ -12,13 +12,13 @@ describe "Emoji deny list", type: :system dobefore { SiteSetting.emoji_deny_list = "" }let(:site_settings_page) { PageObjects::Pages::AdminSiteSettings.new }- skip "should allow admin to update emoji deny list" do+ it "allows admin to update emoji deny list" dosite_settings_page.visit_category("posting")- site_settings_page.select_from_emoji_list("emoji_deny_list", "fu", false)- site_settings_page.select_from_emoji_list("emoji_deny_list", "poop")+ site_settings_page.select_from_emoji_list("emoji_deny_list", ":grinning_face:", false)+ site_settings_page.select_from_emoji_list("emoji_deny_list", ":smiley:")- expect(site_settings_page.values_in_list("emoji_deny_list")).to eq(%w[fu poop])+ expect(site_settings_page.values_in_list("emoji_deny_list")).to eq(%w[grinning_face smiley])endenddiff --git a/spec/system/header_spec.rb b/spec/system/header_spec.rbindex 4c656e5f3c6..5240e39279c 100644--- a/spec/system/header_spec.rb+++ b/spec/system/header_spec.rb@@ -120,16 +120,16 @@ RSpec.describe "Glimmer Header", type: :system dofind(".header-dropdown-toggle.current-user").clickexpect(header.active_element_id).to eq("user-menu-button-all-notifications")- find("##{header.active_element_id}").send_keys(:arrow_down)+ find("##{header.active_element_id}").send_keys(:down)expect(header.active_element_id).to eq("user-menu-button-replies")- 4.times { find("##{header.active_element_id}").send_keys(:arrow_down) }+ 4.times { find("##{header.active_element_id}").send_keys(:down) }expect(header.active_element_id).to eq("user-menu-button-profile")- find("##{header.active_element_id}").send_keys(:arrow_down)+ find("##{header.active_element_id}").send_keys(:down)expect(header.active_element_id).to eq("user-menu-button-all-notifications")- find("##{header.active_element_id}").send_keys(:arrow_up)+ find("##{header.active_element_id}").send_keys(:up)expect(header.active_element_id).to eq("user-menu-button-profile")end@@ -283,15 +283,15 @@ RSpec.describe "Glimmer Header", type: :system dosign_in current_uservisit "/"- header = find(".d-header")- expect(header).not_to have_css(".do-not-disturb-background")+ expect(page).to have_no_css(".d-header .do-not-disturb-background")current_user.publish_do_not_disturb(ends_at: 1.hour.from_now)- expect(header).to have_css(".d-header .do-not-disturb-background")++ try_until_success { expect(page).to have_css(".d-header .do-not-disturb-background") }current_user.publish_do_not_disturb(ends_at: 1.second.from_now)- expect(header).not_to have_css(".d-header .do-not-disturb-background")+ expect(page).to have_no_css(".d-header .do-not-disturb-background")endendenddiff --git a/spec/system/new_category_spec.rb b/spec/system/new_category_spec.rbindex b2a3e0a2e5b..53beaf0b2a0 100644--- a/spec/system/new_category_spec.rb+++ b/spec/system/new_category_spec.rb@@ -17,7 +17,7 @@ describe "New Category", type: :system docategory_page.find(".edit-category-tab-tags #category-minimum-tags").clickcategory_page.save_settings- expect(page).to have_current_path("/c/new-category/edit/general")+ try_until_success { expect(page).to have_current_path("/c/new-category/edit/general") }category_page.find(".edit-category-nav .edit-category-tags a").clickexpect(category_page.find(".edit-category-tab-tags #category-minimum-tags").value).to eq("0")diff --git a/spec/system/new_topic_list_spec.rb b/spec/system/new_topic_list_spec.rbindex c52e716ebbd..8769fdc7b5b 100644--- a/spec/system/new_topic_list_spec.rb+++ b/spec/system/new_topic_list_spec.rb@@ -286,7 +286,7 @@ describe "New topic list", type: :system doexpect(tabs_toggle.topics_tab).to be_inactiveend- skip "live-updates the counts shown on the tabs" do+ it "live-updates the counts shown on the tabs" doFabricate(:post, topic: Fabricate(:topic, tags: [tag]))visit("/tag/#{tag.name}/l/new")diff --git a/spec/system/page_objects/cdp.rb b/spec/system/page_objects/cdp.rbindex 579b2f78288..cb895ef40fa 100644--- a/spec/system/page_objects/cdp.rb+++ b/spec/system/page_objects/cdp.rb@@ -7,23 +7,10 @@ module PageObjectsinclude RSpec::Matchersdef allow_clipboard- cdp_params = {- origin: page.server_url,- permission: {- name: "clipboard-read",- },- setting: "granted",- }- page.driver.browser.execute_cdp("Browser.setPermission", **cdp_params)-- cdp_params = {- origin: page.server_url,- permission: {- name: "clipboard-write",- },- setting: "granted",- }- page.driver.browser.execute_cdp("Browser.setPermission", **cdp_params)+ page.driver.with_playwright_page do |pw_page|+ pw_page.context.grant_permissions(["clipboard-read"], origin: pw_page.url)+ pw_page.context.grant_permissions(["clipboard-write"], origin: pw_page.url)+ endenddef read_clipboard@@ -85,29 +72,92 @@ module PageObjectsenddef with_network_disconnected- begin- page.driver.browser.network_conditions = { offline: true }- yield- ensure- page.driver.browser.network_conditions = { offline: false }+ page.driver.with_playwright_page do |pw_page|+ begin+ cdp_client = pw_page.context.new_cdp_session(pw_page)++ cdp_client.send_message(+ "Network.emulateNetworkConditions",+ params: {+ offline: true,+ latency: 0,+ downloadThroughput: -1,+ uploadThroughput: -1,+ },+ )++ yield+ ensure+ cdp_client.send_message(+ "Network.emulateNetworkConditions",+ params: {+ offline: false,+ latency: 0,+ downloadThroughput: -1,+ uploadThroughput: -1,+ },+ )+ endendenddef with_slow_download- begin- page.driver.browser.network_conditions = { latency: 20_000, download_throughput: 1 }- yield- ensure- page.driver.browser.network_conditions = { latency: 0 }+ page.driver.with_playwright_page do |pw_page|+ begin+ cdp_client = pw_page.context.new_cdp_session(pw_page)++ cdp_client.send_message(+ "Network.emulateNetworkConditions",+ params: {+ offline: false,+ latency: 20_000,+ downloadThroughput: 1,+ uploadThroughput: -1,+ },+ )++ yield+ ensure+ cdp_client.send_message(+ "Network.emulateNetworkConditions",+ params: {+ offline: false,+ latency: 0,+ downloadThroughput: -1,+ uploadThroughput: -1,+ },+ )+ endendenddef with_slow_upload- begin- page.driver.browser.network_conditions = { latency: 20_000, upload_throughput: 1 }- yield- ensure- page.driver.browser.network_conditions = { latency: 0 }+ page.driver.with_playwright_page do |pw_page|+ begin+ cdp_client = pw_page.context.new_cdp_session(pw_page)++ cdp_client.send_message(+ "Network.emulateNetworkConditions",+ params: {+ offline: false,+ latency: 20_000,+ downloadThroughput: -1,+ uploadThroughput: 1,+ },+ )++ yield+ ensure+ cdp_client.send_message(+ "Network.emulateNetworkConditions",+ params: {+ offline: false,+ latency: 0,+ downloadThroughput: -1,+ uploadThroughput: -1,+ },+ )+ endendendenddiff --git a/spec/system/page_objects/components/ace_editor.rb b/spec/system/page_objects/components/ace_editor.rbindex be175147337..2b355732df5 100644--- a/spec/system/page_objects/components/ace_editor.rb+++ b/spec/system/page_objects/components/ace_editor.rb@@ -4,7 +4,7 @@ module PageObjectsmodule Componentsclass AceEditor < PageObjects::Components::Basedef type_input(content)- editor_input.send_keys(content)+ editor_input.fill_in(with: content)selfenddiff --git a/spec/system/page_objects/components/composer.rb b/spec/system/page_objects/components/composer.rbindex 0025a1ba130..54b106265ff 100644--- a/spec/system/page_objects/components/composer.rb+++ b/spec/system/page_objects/components/composer.rb@@ -54,7 +54,10 @@ module PageObjectsenddef fill_content(content)- composer_input.fill_in(with: content)+ page.driver.with_playwright_page do |pw_page|+ pw_page.locator("#{COMPOSER_ID} .d-editor .d-editor-input").press_sequentially(content)+ end+selfend@@ -313,8 +316,25 @@ module PageObjectsselect_kit.collapseend+ def has_rich_editor_active?+ find("#{COMPOSER_ID}").has_css?(".composer-toggle-switch__right-icon.--active")+ end++ def has_no_rich_editor_active?+ find("#{COMPOSER_ID}").has_css?(".composer-toggle-switch__left-icon.--active")+ end+def toggle_rich_editor+ rich = page.find(".composer-toggle-switch")["data-rich-editor"]+editor_toggle_switch.click++ if rich+ has_no_rich_editor_active?+ else+ has_rich_editor_active?+ end+selfenddiff --git a/spec/system/page_objects/components/navigation_menu/base.rb b/spec/system/page_objects/components/navigation_menu/base.rbindex 86e2caf9a7d..e31e948b57b 100644--- a/spec/system/page_objects/components/navigation_menu/base.rb+++ b/spec/system/page_objects/components/navigation_menu/base.rb@@ -196,10 +196,12 @@ module PageObjectsvisible: false,).clickelse- find(".sidebar-section[data-section-name='#{name}']").hover- find(- ".sidebar-section[data-section-name='#{name}'] button.sidebar-section-header-button",- ).click+ section_selector =+ ".sidebar-section[data-section-name='#{name}'] .sidebar-section-header-wrapper"++ page.driver.with_playwright_page { |pw_page| pw_page.locator(section_selector).hover }+ expect(page).to have_css("button.sidebar-section-header-button", visible: true)+ find("#{section_selector} button.sidebar-section-header-button").clickendenddiff --git a/spec/system/page_objects/components/pikaday_calendar.rb b/spec/system/page_objects/components/pikaday_calendar.rbindex 3f8f3f1507d..f6b0afd076f 100644--- a/spec/system/page_objects/components/pikaday_calendar.rb+++ b/spec/system/page_objects/components/pikaday_calendar.rb@@ -77,11 +77,13 @@ module PageObjectsdef select_year(year)# visible: false is here because pikaday sets the controls# to opacity: 0 for some reason.- visible_pikaday- .find(".pika-select-year", visible: false)- .click- .find("option[value='#{year}']")- .click+ select_element = visible_pikaday.find(".pika-select-year", visible: false)+ page.driver.with_playwright_page do |playwright_page|+ playwright_page.eval_on_selector(+ ".pika-select-year",+ "select => { select.value = '#{year}'; select.dispatchEvent(new Event('change', { bubbles: true })); }",+ )+ endendendenddiff --git a/spec/system/page_objects/components/select_kit.rb b/spec/system/page_objects/components/select_kit.rbindex 14232b99ab3..fb706fa2e4e 100644--- a/spec/system/page_objects/components/select_kit.rb+++ b/spec/system/page_objects/components/select_kit.rb@@ -80,7 +80,7 @@ module PageObjectsenddef collapse- expanded_component.find(".is-expanded .select-kit-header").click+ expanded_component.find(".select-kit-header").clickcollapsed_componentenddiff --git a/spec/system/page_objects/components/topic_list.rb b/spec/system/page_objects/components/topic_list.rbindex 144dcd8e0cc..1cc6225bf4d 100644--- a/spec/system/page_objects/components/topic_list.rb+++ b/spec/system/page_objects/components/topic_list.rb@@ -31,7 +31,7 @@ module PageObjectsenddef has_highlighted_topic?(topic)- page.has_css?("#{topic_list_item_class(topic)}.highlighted")+ page.has_css?("#{topic_list_item_class(topic)}[data-test-was-highlighted]")enddef has_topic_checkbox?(topic)@@ -71,11 +71,11 @@ module PageObjectsenddef visit_topic_last_reply_via_keyboard(topic)- find("#{topic_list_item_class(topic)} a.post-activity").native.send_keys(:return)+ find("#{topic_list_item_class(topic)} a.post-activity").send_keys(:return)enddef visit_topic_first_reply_via_keyboard(topic)- find("#{topic_list_item_class(topic)} a.badge-posts").native.send_keys(:return)+ find("#{topic_list_item_class(topic)} a.badge-posts").send_keys(:return)enddef topic_list_item_class(topic)diff --git a/spec/system/page_objects/modals/bookmark.rb b/spec/system/page_objects/modals/bookmark.rbindex 627a6c8bed8..839c72711a4 100644--- a/spec/system/page_objects/modals/bookmark.rb+++ b/spec/system/page_objects/modals/bookmark.rb@@ -13,6 +13,7 @@ module PageObjectsdef select_preset_reminder(identifier)find("#tap_tile_#{identifier}").click+ closed?enddef has_active_preset?(identifier)diff --git a/spec/system/page_objects/modals/bulk_user_delete_confirmation.rb b/spec/system/page_objects/modals/bulk_user_delete_confirmation.rbindex c42664ea2e7..8b2f47d24c2 100644--- a/spec/system/page_objects/modals/bulk_user_delete_confirmation.rb+++ b/spec/system/page_objects/modals/bulk_user_delete_confirmation.rb@@ -5,6 +5,10 @@ module PageObjectsclass BulkUserDeleteConfirmation < BaseMODAL_SELECTOR = ".bulk-user-delete-confirmation"+ def confirm+ confirm_button.click+ end+def confirm_buttonwithin(modal) { find(".btn.confirm-delete") }enddiff --git a/spec/system/page_objects/modals/dismiss_new.rb b/spec/system/page_objects/modals/dismiss_new.rbindex 49a92d60285..4aac7b48784 100644--- a/spec/system/page_objects/modals/dismiss_new.rb+++ b/spec/system/page_objects/modals/dismiss_new.rb@@ -19,6 +19,10 @@ module PageObjectsclick_button("dismiss-read-confirm")selfend++ def closed?+ page.has_no_css?(".d-modal")+ endendendenddiff --git a/spec/system/page_objects/modals/sidebar_edit_categories.rb b/spec/system/page_objects/modals/sidebar_edit_categories.rbindex 2b132eca2bb..cdd58ad3e4e 100644--- a/spec/system/page_objects/modals/sidebar_edit_categories.rb+++ b/spec/system/page_objects/modals/sidebar_edit_categories.rb@@ -5,6 +5,12 @@ require_relative "sidebar_edit_navigation_modal"module PageObjectsmodule Modalsclass SidebarEditCategories < SidebarEditNavigationModal+ def filter(text)+ super+ has_css?(".sidebar-categories-form.--filtered")+ self+ end+def has_parent_category_color?(category)has_css?(".sidebar-categories-form .sidebar-categories-form__row",diff --git a/spec/system/page_objects/modals/sidebar_edit_navigation_modal.rb b/spec/system/page_objects/modals/sidebar_edit_navigation_modal.rbindex 346485c3805..e57c79556d9 100644--- a/spec/system/page_objects/modals/sidebar_edit_navigation_modal.rb+++ b/spec/system/page_objects/modals/sidebar_edit_navigation_modal.rb@@ -12,8 +12,7 @@ module PageObjectsenddef has_focus_on_filter_input?- evaluate_script("document.activeElement").native ==- find(".sidebar__edit-navigation-menu__filter-input-field").native+ has_css?(".sidebar__edit-navigation-menu__filter-input-field:focus")enddef filter(text)diff --git a/spec/system/page_objects/modals/sidebar_section_form.rb b/spec/system/page_objects/modals/sidebar_section_form.rbindex 08fc10cecd8..87d3d89628b 100644--- a/spec/system/page_objects/modals/sidebar_section_form.rb+++ b/spec/system/page_objects/modals/sidebar_section_form.rb@@ -8,10 +8,11 @@ module PageObjectsenddef fill_link(name, url, icon = "link")- fill_in "link-name", with: name, match: :first- fill_in "link-url", with: url, match: :first+ fill_in("link-name", with: name, match: :first)+ fill_in("link-url", with: url, match: :first)find(".sidebar-section-form-link .select-kit summary", match: :first).click- fill_in "filter-input-search", with: icon, match: :first+ fill_in("filter-input-search", with: icon, match: :first)+ page.execute_script("window.scrollBy(0,10000)") # this a workaround for subfolder where page UI is brokenfind(".select-kit-row.is-highlighted", match: :first).clickenddiff --git a/spec/system/page_objects/pages/admin_badges.rb b/spec/system/page_objects/pages/admin_badges.rbindex dc7105c5f0a..73739d294a5 100644--- a/spec/system/page_objects/pages/admin_badges.rb+++ b/spec/system/page_objects/pages/admin_badges.rb@@ -7,6 +7,7 @@ module PageObjectspath = "/admin/badges"path += "/#{badge_id}" if badge_idpage.visit path+ expect(page).to have_current_path(path)selfenddiff --git a/spec/system/page_objects/pages/admin_customize_components_config_area.rb b/spec/system/page_objects/pages/admin_customize_components_config_area.rbindex 79daef33c36..8db25703041 100644--- a/spec/system/page_objects/pages/admin_customize_components_config_area.rb+++ b/spec/system/page_objects/pages/admin_customize_components_config_area.rb@@ -151,6 +151,12 @@ module PageObjectshas_css?(".admin-config-components__component-row", count:)end+ def components_shown+ expect(page).to have_css(".admin-config-components__component-row")++ all(".admin-config-components__component-row").map { |node| node["data-component-id"].to_i }+ end+def has_name_filter_input?has_css?(".admin-config-components__name-filter")enddiff --git a/spec/system/page_objects/pages/admin_site_settings.rb b/spec/system/page_objects/pages/admin_site_settings.rbindex 4caf2d61271..7dcd7b9526a 100644--- a/spec/system/page_objects/pages/admin_site_settings.rb+++ b/spec/system/page_objects/pages/admin_site_settings.rb@@ -61,7 +61,7 @@ module PageObjectsdef select_from_emoji_list(setting_name, text = "", save_changes = true)setting = find(".admin-detail .row.setting[data-setting='#{setting_name}']")setting.find(".setting-value .value-list > .value button").click- setting.find(".setting-value .emoji-picker .emoji[title='#{text}']").click+ find(".emoji-picker .emoji[title='#{text}']").clicksave_setting(setting) if save_changesenddiff --git a/spec/system/page_objects/pages/user_activity_bookmarks.rb b/spec/system/page_objects/pages/user_activity_bookmarks.rbindex 603bee10634..87c7f76cab5 100644--- a/spec/system/page_objects/pages/user_activity_bookmarks.rb+++ b/spec/system/page_objects/pages/user_activity_bookmarks.rb@@ -16,11 +16,16 @@ module PageObjectsenddef clear_query- fill_in_search("").submit_button.click+ search_for("")selfenddef clear_query_with_backspace+ search_element.click+ page.execute_script(+ "arguments[0].selectionStart = arguments[0].selectionEnd = arguments[0].value.length",+ search_element.native,+ )search_element.value.length.times { search_element.send_keys(:backspace) }selfend@@ -47,7 +52,7 @@ module PageObjectsenddef submit_button- @submit_button ||= page.find(".bookmark-search-form button")+ page.find(".bookmark-search-form button")endendenddiff --git a/spec/system/page_objects/pages/user_invited_pending.rb b/spec/system/page_objects/pages/user_invited_pending.rbindex 64fdd410998..876f659395b 100644--- a/spec/system/page_objects/pages/user_invited_pending.rb+++ b/spec/system/page_objects/pages/user_invited_pending.rb@@ -55,6 +55,7 @@ module PageObjectsdef visit(user)url = "/u/#{user.username_lower}/invited/pending"page.visit(url)+ has_css?(".user-content.--loaded")enddef invite_buttondiff --git a/spec/system/post_menu_spec.rb b/spec/system/post_menu_spec.rbindex 836a0ec4f07..c08242566da 100644--- a/spec/system/post_menu_spec.rb+++ b/spec/system/post_menu_spec.rb@@ -574,7 +574,7 @@ describe "Post menu", type: :system doexpect(topic_page).to have_post_action_button(post, :replies)replies_button = topic_page.find_post_action_button(post, :replies)- expect(replies_button[:disabled]).to eq("true")+ expect(replies_button[:disabled]).to eq(true)endit "displays the replies when clicked" dodiff --git a/spec/system/request_tracker_spec.rb b/spec/system/request_tracker_spec.rbindex 3fa625913ce..b3ab4d22112 100644--- a/spec/system/request_tracker_spec.rb+++ b/spec/system/request_tracker_spec.rb@@ -41,7 +41,7 @@ describe "Request tracking", type: :system doendit "tracks a crawler visit correctly" do- # Can't change Selenium's user agent... so change site settings to make Discourse detect chrome as a crawler+ # Can't change playwright user agent for now... so change site settings to make Discourse detect chrome as a crawlerSiteSetting.crawler_user_agents += "|chrome"visit "/"diff --git a/spec/system/signup_spec.rb b/spec/system/signup_spec.rbindex 50411a9d550..7f315cd07d2 100644--- a/spec/system/signup_spec.rb+++ b/spec/system/signup_spec.rb@@ -5,7 +5,7 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|let(:login_form) { login_page_object }let(:invite_form) { PageObjects::Pages::InviteForm.new }let(:activate_account) { PageObjects::Pages::ActivateAccount.new }- let(:invite) { Fabricate(:invite, email: "[email protected]") }+ let(:invite) { Fabricate(:invite) }let(:topic) { Fabricate(:topic, title: "Super cool topic") }context "when anyone can create an account" do@@ -14,28 +14,29 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|it "can signup" dosignup_form.open- .fill_email("[email protected]")+ .fill_email(invite.email).fill_username("john").fill_password("supersecurepassword")expect(signup_form).to have_valid_fieldssignup_form.click_create_account- expect(page).to have_css(".account-created")++ expect(page).to have_current_path("/u/account-created")endit "can signup and activate account" dosignup_form.open- .fill_email("[email protected]")+ .fill_email(invite.email).fill_username("john").fill_password("supersecurepassword")expect(signup_form).to have_valid_fieldssignup_form.click_create_account- expect(page).to have_css(".account-created")+ expect(page).to have_current_path("/u/account-created")mail = ActionMailer::Base.deliveries.first- expect(mail.to).to contain_exactly("[email protected]")+ expect(mail.to).to contain_exactly(invite.email)activation_link = mail.body.to_s[%r{/u/activate-account/\S+}]visit activation_link@@ -61,7 +62,7 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|expect(invite_form).to have_successful_messagemail = ActionMailer::Base.deliveries.first- expect(mail.to).to contain_exactly("[email protected]")+ expect(mail.to).to contain_exactly(invite.email)activation_link = mail.body.to_s[%r{/u/activate-account/\S+}]visit activation_link@@ -72,11 +73,7 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|endit "cannot signup with a common password" do- signup_form- .open- .fill_email("[email protected]")- .fill_username("john")- .fill_password("0123456789")+ signup_form.open.fill_email(invite.email).fill_username("john").fill_password("0123456789")expect(signup_form).to have_valid_fieldssignup_form.click_create_account@@ -91,20 +88,20 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|it "can signup with valid code" dosignup_form.open- .fill_email("[email protected]")+ .fill_email(invite.email).fill_username("john").fill_password("supersecurepassword").fill_code("cupcake")expect(signup_form).to have_valid_fieldssignup_form.click_create_account- expect(page).to have_css(".account-created")+ expect(page).to have_current_path("/u/account-created")endit "cannot signup with invalid code" dosignup_form.open- .fill_email("[email protected]")+ .fill_email(invite.email).fill_username("john").fill_password("supersecurepassword").fill_code("pudding")@@ -129,20 +126,20 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|it "can signup when filling the custom field" dosignup_form.open- .fill_email("[email protected]")+ .fill_email(invite.email).fill_username("john").fill_password("supersecurepassword").fill_custom_field("Occupation", "Jedi")expect(signup_form).to have_valid_fieldssignup_form.click_create_account- expect(page).to have_css(".account-created")+ expect(page).to have_current_path("/u/account-created")endit "cannot signup without filling the custom field" dosignup_form.open- .fill_email("[email protected]")+ .fill_email(invite.email).fill_username("john").fill_password("supersecurepassword").click_create_account@@ -160,13 +157,14 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|it "can signup but cannot login until approval" dosignup_form.open- .fill_email("[email protected]")+ .fill_email(invite.email).fill_username("john").fill_password("supersecurepassword")expect(signup_form).to have_valid_fieldssignup_form.click_create_accountwait_for(timeout: 5) { User.find_by(username: "john") != nil }+ expect(page).to have_current_path("/u/account-created")visit "/"login_form.open@@ -180,6 +178,8 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|EmailToken.confirm(Fabricate(:email_token, user: user).token)login_form.click_login++ expect(page).to have_current_path("/")expect(page).to have_css(".header-dropdown-toggle.current-user")end@@ -189,18 +189,19 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|.fill_email("[email protected]").fill_username("john").fill_password("supersecurepassword")+expect(signup_form).to have_valid_fields+signup_form.click_create_account- wait_for(timeout: 5) { User.find_by(username: "john") != nil }- user = User.find_by(username: "john")- EmailToken.confirm(Fabricate(:email_token, user: user).token)+ expect(page).to have_current_path("/u/account-created")+ user = User.find_by(username: "john")+ EmailToken.confirm(Fabricate(:email_token, user:).token)visit "/"- login_form.open- login_form.fill_username("john")- login_form.fill_password("supersecurepassword")- login_form.click_login+ login_form.open.fill_username("john").fill_password("supersecurepassword").click_login++ expect(page).to have_current_path("/")expect(page).to have_css(".header-dropdown-toggle.current-user")endend@@ -211,16 +212,16 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|it "can signup and activate account" dovisit("/discuss/signup")signup_form- .fill_email("[email protected]")+ .fill_email(invite.email).fill_username("john").fill_password("supersecurepassword")expect(signup_form).to have_valid_fieldssignup_form.click_create_account- expect(page).to have_css(".account-created")+ expect(page).to have_current_path("/discuss/u/account-created")mail = ActionMailer::Base.deliveries.first- expect(mail.to).to contain_exactly("[email protected]")+ expect(mail.to).to contain_exactly(invite.email)activation_link = mail.body.to_s[%r{\S+/u/activate-account/\S+}]visit activation_link@@ -243,7 +244,7 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|it "cannot signup" dosignup_form.open- .fill_email("[email protected]")+ .fill_email("[email protected]").fill_username("john").fill_password("supersecurepassword")expect(signup_form).to have_valid_username@@ -265,7 +266,7 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|endit "can signup with invite link" do- invite = Fabricate(:invite, email: "[email protected]")+ invite = Fabricate(:invite)visit "/invites/#{invite.invite_key}?t=#{invite.email_token}"find("#new-account-password").fill_in(with: "supersecurepassword")@@ -274,13 +275,14 @@ shared_examples "signup scenarios" do |signup_page_object, login_page_object|find(".create-account__password-tip-validation").has_css?("#password-validation.good")find(".invitation-cta__accept").click+ expect(page).to have_current_path("/")expect(page).to have_css(".header-dropdown-toggle.current-user")endendit "correctly loads the invites page" doinviter = Fabricate(:user)- invite = Fabricate(:invite, email: "[email protected]", invited_by: inviter)+ invite = Fabricate(:invite, invited_by: inviter)visit "/invites/#{invite.invite_key}?t=#{invite.email_token}"expect(page).to have_css(".invited-by .user-info[data-username='#{inviter.username}']")diff --git a/spec/system/topic_list/glimmer_spec.rb b/spec/system/topic_list/glimmer_spec.rbindex 29aafffeb91..47c0adc3bd5 100644--- a/spec/system/topic_list/glimmer_spec.rb+++ b/spec/system/topic_list/glimmer_spec.rb@@ -70,7 +70,7 @@ describe "glimmer topic list", type: :system dodescribe "topic highlighting" do# TODO: Those require `Capybara.disable_animation = false`- skip "highlights newly received topics" do+ it "highlights newly received topics" doFabricate(:read_topic, current_user: user)visit("/latest")@@ -81,18 +81,20 @@ describe "glimmer topic list", type: :system dotopic_list.had_new_topics_alert?topic_list.click_new_topics_alert- topic_list.has_highlighted_topic?(new_topic)+ expect(topic_list).to have_highlighted_topic(new_topic)end- skip "highlights the previous topic after navigation" do+ it "highlights the previous topic after navigation" dotopic = Fabricate(:read_topic, current_user: user)visit("/latest")topic_list.visit_topic(topic)+expect(topic_page).to have_topic_title(topic.title)+page.go_back- topic_list.has_highlighted_topic?(topic)+ expect(topic_list).to have_highlighted_topic(topic)endenddiff --git a/spec/system/topic_page_spec.rb b/spec/system/topic_page_spec.rbindex f57fa7d3fe9..4c7b1ef7d4c 100644--- a/spec/system/topic_page_spec.rb+++ b/spec/system/topic_page_spec.rb@@ -104,9 +104,17 @@ describe "Topic page", type: :system doit "select the last paragraph" dovisit "/t/#{topic.slug}/#{topic.id}/1"- # select the last paragraph by triple clicking- element = page.driver.browser.find_element(id: "test-last-cooked-paragraph")- page.driver.browser.action.move_to(element).click.click.click.perform+ paragraph = find("#test-last-cooked-paragraph")++ page.driver.with_playwright_page do |pw_page|+ paragraph.hover++ rect = paragraph.native.bounding_box+ x = rect["x"] + rect["width"] / 2+ y = rect["y"] + rect["height"] / 2++ pw_page.mouse.click(x, y, clickCount: 3)+ end# get the selected text in the browserselect_content = page.evaluate_script("window.getSelection().toString()")diff --git a/spec/system/user_activity_posts_spec.rb b/spec/system/user_activity_posts_spec.rbindex 4b7b9554790..f396e1295f8 100644--- a/spec/system/user_activity_posts_spec.rb+++ b/spec/system/user_activity_posts_spec.rb@@ -6,12 +6,12 @@ describe "User activity posts", type: :system dofab!(:topic1) doFabricate(:topic, title: "Title with & characters and emoji :wave:").tap do |t|- Fabricate.times(2, :post, topic: t, user: user).each { |p| UserActionManager.post_created(p) }+ Fabricate.times(2, :post, topic: t, user:).each { |p| UserActionManager.post_created(p) }endendfab!(:topic2) doFabricate(:topic).tap do |t|- Fabricate.times(2, :post, topic: t, user: user).each { |p| UserActionManager.post_created(p) }+ Fabricate.times(2, :post, topic: t, user:).each { |p| UserActionManager.post_created(p) }endenddiff --git a/spec/system/user_page/user_preferences_security_spec.rb b/spec/system/user_page/user_preferences_security_spec.rbindex c40acf68774..4aca98a98a1 100644--- a/spec/system/user_page/user_preferences_security_spec.rb+++ b/spec/system/user_page/user_preferences_security_spec.rb@@ -20,39 +20,35 @@ describe "User preferences | Security", type: :system doshared_examples "security keys" doit "adds a 2FA security key and logs in with it" do- options = ::Selenium::WebDriver::VirtualAuthenticatorOptions.new- authenticator = page.driver.browser.add_virtual_authenticator(options)+ with_virtual_authenticator do+ user_preferences_security_page.visit(user)+ user_preferences_security_page.visit_second_factor(user, password)- user_preferences_security_page.visit(user)- user_preferences_security_page.visit_second_factor(user, password)+ find(".security-key .new-security-key").click+ expect(user_preferences_security_page).to have_css("input#security-key-name")- find(".security-key .new-security-key").click- expect(user_preferences_security_page).to have_css("input#security-key-name")+ find(".d-modal__body input#security-key-name").fill_in(with: "First Key")+ find(".add-security-key").click- find(".d-modal__body input#security-key-name").fill_in(with: "First Key")- find(".add-security-key").click+ expect(user_preferences_security_page).to have_css(".security-key .second-factor-item")- expect(user_preferences_security_page).to have_css(".security-key .second-factor-item")+ user_menu.sign_out- user_menu.sign_out+ # puts <<~STRING+ # public_key_base64 = \"#{user.second_factor_security_keys.first.public_key}\"+ # private_key_string = \"#{authenticator.credentials.first.private_key}\"+ # STRING- # puts <<~STRING- # public_key_base64 = \"#{user.second_factor_security_keys.first.public_key}\"- # private_key_string = \"#{authenticator.credentials.first.private_key}\"- # STRING+ # login flow+ find(".d-header .login-button").click+ find("input#login-account-name").fill_in(with: user.username)+ find("input#login-account-password").fill_in(with: password)- # login flow- find(".d-header .login-button").click- find("input#login-account-name").fill_in(with: user.username)- find("input#login-account-password").fill_in(with: password)+ find("#login-button.btn-primary").click+ find("#security-key .btn-primary").click- find("#login-button.btn-primary").click- find("#security-key .btn-primary").click-- expect(page).to have_css(".header-dropdown-toggle.current-user")- ensure- # clear authenticator (otherwise it will interfere with other tests)- authenticator&.remove!+ expect(page).to have_css(".header-dropdown-toggle.current-user")+ endendend@@ -60,65 +56,55 @@ describe "User preferences | Security", type: :system dobefore { SiteSetting.enable_passkeys = true }it "adds a passkey, removes user password, logs in with passkey" do- options =- ::Selenium::WebDriver::VirtualAuthenticatorOptions.new(- user_verification: true,- user_verified: true,- resident_key: true,- )- authenticator = page.driver.browser.add_virtual_authenticator(options)-- page.driver.browser.manage.add_cookie(- domain: Discourse.current_hostname,- name: "destination_url",- value: "/new",- path: "/",- )+ with_virtual_authenticator(+ hasUserVerification: true,+ hasResidentKey: true,+ isUserVerified: true,+ ) do+ add_cookie(name: "destination_url", value: "/new")- user_preferences_security_page.visit(user)+ user_preferences_security_page.visit(user)- find(".pref-passkeys__add .btn").click- expect(user_preferences_security_page).to have_css("input#password")+ find(".pref-passkeys__add .btn").click+ expect(user_preferences_security_page).to have_css("input#password")- find(".dialog-body input#password").fill_in(with: password)- find(".confirm-session .btn-primary").click+ find(".dialog-body input#password").fill_in(with: password)+ find(".confirm-session .btn-primary").click- expect(user_preferences_security_page).to have_css(".rename-passkey__form")+ expect(user_preferences_security_page).to have_css(".rename-passkey__form")- find(".dialog-close").click+ find(".dialog-close").click- expect(user_preferences_security_page).to have_css(".pref-passkeys__rows .row")+ expect(user_preferences_security_page).to have_css(".pref-passkeys__rows .row")- select_kit = PageObjects::Components::SelectKit.new(".passkey-options-dropdown")- select_kit.expand- select_kit.select_row_by_name("Delete")+ select_kit = PageObjects::Components::SelectKit.new(".passkey-options-dropdown")+ select_kit.expand+ select_kit.select_row_by_name("Delete")- # confirm deletion screen shown without requiring session confirmation- # since this was already done when adding the passkey- expect(user_preferences_security_page).to have_css(".dialog-footer .btn-danger")+ # confirm deletion screen shown without requiring session confirmation+ # since this was already done when adding the passkey+ expect(user_preferences_security_page).to have_css(".dialog-footer .btn-danger")- # close the dialog (don't delete the key, we need it to login in the next step)- find(".dialog-close").click+ # close the dialog (don't delete the key, we need it to login in the next step)+ find(".dialog-close").click- find("#remove-password-link").click- # already confirmed session for the passkey, so this will go straight for the confirmation dialog- find(".dialog-footer .btn-danger").click- expect(user_preferences_security_page).to have_no_css("#remove-password-link")+ find("#remove-password-link").click+ # already confirmed session for the passkey, so this will go straight for the confirmation dialog+ find(".dialog-footer .btn-danger").click+ expect(user_preferences_security_page).to have_no_css("#remove-password-link")- user_menu.sign_out+ user_menu.sign_out- # login with the key we just created- # this triggers the conditional UI for passkeys- # which uses the virtual authenticator- find(".d-header .login-button").click+ # login with the key we just created+ # this triggers the conditional UI for passkeys+ # which uses the virtual authenticator+ find(".d-header .login-button").click- expect(page).to have_css(".header-dropdown-toggle.current-user")+ expect(page).to have_css(".header-dropdown-toggle.current-user")- # ensures that we are redirected to the destination_url cookie- expect(page.driver.current_url).to include("/new")- ensure- # clear authenticator (otherwise it will interfere with other tests)- authenticator&.remove!+ # ensures that we are redirected to the destination_url cookie+ expect(page.driver.current_url).to include("/new")+ endendenddiff --git a/spec/system/user_selector_spec.rb b/spec/system/user_selector_spec.rbindex e629bc82ca0..c5169e685cd 100644--- a/spec/system/user_selector_spec.rb+++ b/spec/system/user_selector_spec.rb@@ -15,7 +15,7 @@ describe "User selector", type: :system doit "correctly shows the user" dovisit("/t/-/#{topic.id}")find(".btn-primary.create").click- find(".d-editor-input").fill_in(with: "Hello @som")+ find(".d-editor-input").send_keys("Hello @som")within(".autocomplete.ac-user") do |el|expect(el).to have_selector(".selected .avatar[title=someone]")@@ -28,7 +28,7 @@ describe "User selector", type: :system doit "correctly shows the user" dovisit("/t/-/#{topic.id}")find(".btn-primary.create").click- find(".d-editor-input").fill_in(with: "Hello @adm")+ find(".d-editor-input").send_keys("Hello @adm")within(".autocomplete.ac-user") do |el|expect(el).to have_selector(".selected .d-icon-users")