Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7bcbd59f
Commit
7bcbd59f
authored
Nov 16, 2020
by
Erick Banks
Committed by
Mark Lapierre
Nov 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor file tests
Break up the previous file create, edit, delete tests into individual tests.
parent
79f7a27c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
8 deletions
+112
-8
qa/qa/resource/file.rb
qa/qa/resource/file.rb
+13
-8
qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb
...r_ui/3_create/repository/file/create_file_via_web_spec.rb
+31
-0
qa/qa/specs/features/browser_ui/3_create/repository/file/delete_file_via_web_spec.rb
...r_ui/3_create/repository/file/delete_file_via_web_spec.rb
+32
-0
qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb
...ser_ui/3_create/repository/file/edit_file_via_web_spec.rb
+36
-0
No files found.
qa/qa/resource/file.rb
View file @
7bcbd59f
...
...
@@ -5,10 +5,10 @@ module QA
class
File
<
Base
attr_accessor
:author_email
,
:author_name
,
:branch
,
:content
,
:commit_message
,
:name
attr_writer
:branch
attribute
:project
do
Project
.
fabricate!
do
|
resource
|
...
...
@@ -29,6 +29,10 @@ module QA
@commit_message
=
'QA Test - Commit message'
end
def
branch
@branch
||=
"master"
end
def
fabricate!
project
.
visit!
...
...
@@ -42,12 +46,6 @@ module QA
end
end
def
resource_web_url
(
resource
)
super
rescue
ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def
api_get_path
"/projects/
#{
CGI
.
escape
(
project
.
path_with_namespace
)
}
/repository/files/
#{
CGI
.
escape
(
@name
)
}
"
end
...
...
@@ -58,13 +56,20 @@ module QA
def
api_post_body
{
branch:
@branch
||
"master"
,
branch:
branch
,
author_email:
@author_email
||
Runtime
::
User
.
default_email
,
author_name:
@author_name
||
Runtime
::
User
.
username
,
content:
content
,
commit_message:
commit_message
}
end
private
def
transform_api_resource
(
api_resource
)
api_resource
[
:web_url
]
=
"
#{
Runtime
::
Scenario
.
gitlab_address
}
/
#{
project
.
full_path
}
/-/tree/
#{
branch
}
/
#{
api_resource
[
:file_path
]
}
"
api_resource
end
end
end
end
qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb
0 → 100644
View file @
7bcbd59f
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Create'
do
context
'File management'
do
file_name
=
'QA Test - File name'
file_content
=
'QA Test - File content'
commit_message_for_create
=
'QA Test - Create new file'
before
do
Flow
::
Login
.
sign_in
end
it
'user creates a file via the Web'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1093'
do
Resource
::
File
.
fabricate_via_browser_ui!
do
|
file
|
file
.
name
=
file_name
file
.
content
=
file_content
file
.
commit_message
=
commit_message_for_create
end
Page
::
File
::
Show
.
perform
do
|
file
|
aggregate_failures
'file details'
do
expect
(
file
).
to
have_file
(
file_name
)
expect
(
file
).
to
have_file_content
(
file_content
)
expect
(
file
).
to
have_commit_message
(
commit_message_for_create
)
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/3_create/repository/file/delete_file_via_web_spec.rb
0 → 100644
View file @
7bcbd59f
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Create'
do
context
'File management'
do
let
(
:file
)
{
Resource
::
File
.
fabricate_via_api!
}
commit_message_for_delete
=
'QA Test - Delete file'
before
do
Flow
::
Login
.
sign_in
file
.
visit!
end
it
'user deletes a file via the Web'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1095'
do
Page
::
File
::
Show
.
perform
do
|
file
|
file
.
click_delete
file
.
add_commit_message
(
commit_message_for_delete
)
file
.
click_delete_file
end
Page
::
Project
::
Show
.
perform
do
|
project
|
aggregate_failures
'file details'
do
expect
(
project
).
to
have_notice
(
'The file has been successfully deleted.'
)
expect
(
project
).
to
have_commit_message
(
commit_message_for_delete
)
expect
(
project
).
not_to
have_file
(
file
.
name
)
end
end
end
end
end
end
qa/qa/specs/features/browser_ui/3_create/repository/
create_edit_delete
_file_via_web_spec.rb
→
qa/qa/specs/features/browser_ui/3_create/repository/
file/edit
_file_via_web_spec.rb
View file @
7bcbd59f
...
...
@@ -2,33 +2,18 @@
module
QA
RSpec
.
describe
'Create'
do
describe
'Files management'
do
it
'user creates, edits and deletes a file via the Web'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/451'
do
Flow
::
Login
.
sign_in
# Create
file_name
=
'QA Test - File name'
file_content
=
'QA Test - File content'
commit_message_for_create
=
'QA Test - Create new file'
context
'File management'
do
let
(
:file
)
{
Resource
::
File
.
fabricate_via_api!
}
Resource
::
File
.
fabricate_via_browser_ui!
do
|
file
|
file
.
name
=
file_name
file
.
content
=
file_content
file
.
commit_message
=
commit_message_for_create
end
updated_file_content
=
'QA Test - Updated file content'
commit_message_for_update
=
'QA Test - Update file'
Page
::
File
::
Show
.
perform
do
|
file
|
aggregate_failures
'file details'
do
expect
(
file
).
to
have_file
(
file_name
)
expect
(
file
).
to
have_file_content
(
file_content
)
expect
(
file
).
to
have_commit_message
(
commit_message_for_create
)
end
end
# Edit
updated_file_content
=
'QA Test - Updated file content'
commit_message_for_update
=
'QA Test - Update file'
before
do
Flow
::
Login
.
sign_in
file
.
visit!
end
it
'user edits a file via the Web'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1094'
do
Page
::
File
::
Show
.
perform
(
&
:click_edit
)
Page
::
File
::
Form
.
perform
do
|
file
|
...
...
@@ -45,23 +30,6 @@ module QA
expect
(
file
).
to
have_commit_message
(
commit_message_for_update
)
end
end
# Delete
commit_message_for_delete
=
'QA Test - Delete file'
Page
::
File
::
Show
.
perform
do
|
file
|
file
.
click_delete
file
.
add_commit_message
(
commit_message_for_delete
)
file
.
click_delete_file
end
Page
::
Project
::
Show
.
perform
do
|
project
|
aggregate_failures
'file details'
do
expect
(
project
).
to
have_notice
(
'The file has been successfully deleted.'
)
expect
(
project
).
to
have_commit_message
(
commit_message_for_delete
)
expect
(
project
).
not_to
have_file
(
file_name
)
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment