From 390e0d8906c066996e8bbb14aa5824643f9798f8 Mon Sep 17 00:00:00 2001 From: ddavison Date: Wed, 29 May 2019 16:47:53 -0700 Subject: Introduce data-qa-selector to supplant .qa-class In order to break away from using CSS classes as our primary method of element identification, we need to provide the ability to search for data attributes. Make Test::Sanity::Selectors now work Utilize regex to match on literal strings of the element name Suggest the data-qa-selector pattern vs the qa- Add data-qa-selector to login page to start We need a page that is heavily used in order to be confident that this functionality works. Let's start with the Login page Use appropriate HAML data tag practices --- rubocop/cop/qa/element_with_pattern.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rubocop') diff --git a/rubocop/cop/qa/element_with_pattern.rb b/rubocop/cop/qa/element_with_pattern.rb index d14eeaaeaf3..f7debf13151 100644 --- a/rubocop/cop/qa/element_with_pattern.rb +++ b/rubocop/cop/qa/element_with_pattern.rb @@ -30,7 +30,7 @@ module RuboCop return if args.first.nil? args.first.each_node(:str) do |arg| - add_offense(arg, message: MESSAGE % "qa-#{element_name.value.to_s.tr('_', '-')}") + add_offense(arg, message: MESSAGE % "data-qa-selector=\"#{element_name.value}\"") end end -- cgit v1.2.1