Fix QA selector class used to click on QA elements

This commit is contained in:
Grzegorz Bizon 2018-01-10 10:49:11 +01:00
parent fc9ecdbb4f
commit 9910968f0c
4 changed files with 15 additions and 4 deletions

View file

@ -6,8 +6,8 @@
.dropdown-menu.projects-dropdown-menu
= render "layouts/nav/projects_dropdown/show"
= nav_link(controller: ['dashboard/groups', 'explore/groups'], html_options: { class: "hidden-xs qa-groups-link" }) do
= link_to dashboard_groups_path, class: 'dashboard-shortcuts-groups', title: 'Groups' do
= nav_link(controller: ['dashboard/groups', 'explore/groups'], html_options: { class: "hidden-xs" }) do
= link_to dashboard_groups_path, class: 'dashboard-shortcuts-groups qa-groups-link', title: 'Groups' do
Groups
= nav_link(path: 'dashboard#activity', html_options: { class: "visible-lg" }) do

View file

@ -41,7 +41,7 @@ module QA
end
def click_element(name)
find(Page::Element.new(name).selector).click
find(Page::Element.new(name).selector_css).click
end
def self.path

View file

@ -12,6 +12,10 @@ module QA
"qa-#{@name.to_s.tr('_', '-')}"
end
def selector_css
".#{selector}"
end
def expression
if @pattern.is_a?(String)
@_regexp ||= Regexp.new(Regexp.escape(@pattern))

View file

@ -1,11 +1,18 @@
describe QA::Page::Element do
describe '#selector' do
it 'transform element name into QA-specific selector' do
it 'transforms element name into QA-specific selector' do
expect(described_class.new(:sign_in_button).selector)
.to eq 'qa-sign-in-button'
end
end
describe '#selector_css' do
it 'transforms element name into QA-specific clickable css selector' do
expect(described_class.new(:sign_in_button).selector_css)
.to eq '.qa-sign-in-button'
end
end
context 'when pattern is an expression' do
subject { described_class.new(:something, /button 'Sign in'/) }