mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:50:00 +08:00
DEV: add watched words system spec
This commit is contained in:
parent
e7d0083dbe
commit
f4acb43ee7
20
spec/system/admin_watched_words_spec.rb
Normal file
20
spec/system/admin_watched_words_spec.rb
Normal 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
|
25
spec/system/page_objects/pages/admin_watched_words.rb
Normal file
25
spec/system/page_objects/pages/admin_watched_words.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user