diff options
author | ddavison <ddavison@gitlab.com> | 2019-05-30 02:47:53 +0300 |
---|---|---|
committer | ddavison <ddavison@gitlab.com> | 2019-07-11 02:09:43 +0300 |
commit | 390e0d8906c066996e8bbb14aa5824643f9798f8 (patch) | |
tree | 8b220d1d2e0770bc96cc958ce624043e1ae0885e /app/views | |
parent | 48fa47e07d54979b70704beb16ea55548f2190c4 (diff) |
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
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/devise/sessions/_new_base.html.haml | 6 | ||||
-rw-r--r-- | app/views/layouts/devise.html.haml | 2 | ||||
-rw-r--r-- | app/views/layouts/header/_default.html.haml | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/app/views/devise/sessions/_new_base.html.haml b/app/views/devise/sessions/_new_base.html.haml index 7dacd0b1d72..2f10f08c839 100644 --- a/app/views/devise/sessions/_new_base.html.haml +++ b/app/views/devise/sessions/_new_base.html.haml @@ -1,10 +1,10 @@ = form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: 'new_user gl-show-field-errors', 'aria-live' => 'assertive'}) do |f| .form-group = f.label "Username or email", for: "user_login", class: 'label-bold' - = f.text_field :login, class: "form-control top qa-login-field", autofocus: "autofocus", autocapitalize: "off", autocorrect: "off", required: true, title: "This field is required." + = f.text_field :login, class: "form-control top", autofocus: "autofocus", autocapitalize: "off", autocorrect: "off", required: true, title: "This field is required.", data: { qa_selector: 'login_field' } .form-group = f.label :password, class: 'label-bold' - = f.password_field :password, class: "form-control bottom qa-password-field", required: true, title: "This field is required." + = f.password_field :password, class: "form-control bottom", required: true, title: "This field is required.", data: { qa_selector: 'password_field' } - if devise_mapping.rememberable? .remember-me %label{ for: "user_remember_me" } @@ -17,4 +17,4 @@ = recaptcha_tags .submit-container.move-submit-down - = f.submit "Sign in", class: "btn btn-success qa-sign-in-button" + = f.submit "Sign in", class: "btn btn-success", data: { qa_selector: 'sign_in_button' } diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml index ff3410f6268..e9a4a068599 100644 --- a/app/views/layouts/devise.html.haml +++ b/app/views/layouts/devise.html.haml @@ -1,7 +1,7 @@ !!! 5 %html.devise-layout-html{ class: system_message_class } = render "layouts/head" - %body.ui-indigo.login-page.application.navless.qa-login-page{ data: { page: body_data_page } } + %body.ui-indigo.login-page.application.navless{ data: { page: body_data_page, qa_selector: 'login_page' } } = header_message .page-wrap = render "layouts/header/empty" diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index f9ee6f42e23..36ae24fc4bf 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -5,7 +5,7 @@ - else - search_path_url = search_path -%header.navbar.navbar-gitlab.qa-navbar.navbar-expand-sm.js-navbar +%header.navbar.navbar-gitlab.navbar-expand-sm.js-navbar{ data: { qa_selector: 'navbar' } } %a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content .container-fluid .header-content |