discourse/spec/system/post_menu_spec.rb
Martin Brennan 4e6d4193ea
DEV: Fix spec for post menu (#25100)
Followup to b92993fcee
I ran out of time to get this working for that fix,
also here I am making the post.url method have parity
with post.shareUrl in JS, which omits the post number
for the first post.
2024-01-03 16:55:08 +10:00

26 lines
681 B
Ruby

# frozen_string_literal: true
describe "Post menu", type: :system, js: true do
fab!(:current_user) { Fabricate(:user) }
fab!(:topic)
fab!(:post) { Fabricate(:post, topic: topic) }
let(:topic_page) { PageObjects::Pages::Topic.new }
before { sign_in(current_user) }
describe "copy link" do
let(:cdp) { PageObjects::CDP.new }
before { cdp.allow_clipboard }
it "copies the absolute link to the post when clicked" do
topic_page.visit_topic(post.topic)
topic_page.click_post_action_button(post, :copy_link)
expect(cdp.read_clipboard).to eq(
post.full_url(share_url: true) + "?u=#{current_user.username}",
)
end
end
end