From a265a03620ad9d3214a83ef3131c1a20be89f2ea Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Sat, 15 Apr 2023 15:19:15 +0900 Subject: [PATCH 1/9] Move the TestFile Super Scaffolding test --- test/bin/setup-super-scaffolding-system-test | 1 - test/system/super_scaffolding_partial_test.rb | 35 ------------------- test/system/super_scaffolding_test.rb | 35 +++++++++++++++++++ 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/test/bin/setup-super-scaffolding-system-test b/test/bin/setup-super-scaffolding-system-test index 5aac7036f..56420d17f 100755 --- a/test/bin/setup-super-scaffolding-system-test +++ b/test/bin/setup-super-scaffolding-system-test @@ -103,7 +103,6 @@ fi if [ -z "${CIRCLE_NODE_INDEX}" ] || [ "${CIRCLE_NODE_INDEX}" == "6" ]; then bundle exec spring rails g model TestFile team:references name:string foo:attachment bin/super-scaffold crud TestFile Team name:text_field foo:file_field --sidebar="ti.ti-tag" - # TODO Write an actual test for this in `test/system/super_scaffolding_test.rb`. bundle exec spring rails g model ColorPicker team:references color_picker_value:string bin/super-scaffold crud ColorPicker Team color_picker_value:color_picker --sidebar="ti.ti-tag" diff --git a/test/system/super_scaffolding_partial_test.rb b/test/system/super_scaffolding_partial_test.rb index c33e578ab..aa65c22cb 100644 --- a/test/system/super_scaffolding_partial_test.rb +++ b/test/system/super_scaffolding_partial_test.rb @@ -32,41 +32,6 @@ def setup nil end - if defined?(TestFile) - test "developers can Super Scaffold a file partial and perfrom crud actions on the record" do - display_details = @@test_devices[:macbook_pro_15_inch] - resize_for(display_details) - - login_as(@jane, scope: :user) - visit account_team_path(@jane.current_team) - - assert page.has_content?("Test Files") - click_on "Add New Test File" - - fill_in "Name", with: "Test File Name" - assert page.has_content?("Upload New Document") - fill_in "Name", with: "Foo" - attach_file("test/support/foo.txt", make_visible: true) - click_on "Create Test File" - - assert page.has_content?("Test File was successfully created.") - refute TestFile.first.foo.blank? - - click_on "Edit" - assert page.has_content?("Remove Current Document") - find("span", text: "Remove Current Document").click - click_on "Update Test File" - - assert page.has_content?("Test File was successfully updated.") - assert TestFile.first.foo.blank? - - # This test consistently adds a new text file, - # so we clear out all instances of foo from the storage directory. - storage = Dir.glob("tmp/storage/**") - storage.each { |dir| FileUtils.rm_r(dir) if dir.match?(/\/([0-9]|[a-z]){2}$/) } - end - end - if defined?(ColorPicker) test "super scaffolded color pickers function properly" do display_details = @@test_devices[:macbook_pro_15_inch] diff --git a/test/system/super_scaffolding_test.rb b/test/system/super_scaffolding_test.rb index 4d9f43b3b..240c0b5e2 100644 --- a/test/system/super_scaffolding_test.rb +++ b/test/system/super_scaffolding_test.rb @@ -283,6 +283,41 @@ def setup end end + if defined?(TestFile) + test "developers can Super Scaffold a file partial and perform crud actions on the record" do + display_details = @@test_devices[:macbook_pro_15_inch] + resize_for(display_details) + + login_as(@jane, scope: :user) + visit account_team_path(@jane.current_team) + + assert page.has_content?("Test Files") + click_on "Add New Test File" + + fill_in "Name", with: "Test File Name" + assert page.has_content?("Upload New Document") + fill_in "Name", with: "Foo" + attach_file("test/support/foo.txt", make_visible: true) + click_on "Create Test File" + + assert page.has_content?("Test File was successfully created.") + refute TestFile.first.foo.blank? + + click_on "Edit" + assert page.has_content?("Remove Current Document") + find("span", text: "Remove Current Document").click + click_on "Update Test File" + + assert page.has_content?("Test File was successfully updated.") + assert TestFile.first.foo.blank? + + # This test consistently adds a new text file, + # so we clear out all instances of foo from the storage directory. + storage = Dir.glob("tmp/storage/**") + storage.each { |dir| FileUtils.rm_r(dir) if dir.match?(/\/([0-9]|[a-z]){2}$/) } + end + end + test "OpenAPI V3 document is still valid" do visit "http://localhost:3001/api/v1/openapi.yaml" puts(output = `yarn exec redocly lint http://localhost:3001/api/v1/openapi.yaml 1> /dev/stdout 2> /dev/stdout; rm openapi.yaml`) From b16c3a84d2a13f4a17ac4cf5b7e9035eff747922 Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Sat, 15 Apr 2023 15:32:20 +0900 Subject: [PATCH 2/9] Uncomment Super Scaffolding tests for password field --- test/bin/setup-super-scaffolding-system-test | 1 - test/system/super_scaffolding_partial_test.rb | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/bin/setup-super-scaffolding-system-test b/test/bin/setup-super-scaffolding-system-test index 56420d17f..8a479f7e6 100755 --- a/test/bin/setup-super-scaffolding-system-test +++ b/test/bin/setup-super-scaffolding-system-test @@ -111,7 +111,6 @@ else fi # TODO: Generate these in parallel. -# TODO: Super Scaffold password_field partials correctly. bundle exec spring rails g model PartialTest team:references \ text_field_test:string \ boolean_test:boolean \ diff --git a/test/system/super_scaffolding_partial_test.rb b/test/system/super_scaffolding_partial_test.rb index aa65c22cb..42c818d3b 100644 --- a/test/system/super_scaffolding_partial_test.rb +++ b/test/system/super_scaffolding_partial_test.rb @@ -91,7 +91,7 @@ def setup check("One") check("Three") # Password partial - # fill_in "Password Test", with: "testpassword123" + fill_in "Password Test", with: "testpassword123" # Phone Field Partial fill_in "Phone Field Test", with: "(000)000-0000" # Super Select partial @@ -132,7 +132,7 @@ def setup assert_equal partial_test.multiple_options_test, ["one", "three"] # Password # refute_nil partial_test.password_test - # assert_equal partial_test.password_test, "testpassword123" + assert_equal partial_test.password_test, "testpassword123" # Phone Field refute_nil partial_test.phone_field_test assert_equal partial_test.phone_field_test, "(000)000-0000" @@ -145,6 +145,9 @@ def setup # Text Area refute_nil partial_test.text_area_test assert_equal partial_test.text_area_test, "Lorem ipsum dolor sit amet, consectetur adipiscing elit" + + # Check if the password is hidden. + assert page.has_content?("●" * partial_test.password_test.length) end end end From f4cd6b11a2fa1810435f6fe092ed7092d4d34a6c Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Sat, 15 Apr 2023 15:37:34 +0900 Subject: [PATCH 3/9] Change order of super scaffolding system tests --- test/system/super_scaffolding_test.rb | 71 ++++++++++++++------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/test/system/super_scaffolding_test.rb b/test/system/super_scaffolding_test.rb index 240c0b5e2..a0e89539e 100644 --- a/test/system/super_scaffolding_test.rb +++ b/test/system/super_scaffolding_test.rb @@ -25,6 +25,7 @@ def setup [ "TestSite", "TestPage", + "TestFile", "Project", "Projects::Deliverable", "Projects::Tag", @@ -100,6 +101,41 @@ def setup end end + if defined?(TestFile) + test "developers can Super Scaffold a file partial and perform crud actions on the record" do + display_details = @@test_devices[:macbook_pro_15_inch] + resize_for(display_details) + + login_as(@jane, scope: :user) + visit account_team_path(@jane.current_team) + + assert page.has_content?("Test Files") + click_on "Add New Test File" + + fill_in "Name", with: "Test File Name" + assert page.has_content?("Upload New Document") + fill_in "Name", with: "Foo" + attach_file("test/support/foo.txt", make_visible: true) + click_on "Create Test File" + + assert page.has_content?("Test File was successfully created.") + refute TestFile.first.foo.blank? + + click_on "Edit" + assert page.has_content?("Remove Current Document") + find("span", text: "Remove Current Document").click + click_on "Update Test File" + + assert page.has_content?("Test File was successfully updated.") + assert TestFile.first.foo.blank? + + # This test consistently adds a new text file, + # so we clear out all instances of foo from the storage directory. + storage = Dir.glob("tmp/storage/**") + storage.each { |dir| FileUtils.rm_r(dir) if dir.match?(/\/([0-9]|[a-z]){2}$/) } + end + end + if defined?(Project) test "developers can generate a Project and a nested Projects::Deliverable model" do login_as(@jane, scope: :user) @@ -283,41 +319,6 @@ def setup end end - if defined?(TestFile) - test "developers can Super Scaffold a file partial and perform crud actions on the record" do - display_details = @@test_devices[:macbook_pro_15_inch] - resize_for(display_details) - - login_as(@jane, scope: :user) - visit account_team_path(@jane.current_team) - - assert page.has_content?("Test Files") - click_on "Add New Test File" - - fill_in "Name", with: "Test File Name" - assert page.has_content?("Upload New Document") - fill_in "Name", with: "Foo" - attach_file("test/support/foo.txt", make_visible: true) - click_on "Create Test File" - - assert page.has_content?("Test File was successfully created.") - refute TestFile.first.foo.blank? - - click_on "Edit" - assert page.has_content?("Remove Current Document") - find("span", text: "Remove Current Document").click - click_on "Update Test File" - - assert page.has_content?("Test File was successfully updated.") - assert TestFile.first.foo.blank? - - # This test consistently adds a new text file, - # so we clear out all instances of foo from the storage directory. - storage = Dir.glob("tmp/storage/**") - storage.each { |dir| FileUtils.rm_r(dir) if dir.match?(/\/([0-9]|[a-z]){2}$/) } - end - end - test "OpenAPI V3 document is still valid" do visit "http://localhost:3001/api/v1/openapi.yaml" puts(output = `yarn exec redocly lint http://localhost:3001/api/v1/openapi.yaml 1> /dev/stdout 2> /dev/stdout; rm openapi.yaml`) From 45c2dc441c3983a6097b0042ef814097b2f3d700 Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Mon, 1 May 2023 23:03:13 +0900 Subject: [PATCH 4/9] Specifiy single option selection with same text as another element --- test/system/super_scaffolding_partial_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/system/super_scaffolding_partial_test.rb b/test/system/super_scaffolding_partial_test.rb index 9c181ae3a..518bc1e82 100644 --- a/test/system/super_scaffolding_partial_test.rb +++ b/test/system/super_scaffolding_partial_test.rb @@ -121,7 +121,7 @@ def setup # File partial attach_file("test/support/foo.txt", make_visible: true) # Single Option partial - choose("One") + page.all('input').select {|node| node.value == "one"}.first.click # Multiple Option partial check("One") check("Three") From b84c8c7495bd187d80ddadf9dc63ba56dffe9861 Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Mon, 1 May 2023 23:06:17 +0900 Subject: [PATCH 5/9] Fixing Standard Ruby --- test/system/super_scaffolding_partial_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/system/super_scaffolding_partial_test.rb b/test/system/super_scaffolding_partial_test.rb index 518bc1e82..78c35053b 100644 --- a/test/system/super_scaffolding_partial_test.rb +++ b/test/system/super_scaffolding_partial_test.rb @@ -121,7 +121,7 @@ def setup # File partial attach_file("test/support/foo.txt", make_visible: true) # Single Option partial - page.all('input').select {|node| node.value == "one"}.first.click + page.all("input").find { |node| node.value == "one" }.click # Multiple Option partial check("One") check("Three") From 27118720836bca237982c6a97d65755fb11e4fa8 Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Mon, 1 May 2023 23:09:16 +0900 Subject: [PATCH 6/9] Add TODO for partial system tests --- test/system/super_scaffolding_partial_test.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/system/super_scaffolding_partial_test.rb b/test/system/super_scaffolding_partial_test.rb index 78c35053b..f281f460f 100644 --- a/test/system/super_scaffolding_partial_test.rb +++ b/test/system/super_scaffolding_partial_test.rb @@ -121,6 +121,7 @@ def setup # File partial attach_file("test/support/foo.txt", make_visible: true) # Single Option partial + # TODO: Not sure why we have to specify this, but not the other button with "one". page.all("input").find { |node| node.value == "one" }.click # Multiple Option partial check("One") From b0e298b7d1a390ec40e605cf1d6be5b36b503aa5 Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Thu, 3 Aug 2023 14:49:13 +0900 Subject: [PATCH 7/9] Remove conflicts --- test/system/super_scaffolding_partial_test.rb | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/test/system/super_scaffolding_partial_test.rb b/test/system/super_scaffolding_partial_test.rb index 8b8fc472a..0607468ea 100644 --- a/test/system/super_scaffolding_partial_test.rb +++ b/test/system/super_scaffolding_partial_test.rb @@ -169,14 +169,9 @@ def setup refute_nil partial_test.multiple_options_test assert_equal partial_test.multiple_options_test, ["one", "three"] # Password -<<<<<<< HEAD - # refute_nil partial_test.password_test - assert_equal partial_test.password_test, "testpassword123" -======= refute_nil partial_test.password_test assert_equal partial_test.password_test, "testpassword123" assert page.has_content?("●" * partial_test.password_test.length) ->>>>>>> main # Phone Field refute_nil partial_test.phone_field_test assert_equal partial_test.phone_field_test, "(000)000-0000" @@ -189,15 +184,9 @@ def setup # Text Area refute_nil partial_test.text_area_test assert_equal partial_test.text_area_test, "Lorem ipsum dolor sit amet, consectetur adipiscing elit" -<<<<<<< HEAD - - # Check if the password is hidden. - assert page.has_content?("●" * partial_test.password_test.length) -======= # Number Field refute_nil partial_test.number_field_test assert_equal partial_test.number_field_test, 47 ->>>>>>> main end end end From 35229b0f6e1bc764bfc020c97d15ee541bdf347d Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Thu, 3 Aug 2023 14:57:35 +0900 Subject: [PATCH 8/9] Remove duplicated test --- test/system/super_scaffolding_test.rb | 35 --------------------------- 1 file changed, 35 deletions(-) diff --git a/test/system/super_scaffolding_test.rb b/test/system/super_scaffolding_test.rb index a0e89539e..5773e4e2d 100644 --- a/test/system/super_scaffolding_test.rb +++ b/test/system/super_scaffolding_test.rb @@ -101,41 +101,6 @@ def setup end end - if defined?(TestFile) - test "developers can Super Scaffold a file partial and perform crud actions on the record" do - display_details = @@test_devices[:macbook_pro_15_inch] - resize_for(display_details) - - login_as(@jane, scope: :user) - visit account_team_path(@jane.current_team) - - assert page.has_content?("Test Files") - click_on "Add New Test File" - - fill_in "Name", with: "Test File Name" - assert page.has_content?("Upload New Document") - fill_in "Name", with: "Foo" - attach_file("test/support/foo.txt", make_visible: true) - click_on "Create Test File" - - assert page.has_content?("Test File was successfully created.") - refute TestFile.first.foo.blank? - - click_on "Edit" - assert page.has_content?("Remove Current Document") - find("span", text: "Remove Current Document").click - click_on "Update Test File" - - assert page.has_content?("Test File was successfully updated.") - assert TestFile.first.foo.blank? - - # This test consistently adds a new text file, - # so we clear out all instances of foo from the storage directory. - storage = Dir.glob("tmp/storage/**") - storage.each { |dir| FileUtils.rm_r(dir) if dir.match?(/\/([0-9]|[a-z]){2}$/) } - end - end - if defined?(Project) test "developers can generate a Project and a nested Projects::Deliverable model" do login_as(@jane, scope: :user) From 928dfdd647bfe070c268349e78cae26c3aa91820 Mon Sep 17 00:00:00 2001 From: Gabriel Zayas Date: Thu, 3 Aug 2023 14:59:40 +0900 Subject: [PATCH 9/9] Remove unneeded constant --- test/system/super_scaffolding_test.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/test/system/super_scaffolding_test.rb b/test/system/super_scaffolding_test.rb index 5773e4e2d..4d9f43b3b 100644 --- a/test/system/super_scaffolding_test.rb +++ b/test/system/super_scaffolding_test.rb @@ -25,7 +25,6 @@ def setup [ "TestSite", "TestPage", - "TestFile", "Project", "Projects::Deliverable", "Projects::Tag",