very basic system tests
This commit is contained in:
parent
345a932514
commit
c31d4266cd
12 changed files with 114 additions and 185 deletions
|
|
@ -24,7 +24,7 @@ class SuccessCriteriaController < ApplicationController
|
||||||
@success_criterion = SuccessCriterion.new(success_criterion_params)
|
@success_criterion = SuccessCriterion.new(success_criterion_params)
|
||||||
|
|
||||||
if @success_criterion.save
|
if @success_criterion.save
|
||||||
redirect_to @success_criterion, notice: 'Success criterion was successfully created.'
|
redirect_to @success_criterion, notice: 'Erfolgskriterium was successfully created.'
|
||||||
else
|
else
|
||||||
render :new, status: :unprocessable_entity
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
@ -33,7 +33,7 @@ class SuccessCriteriaController < ApplicationController
|
||||||
# PATCH/PUT /success_criteria/1
|
# PATCH/PUT /success_criteria/1
|
||||||
def update
|
def update
|
||||||
if @success_criterion.update(success_criterion_params)
|
if @success_criterion.update(success_criterion_params)
|
||||||
redirect_to @success_criterion, notice: 'Success criterion was successfully updated.', status: :see_other
|
redirect_to @success_criterion, notice: 'Erfolgskriterium was successfully updated.', status: :see_other
|
||||||
else
|
else
|
||||||
render :edit, status: :unprocessable_entity
|
render :edit, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|
@ -44,7 +44,7 @@ class SuccessCriteriaController < ApplicationController
|
||||||
@success_criterion.destroy!
|
@success_criterion.destroy!
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
redirect_to success_criteria_url, notice: 'Success criterion was successfully destroyed.', status: :see_other
|
redirect_to success_criteria_url, notice: 'Erfolgskriterium was successfully destroyed.', status: :see_other
|
||||||
end
|
end
|
||||||
format.turbo_stream
|
format.turbo_stream
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
<%= bootstrap_form_with(model: checklist) do |form| %>
|
<%= bootstrap_form_with(model: checklist) do |form| %>
|
||||||
<%# form.text_field :code %>
|
|
||||||
<%= form.text_field :name %>
|
<%= form.text_field :name %>
|
||||||
<%= form.rich_text_area :description_html, rows: 12 %>
|
<%= form.rich_text_area :description_html, rows: 12 %>
|
||||||
<%= form.submit %>
|
<%= form.submit %>
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
<%= turbo_stream.delete dom_id(@success_criterion) %>
|
<%= turbo_stream.remove dom_id(@success_criterion) %>
|
||||||
|
|
@ -3,7 +3,7 @@ de-CH:
|
||||||
attributes:
|
attributes:
|
||||||
success_criterion:
|
success_criterion:
|
||||||
title: Titel
|
title: Titel
|
||||||
description_html: Richtline
|
description_html: Richtlinie
|
||||||
comment_html: Testkommentar
|
comment_html: Testkommentar
|
||||||
level: Stufe
|
level: Stufe
|
||||||
result: Testergebnis
|
result: Testergebnis
|
||||||
|
|
@ -15,6 +15,10 @@ de-CH:
|
||||||
level: Stufe
|
level: Stufe
|
||||||
position: Position
|
position: Position
|
||||||
success_criterion_html: Erfolgskriterium
|
success_criterion_html: Erfolgskriterium
|
||||||
|
checklist:
|
||||||
|
id: ID
|
||||||
|
name: Überschrift
|
||||||
|
description_html: Details
|
||||||
element:
|
element:
|
||||||
id: ID
|
id: ID
|
||||||
title: Beschreibung
|
title: Beschreibung
|
||||||
|
|
@ -40,3 +44,6 @@ de-CH:
|
||||||
success_criterion:
|
success_criterion:
|
||||||
one: Erfolgskriterium
|
one: Erfolgskriterium
|
||||||
other: Erfolgskriterien
|
other: Erfolgskriterien
|
||||||
|
element:
|
||||||
|
one: Element
|
||||||
|
other: Elemente
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,13 @@
|
||||||
require 'test_helper'
|
require 'test_helper'
|
||||||
|
|
||||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||||
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
|
driven_by(:selenium, using: :headless_chrome,
|
||||||
|
options: { browser: :remote, url: ENV.fetch('SELENIUM_REMOTE_URL', nil) })
|
||||||
|
|
||||||
|
def setup
|
||||||
|
Capybara.server_host = '0.0.0.0' # bind to all interfaces
|
||||||
|
Capybara.app_host = "http://#{IPSocket.getaddress(Socket.gethostname)}" if ENV['SELENIUM_REMOTE_URL'].present?
|
||||||
|
|
||||||
|
super
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
require "application_system_test_case"
|
|
||||||
|
|
||||||
class ChecklistEntriesTest < ApplicationSystemTestCase
|
|
||||||
setup do
|
|
||||||
@checklist_entry = checklist_entries(:one)
|
|
||||||
end
|
|
||||||
|
|
||||||
test "visiting the index" do
|
|
||||||
visit checklist_entries_url
|
|
||||||
assert_selector "h1", text: "Checklist entries"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should create checklist entry" do
|
|
||||||
visit checklist_entries_url
|
|
||||||
click_on "New checklist entry"
|
|
||||||
|
|
||||||
fill_in "Check", with: @checklist_entry.check_id
|
|
||||||
fill_in "Checklist", with: @checklist_entry.checklist_id
|
|
||||||
fill_in "Position", with: @checklist_entry.position
|
|
||||||
click_on "Create Checklist entry"
|
|
||||||
|
|
||||||
assert_text "Checklist entry was successfully created"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should update Checklist entry" do
|
|
||||||
visit checklist_entry_url(@checklist_entry)
|
|
||||||
click_on "Edit this checklist entry", match: :first
|
|
||||||
|
|
||||||
fill_in "Check", with: @checklist_entry.check_id
|
|
||||||
fill_in "Checklist", with: @checklist_entry.checklist_id
|
|
||||||
fill_in "Position", with: @checklist_entry.position
|
|
||||||
click_on "Update Checklist entry"
|
|
||||||
|
|
||||||
assert_text "Checklist entry was successfully updated"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
|
||||||
|
|
||||||
test "should destroy Checklist entry" do
|
|
||||||
visit checklist_entry_url(@checklist_entry)
|
|
||||||
click_on "Destroy this checklist entry", match: :first
|
|
||||||
|
|
||||||
assert_text "Checklist entry was successfully destroyed"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,45 +1,35 @@
|
||||||
require "application_system_test_case"
|
require 'application_system_test_case'
|
||||||
|
|
||||||
class ChecklistsTest < ApplicationSystemTestCase
|
class ChecklistsTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
@checklist = checklists(:one)
|
@checklist = checklists(:one)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "visiting the index" do
|
test 'visiting the index' do
|
||||||
visit checklists_url
|
visit checklists_url
|
||||||
assert_selector "h1", text: "Checklists"
|
assert_selector 'h1', text: 'Checklisten'
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should create checklist" do
|
test 'should create checklist' do
|
||||||
visit checklists_url
|
visit checklists_url
|
||||||
click_on "New checklist"
|
click_on 'Checkliste hinzufügen'
|
||||||
|
|
||||||
fill_in "Code", with: @checklist.code
|
fill_in_rich_text_area 'Details', with: @checklist.description
|
||||||
fill_in "Description", with: @checklist.description
|
fill_in 'Überschrift', with: @checklist.name
|
||||||
fill_in "Name", with: @checklist.name
|
click_on 'Checkliste erstellen'
|
||||||
click_on "Create Checklist"
|
|
||||||
|
|
||||||
assert_text "Checklist was successfully created"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should update Checklist" do
|
test 'should update Checkliste' do
|
||||||
visit checklist_url(@checklist)
|
visit checklist_url(@checklist)
|
||||||
click_on "Edit this checklist", match: :first
|
click_on 'Checkliste bearbeiten', match: :first
|
||||||
|
|
||||||
fill_in "Code", with: @checklist.code
|
fill_in_rich_text_area 'Details', with: @checklist.description
|
||||||
fill_in "Description", with: @checklist.description
|
fill_in 'Überschrift', with: @checklist.name
|
||||||
fill_in "Name", with: @checklist.name
|
click_on 'Checkliste aktualisieren'
|
||||||
click_on "Update Checklist"
|
|
||||||
|
|
||||||
assert_text "Checklist was successfully updated"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should destroy Checklist" do
|
test 'should destroy Checkliste' do
|
||||||
visit checklist_url(@checklist)
|
visit checklist_url(@checklist)
|
||||||
click_on "Destroy this checklist", match: :first
|
click_on 'Checkliste löschen', match: :first
|
||||||
|
|
||||||
assert_text "Checklist was successfully destroyed"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,40 @@
|
||||||
require "application_system_test_case"
|
require 'application_system_test_case'
|
||||||
|
|
||||||
class ChecksTest < ApplicationSystemTestCase
|
class ChecksTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
@check = checks(:one)
|
@check = checks(:one)
|
||||||
|
@deletable_check = checks(:deletable)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "visiting the index" do
|
test 'visiting the index' do
|
||||||
visit checks_url
|
visit checks_url
|
||||||
assert_selector "h1", text: "Checks"
|
assert_selector 'h1', text: 'Checks'
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should create check" do
|
test 'should create check' do
|
||||||
visit checks_url
|
visit checks_url
|
||||||
click_on "New check"
|
click_on 'Check hinzufügen'
|
||||||
|
|
||||||
fill_in "Level", with: @check.level
|
select 'AAA', from: 'Stufe'
|
||||||
fill_in "Name", with: @check.name
|
fill_in 'Name', with: @check.name
|
||||||
fill_in "Position", with: @check.position
|
fill_in 'Position', with: @check.position
|
||||||
fill_in "Success criterion", with: @check.success_criterion
|
fill_in_rich_text_area 'Erfolgskriterium', with: @check.success_criterion_html
|
||||||
click_on "Create Check"
|
click_on 'Check erstellen'
|
||||||
|
|
||||||
assert_text "Check was successfully created"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should update Check" do
|
test 'should update Check' do
|
||||||
visit check_url(@check)
|
visit check_url(@check)
|
||||||
click_on "Edit this check", match: :first
|
click_on 'Check bearbeiten', match: :first
|
||||||
|
|
||||||
fill_in "Level", with: @check.level
|
select 'AAA', from: 'Stufe'
|
||||||
fill_in "Name", with: @check.name
|
fill_in 'Name', with: @check.name
|
||||||
fill_in "Position", with: @check.position
|
fill_in 'Position', with: @check.position
|
||||||
fill_in "Success criterion", with: @check.success_criterion
|
fill_in_rich_text_area 'Erfolgskriterium', with: @check.success_criterion_html
|
||||||
click_on "Update Check"
|
click_on 'Check aktualisieren'
|
||||||
|
|
||||||
assert_text "Check was successfully updated"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should destroy Check" do
|
test 'should destroy Check' do
|
||||||
visit check_url(@check)
|
visit check_url(@deletable_check)
|
||||||
click_on "Destroy this check", match: :first
|
click_on 'Check löschen', match: :first
|
||||||
|
|
||||||
assert_text "Check was successfully destroyed"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,37 @@
|
||||||
require "application_system_test_case"
|
require 'application_system_test_case'
|
||||||
|
|
||||||
class ElementsTest < ApplicationSystemTestCase
|
class ElementsTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
@element = elements(:one)
|
@element = elements(:one)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "visiting the index" do
|
test 'visiting the index' do
|
||||||
visit elements_url
|
visit elements_url
|
||||||
assert_selector "h1", text: "Elements"
|
assert_selector 'h1', text: 'Elemente'
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should create element" do
|
test 'should create element' do
|
||||||
visit elements_url
|
visit elements_url
|
||||||
click_on "New element"
|
click_on 'Element hinzufügen'
|
||||||
|
|
||||||
fill_in "Description", with: @element.description
|
fill_in_rich_text_area 'Details', with: @element.description
|
||||||
fill_in "Path", with: @element.path
|
fill_in 'Pfad', with: @element.path
|
||||||
fill_in "Report", with: @element.report_id
|
fill_in 'Beschreibung', with: @element.title
|
||||||
fill_in "Title", with: @element.title
|
click_on 'Element erstellen'
|
||||||
click_on "Create Element"
|
|
||||||
|
|
||||||
assert_text "Element was successfully created"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should update Element" do
|
test 'should update Element' do
|
||||||
visit element_url(@element)
|
visit element_url(@element)
|
||||||
click_on "Edit this element", match: :first
|
click_on 'Element bearbeiten', match: :first
|
||||||
|
|
||||||
fill_in "Description", with: @element.description
|
fill_in_rich_text_area 'Details', with: @element.description
|
||||||
fill_in "Path", with: @element.path
|
fill_in 'Pfad', with: @element.path
|
||||||
fill_in "Report", with: @element.report_id
|
fill_in 'Beschreibung', with: @element.title
|
||||||
fill_in "Title", with: @element.title
|
click_on 'Element aktualisieren'
|
||||||
click_on "Update Element"
|
|
||||||
|
|
||||||
assert_text "Element was successfully updated"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should destroy Element" do
|
test 'should destroy Element' do
|
||||||
visit element_url(@element)
|
visit element_url(@element)
|
||||||
click_on "Destroy this element", match: :first
|
click_on 'Element löschen', match: :first
|
||||||
|
|
||||||
assert_text "Element was successfully destroyed"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,43 +1,35 @@
|
||||||
require "application_system_test_case"
|
require 'application_system_test_case'
|
||||||
|
|
||||||
class ReportsTest < ApplicationSystemTestCase
|
class ReportsTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
@report = reports(:one)
|
@report = reports(:one)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "visiting the index" do
|
test 'visiting the index' do
|
||||||
visit reports_url
|
visit reports_url
|
||||||
assert_selector "h1", text: "Reports"
|
assert_selector 'h1', text: 'Prüfberichte'
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should create report" do
|
test 'should create report' do
|
||||||
visit reports_url
|
visit reports_url
|
||||||
click_on "New report"
|
click_on 'Prüfbericht hinzufügen'
|
||||||
|
|
||||||
fill_in "Comment", with: @report.comment
|
fill_in_rich_text_area 'Projektbeschreibung', with: @report.comment_html
|
||||||
fill_in "Name", with: @report.name
|
fill_in 'Bezeichnung', with: @report.name
|
||||||
click_on "Create Report"
|
click_on 'Prüfbericht erstellen'
|
||||||
|
|
||||||
assert_text "Report was successfully created"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should update Report" do
|
test 'should update Report' do
|
||||||
visit report_url(@report)
|
visit report_url(@report)
|
||||||
click_on "Edit this report", match: :first
|
click_on 'Prüfbericht bearbeiten', match: :first
|
||||||
|
|
||||||
fill_in "Comment", with: @report.comment
|
fill_in_rich_text_area 'Projektbeschreibung', with: @report.comment_html
|
||||||
fill_in "Name", with: @report.name
|
fill_in 'Bezeichnung', with: @report.name
|
||||||
click_on "Update Report"
|
click_on 'Prüfbericht aktualisieren'
|
||||||
|
|
||||||
assert_text "Report was successfully updated"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should destroy Report" do
|
test 'should destroy Report' do
|
||||||
visit report_url(@report)
|
visit report_url(@report)
|
||||||
click_on "Destroy this report", match: :first
|
click_on 'Prüfbericht löschen', match: :first
|
||||||
|
|
||||||
assert_text "Report was successfully destroyed"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,51 +1,44 @@
|
||||||
require "application_system_test_case"
|
require 'application_system_test_case'
|
||||||
|
|
||||||
class SuccessCriteriaTest < ApplicationSystemTestCase
|
class SuccessCriteriaTest < ApplicationSystemTestCase
|
||||||
setup do
|
setup do
|
||||||
@success_criterion = success_criteria(:one)
|
@success_criterion = success_criteria(:one)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "visiting the index" do
|
test 'visiting the index' do
|
||||||
visit success_criteria_url
|
visit success_criteria_url
|
||||||
assert_selector "h1", text: "Success criteria"
|
assert_selector 'h1', text: 'Erfolgskriterien'
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should create success criterion" do
|
test 'should create Erfolgskriterium' do
|
||||||
visit success_criteria_url
|
visit success_criteria_url
|
||||||
click_on "New success criterion"
|
click_on 'Erfolgskriterium hinzufügen'
|
||||||
|
|
||||||
fill_in "Comment", with: @success_criterion.comment
|
fill_in_rich_text_area 'Testkommentar', with: @success_criterion.comment
|
||||||
fill_in "Description", with: @success_criterion.description
|
fill_in_rich_text_area 'Richtlinie', with: @success_criterion.description
|
||||||
fill_in "Element", with: @success_criterion.element_id
|
# fill_in 'Element', with: @success_criterion.element_id
|
||||||
fill_in "Level", with: @success_criterion.level
|
# fill_in 'Level', with: @success_criterion.level
|
||||||
fill_in "Result", with: @success_criterion.result
|
# fill_in 'Result', with: @success_criterion.result
|
||||||
fill_in "Title", with: @success_criterion.title
|
# fill_in 'Title', with: @success_criterion.title
|
||||||
click_on "Create Success criterion"
|
click_on 'Erfolgskriterium erstellen'
|
||||||
|
|
||||||
assert_text "Success criterion was successfully created"
|
|
||||||
click_on "Back"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should update Success criterion" do
|
test 'should update Erfolgskriterium' do
|
||||||
visit success_criterion_url(@success_criterion)
|
visit success_criterion_url(@success_criterion)
|
||||||
click_on "Edit this success criterion", match: :first
|
click_on 'Erfolgskriterium bearbeiten', match: :first
|
||||||
|
|
||||||
fill_in "Comment", with: @success_criterion.comment
|
fill_in_rich_text_area 'Testkommentar', with: @success_criterion.comment_html
|
||||||
fill_in "Description", with: @success_criterion.description
|
fill_in_rich_text_area 'Richtlinie', with: @success_criterion.description
|
||||||
fill_in "Element", with: @success_criterion.element_id
|
find('label', text: 'Bestanden', visible: true).click
|
||||||
fill_in "Level", with: @success_criterion.level
|
fill_in 'Titel', with: 'new'
|
||||||
fill_in "Result", with: @success_criterion.result
|
click_on 'Erfolgskriterium aktualisieren'
|
||||||
fill_in "Title", with: @success_criterion.title
|
|
||||||
click_on "Update Success criterion"
|
|
||||||
|
|
||||||
assert_text "Success criterion was successfully updated"
|
# assert_text 'Erfolgskriterium was successfully updated'
|
||||||
click_on "Back"
|
# click_on 'Back'
|
||||||
end
|
end
|
||||||
|
|
||||||
test "should destroy Success criterion" do
|
test 'should destroy Erfolgskriterium' do
|
||||||
visit success_criterion_url(@success_criterion)
|
visit success_criterion_url(@success_criterion)
|
||||||
click_on "Destroy this success criterion", match: :first
|
click_on 'Erfolgskriterium löschen', match: :first
|
||||||
|
|
||||||
assert_text "Success criterion was successfully destroyed"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,11 @@
|
||||||
ENV['RAILS_ENV'] ||= 'test'
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
require_relative '../config/environment'
|
require_relative '../config/environment'
|
||||||
require 'rails/test_help'
|
require 'rails/test_help'
|
||||||
|
require 'action_text/system_test_helper'
|
||||||
|
|
||||||
module ActiveSupport
|
module ActiveSupport
|
||||||
class TestCase
|
class TestCase
|
||||||
|
include ActionText::SystemTestHelper
|
||||||
# Run tests in parallel with specified workers
|
# Run tests in parallel with specified workers
|
||||||
parallelize(workers: :number_of_processors)
|
parallelize(workers: :number_of_processors)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue