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)
|
||||
|
||||
if @success_criterion.save
|
||||
redirect_to @success_criterion, notice: 'Success criterion was successfully created.'
|
||||
redirect_to @success_criterion, notice: 'Erfolgskriterium was successfully created.'
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -33,7 +33,7 @@ class SuccessCriteriaController < ApplicationController
|
|||
# PATCH/PUT /success_criteria/1
|
||||
def update
|
||||
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
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
|
@ -44,7 +44,7 @@ class SuccessCriteriaController < ApplicationController
|
|||
@success_criterion.destroy!
|
||||
respond_to do |format|
|
||||
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
|
||||
format.turbo_stream
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<%= bootstrap_form_with(model: checklist) do |form| %>
|
||||
<%# form.text_field :code %>
|
||||
<%= form.text_field :name %>
|
||||
<%= form.rich_text_area :description_html, rows: 12 %>
|
||||
<%= 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:
|
||||
success_criterion:
|
||||
title: Titel
|
||||
description_html: Richtline
|
||||
description_html: Richtlinie
|
||||
comment_html: Testkommentar
|
||||
level: Stufe
|
||||
result: Testergebnis
|
||||
|
|
@ -15,6 +15,10 @@ de-CH:
|
|||
level: Stufe
|
||||
position: Position
|
||||
success_criterion_html: Erfolgskriterium
|
||||
checklist:
|
||||
id: ID
|
||||
name: Überschrift
|
||||
description_html: Details
|
||||
element:
|
||||
id: ID
|
||||
title: Beschreibung
|
||||
|
|
@ -40,3 +44,6 @@ de-CH:
|
|||
success_criterion:
|
||||
one: Erfolgskriterium
|
||||
other: Erfolgskriterien
|
||||
element:
|
||||
one: Element
|
||||
other: Elemente
|
||||
|
|
|
|||
|
|
@ -3,5 +3,13 @@
|
|||
require 'test_helper'
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
setup do
|
||||
@checklist = checklists(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
test 'visiting the index' do
|
||||
visit checklists_url
|
||||
assert_selector "h1", text: "Checklists"
|
||||
assert_selector 'h1', text: 'Checklisten'
|
||||
end
|
||||
|
||||
test "should create checklist" do
|
||||
test 'should create checklist' do
|
||||
visit checklists_url
|
||||
click_on "New checklist"
|
||||
click_on 'Checkliste hinzufügen'
|
||||
|
||||
fill_in "Code", with: @checklist.code
|
||||
fill_in "Description", with: @checklist.description
|
||||
fill_in "Name", with: @checklist.name
|
||||
click_on "Create Checklist"
|
||||
|
||||
assert_text "Checklist was successfully created"
|
||||
click_on "Back"
|
||||
fill_in_rich_text_area 'Details', with: @checklist.description
|
||||
fill_in 'Überschrift', with: @checklist.name
|
||||
click_on 'Checkliste erstellen'
|
||||
end
|
||||
|
||||
test "should update Checklist" do
|
||||
test 'should update Checkliste' do
|
||||
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 "Description", with: @checklist.description
|
||||
fill_in "Name", with: @checklist.name
|
||||
click_on "Update Checklist"
|
||||
|
||||
assert_text "Checklist was successfully updated"
|
||||
click_on "Back"
|
||||
fill_in_rich_text_area 'Details', with: @checklist.description
|
||||
fill_in 'Überschrift', with: @checklist.name
|
||||
click_on 'Checkliste aktualisieren'
|
||||
end
|
||||
|
||||
test "should destroy Checklist" do
|
||||
test 'should destroy Checkliste' do
|
||||
visit checklist_url(@checklist)
|
||||
click_on "Destroy this checklist", match: :first
|
||||
|
||||
assert_text "Checklist was successfully destroyed"
|
||||
click_on 'Checkliste löschen', match: :first
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,47 +1,40 @@
|
|||
require "application_system_test_case"
|
||||
require 'application_system_test_case'
|
||||
|
||||
class ChecksTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@check = checks(:one)
|
||||
@deletable_check = checks(:deletable)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
test 'visiting the index' do
|
||||
visit checks_url
|
||||
assert_selector "h1", text: "Checks"
|
||||
assert_selector 'h1', text: 'Checks'
|
||||
end
|
||||
|
||||
test "should create check" do
|
||||
test 'should create check' do
|
||||
visit checks_url
|
||||
click_on "New check"
|
||||
click_on 'Check hinzufügen'
|
||||
|
||||
fill_in "Level", with: @check.level
|
||||
fill_in "Name", with: @check.name
|
||||
fill_in "Position", with: @check.position
|
||||
fill_in "Success criterion", with: @check.success_criterion
|
||||
click_on "Create Check"
|
||||
|
||||
assert_text "Check was successfully created"
|
||||
click_on "Back"
|
||||
select 'AAA', from: 'Stufe'
|
||||
fill_in 'Name', with: @check.name
|
||||
fill_in 'Position', with: @check.position
|
||||
fill_in_rich_text_area 'Erfolgskriterium', with: @check.success_criterion_html
|
||||
click_on 'Check erstellen'
|
||||
end
|
||||
|
||||
test "should update Check" do
|
||||
test 'should update Check' do
|
||||
visit check_url(@check)
|
||||
click_on "Edit this check", match: :first
|
||||
click_on 'Check bearbeiten', match: :first
|
||||
|
||||
fill_in "Level", with: @check.level
|
||||
fill_in "Name", with: @check.name
|
||||
fill_in "Position", with: @check.position
|
||||
fill_in "Success criterion", with: @check.success_criterion
|
||||
click_on "Update Check"
|
||||
|
||||
assert_text "Check was successfully updated"
|
||||
click_on "Back"
|
||||
select 'AAA', from: 'Stufe'
|
||||
fill_in 'Name', with: @check.name
|
||||
fill_in 'Position', with: @check.position
|
||||
fill_in_rich_text_area 'Erfolgskriterium', with: @check.success_criterion_html
|
||||
click_on 'Check aktualisieren'
|
||||
end
|
||||
|
||||
test "should destroy Check" do
|
||||
visit check_url(@check)
|
||||
click_on "Destroy this check", match: :first
|
||||
|
||||
assert_text "Check was successfully destroyed"
|
||||
test 'should destroy Check' do
|
||||
visit check_url(@deletable_check)
|
||||
click_on 'Check löschen', match: :first
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,47 +1,37 @@
|
|||
require "application_system_test_case"
|
||||
require 'application_system_test_case'
|
||||
|
||||
class ElementsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@element = elements(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
test 'visiting the index' do
|
||||
visit elements_url
|
||||
assert_selector "h1", text: "Elements"
|
||||
assert_selector 'h1', text: 'Elemente'
|
||||
end
|
||||
|
||||
test "should create element" do
|
||||
test 'should create element' do
|
||||
visit elements_url
|
||||
click_on "New element"
|
||||
click_on 'Element hinzufügen'
|
||||
|
||||
fill_in "Description", with: @element.description
|
||||
fill_in "Path", with: @element.path
|
||||
fill_in "Report", with: @element.report_id
|
||||
fill_in "Title", with: @element.title
|
||||
click_on "Create Element"
|
||||
|
||||
assert_text "Element was successfully created"
|
||||
click_on "Back"
|
||||
fill_in_rich_text_area 'Details', with: @element.description
|
||||
fill_in 'Pfad', with: @element.path
|
||||
fill_in 'Beschreibung', with: @element.title
|
||||
click_on 'Element erstellen'
|
||||
end
|
||||
|
||||
test "should update Element" do
|
||||
test 'should update Element' do
|
||||
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 "Path", with: @element.path
|
||||
fill_in "Report", with: @element.report_id
|
||||
fill_in "Title", with: @element.title
|
||||
click_on "Update Element"
|
||||
|
||||
assert_text "Element was successfully updated"
|
||||
click_on "Back"
|
||||
fill_in_rich_text_area 'Details', with: @element.description
|
||||
fill_in 'Pfad', with: @element.path
|
||||
fill_in 'Beschreibung', with: @element.title
|
||||
click_on 'Element aktualisieren'
|
||||
end
|
||||
|
||||
test "should destroy Element" do
|
||||
test 'should destroy Element' do
|
||||
visit element_url(@element)
|
||||
click_on "Destroy this element", match: :first
|
||||
|
||||
assert_text "Element was successfully destroyed"
|
||||
click_on 'Element löschen', match: :first
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,43 +1,35 @@
|
|||
require "application_system_test_case"
|
||||
require 'application_system_test_case'
|
||||
|
||||
class ReportsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@report = reports(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
test 'visiting the index' do
|
||||
visit reports_url
|
||||
assert_selector "h1", text: "Reports"
|
||||
assert_selector 'h1', text: 'Prüfberichte'
|
||||
end
|
||||
|
||||
test "should create report" do
|
||||
test 'should create report' do
|
||||
visit reports_url
|
||||
click_on "New report"
|
||||
click_on 'Prüfbericht hinzufügen'
|
||||
|
||||
fill_in "Comment", with: @report.comment
|
||||
fill_in "Name", with: @report.name
|
||||
click_on "Create Report"
|
||||
|
||||
assert_text "Report was successfully created"
|
||||
click_on "Back"
|
||||
fill_in_rich_text_area 'Projektbeschreibung', with: @report.comment_html
|
||||
fill_in 'Bezeichnung', with: @report.name
|
||||
click_on 'Prüfbericht erstellen'
|
||||
end
|
||||
|
||||
test "should update Report" do
|
||||
test 'should update Report' do
|
||||
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 "Name", with: @report.name
|
||||
click_on "Update Report"
|
||||
|
||||
assert_text "Report was successfully updated"
|
||||
click_on "Back"
|
||||
fill_in_rich_text_area 'Projektbeschreibung', with: @report.comment_html
|
||||
fill_in 'Bezeichnung', with: @report.name
|
||||
click_on 'Prüfbericht aktualisieren'
|
||||
end
|
||||
|
||||
test "should destroy Report" do
|
||||
test 'should destroy Report' do
|
||||
visit report_url(@report)
|
||||
click_on "Destroy this report", match: :first
|
||||
|
||||
assert_text "Report was successfully destroyed"
|
||||
click_on 'Prüfbericht löschen', match: :first
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,51 +1,44 @@
|
|||
require "application_system_test_case"
|
||||
require 'application_system_test_case'
|
||||
|
||||
class SuccessCriteriaTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@success_criterion = success_criteria(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
test 'visiting the index' do
|
||||
visit success_criteria_url
|
||||
assert_selector "h1", text: "Success criteria"
|
||||
assert_selector 'h1', text: 'Erfolgskriterien'
|
||||
end
|
||||
|
||||
test "should create success criterion" do
|
||||
test 'should create Erfolgskriterium' do
|
||||
visit success_criteria_url
|
||||
click_on "New success criterion"
|
||||
click_on 'Erfolgskriterium hinzufügen'
|
||||
|
||||
fill_in "Comment", with: @success_criterion.comment
|
||||
fill_in "Description", with: @success_criterion.description
|
||||
fill_in "Element", with: @success_criterion.element_id
|
||||
fill_in "Level", with: @success_criterion.level
|
||||
fill_in "Result", with: @success_criterion.result
|
||||
fill_in "Title", with: @success_criterion.title
|
||||
click_on "Create Success criterion"
|
||||
|
||||
assert_text "Success criterion was successfully created"
|
||||
click_on "Back"
|
||||
fill_in_rich_text_area 'Testkommentar', with: @success_criterion.comment
|
||||
fill_in_rich_text_area 'Richtlinie', with: @success_criterion.description
|
||||
# fill_in 'Element', with: @success_criterion.element_id
|
||||
# fill_in 'Level', with: @success_criterion.level
|
||||
# fill_in 'Result', with: @success_criterion.result
|
||||
# fill_in 'Title', with: @success_criterion.title
|
||||
click_on 'Erfolgskriterium erstellen'
|
||||
end
|
||||
|
||||
test "should update Success criterion" do
|
||||
test 'should update Erfolgskriterium' do
|
||||
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 "Description", with: @success_criterion.description
|
||||
fill_in "Element", with: @success_criterion.element_id
|
||||
fill_in "Level", with: @success_criterion.level
|
||||
fill_in "Result", with: @success_criterion.result
|
||||
fill_in "Title", with: @success_criterion.title
|
||||
click_on "Update Success criterion"
|
||||
fill_in_rich_text_area 'Testkommentar', with: @success_criterion.comment_html
|
||||
fill_in_rich_text_area 'Richtlinie', with: @success_criterion.description
|
||||
find('label', text: 'Bestanden', visible: true).click
|
||||
fill_in 'Titel', with: 'new'
|
||||
click_on 'Erfolgskriterium aktualisieren'
|
||||
|
||||
assert_text "Success criterion was successfully updated"
|
||||
click_on "Back"
|
||||
# assert_text 'Erfolgskriterium was successfully updated'
|
||||
# click_on 'Back'
|
||||
end
|
||||
|
||||
test "should destroy Success criterion" do
|
||||
test 'should destroy Erfolgskriterium' do
|
||||
visit success_criterion_url(@success_criterion)
|
||||
click_on "Destroy this success criterion", match: :first
|
||||
|
||||
assert_text "Success criterion was successfully destroyed"
|
||||
click_on 'Erfolgskriterium löschen', match: :first
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@
|
|||
ENV['RAILS_ENV'] ||= 'test'
|
||||
require_relative '../config/environment'
|
||||
require 'rails/test_help'
|
||||
require 'action_text/system_test_helper'
|
||||
|
||||
module ActiveSupport
|
||||
class TestCase
|
||||
include ActionText::SystemTestHelper
|
||||
# Run tests in parallel with specified workers
|
||||
parallelize(workers: :number_of_processors)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue