2021-01-03 14:25:43 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# These helpers allow you to manipulate with notes.
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# describe "..." do
|
2023-06-20 00:43:36 +05:30
|
|
|
# include Features::CanonicalLinkHelpers
|
2021-01-03 14:25:43 +05:30
|
|
|
# ...
|
|
|
|
#
|
|
|
|
# expect(page).to have_canonical_link(url)
|
|
|
|
#
|
2023-06-20 00:43:36 +05:30
|
|
|
module Features
|
|
|
|
module CanonicalLinkHelpers
|
|
|
|
def have_canonical_link(url)
|
|
|
|
have_xpath("//link[@rel=\"canonical\" and @href=\"#{url}\"]", visible: false)
|
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
def have_any_canonical_links
|
|
|
|
have_xpath('//link[@rel="canonical"]', visible: false)
|
2021-01-03 14:25:43 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|