diff options
author | Mark Lapierre <mlapierre@gitlab.com> | 2018-09-26 15:15:35 -0400 |
---|---|---|
committer | Mark Lapierre <mlapierre@gitlab.com> | 2018-10-09 11:17:02 -0400 |
commit | d36055cbef1e5f2e9ffe1b0b9c1ad32e85bb5248 (patch) | |
tree | 98762181835df5d65c26a17af846593c1e6712e4 /qa/qa/page/file | |
parent | eeb0baff480a5b4275fb152920e5b81b1a2cda3c (diff) | |
download | gitlab-ce-d36055cbef1e5f2e9ffe1b0b9c1ad32e85bb5248.tar.gz |
Add tests of adding file templates
Adds tests that adds new files via file templates via the Files view
and the Web IDE.
Includes changes to page objects and associated code
Fetches template content from the API rather than hardcoding strings
that will need to be updated if the templates change. Some of the
content is stored as flat files but we can't use them because they're
not included in the docker images gitlab-qa uses.
Diffstat (limited to 'qa/qa/page/file')
-rw-r--r-- | qa/qa/page/file/form.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/qa/qa/page/file/form.rb b/qa/qa/page/file/form.rb index f6e502f500b..3752f5066c9 100644 --- a/qa/qa/page/file/form.rb +++ b/qa/qa/page/file/form.rb @@ -3,6 +3,7 @@ module QA module File class Form < Page::Base include Shared::CommitMessage + include Page::Component::DropdownFilter view 'app/views/projects/blob/_editor.html.haml' do element :file_name, "text_field_tag 'file_name'" @@ -13,6 +14,14 @@ module QA element :commit_changes, "button_tag 'Commit changes'" end + view 'app/views/projects/blob/_template_selectors.html.haml' do + element :template_type_dropdown + element :gitignore_dropdown + element :gitlab_ci_yml_dropdown + element :dockerfile_dropdown + element :license_dropdown + end + def add_name(name) fill_in 'file_name', with: name end @@ -29,6 +38,25 @@ module QA click_on 'Commit changes' end + def select_template(template_type, template) + click_element :template_type_dropdown + click_link template_type + + case template_type + when '.gitignore' + click_element :gitignore_dropdown + when '.gitlab-ci.yml' + click_element :gitlab_ci_yml_dropdown + when 'Dockerfile' + click_element :dockerfile_dropdown + when 'LICENSE' + click_element :license_dropdown + else + raise %Q(Unsupported template_type "#{template_type}". Please confirm that it is a valid option.) + end + filter_and_select template + end + private def text_area |