1# frozen_string_literal: true 2 3module QA 4 module Page 5 module File 6 class Form < Page::Base 7 include Shared::CommitMessage 8 include Page::Component::DropdownFilter 9 include Shared::CommitButton 10 include Shared::Editor 11 12 view 'app/views/projects/blob/_editor.html.haml' do 13 element :file_name, "text_field_tag 'file_name'" # rubocop:disable QA/ElementWithPattern 14 end 15 16 view 'app/views/projects/blob/_template_selectors.html.haml' do 17 element :template_type_dropdown 18 element :gitignore_dropdown 19 element :gitlab_ci_yml_dropdown 20 element :dockerfile_dropdown 21 element :license_dropdown 22 end 23 24 def add_name(name) 25 fill_in 'file_name', with: name 26 end 27 28 def select_template(template_type, template) 29 click_element :template_type_dropdown 30 click_link template_type 31 32 case template_type 33 when '.gitignore' 34 click_element :gitignore_dropdown 35 when '.gitlab-ci.yml' 36 click_element :gitlab_ci_yml_dropdown 37 when 'Dockerfile' 38 click_element :dockerfile_dropdown 39 when 'LICENSE' 40 click_element :license_dropdown 41 else 42 raise %Q(Unsupported template_type "#{template_type}". Please confirm that it is a valid option.) 43 end 44 filter_and_select template 45 end 46 end 47 end 48 end 49end 50