Fix test suite
This commit is contained in:
parent
2b24083653
commit
47df4d8afd
5 changed files with 44 additions and 37 deletions
|
|
@ -4,27 +4,34 @@ class UploadsTest < ApplicationSystemTestCase
|
|||
test "upload broken screenshot anonymously and get error message" do
|
||||
visit package_path(name: 'firefox')
|
||||
click_on 'Upload a screenshot'
|
||||
attach_file 'file[]', Rails.root.join('test/fixtures/files/large-broken.png')
|
||||
click_on 'Start upload'
|
||||
# The actual file field is hidden in favor of a more beautiful button -> visible=false
|
||||
attach_file 'file[]', Rails.root.join('test/fixtures/files/large-broken.png'), visible: false
|
||||
# Upload starts automatically through Javascript trigger
|
||||
assert_text 'large-broken.png must be a valid'
|
||||
end
|
||||
|
||||
# test "upload png screenshot anonymously and await moderation" do
|
||||
# visit package_path(name: 'firefox')
|
||||
# click_on 'Upload a screenshot'
|
||||
# img_count_before = page.find_all('img').count
|
||||
# attach_file 'file[]', Rails.root.join('test/fixtures/files/large1.png')
|
||||
# click_on 'Start upload'
|
||||
# img_count_after = page.find_all('img').count
|
||||
# assert_equal img_count_after, img_count_before + 1
|
||||
test "upload png screenshot anonymously and await moderation" do
|
||||
visit package_path(name: 'firefox')
|
||||
img_count_before = page.find_all('img').count
|
||||
click_on 'Upload a screenshot'
|
||||
attach_file 'file[]', Rails.root.join('test/fixtures/files/large1.png'), visible: false
|
||||
|
||||
# # Screenshot must be moderated
|
||||
# newest_screenshot = Package.find_by_name(:firefox).screenshots.order(id: :desc).first
|
||||
# assert_equal newest_screenshot.approved, false
|
||||
# Upload starts automatically when file is selected.
|
||||
# Wait for upload to complete.
|
||||
# https://github.com/teamcapybara/capybara#asynchronous-javascript-ajax-and-friends
|
||||
assert page.has_content?('Uploaded by you')
|
||||
assert page.has_content?('needs to be approved')
|
||||
|
||||
# # Clean up
|
||||
# newest_screenshot.destroy
|
||||
# end
|
||||
img_count_after = page.find_all('img').count
|
||||
assert_equal img_count_after, img_count_before + 1
|
||||
|
||||
# Screenshot must be moderated
|
||||
newest_screenshot = Package.find_by_name(:firefox).screenshots.order(id: :desc).first
|
||||
assert_equal newest_screenshot.approved, false
|
||||
|
||||
# Clean up
|
||||
newest_screenshot.destroy
|
||||
end
|
||||
|
||||
# test "upload screenshot as Debian SSO user and get auto-approval" do
|
||||
# sign_in users(:debian)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue