DEV: add watched words system spec

This commit is contained in:
Régis Hanol 2024-04-30 19:03:27 +02:00
parent e7d0083dbe
commit f4acb43ee7
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,20 @@
# frozen_string_literal: true
describe "Admin Watched Words", type: :system, js: true do
fab!(:current_user) { Fabricate(:admin) }
before { sign_in(current_user) }
let(:ww_page) { PageObjects::Pages::AdminWatchedWords.new }
it "correctly saves watched words" do
ww_page.visit
ww_page.add_word "foo"
expect(ww_page).to have_word
ww_page.visit
expect(ww_page).to have_word
end
end

View File

@ -0,0 +1,25 @@
# frozen_string_literal: true
module PageObjects
module Pages
class AdminWatchedWords < PageObjects::Pages::Base
def visit
page.visit "admin/customize/watched_words"
self
end
def add_word(word)
ww = page.find("#watched-words")
ww.find("#watched-words-header").click
ww.find(".filter-input").send_keys(word)
ww.find(".select-kit-row").click
page.find(".watched-words-detail .btn-primary").click
end
def has_word?
has_css?(".watched-words-detail .show-words-checkbox")
end
end
end
end