Skip to content

Commit

Permalink
Add basic end-to-end test for admin moderation interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed Feb 27, 2024
1 parent 76d2561 commit cf7ea97
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spec/support/streaming_server_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def stop
# Also needs to be set per-example here because of the database cleaner.
Setting.registrations_mode = 'open'

# Load seeds so we have the default roles otherwise cleared by `DatabaseCleaner`
Rails.application.load_seed

example.run
end

Expand Down
32 changes: 32 additions & 0 deletions spec/system/report_interface_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

require 'rails_helper'

describe 'report interface', :paperclip_processing do
include ProfileStories

let(:email) { 'admin@example.com' }
let(:password) { 'password' }
let(:confirmed_at) { Time.zone.now }
let(:finished_onboarding) { true }

let(:reported_account) { Fabricate(:account) }
let(:reported_status) { Fabricate(:status, account: reported_account) }
let(:media_attachment) { Fabricate(:media_attachment, account: reported_account, status: reported_status, file: attachment_fixture('attachment.jpg')) }
let!(:report) { Fabricate(:report, target_account: reported_account, status_ids: [media_attachment.status.id]) }

before do
as_a_logged_in_user
bob.update!(role: UserRole.find_by!(name: 'Admin'))
visit admin_report_path(report)
end

it 'displays the report interface, including the javascript bits' do
# The report category selector React component is properly rendered
expect(page).to have_css('.report-reason-selector')

# The media React component is properly rendered
page.scroll_to(page.find('.batch-table__row'))
expect(page).to have_css('.spoiler-button__overlay__label')
end
end

0 comments on commit cf7ea97

Please sign in to comment.