Commit 69186b8d authored by David Lucadou's avatar David Lucadou

Filled out a couple of tests

parent 9b1b1f18
Pipeline #60918022 passed with stage
in 9 minutes and 9 seconds
require 'rails_helper'
include AuthenticationHelpers
include ReportsHelpers
#include ReportsHelpers
# need to:
# add some reports to the test_seeds file
......@@ -8,15 +9,70 @@ include AuthenticationHelpers
RSpec.describe "AdminReportsSearch", type: :request do
before :each do
email = 'admin@domain.example'
password = 'passwordpassword1'
sign_in_with(email, password)
visit chat_logs_path
name_1 = 'Test User 1'
email_1 = 'testuser@domain.test'
password_1 = 'CorrectHorseBatteryStaple'
sign_up_with(name_1, email_1, password_1, password_1)
sign_in_with(email_1, password_1)
(1..20).each do |n|
create_report_with(msg_id: n, reason: "Reason #{n}")
end
sign_out_with()
name_2 = 'Test User 2'
email_2 = 'testuser2@domain.test'
password_2 = 'CorrectHorseBatteryStaple2'
sign_up_with(name_2, email_2, password_2, password_2)
sign_in_with(email_2, password_2)
(10..30).each do |n|
create_report_with(msg_id: n, reason: "ReaSoN #{n}")
end
(120..124).each do |n|
create_report_with(msg_id: n, reason: "/reAsOn #{n}")
end
(124..126).each do |n|
create_report_with(msg_id: n, reason: "/rEason #{n}/")
end
(126..130).each do |n|
create_report_with(msg_id: n, reason: "reasOn #{n}/")
end
switch_to_user(email_1, password_1)
(125..130).each do |n|
create_report_with(msg_id: n, reason: "rEasOn #{n}")
end
admin_email = 'admin@domain.example'
admin_password = 'passwordpassword1'
switch_to_user(admin_email, admin_password)
@basic_user_1 = {username: email_1, password: password_1}
@basic_user_2 = {username: email_2, password: password_2}
@admin_user = {username: admin_email, password: admin_password}
visit admin_reports_path
end
describe "Admin can" do
it "see reports from all users"
it "search all reports with no fields filled in"
it "see reports from all users" do
visit admin_reports_path
# See reports from Test User 1
expect(page).to have_content("rEasOn 130")
expect(page).to have_content("rEasOn 128")
expect(page).to have_content("rEasOn 125")
# See reports from Test User 2
expect(page).to have_content("reasOn 130/")
expect(page).to have_content("reasOn 128/")
expect(page).to have_content("reasOn 127/")
expect(page).to have_link("Next ›", href: admin_reports_path(page: 2))
expect(page).to have_link("Last »", href: admin_reports_path(page: 10))
end
it "search all reports with no fields filled in" do
search_admin_reports_with()
expect(page).to have_content("rEasOn 130")
expect(page).to have_content("rEasOn 128")
expect(page).to have_content("rEasOn 125")
expect(page).to have_content("reasOn 130/")
expect(page).to have_content("reasOn 128/")
expect(page).to have_content("reasOn 127/")
expect(page).to have_link("Next ›", href: "/admin/reports?advanced_query=&channel=&end_time=&page=2&per_page=&reason=&resolved=all&resolver_id=&sender=&start_time=&user_id=")
expect(page).to have_link("Last »", href: "/admin/reports?advanced_query=&channel=&end_time=&page=10&per_page=&reason=&resolved=all&resolver_id=&sender=&start_time=&user_id=")
end
it "search all reports with a report status"
it "search all reports with a reporting user ID"
# email and ID
......
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