-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from maii-chgk/capybara
run capybara tests in CI
- Loading branch information
Showing
14 changed files
with
166 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# we only load action_cable as a workaround (https://github.com/maii-chgk/rating-ui/commit/a87d74163bd1af171131eef05d7e7e6f92b89a9a) | ||
# and don’t actually use it (or need any config for it) | ||
# however, if this file does not exist, action_cable’s test helper crashes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require "minitest/test_task" | ||
|
||
Minitest::TestTask.create(:test) do |t| | ||
t.libs << "test" | ||
t.warning = false | ||
t.test_globs = ["test/system/*_test.rb"] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "test_helper" | ||
require "minitest/autorun" | ||
|
||
class VisitMainPageTest < ActionDispatch::IntegrationTest | ||
include Capybara::DSL | ||
|
||
test "latest release is shown with correct data" do | ||
visit "/" | ||
|
||
assert_selector "table" | ||
|
||
within "table" do | ||
assert_selector "tr", text: "Борский корабел" | ||
assert_selector "tr", text: "14825" | ||
end | ||
end | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
ENV["RAILS_ENV"] = "test" | ||
|
||
require "minitest" | ||
require_relative "../config/environment" | ||
require "capybara/rails" | ||
Capybara.default_driver = :rack_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--This trims a full Postgres backup to leave only data used in tests | ||
|
||
drop table auth_group_permissions cascade; | ||
drop table auth_user_groups cascade; | ||
drop table auth_group cascade; | ||
drop table auth_user_user_permissions cascade; | ||
drop table auth_permission cascade; | ||
drop table django_admin_log cascade; | ||
drop table django_content_type cascade; | ||
drop table django_migrations cascade; | ||
drop table django_session cascade; | ||
drop table auth_user cascade; | ||
drop table b.team_lost_heredity cascade; | ||
drop table b.team_rating_by_player cascade; | ||
drop table ndcg cascade; | ||
drop table rosters cascade; | ||
drop table rating_individual_old; | ||
drop table rating_individual_old_details; | ||
|
||
delete from b.player_rating | ||
where release_id not in (131, 132); | ||
|
||
delete from b.team_rating | ||
where release_id not in (131, 132); | ||
|
||
delete from b.tournament_in_release | ||
where release_id not in (131, 132); | ||
|
||
delete from b.tournament_result | ||
where tournament_id not in (10294); | ||
|
||
delete from tournament_results | ||
where tournament_id not in (10294); | ||
|
||
delete from true_dls | ||
where tournament_id not in (10294); | ||
|
||
delete from tournament_rosters | ||
where tournament_id not in (10294); | ||
|
||
delete from tournaments | ||
where id not in (10294); | ||
|
||
delete from base_rosters | ||
where team_id not in (49804); | ||
|
||
delete from b.release where id not in (131, 132); | ||
|
||
delete from teams | ||
where id not in (select team_id from tournament_rosters where tournament_id = 10294); | ||
delete from teams | ||
where id not in (select team_id from b.team_ranking where release_id in (131, 132) and place <= 1000); | ||
|
||
delete from players | ||
where id not in (select player_id from tournament_rosters where tournament_id = 10294); | ||
delete from players | ||
where id not in (select player_id from b.player_ranking where release_id in (131, 132) and place <= 1000); | ||
|
||
delete from b.player_rating_by_tournament | ||
where release_id not in (131, 132); | ||
|
||
delete from b.player_rating_by_tournament | ||
where player_id not in (select id from players); | ||
|
||
refresh materialized view b.player_ranking; | ||
refresh materialized view b.team_ranking; |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.