This commit is contained in:
Christoph Haas 2025-06-26 23:34:51 +02:00
parent d40d2ff164
commit e1f42aee0c
3 changed files with 19 additions and 20 deletions

View file

@ -1,4 +1,4 @@
require "application_system_test_case"
require 'application_system_test_case'
class BrowsesTest < ApplicationSystemTestCase
# test "visiting the index" do
@ -7,14 +7,13 @@ class BrowsesTest < ApplicationSystemTestCase
# assert_selector "h1", text: "Browse"
# end
test "user can see home page" do
test 'user can see home page' do
visit root_path
assert_text /This website lets you browse screenshots of [\d,]+ software packages/
assert_text(/This website lets you browse screenshots of [\d,]+ software packages/)
end
test "user can browse packages" do
test 'user can browse packages' do
visit packages_grid_path
has_link? href: packages_grid_path(page: 2)
end
end

View file

@ -1,7 +1,7 @@
require "application_system_test_case"
require 'application_system_test_case'
class UploadsTest < ApplicationSystemTestCase
test "upload broken screenshot anonymously and get error message" do
test 'upload broken screenshot anonymously and get error message' do
visit package_path(name: 'firefox')
click_on 'Upload a screenshot'
# The actual file field is hidden in favor of a more beautiful button -> visible=false
@ -10,10 +10,10 @@ class UploadsTest < ApplicationSystemTestCase
assert_text 'large-broken.png must be a valid'
end
test "upload png screenshot anonymously and await moderation" do
test 'upload png screenshot anonymously and await moderation' do
visit package_path(name: 'firefox')
img_count1 = page.find_all('img').count
#Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count1}"
# Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count1}"
click_on 'Upload a screenshot'
attach_file 'file[]', Rails.root.join('test/fixtures/files/large1.png'), visible: false
@ -25,7 +25,7 @@ class UploadsTest < ApplicationSystemTestCase
assert page.has_content?('needs to be approved')
img_count2 = page.find_all('img').count
#Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count2}"
# Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count2}"
assert_equal img_count2, img_count1 + 1
@ -40,13 +40,12 @@ class UploadsTest < ApplicationSystemTestCase
# Wait for redirect to details page
assert page.has_content?('Homepage')
img_count3 = page.find_all('img').count
#Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count3}"
# Rails::logger.debug "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 1=#{img_count3}"
assert_equal img_count3, img_count1
end
test "upload png screenshot as moderator and expect auto-approval" do
test 'upload png screenshot as moderator and expect auto-approval' do
# Delete all screenshots for the Firefox package
Package.find_by_name(:firefox).screenshots.delete_all
@ -83,7 +82,6 @@ class UploadsTest < ApplicationSystemTestCase
assert page.has_content?('Homepage')
end
# test "upload screenshot as Debian SSO user and get auto-approval" do
# sign_in users(:debian)
# visit upload_path(name: 'firefox')
@ -128,5 +126,4 @@ class UploadsTest < ApplicationSystemTestCase
# newest_screenshot.destroy
# sign_out users(:debian)
# end
end