summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalmyr Lima <walmyr@gitlab.com>2019-07-31 15:29:06 +0200
committerWalmyr Lima <walmyr@gitlab.com>2019-08-01 12:51:03 +0200
commitf26bb243ccf4e05f3f231d3ed62eb862dc643f0c (patch)
tree39e0999facd8c4181516df8bedef0ce6b0a9da35
parent25cfdd69d3fbdd44d4fc2588ea2c0413d3a089df (diff)
downloadgitlab-ce-f26bb243ccf4e05f3f231d3ed62eb862dc643f0c.tar.gz
Update e2e style guide with new guidelinedocs/update-end-to-end-style-guide
-rw-r--r--doc/development/testing_guide/end_to_end/style_guide.md44
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/development/testing_guide/end_to_end/style_guide.md b/doc/development/testing_guide/end_to_end/style_guide.md
index c9c375d4320..97560e616a1 100644
--- a/doc/development/testing_guide/end_to_end/style_guide.md
+++ b/doc/development/testing_guide/end_to_end/style_guide.md
@@ -98,3 +98,47 @@ view '...' do
element :ssh_clone_url
end
```
+
+## Block argument naming
+
+To have a standard on how we call pages when using the `.perform` method, we use the name of page object being called, all lowercased, and separated by underscore, if needed (see good and bad examples below.) This also applies to resources. We chose not to simply use `page` because that would shadow the Capybara DSL, potentially leading to confusion and bugs.
+
+### Examples
+
+**Good**
+
+```ruby
+# qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb
+
+Page::Project::Settings::Members.perform do |members|
+ members.do_something
+end
+```
+
+```ruby
+# qa/specs/features/ee/browser_ui/3_create/merge_request/add_batch_comments_in_merge_request_spec.rb
+
+Resource::MergeRequest.fabricate! do |merge_request|
+ merge_request.do_something_else
+end
+```
+
+**Bad**
+
+```ruby
+# qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb
+
+Page::Project::Settings::Members.perform do |project_settings_members_page|
+ project_settings_members_page.do_something
+end
+```
+
+```ruby
+# qa/specs/features/ee/browser_ui/3_create/merge_request/add_batch_comments_in_merge_request_spec.rb
+
+Resource::MergeRequest.fabricate! do |merge_request_page|
+ merge_request_page.do_something_else
+end
+```
+
+> Besides the advantage of having a standard in place, by following this standard we also write shorter lines of code. \ No newline at end of file