Commit 7d61ce0f authored by Walmyr's avatar Walmyr Committed by Rémy Coutable

Change test assertions

With the new assertions we benefit from:
- Running the test faster
- Testing the real functionality instead of only asserting on
messages
parent eeab52de
......@@ -242,7 +242,7 @@ module QA
issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'Issue to test the scoped labels'
issue.labels = @initial_label
issue.labels = [@initial_label]
end
[@new_label_same_scope, @new_label_different_scope].each do |label|
......@@ -365,6 +365,14 @@ Add the following `attribute :id` and `attribute :labels` right above the [`attr
> We add the attributes above the existing attribute to keep them alphabetically organized.
Then, let's initialize an instance variable for labels to allow an empty array as default value when such information is not passed during the resource fabricatioin, since this optional. [Between the attributes and the `fabricate!` method](https://gitlab.com/gitlab-org/gitlab-ee/blob/1a1f1408728f19b2aa15887cd20bddab7e70c8bd/qa/qa/resource/issue.rb#L18), add the following:
```ruby
def initialize
@labels = []
end
```
Next, add the following code right below the [`fabricate!`](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/issue.rb#L27) method.
```ruby
......@@ -378,7 +386,7 @@ end
def api_post_body
{
labels: [labels],
labels: labels,
title: title
}
end
......
......@@ -258,6 +258,7 @@ export default {
:can-reorder="canReorder"
:path-id-separator="pathIdSeparator"
event-namespace="relatedIssue"
class="qa-related-issuable-item"
@relatedIssueRemoveRequest="$emit('relatedIssueRemoveRequest', $event)"
>
<span v-if="issue.weight" slot="weight" class="order-md-1">
......
......@@ -25,6 +25,10 @@ module QA
element :add_issue_input
end
view 'ee/app/assets/javascripts/related_issues/components/related_issues_block.vue' do
element :related_issuable_item
end
view 'ee/app/assets/javascripts/related_issues/constants.js' do
element :add_issues_button
end
......@@ -58,6 +62,14 @@ module QA
def close_reopen_epic
click_element :close_reopen_epic_button
end
def has_related_issuable_item?
has_element?(:related_issuable_item)
end
def has_no_related_issuable_item?
has_no_element?(:related_issuable_item)
end
end
end
end
......
......@@ -16,6 +16,10 @@ module QA
attribute :labels
attribute :title
def initialize
@labels = []
end
def fabricate!
project.visit!
......@@ -38,7 +42,7 @@ module QA
def api_post_body
{
labels: [labels],
labels: labels,
title: title
}
end
......
......@@ -44,15 +44,15 @@ module QA
EE::Page::Group::Epic::Show.perform do |show_page|
show_page.add_issue_to_epic(issue.web_url)
expect(show_page).to have_content('added issue')
expect(show_page).to have_related_issuable_item
show_page.remove_issue_from_epic
expect(show_page).to have_content('removed issue')
expect(show_page).to have_no_related_issuable_item
end
end
it 'comments on epic', :quarantine do
it 'comments on epic' do
epic.visit!
comment = 'My Epic Comment'
......@@ -75,7 +75,7 @@ module QA
expect(page).to have_content('Open')
end
it 'adds/removes issue to/from epic using quick actions', :quarantine do
it 'adds/removes issue to/from epic using quick actions' do
issue.visit!
Page::Project::Issue::Show.perform do |show_page|
......@@ -97,7 +97,6 @@ module QA
def create_issue_resource
Resource::Issue.fabricate_via_api! do |issue|
issue.labels = ''
issue.title = 'Issue created via API'
end
end
......
......@@ -17,11 +17,13 @@ module QA
project.group = group
end
Resource::Issue.fabricate_via_browser_ui! do |issue|
issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = issue_title
issue.project = project
end
issue.visit!
Page::Project::Issue::Show.perform do |show|
# Due to the randomness of tests execution, sometimes a previous test
# may have changed the filter, which makes the below action needed.
......
......@@ -11,7 +11,7 @@ module QA
issue = Resource::Issue.fabricate_via_api! do |issue|
issue.title = 'Issue to test the scoped labels'
issue.labels = @initial_label
issue.labels = [@initial_label]
end
[@new_label_same_scope, @new_label_different_scope].each do |label|
......
......@@ -26,7 +26,6 @@ module QA
@issue = Resource::Issue.fabricate! do |issue|
issue.title = 'My geo issue'
issue.project = @project
issue.labels = ''
end
@issue.visit!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment