hiptest-publisher-fork 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +295 -0
- data/LICENSE +21 -0
- data/README.md +265 -0
- data/bin/hiptest-publisher +47 -0
- data/config/i18n-tasks.yml +137 -0
- data/config/locales/en.yml +250 -0
- data/lib/config/behat.conf +44 -0
- data/lib/config/behave.conf +40 -0
- data/lib/config/csharp-nunit.conf +15 -0
- data/lib/config/cucumber-groovy.conf +40 -0
- data/lib/config/cucumber-java.conf +24 -0
- data/lib/config/cucumber-javascript.conf +23 -0
- data/lib/config/cucumber-ruby.conf +22 -0
- data/lib/config/cucumber-typescript.conf +41 -0
- data/lib/config/cucumber_legacy-groovy.conf +40 -0
- data/lib/config/cucumber_legacy-java.conf +24 -0
- data/lib/config/cucumber_legacy-typescript.conf +41 -0
- data/lib/config/groovy-spock.conf +25 -0
- data/lib/config/java-espresso.conf +15 -0
- data/lib/config/java-junit.conf +21 -0
- data/lib/config/java-testng.conf +15 -0
- data/lib/config/javascript-codeceptjs.conf +23 -0
- data/lib/config/javascript-jasmine.conf +12 -0
- data/lib/config/javascript-mocha.conf +12 -0
- data/lib/config/javascript-protractor.conf +12 -0
- data/lib/config/javascript-qunit.conf +12 -0
- data/lib/config/jbehave.conf +24 -0
- data/lib/config/php-phpunit.conf +14 -0
- data/lib/config/python-unittest.conf +13 -0
- data/lib/config/robotframework.conf +13 -0
- data/lib/config/ruby-minitest.conf +11 -0
- data/lib/config/ruby-rspec.conf +11 -0
- data/lib/config/seleniumide.conf +12 -0
- data/lib/config/specflow.conf +25 -0
- data/lib/config/swift-xctest.conf +18 -0
- data/lib/hiptest-publisher/cli_options_checker.rb +270 -0
- data/lib/hiptest-publisher/client.rb +326 -0
- data/lib/hiptest-publisher/export_cache.rb +85 -0
- data/lib/hiptest-publisher/file_writer.rb +30 -0
- data/lib/hiptest-publisher/formatters/console_formatter.rb +101 -0
- data/lib/hiptest-publisher/formatters/diff_displayer.rb +173 -0
- data/lib/hiptest-publisher/formatters/reporter.rb +74 -0
- data/lib/hiptest-publisher/handlebars_helper.rb +314 -0
- data/lib/hiptest-publisher/i18n.rb +5 -0
- data/lib/hiptest-publisher/indexers/actionword_indexer.rb +32 -0
- data/lib/hiptest-publisher/indexers/library_actionword_indexer.rb +32 -0
- data/lib/hiptest-publisher/node_modifiers/actionword_uniq_renamer.rb +39 -0
- data/lib/hiptest-publisher/node_modifiers/add_all.rb +21 -0
- data/lib/hiptest-publisher/node_modifiers/call_arguments_adder.rb +46 -0
- data/lib/hiptest-publisher/node_modifiers/datatable_fixer.rb +32 -0
- data/lib/hiptest-publisher/node_modifiers/gherkin_adder.rb +252 -0
- data/lib/hiptest-publisher/node_modifiers/items_orderer.rb +33 -0
- data/lib/hiptest-publisher/node_modifiers/parameter_type_adder.rb +141 -0
- data/lib/hiptest-publisher/node_modifiers/parent_adder.rb +18 -0
- data/lib/hiptest-publisher/nodes.rb +601 -0
- data/lib/hiptest-publisher/nodes_walker.rb +34 -0
- data/lib/hiptest-publisher/options_parser.rb +826 -0
- data/lib/hiptest-publisher/project_grapher.rb +94 -0
- data/lib/hiptest-publisher/render_context_maker.rb +194 -0
- data/lib/hiptest-publisher/renderer.rb +52 -0
- data/lib/hiptest-publisher/renderer_addons/behave_addon.rb +23 -0
- data/lib/hiptest-publisher/renderer_addons/gherkin_addon.rb +59 -0
- data/lib/hiptest-publisher/renderer_addons/groovy_spock_addon.rb +34 -0
- data/lib/hiptest-publisher/renderer_addons/robot_framework_addon.rb +42 -0
- data/lib/hiptest-publisher/renderer_addons.rb +4 -0
- data/lib/hiptest-publisher/signature_differ.rb +105 -0
- data/lib/hiptest-publisher/signature_exporter.rb +56 -0
- data/lib/hiptest-publisher/string.rb +76 -0
- data/lib/hiptest-publisher/utils.rb +39 -0
- data/lib/hiptest-publisher/version_checker.rb +41 -0
- data/lib/hiptest-publisher/xml_parser.rb +407 -0
- data/lib/hiptest-publisher.rb +261 -0
- data/lib/templates/behat/actionword.hbs +8 -0
- data/lib/templates/behat/actionwords/parameter.hbs +1 -0
- data/lib/templates/behat/actionwords.hbs +16 -0
- data/lib/templates/behat/library.hbs +16 -0
- data/lib/templates/behat/libraryactionword.hbs +8 -0
- data/lib/templates/behat/parameter.hbs +1 -0
- data/lib/templates/behave/actionword.hbs +4 -0
- data/lib/templates/behave/actionwords.hbs +12 -0
- data/lib/templates/behave/library.hbs +7 -0
- data/lib/templates/behave/libraryactionword.hbs +4 -0
- data/lib/templates/behave/nullliteral.hbs +1 -0
- data/lib/templates/common/_gherkin_pattern.hbs +1 -0
- data/lib/templates/common/_gherkin_typed_pattern.hbs +1 -0
- data/lib/templates/common/booleanliteral.hbs +1 -0
- data/lib/templates/common/dataset.hbs +0 -0
- data/lib/templates/common/datatable.hbs +3 -0
- data/lib/templates/common/empty.hbs +0 -0
- data/lib/templates/common/nullliteral.hbs +1 -0
- data/lib/templates/common/numericliteral.hbs +1 -0
- data/lib/templates/common/stringliteral.hbs +1 -0
- data/lib/templates/common/symbol.hbs +1 -0
- data/lib/templates/common/unaryexpression.hbs +1 -0
- data/lib/templates/common/variable.hbs +1 -0
- data/lib/templates/csharp/_body.hbs +5 -0
- data/lib/templates/csharp/_item_as_function.hbs +8 -0
- data/lib/templates/csharp/_scenario.hbs +8 -0
- data/lib/templates/csharp/actionword.hbs +1 -0
- data/lib/templates/csharp/actionwords.hbs +10 -0
- data/lib/templates/csharp/argument.hbs +1 -0
- data/lib/templates/csharp/assign.hbs +1 -0
- data/lib/templates/csharp/binaryexpression.hbs +1 -0
- data/lib/templates/csharp/call.hbs +2 -0
- data/lib/templates/csharp/dataset.hbs +4 -0
- data/lib/templates/csharp/dict.hbs +1 -0
- data/lib/templates/csharp/field.hbs +1 -0
- data/lib/templates/csharp/folder.hbs +22 -0
- data/lib/templates/csharp/ifthen.hbs +7 -0
- data/lib/templates/csharp/index.hbs +1 -0
- data/lib/templates/csharp/list.hbs +1 -0
- data/lib/templates/csharp/nullliteral.hbs +1 -0
- data/lib/templates/csharp/parameter.hbs +1 -0
- data/lib/templates/csharp/parenthesis.hbs +1 -0
- data/lib/templates/csharp/property.hbs +1 -0
- data/lib/templates/csharp/scenario.hbs +1 -0
- data/lib/templates/csharp/scenarios.hbs +20 -0
- data/lib/templates/csharp/single_scenario.hbs +16 -0
- data/lib/templates/csharp/single_test.hbs +15 -0
- data/lib/templates/csharp/step.hbs +1 -0
- data/lib/templates/csharp/stringliteral.hbs +1 -0
- data/lib/templates/csharp/tag.hbs +1 -0
- data/lib/templates/csharp/template.hbs +1 -0
- data/lib/templates/csharp/test.hbs +1 -0
- data/lib/templates/csharp/tests.hbs +15 -0
- data/lib/templates/csharp/variable.hbs +1 -0
- data/lib/templates/csharp/while.hbs +4 -0
- data/lib/templates/cucumber/actionword.hbs +5 -0
- data/lib/templates/cucumber/actionwords.hbs +5 -0
- data/lib/templates/cucumber/groovy/step-definitions/_gherkin_pattern.hbs +1 -0
- data/lib/templates/cucumber/groovy/step-definitions/actionword.hbs +5 -0
- data/lib/templates/cucumber/groovy/step-definitions/actionwords.hbs +11 -0
- data/lib/templates/cucumber/groovy/step-definitions/library.hbs +11 -0
- data/lib/templates/cucumber/groovy/step-definitions/libraryactionword.hbs +5 -0
- data/lib/templates/cucumber/groovy/step-definitions/parameter.hbs +1 -0
- data/lib/templates/cucumber/java/actionword.hbs +6 -0
- data/lib/templates/cucumber/java/actionwords/parameter.hbs +1 -0
- data/lib/templates/cucumber/java/actionwords.hbs +12 -0
- data/lib/templates/cucumber/java/parameter.hbs +1 -0
- data/lib/templates/cucumber/javascript/_after_hook.hbs +4 -0
- data/lib/templates/cucumber/javascript/_before_hook.hbs +4 -0
- data/lib/templates/cucumber/javascript/actionword.hbs +6 -0
- data/lib/templates/cucumber/javascript/actionwords.hbs +8 -0
- data/lib/templates/cucumber/parameter.hbs +1 -0
- data/lib/templates/cucumber/typescript/_after_hook.hbs +4 -0
- data/lib/templates/cucumber/typescript/_before_hook.hbs +4 -0
- data/lib/templates/cucumber/typescript/actionword.hbs +5 -0
- data/lib/templates/cucumber/typescript/actionwords.hbs +10 -0
- data/lib/templates/cucumber/typescript/library.hbs +12 -0
- data/lib/templates/cucumber/typescript/libraryactionword.hbs +5 -0
- data/lib/templates/cucumber_legacy/groovy/step-definitions/actionword.hbs +5 -0
- data/lib/templates/cucumber_legacy/groovy/step-definitions/actionwords.hbs +10 -0
- data/lib/templates/cucumber_legacy/groovy/step-definitions/library.hbs +10 -0
- data/lib/templates/cucumber_legacy/groovy/step-definitions/libraryactionword.hbs +5 -0
- data/lib/templates/cucumber_legacy/java/actionword.hbs +6 -0
- data/lib/templates/cucumber_legacy/java/actionwords.hbs +12 -0
- data/lib/templates/cucumber_legacy/typescript/actionword.hbs +5 -0
- data/lib/templates/cucumber_legacy/typescript/libraryactionword.hbs +5 -0
- data/lib/templates/gherkin/_call.hbs +5 -0
- data/lib/templates/gherkin/_gherkin_text.hbs +1 -0
- data/lib/templates/gherkin/_scenario.hbs +18 -0
- data/lib/templates/gherkin/_scenario_outline_title.hbs +1 -0
- data/lib/templates/gherkin/argument.hbs +1 -0
- data/lib/templates/gherkin/call.hbs +1 -0
- data/lib/templates/gherkin/dataset.hbs +1 -0
- data/lib/templates/gherkin/datatable.hbs +2 -0
- data/lib/templates/gherkin/folder.hbs +10 -0
- data/lib/templates/gherkin/inlined_uids/_scenario_outline_title.hbs +1 -0
- data/lib/templates/gherkin/java/single_scenario.hbs +1 -0
- data/lib/templates/gherkin/parameter.hbs +1 -0
- data/lib/templates/gherkin/scenarios.hbs +3 -0
- data/lib/templates/gherkin/single_scenario.hbs +1 -0
- data/lib/templates/gherkin/single_test.hbs +3 -0
- data/lib/templates/gherkin/step.hbs +1 -0
- data/lib/templates/gherkin/stringliteral.hbs +1 -0
- data/lib/templates/gherkin/tag.hbs +1 -0
- data/lib/templates/gherkin/template.hbs +1 -0
- data/lib/templates/groovy/_body.hbs +8 -0
- data/lib/templates/groovy/_desc.hbs +5 -0
- data/lib/templates/groovy/_scenario.hbs +10 -0
- data/lib/templates/groovy/_steps.hbs +4 -0
- data/lib/templates/groovy/_test.hbs +4 -0
- data/lib/templates/groovy/actionword.hbs +2 -0
- data/lib/templates/groovy/actionwords.hbs +7 -0
- data/lib/templates/groovy/assign.hbs +1 -0
- data/lib/templates/groovy/call.hbs +2 -0
- data/lib/templates/groovy/dataset.hbs +1 -0
- data/lib/templates/groovy/datatable.hbs +2 -0
- data/lib/templates/groovy/dict.hbs +1 -0
- data/lib/templates/groovy/folder.hbs +18 -0
- data/lib/templates/groovy/index.hbs +1 -0
- data/lib/templates/groovy/libraries.hbs +9 -0
- data/lib/templates/groovy/library.hbs +8 -0
- data/lib/templates/groovy/libraryactionword.hbs +2 -0
- data/lib/templates/groovy/list.hbs +1 -0
- data/lib/templates/groovy/nullliteral.hbs +1 -0
- data/lib/templates/groovy/parameter.hbs +1 -0
- data/lib/templates/groovy/property.hbs +1 -0
- data/lib/templates/groovy/scenario.hbs +1 -0
- data/lib/templates/groovy/scenarios.hbs +10 -0
- data/lib/templates/groovy/single_scenario.hbs +9 -0
- data/lib/templates/groovy/single_test.hbs +10 -0
- data/lib/templates/groovy/template.hbs +1 -0
- data/lib/templates/groovy/test.hbs +1 -0
- data/lib/templates/groovy/tests.hbs +10 -0
- data/lib/templates/java/_body.hbs +5 -0
- data/lib/templates/java/_item_as_function.hbs +8 -0
- data/lib/templates/java/_scenario.hbs +7 -0
- data/lib/templates/java/actionword.hbs +1 -0
- data/lib/templates/java/actionwords.hbs +8 -0
- data/lib/templates/java/argument.hbs +1 -0
- data/lib/templates/java/assign.hbs +1 -0
- data/lib/templates/java/binaryexpression.hbs +1 -0
- data/lib/templates/java/call.hbs +2 -0
- data/lib/templates/java/dataset.hbs +3 -0
- data/lib/templates/java/dict.hbs +1 -0
- data/lib/templates/java/espresso/_scenario.hbs +8 -0
- data/lib/templates/java/espresso/dataset.hbs +4 -0
- data/lib/templates/java/espresso/folder.hbs +29 -0
- data/lib/templates/java/espresso/scenarios.hbs +23 -0
- data/lib/templates/java/espresso/single_scenario.hbs +24 -0
- data/lib/templates/java/espresso/single_test.hbs +22 -0
- data/lib/templates/java/espresso/tests.hbs +23 -0
- data/lib/templates/java/field.hbs +1 -0
- data/lib/templates/java/folder.hbs +18 -0
- data/lib/templates/java/ifthen.hbs +7 -0
- data/lib/templates/java/index.hbs +1 -0
- data/lib/templates/java/libraries.hbs +9 -0
- data/lib/templates/java/library.hbs +7 -0
- data/lib/templates/java/libraryactionword.hbs +1 -0
- data/lib/templates/java/list.hbs +1 -0
- data/lib/templates/java/nullliteral.hbs +1 -0
- data/lib/templates/java/parameter.hbs +1 -0
- data/lib/templates/java/parenthesis.hbs +1 -0
- data/lib/templates/java/property.hbs +1 -0
- data/lib/templates/java/scenario.hbs +1 -0
- data/lib/templates/java/scenarios.hbs +11 -0
- data/lib/templates/java/single_scenario.hbs +12 -0
- data/lib/templates/java/single_test.hbs +11 -0
- data/lib/templates/java/step.hbs +1 -0
- data/lib/templates/java/stringliteral.hbs +1 -0
- data/lib/templates/java/tag.hbs +1 -0
- data/lib/templates/java/template.hbs +1 -0
- data/lib/templates/java/test.hbs +1 -0
- data/lib/templates/java/testng/_scenario.hbs +8 -0
- data/lib/templates/java/testng/dataset.hbs +4 -0
- data/lib/templates/java/testng/folder.hbs +19 -0
- data/lib/templates/java/testng/scenarios.hbs +16 -0
- data/lib/templates/java/testng/single_scenario.hbs +12 -0
- data/lib/templates/java/testng/single_test.hbs +11 -0
- data/lib/templates/java/testng/tests.hbs +16 -0
- data/lib/templates/java/tests.hbs +11 -0
- data/lib/templates/java/variable.hbs +1 -0
- data/lib/templates/java/while.hbs +4 -0
- data/lib/templates/javascript/_body.hbs +10 -0
- data/lib/templates/javascript/_item_as_function.hbs +3 -0
- data/lib/templates/javascript/_item_as_hash_key.hbs +3 -0
- data/lib/templates/javascript/_module_declaration.hbs +5 -0
- data/lib/templates/javascript/_scenario.hbs +4 -0
- data/lib/templates/javascript/actionword.hbs +1 -0
- data/lib/templates/javascript/actionwords.hbs +4 -0
- data/lib/templates/javascript/argument.hbs +1 -0
- data/lib/templates/javascript/assign.hbs +1 -0
- data/lib/templates/javascript/binaryexpression.hbs +1 -0
- data/lib/templates/javascript/call.hbs +2 -0
- data/lib/templates/javascript/codeceptjs/actionword.hbs +5 -0
- data/lib/templates/javascript/codeceptjs/actionwords.hbs +9 -0
- data/lib/templates/javascript/dataset.hbs +3 -0
- data/lib/templates/javascript/dict.hbs +1 -0
- data/lib/templates/javascript/es6/actionwords.hbs +4 -0
- data/lib/templates/javascript/field.hbs +1 -0
- data/lib/templates/javascript/folder.hbs +14 -0
- data/lib/templates/javascript/ifthen.hbs +7 -0
- data/lib/templates/javascript/index.hbs +1 -0
- data/lib/templates/javascript/jasmine/_before_each.hbs +3 -0
- data/lib/templates/javascript/jasmine/_scenario.hbs +8 -0
- data/lib/templates/javascript/jasmine/dataset.hbs +3 -0
- data/lib/templates/javascript/jasmine/folder.hbs +11 -0
- data/lib/templates/javascript/jasmine/scenarios.hbs +8 -0
- data/lib/templates/javascript/jasmine/single_scenario.hbs +6 -0
- data/lib/templates/javascript/jasmine/single_test.hbs +6 -0
- data/lib/templates/javascript/jasmine/tests.hbs +8 -0
- data/lib/templates/javascript/list.hbs +1 -0
- data/lib/templates/javascript/mocha/_before_each.hbs +4 -0
- data/lib/templates/javascript/mocha/folder.hbs +11 -0
- data/lib/templates/javascript/nullliteral.hbs +1 -0
- data/lib/templates/javascript/parameter.hbs +1 -0
- data/lib/templates/javascript/parenthesis.hbs +1 -0
- data/lib/templates/javascript/project.hbs +2 -0
- data/lib/templates/javascript/property.hbs +1 -0
- data/lib/templates/javascript/scenario.hbs +1 -0
- data/lib/templates/javascript/scenarios.hbs +8 -0
- data/lib/templates/javascript/single_scenario.hbs +6 -0
- data/lib/templates/javascript/single_test.hbs +6 -0
- data/lib/templates/javascript/step.hbs +1 -0
- data/lib/templates/javascript/tag.hbs +1 -0
- data/lib/templates/javascript/template.hbs +1 -0
- data/lib/templates/javascript/test.hbs +1 -0
- data/lib/templates/javascript/tests.hbs +8 -0
- data/lib/templates/javascript/while.hbs +5 -0
- data/lib/templates/jbehave/_scenario.hbs +9 -0
- data/lib/templates/jbehave/actionwords/parameter.hbs +1 -0
- data/lib/templates/jbehave/call.hbs +5 -0
- data/lib/templates/jbehave/folder.hbs +16 -0
- data/lib/templates/jbehave/single_test.hbs +3 -0
- data/lib/templates/jbehave/steps/_gherkin_pattern.hbs +1 -0
- data/lib/templates/jbehave/steps/actionword.hbs +6 -0
- data/lib/templates/jbehave/steps/actionwords.hbs +18 -0
- data/lib/templates/php/_body.hbs +9 -0
- data/lib/templates/php/_item_as_function.hbs +3 -0
- data/lib/templates/php/_scenario.hbs +4 -0
- data/lib/templates/php/_setup.hbs +4 -0
- data/lib/templates/php/actionword.hbs +1 -0
- data/lib/templates/php/actionwords.hbs +9 -0
- data/lib/templates/php/argument.hbs +1 -0
- data/lib/templates/php/assign.hbs +1 -0
- data/lib/templates/php/binaryexpression.hbs +1 -0
- data/lib/templates/php/call.hbs +2 -0
- data/lib/templates/php/dataset.hbs +3 -0
- data/lib/templates/php/dict.hbs +1 -0
- data/lib/templates/php/field.hbs +1 -0
- data/lib/templates/php/folder.hbs +17 -0
- data/lib/templates/php/ifthen.hbs +7 -0
- data/lib/templates/php/index.hbs +1 -0
- data/lib/templates/php/libraries.hbs +11 -0
- data/lib/templates/php/library.hbs +20 -0
- data/lib/templates/php/libraryactionword.hbs +1 -0
- data/lib/templates/php/list.hbs +1 -0
- data/lib/templates/php/nullliteral.hbs +1 -0
- data/lib/templates/php/parameter.hbs +1 -0
- data/lib/templates/php/parenthesis.hbs +1 -0
- data/lib/templates/php/project.hbs +2 -0
- data/lib/templates/php/property.hbs +1 -0
- data/lib/templates/php/scenario.hbs +1 -0
- data/lib/templates/php/scenarios.hbs +13 -0
- data/lib/templates/php/single_scenario.hbs +11 -0
- data/lib/templates/php/single_test.hbs +11 -0
- data/lib/templates/php/step.hbs +1 -0
- data/lib/templates/php/tag.hbs +1 -0
- data/lib/templates/php/template.hbs +1 -0
- data/lib/templates/php/test.hbs +1 -0
- data/lib/templates/php/tests.hbs +13 -0
- data/lib/templates/php/variable.hbs +1 -0
- data/lib/templates/php/while.hbs +5 -0
- data/lib/templates/python/_body.hbs +11 -0
- data/lib/templates/python/_item_as_def.hbs +2 -0
- data/lib/templates/python/_parameters.hbs +1 -0
- data/lib/templates/python/_scenario.hbs +4 -0
- data/lib/templates/python/actionword.hbs +1 -0
- data/lib/templates/python/actionwords.hbs +12 -0
- data/lib/templates/python/argument.hbs +1 -0
- data/lib/templates/python/assign.hbs +1 -0
- data/lib/templates/python/binaryexpression.hbs +1 -0
- data/lib/templates/python/booleanliteral.hbs +1 -0
- data/lib/templates/python/call.hbs +2 -0
- data/lib/templates/python/dataset.hbs +2 -0
- data/lib/templates/python/dict.hbs +1 -0
- data/lib/templates/python/field.hbs +1 -0
- data/lib/templates/python/folder.hbs +12 -0
- data/lib/templates/python/ifthen.hbs +4 -0
- data/lib/templates/python/index.hbs +1 -0
- data/lib/templates/python/libraries.hbs +9 -0
- data/lib/templates/python/library.hbs +17 -0
- data/lib/templates/python/libraryactionword.hbs +1 -0
- data/lib/templates/python/list.hbs +1 -0
- data/lib/templates/python/nullliteral.hbs +1 -0
- data/lib/templates/python/parameter.hbs +1 -0
- data/lib/templates/python/parenthesis.hbs +1 -0
- data/lib/templates/python/project.hbs +2 -0
- data/lib/templates/python/property.hbs +1 -0
- data/lib/templates/python/scenario.hbs +1 -0
- data/lib/templates/python/scenarios.hbs +11 -0
- data/lib/templates/python/single_scenario.hbs +9 -0
- data/lib/templates/python/single_test.hbs +9 -0
- data/lib/templates/python/step.hbs +1 -0
- data/lib/templates/python/tag.hbs +1 -0
- data/lib/templates/python/template.hbs +1 -0
- data/lib/templates/python/test.hbs +1 -0
- data/lib/templates/python/tests.hbs +11 -0
- data/lib/templates/python/unittest/actionwords.hbs +9 -0
- data/lib/templates/python/while.hbs +4 -0
- data/lib/templates/robotframework/_keyword.hbs +1 -0
- data/lib/templates/robotframework/_keyword_body.hbs +4 -0
- data/lib/templates/robotframework/_scenario.hbs +12 -0
- data/lib/templates/robotframework/actionword.hbs +3 -0
- data/lib/templates/robotframework/actionwords.hbs +4 -0
- data/lib/templates/robotframework/argument.hbs +1 -0
- data/lib/templates/robotframework/call.hbs +1 -0
- data/lib/templates/robotframework/dataset.hbs +1 -0
- data/lib/templates/robotframework/datatable.hbs +2 -0
- data/lib/templates/robotframework/folder.hbs +35 -0
- data/lib/templates/robotframework/ifthen.hbs +1 -0
- data/lib/templates/robotframework/parameter.hbs +1 -0
- data/lib/templates/robotframework/property.hbs +1 -0
- data/lib/templates/robotframework/scenarios.hbs +25 -0
- data/lib/templates/robotframework/single_scenario.hbs +10 -0
- data/lib/templates/robotframework/single_test.hbs +10 -0
- data/lib/templates/robotframework/stringliteral.hbs +1 -0
- data/lib/templates/robotframework/template.hbs +1 -0
- data/lib/templates/robotframework/test.hbs +1 -0
- data/lib/templates/robotframework/tests.hbs +7 -0
- data/lib/templates/robotframework/variable.hbs +1 -0
- data/lib/templates/robotframework/while.hbs +1 -0
- data/lib/templates/ruby/_body.hbs +10 -0
- data/lib/templates/ruby/_item_as_def.hbs +3 -0
- data/lib/templates/ruby/_scenario.hbs +5 -0
- data/lib/templates/ruby/actionword.hbs +1 -0
- data/lib/templates/ruby/actionwords.hbs +6 -0
- data/lib/templates/ruby/argument.hbs +1 -0
- data/lib/templates/ruby/assign.hbs +1 -0
- data/lib/templates/ruby/binaryexpression.hbs +1 -0
- data/lib/templates/ruby/call.hbs +2 -0
- data/lib/templates/ruby/dataset.hbs +3 -0
- data/lib/templates/ruby/dict.hbs +1 -0
- data/lib/templates/ruby/field.hbs +1 -0
- data/lib/templates/ruby/folder.hbs +16 -0
- data/lib/templates/ruby/ifthen.hbs +7 -0
- data/lib/templates/ruby/index.hbs +1 -0
- data/lib/templates/ruby/list.hbs +1 -0
- data/lib/templates/ruby/minitest/_item_as_def.hbs +3 -0
- data/lib/templates/ruby/minitest/_scenario.hbs +4 -0
- data/lib/templates/ruby/minitest/dataset.hbs +3 -0
- data/lib/templates/ruby/minitest/folder.hbs +18 -0
- data/lib/templates/ruby/minitest/scenario.hbs +1 -0
- data/lib/templates/ruby/minitest/scenarios.hbs +13 -0
- data/lib/templates/ruby/minitest/single_scenario.hbs +11 -0
- data/lib/templates/ruby/minitest/single_test.hbs +11 -0
- data/lib/templates/ruby/minitest/test.hbs +1 -0
- data/lib/templates/ruby/minitest/tests.hbs +13 -0
- data/lib/templates/ruby/parameter.hbs +1 -0
- data/lib/templates/ruby/parenthesis.hbs +1 -0
- data/lib/templates/ruby/project.hbs +2 -0
- data/lib/templates/ruby/property.hbs +1 -0
- data/lib/templates/ruby/scenario.hbs +1 -0
- data/lib/templates/ruby/scenarios.hbs +12 -0
- data/lib/templates/ruby/single_scenario.hbs +11 -0
- data/lib/templates/ruby/single_test.hbs +11 -0
- data/lib/templates/ruby/step.hbs +1 -0
- data/lib/templates/ruby/symbol.hbs +1 -0
- data/lib/templates/ruby/tag.hbs +1 -0
- data/lib/templates/ruby/template.hbs +1 -0
- data/lib/templates/ruby/test.hbs +1 -0
- data/lib/templates/ruby/tests.hbs +12 -0
- data/lib/templates/ruby/while.hbs +5 -0
- data/lib/templates/seleniumide/argument.hbs +1 -0
- data/lib/templates/seleniumide/call.hbs +6 -0
- data/lib/templates/seleniumide/single_test.hbs +28 -0
- data/lib/templates/seleniumide/step.hbs +0 -0
- data/lib/templates/seleniumide/stringliteral.hbs +1 -0
- data/lib/templates/seleniumide/template.hbs +1 -0
- data/lib/templates/seleniumide/test.hbs +4 -0
- data/lib/templates/seleniumide/tests.hbs +19 -0
- data/lib/templates/specflow/actionword.hbs +6 -0
- data/lib/templates/specflow/actionwords/parameter.hbs +1 -0
- data/lib/templates/specflow/actionwords.hbs +14 -0
- data/lib/templates/specflow/gherkin/tag.hbs +1 -0
- data/lib/templates/specflow/parameter.hbs +1 -0
- data/lib/templates/swift/_body.hbs +11 -0
- data/lib/templates/swift/_item_as_def.hbs +5 -0
- data/lib/templates/swift/_scenario.hbs +7 -0
- data/lib/templates/swift/actionword.hbs +1 -0
- data/lib/templates/swift/actionwords.hbs +6 -0
- data/lib/templates/swift/argument.hbs +1 -0
- data/lib/templates/swift/assign.hbs +1 -0
- data/lib/templates/swift/binaryexpression.hbs +1 -0
- data/lib/templates/swift/call.hbs +2 -0
- data/lib/templates/swift/dataset.hbs +4 -0
- data/lib/templates/swift/dict.hbs +1 -0
- data/lib/templates/swift/field.hbs +1 -0
- data/lib/templates/swift/folder.hbs +23 -0
- data/lib/templates/swift/ifthen.hbs +7 -0
- data/lib/templates/swift/index.hbs +1 -0
- data/lib/templates/swift/list.hbs +1 -0
- data/lib/templates/swift/parameter.hbs +1 -0
- data/lib/templates/swift/parenthesis.hbs +1 -0
- data/lib/templates/swift/project.hbs +2 -0
- data/lib/templates/swift/property.hbs +1 -0
- data/lib/templates/swift/scenario.hbs +1 -0
- data/lib/templates/swift/scenarios.hbs +25 -0
- data/lib/templates/swift/single_scenario.hbs +24 -0
- data/lib/templates/swift/single_test.hbs +23 -0
- data/lib/templates/swift/step.hbs +1 -0
- data/lib/templates/swift/stringliteral.hbs +1 -0
- data/lib/templates/swift/symbol.hbs +1 -0
- data/lib/templates/swift/tag.hbs +1 -0
- data/lib/templates/swift/template.hbs +1 -0
- data/lib/templates/swift/test.hbs +1 -0
- data/lib/templates/swift/tests.hbs +25 -0
- data/lib/templates/swift/while.hbs +5 -0
- data/lib/templates/typescript/_item_as_function.hbs +3 -0
- data/lib/templates/typescript/actionword.hbs +1 -0
- data/lib/templates/typescript/actionwords.hbs +7 -0
- data/lib/templates/typescript/libraries.hbs +9 -0
- data/lib/templates/typescript/library.hbs +18 -0
- data/lib/templates/typescript/libraryactionword.hbs +1 -0
- data/lib/templates/typescript/parameter.hbs +1 -0
- metadata +783 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'i18n'
|
2
|
+
|
3
|
+
require 'hiptest-publisher/utils'
|
4
|
+
|
5
|
+
class ConsoleFormatter
|
6
|
+
attr_reader :verbose
|
7
|
+
|
8
|
+
def initialize(verbose, color: nil)
|
9
|
+
@verbose = verbose
|
10
|
+
@color = color.nil? ? tty? : color
|
11
|
+
@immediate_verbose = true
|
12
|
+
@verbose_messages = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def dump_error(error, message = nil)
|
16
|
+
return unless verbose
|
17
|
+
puts colorize(message, :blue) if message
|
18
|
+
line = "-" * 80
|
19
|
+
puts colorize(line, :yellow)
|
20
|
+
puts colorize("#{error.class.name}: #{error.message}", :red)
|
21
|
+
puts colorize("#{error.backtrace.map {|l| " #{l}\n"}.join}", :yellow)
|
22
|
+
puts colorize(line, :yellow)
|
23
|
+
end
|
24
|
+
|
25
|
+
def show_error(message)
|
26
|
+
STDOUT.print colorize(message, :yellow)
|
27
|
+
end
|
28
|
+
|
29
|
+
def show_failure(message)
|
30
|
+
STDOUT.print(colorize(message, :red))
|
31
|
+
end
|
32
|
+
|
33
|
+
def show_options(options, message = nil)
|
34
|
+
return unless verbose
|
35
|
+
message ||= I18n.t(:verbose_header, version: hiptest_publisher_version)
|
36
|
+
puts colorize(message, :yellow)
|
37
|
+
options.each { |k, v| puts " - #{k}: #{v.inspect}" }
|
38
|
+
end
|
39
|
+
|
40
|
+
def show_verbose_message(message)
|
41
|
+
return unless verbose
|
42
|
+
if @immediate_verbose
|
43
|
+
STDOUT.print "#{message}\n"
|
44
|
+
else
|
45
|
+
@verbose_messages << message
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def show_status_message(message, status=nil)
|
50
|
+
status_icon = " "
|
51
|
+
output = STDOUT
|
52
|
+
|
53
|
+
if status == :success
|
54
|
+
status_icon = colorize("v", :green)
|
55
|
+
elsif status == :warning
|
56
|
+
status_icon = colorize("?", :yellow)
|
57
|
+
elsif status == :failure
|
58
|
+
status_icon = colorize("x", :red)
|
59
|
+
output = STDERR
|
60
|
+
end
|
61
|
+
if status
|
62
|
+
@immediate_verbose = true
|
63
|
+
cursor_offset = ""
|
64
|
+
else
|
65
|
+
return unless tty?
|
66
|
+
return if IO.console.nil?
|
67
|
+
rows, columns = IO.console.winsize
|
68
|
+
return if columns == 0
|
69
|
+
@immediate_verbose = false
|
70
|
+
vertical_offset = (4 + message.length) / columns
|
71
|
+
cursor_offset = "\r\e[#{vertical_offset + 1}A"
|
72
|
+
end
|
73
|
+
|
74
|
+
output.print "[#{status_icon}] #{message}#{cursor_offset}\n"
|
75
|
+
|
76
|
+
if @immediate_verbose && !@verbose_messages.empty?
|
77
|
+
@verbose_messages.each { |message| show_verbose_message(message) }
|
78
|
+
@verbose_messages.clear
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def ask(question)
|
83
|
+
return unless tty?
|
84
|
+
STDOUT.print "[#{colorize('?', :yellow)}] #{question}"
|
85
|
+
return $stdin.gets.chomp.downcase.strip
|
86
|
+
end
|
87
|
+
|
88
|
+
def colored?
|
89
|
+
@color
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def tty?
|
95
|
+
$stdout.tty?
|
96
|
+
end
|
97
|
+
|
98
|
+
def colorize(txt, color)
|
99
|
+
colored? ? txt.send(color) : txt
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
require 'i18n'
|
2
|
+
|
3
|
+
module Hiptest
|
4
|
+
class DiffDisplayer
|
5
|
+
def initialize(diff, cli_options, language_config, file_writer)
|
6
|
+
@diff = diff
|
7
|
+
@cli_options = cli_options
|
8
|
+
@language_config = language_config
|
9
|
+
@file_writer = file_writer
|
10
|
+
end
|
11
|
+
|
12
|
+
def display
|
13
|
+
return export_as_json if @cli_options.actionwords_diff_json && @cli_options.output_directory
|
14
|
+
return display_as_json if @cli_options.actionwords_diff_json
|
15
|
+
return display_deleted if @cli_options.aw_deleted
|
16
|
+
return display_created if @cli_options.aw_created
|
17
|
+
return display_renamed if @cli_options.aw_renamed
|
18
|
+
return display_signature_changed if @cli_options.aw_signature_changed
|
19
|
+
return display_definition_changed if @cli_options.aw_definition_changed
|
20
|
+
|
21
|
+
display_summary
|
22
|
+
end
|
23
|
+
|
24
|
+
def display_created
|
25
|
+
return display_skeletons(@diff[:created])
|
26
|
+
end
|
27
|
+
|
28
|
+
def display_renamed
|
29
|
+
return if @diff[:renamed].nil?
|
30
|
+
|
31
|
+
output(@diff[:renamed].map {|renamed|
|
32
|
+
"#{@language_config.name_action_word(renamed[:name])}\t#{@language_config.name_action_word(renamed[:new_name])}"
|
33
|
+
})
|
34
|
+
end
|
35
|
+
|
36
|
+
def display_signature_changed
|
37
|
+
display_skeletons(@diff[:signature_changed])
|
38
|
+
end
|
39
|
+
|
40
|
+
def display_definition_changed
|
41
|
+
display_skeletons(@diff[:definition_changed])
|
42
|
+
end
|
43
|
+
|
44
|
+
def display_deleted
|
45
|
+
return if @diff[:deleted].nil?
|
46
|
+
|
47
|
+
output(@diff[:deleted].map {|deleted|
|
48
|
+
@language_config.name_action_word(deleted[:name])
|
49
|
+
})
|
50
|
+
end
|
51
|
+
|
52
|
+
def export_as_json
|
53
|
+
@file_writer.write_to_file(
|
54
|
+
"#{@cli_options.output_directory}/actionwords-diff.json",
|
55
|
+
I18n.t('actionwords_diff.exporting_diff_title')) {
|
56
|
+
JSON.pretty_generate(as_api)
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
def display_as_json
|
61
|
+
output(JSON.pretty_generate(as_api))
|
62
|
+
end
|
63
|
+
|
64
|
+
def as_api
|
65
|
+
data = {}
|
66
|
+
|
67
|
+
data[:deleted] = @diff[:deleted].map {|aw|
|
68
|
+
{
|
69
|
+
name: aw[:name],
|
70
|
+
name_in_code: @language_config.name_action_word(aw[:name])
|
71
|
+
}
|
72
|
+
} unless @diff[:deleted].nil?
|
73
|
+
|
74
|
+
data[:created] = @diff[:created].map {|aw|
|
75
|
+
{
|
76
|
+
name: aw[:name],
|
77
|
+
skeleton: actionword_skeleton(aw)
|
78
|
+
}
|
79
|
+
} unless @diff[:created].nil?
|
80
|
+
|
81
|
+
data[:renamed] = @diff[:renamed].map {|aw|
|
82
|
+
{
|
83
|
+
name: aw[:name],
|
84
|
+
old_name: @language_config.name_action_word(aw[:name]),
|
85
|
+
new_name: @language_config.name_action_word(aw[:new_name])
|
86
|
+
}
|
87
|
+
} unless @diff[:renamed].nil?
|
88
|
+
|
89
|
+
data[:signature_changed] = @diff[:signature_changed].map {|aw|
|
90
|
+
{
|
91
|
+
name: aw[:name],
|
92
|
+
skeleton: actionword_skeleton(aw)
|
93
|
+
}
|
94
|
+
} unless @diff[:signature_changed].nil?
|
95
|
+
|
96
|
+
|
97
|
+
data[:definition_changed] = @diff[:definition_changed].map {|aw|
|
98
|
+
{
|
99
|
+
name: aw[:name],
|
100
|
+
skeleton: actionword_skeleton(aw)
|
101
|
+
}
|
102
|
+
} unless @diff[:definition_changed].nil?
|
103
|
+
|
104
|
+
return data
|
105
|
+
end
|
106
|
+
|
107
|
+
def display_summary
|
108
|
+
command_line = @cli_options.command_line_used(exclude: [:actionwords_diff])
|
109
|
+
|
110
|
+
unless @diff[:deleted].nil?
|
111
|
+
puts I18n.t('actionwords_diff.summary.deleted', count: @diff[:deleted].length, command_line: command_line, list: displayable_list(@diff[:deleted]))
|
112
|
+
puts ""
|
113
|
+
end
|
114
|
+
|
115
|
+
unless @diff[:created].nil?
|
116
|
+
puts I18n.t('actionwords_diff.summary.created', count: @diff[:created].length, command_line: command_line, list: displayable_list(@diff[:created]))
|
117
|
+
puts ""
|
118
|
+
end
|
119
|
+
|
120
|
+
unless @diff[:renamed].nil?
|
121
|
+
puts I18n.t('actionwords_diff.summary.renamed', count: @diff[:renamed].length, command_line: command_line, list: displayable_list(@diff[:renamed]))
|
122
|
+
puts ""
|
123
|
+
end
|
124
|
+
|
125
|
+
unless @diff[:signature_changed].nil?
|
126
|
+
puts I18n.t('actionwords_diff.summary.signature_changed', count: @diff[:signature_changed].length, command_line: command_line, list: displayable_list(@diff[:signature_changed]))
|
127
|
+
puts ""
|
128
|
+
end
|
129
|
+
|
130
|
+
unless @diff[:definition_changed].nil?
|
131
|
+
puts I18n.t('actionwords_diff.summary.definition_changed', count: @diff[:definition_changed].length, command_line: command_line, list: displayable_list(@diff[:definition_changed]))
|
132
|
+
puts ""
|
133
|
+
end
|
134
|
+
|
135
|
+
if @diff.empty?
|
136
|
+
puts I18n.t('actionwords_diff.summary.empty')
|
137
|
+
puts ""
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
private
|
142
|
+
|
143
|
+
def output(lines, add_empty_line: true)
|
144
|
+
puts Array(lines).join("\n")
|
145
|
+
puts "" if add_empty_line
|
146
|
+
end
|
147
|
+
|
148
|
+
def displayable_list(actionwords)
|
149
|
+
actionwords.map {|c| "- #{c[:name]}"}.join("\n")
|
150
|
+
end
|
151
|
+
|
152
|
+
def actionword_skeleton(actionword)
|
153
|
+
return if actionwords_group_config.nil?
|
154
|
+
|
155
|
+
node_rendering_context = actionwords_group_config.build_node_rendering_context(actionword[:node])
|
156
|
+
actionword[:node].render(node_rendering_context)
|
157
|
+
end
|
158
|
+
|
159
|
+
def display_skeletons(actionwords)
|
160
|
+
return if actionwords.nil?
|
161
|
+
|
162
|
+
actionwords.each do |actionword|
|
163
|
+
output(actionword_skeleton(actionword))
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def actionwords_group_config
|
168
|
+
@actionwords_group_config ||= @language_config.language_group_configs.select { |language_group_config|
|
169
|
+
language_group_config[:group_name] == "actionwords"
|
170
|
+
}.first
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
class Reporter
|
2
|
+
def initialize(listeners = nil)
|
3
|
+
@listeners = listeners || []
|
4
|
+
end
|
5
|
+
|
6
|
+
def add_listener(listener)
|
7
|
+
@listeners << listener
|
8
|
+
end
|
9
|
+
|
10
|
+
def dump_error(error, message = nil)
|
11
|
+
notify(:dump_error, error, message)
|
12
|
+
end
|
13
|
+
|
14
|
+
def show_error(message)
|
15
|
+
notify(:show_error, message)
|
16
|
+
end
|
17
|
+
|
18
|
+
def show_failure(message)
|
19
|
+
notify(:show_failure, message)
|
20
|
+
end
|
21
|
+
|
22
|
+
def show_options(options, message = nil)
|
23
|
+
notify(:show_options, options, message)
|
24
|
+
end
|
25
|
+
|
26
|
+
def show_verbose_message(message)
|
27
|
+
notify(:show_verbose_message, message)
|
28
|
+
end
|
29
|
+
|
30
|
+
def with_status_message(message, &blk)
|
31
|
+
notify(:show_status_message, message)
|
32
|
+
status = :success
|
33
|
+
yield
|
34
|
+
rescue
|
35
|
+
status = :failure
|
36
|
+
raise
|
37
|
+
ensure
|
38
|
+
notify(:show_status_message, message, status)
|
39
|
+
end
|
40
|
+
|
41
|
+
def success_message(message)
|
42
|
+
notify(:show_status_message, message, :success)
|
43
|
+
end
|
44
|
+
|
45
|
+
def warning_message(message)
|
46
|
+
notify(:show_status_message, message, :warning)
|
47
|
+
end
|
48
|
+
|
49
|
+
def failure_message(message)
|
50
|
+
notify(:show_status_message, message, :failure)
|
51
|
+
end
|
52
|
+
|
53
|
+
def notify(message, *args)
|
54
|
+
@listeners.each do |listener|
|
55
|
+
listener.send(message, *args)
|
56
|
+
end
|
57
|
+
nil
|
58
|
+
end
|
59
|
+
|
60
|
+
def ask(question)
|
61
|
+
askable_listener = @listeners.find { |l| l.respond_to?(:ask) }
|
62
|
+
return nil if askable_listener.nil?
|
63
|
+
return askable_listener.ask(question)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class NullReporter
|
68
|
+
def with_status_message(message, &blk)
|
69
|
+
yield
|
70
|
+
end
|
71
|
+
|
72
|
+
def method_missing(*args)
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,314 @@
|
|
1
|
+
module Hiptest
|
2
|
+
class HandlebarsHelper
|
3
|
+
def self.register_helpers(handlebars, context)
|
4
|
+
instance = Hiptest::HandlebarsHelper.new(handlebars, context)
|
5
|
+
instance.register_string_helpers
|
6
|
+
instance.register_custom_helpers
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(handlebars, context)
|
10
|
+
@handlebars = handlebars
|
11
|
+
@context = context
|
12
|
+
end
|
13
|
+
|
14
|
+
def register_string_helpers
|
15
|
+
string_helpers = [
|
16
|
+
:literate,
|
17
|
+
:normalize,
|
18
|
+
:normalize_lower,
|
19
|
+
:normalize_with_dashes,
|
20
|
+
:normalize_with_spaces,
|
21
|
+
:underscore,
|
22
|
+
:capitalize,
|
23
|
+
:camelize,
|
24
|
+
:camelize_lower,
|
25
|
+
:camelize_upper,
|
26
|
+
:clear_extension,
|
27
|
+
:downcase,
|
28
|
+
:strip
|
29
|
+
]
|
30
|
+
|
31
|
+
string_helpers.each do |helper|
|
32
|
+
@handlebars.register_helper(helper) do |context, block|
|
33
|
+
if block.is_a? Handlebars::Tree::Block
|
34
|
+
value = block.fn(context)
|
35
|
+
else
|
36
|
+
value = block
|
37
|
+
end
|
38
|
+
"#{value.to_s.send(helper)}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def register_custom_helpers
|
44
|
+
self.class.instance_methods.each do |method_name|
|
45
|
+
if method_name.to_s.start_with? 'hh_'
|
46
|
+
@handlebars.register_helper(method_name.to_s.gsub(/hh_/, '')) do |*args|
|
47
|
+
send(method_name, *args)
|
48
|
+
end
|
49
|
+
elsif method_name.to_s.start_with? 'as_hh_'
|
50
|
+
@handlebars.register_as_helper(method_name.to_s.gsub(/as_hh_/, '')) do |*args|
|
51
|
+
send(method_name, *args)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def compute_block_value(context, value, block)
|
58
|
+
value.is_a?(Handlebars::Tree::Block) ? value.fn(context) : value
|
59
|
+
end
|
60
|
+
|
61
|
+
def hh_to_string(context, value, block = nil)
|
62
|
+
value = compute_block_value(context, value, block)
|
63
|
+
"#{value.to_s}"
|
64
|
+
end
|
65
|
+
|
66
|
+
def hh_join(context, items, joiner, block, else_block = nil)
|
67
|
+
as_hh_join(context, items, joiner, :this, block, else_block)
|
68
|
+
end
|
69
|
+
|
70
|
+
def as_hh_join(context, items, joiner, name, block, else_block = nil)
|
71
|
+
joiner = joiner.to_s
|
72
|
+
joiner.gsub!(/\\t/, "\t")
|
73
|
+
joiner.gsub!(/\\n/, "\n")
|
74
|
+
|
75
|
+
if block.nil? || block.items.empty?
|
76
|
+
"#{items.join(joiner)}"
|
77
|
+
else
|
78
|
+
if items.empty? && else_block
|
79
|
+
return else_block.fn(context)
|
80
|
+
end
|
81
|
+
|
82
|
+
items.map do |item|
|
83
|
+
context.with_temporary_context(name => item) do
|
84
|
+
block.fn(context)
|
85
|
+
end
|
86
|
+
end.join(joiner)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def hh_join_gherkin_dataset(context, items, block, else_block = nil)
|
91
|
+
items.map! { |item| item.gsub(/\|/, "\\|").gsub("\n", "\\n") }
|
92
|
+
|
93
|
+
hh_join(context, items, ' | ', block, else_block)
|
94
|
+
end
|
95
|
+
|
96
|
+
def hh_with(context, var, name, block)
|
97
|
+
context.with_temporary_context(name => var) do
|
98
|
+
block.fn(context)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def hh_prepend(context, str, block)
|
103
|
+
block.fn(context).split("\n").map do |line|
|
104
|
+
indented = "#{str}#{line}"
|
105
|
+
indented = "" if indented.strip.empty?
|
106
|
+
indented
|
107
|
+
end.join("\n")
|
108
|
+
end
|
109
|
+
|
110
|
+
def hh_indent(context, block)
|
111
|
+
indentation = @context[:indentation] || ' '
|
112
|
+
indentation = "\t" if indentation == '\t'
|
113
|
+
|
114
|
+
hh_prepend(context, indentation, block)
|
115
|
+
end
|
116
|
+
|
117
|
+
def hh_clear_empty_lines(context, block)
|
118
|
+
block.fn(context).split("\n").map do |line|
|
119
|
+
line unless line.strip.empty?
|
120
|
+
end.compact.join("\n")
|
121
|
+
end
|
122
|
+
|
123
|
+
def hh_index(context, list, index, block)
|
124
|
+
current_this = context.get('this')
|
125
|
+
context.add_item(:this, list[index.to_i])
|
126
|
+
rendered = block.fn(context)
|
127
|
+
context.add_item(:this, current_this)
|
128
|
+
|
129
|
+
return rendered
|
130
|
+
end
|
131
|
+
|
132
|
+
def hh_first(context, list, block)
|
133
|
+
hh_index(context, list, 0, block)
|
134
|
+
end
|
135
|
+
|
136
|
+
def hh_last(context, list, block)
|
137
|
+
hh_index(context, list, list.size - 1, block)
|
138
|
+
end
|
139
|
+
|
140
|
+
# kept for backward compatibility of customized templates
|
141
|
+
def hh_remove_quotes (context, s, block = nil)
|
142
|
+
hh_remove_double_quotes(context, s, block)
|
143
|
+
end
|
144
|
+
|
145
|
+
def hh_remove_double_quotes (context, s, block = nil)
|
146
|
+
s = compute_block_value(context,s, block)
|
147
|
+
s ? s.gsub('"', '') : ""
|
148
|
+
end
|
149
|
+
|
150
|
+
def hh_remove_single_quotes (context, s, block = nil)
|
151
|
+
s = compute_block_value(context,s, block)
|
152
|
+
s ? s.gsub('\'', '') : ""
|
153
|
+
end
|
154
|
+
|
155
|
+
# kept for backward compatibility of customized templates
|
156
|
+
def hh_escape_quotes (context, s, block = nil)
|
157
|
+
hh_escape_double_quotes(context, s, block)
|
158
|
+
end
|
159
|
+
|
160
|
+
def hh_escape_double_quotes (context, s, block = nil)
|
161
|
+
s = compute_block_value(context, s, block)
|
162
|
+
s ? s.gsub('"', '\\"') : ""
|
163
|
+
end
|
164
|
+
|
165
|
+
def hh_escape_single_quotes (context, s, block = nil)
|
166
|
+
# weird \\\\, see http://stackoverflow.com/questions/7074337/why-does-stringgsub-double-content
|
167
|
+
s = compute_block_value(context, s, block)
|
168
|
+
s ? s.gsub('\'', "\\\\'") : ""
|
169
|
+
end
|
170
|
+
|
171
|
+
def hh_unescape_single_quotes (context, s, block = nil)
|
172
|
+
# weird \\\\, see http://stackoverflow.com/questions/7074337/why-does-stringgsub-double-content
|
173
|
+
s = compute_block_value(context, s, block)
|
174
|
+
s ? s.gsub("\\'", "'") : ""
|
175
|
+
end
|
176
|
+
|
177
|
+
def hh_escape_backslashes_and_double_quotes (context, s, block = nil)
|
178
|
+
s = compute_block_value(context, s, block)
|
179
|
+
|
180
|
+
if s
|
181
|
+
s.gsub('\\') { |c| c*2 }.
|
182
|
+
gsub('"', '\\"')
|
183
|
+
else
|
184
|
+
""
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def hh_escape_new_line(context, s, block = nil)
|
189
|
+
s = compute_block_value(context, s, block)
|
190
|
+
s ? s.gsub("\n", '\\n') : ""
|
191
|
+
end
|
192
|
+
|
193
|
+
def hh_remove_surrounding_quotes(context, s, block = nil)
|
194
|
+
s = compute_block_value(context, s, block)
|
195
|
+
|
196
|
+
if s.nil?
|
197
|
+
""
|
198
|
+
elsif surrounded_with?(s, "'") || surrounded_with?(s, '"')
|
199
|
+
s.slice(1...-1)
|
200
|
+
else
|
201
|
+
s
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def surrounded_with?(main, sub)
|
206
|
+
main.start_with?(sub) && main.end_with?(sub)
|
207
|
+
end
|
208
|
+
|
209
|
+
def hh_comment (context, commenter, block)
|
210
|
+
block.fn(context).split("\n").map do |line|
|
211
|
+
stripped_line = line.strip
|
212
|
+
stripped_line.empty? ? commenter : "#{commenter} #{line}"
|
213
|
+
end.join("\n")
|
214
|
+
end
|
215
|
+
|
216
|
+
def hh_description_with_annotations (context, commenter, block)
|
217
|
+
value = compute_block_value(context, commenter, block)
|
218
|
+
value = value.split("\n").map do |line|
|
219
|
+
line.strip.downcase.start_with?('given', 'when', 'then', 'and', 'but', '*', '#') ? "\"#{line}\"" : line
|
220
|
+
end.join("\n")
|
221
|
+
value
|
222
|
+
end
|
223
|
+
|
224
|
+
def hh_curly (context, block)
|
225
|
+
"{#{block.fn(context)}}"
|
226
|
+
end
|
227
|
+
|
228
|
+
def hh_open_curly (context, block, else_block = nil)
|
229
|
+
"{"
|
230
|
+
end
|
231
|
+
|
232
|
+
def hh_close_curly (context, block, else_block = nil)
|
233
|
+
"}"
|
234
|
+
end
|
235
|
+
|
236
|
+
def hh_tab (context, block, else_block = nil)
|
237
|
+
"\t"
|
238
|
+
end
|
239
|
+
|
240
|
+
def hh_relative_path(context, filename, path_prefix = nil, block)
|
241
|
+
levels_count = context.get('context.relative_path').count('/')
|
242
|
+
name = ""
|
243
|
+
name << path_prefix if path_prefix
|
244
|
+
if levels_count == 0
|
245
|
+
name << filename
|
246
|
+
else
|
247
|
+
name << "../" * levels_count
|
248
|
+
name << filename.to_s.gsub(/\A\.\//, '')
|
249
|
+
end
|
250
|
+
name
|
251
|
+
end
|
252
|
+
|
253
|
+
def hh_strip_regexp_delimiters(context, regexp, block = nil)
|
254
|
+
regexp = compute_block_value(context, regexp, block)
|
255
|
+
return regexp.gsub(/(^\^)|(\$$)/, '')
|
256
|
+
end
|
257
|
+
|
258
|
+
def hh_remove_last_character(context, character = '', block)
|
259
|
+
txt = block.fn(context)
|
260
|
+
return txt[-1] == character ? txt[0..-2] : txt
|
261
|
+
end
|
262
|
+
|
263
|
+
def hh_trim_surrounding_characters(context, character, block)
|
264
|
+
return block.fn(context).gsub(/(\A(#{character})*)|((#{character})*\z)/, '')
|
265
|
+
end
|
266
|
+
|
267
|
+
def hh_replace(context, str, replacement, block)
|
268
|
+
return block.fn(context).gsub(str, replacement)
|
269
|
+
end
|
270
|
+
|
271
|
+
def hh_debug(context, block, _)
|
272
|
+
require 'pry'
|
273
|
+
binding.pry
|
274
|
+
""
|
275
|
+
end
|
276
|
+
|
277
|
+
def hh_case(context, expression, block_whens, block_else = nil)
|
278
|
+
result = nil
|
279
|
+
|
280
|
+
context.with_temporary_context(__case_expression: expression, __case_result: nil) do
|
281
|
+
block_whens.fn(context)
|
282
|
+
context.get("__case_result") || (block_else && block_else.fn(context).chomp) || ''
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
def hh_when(context, value, block)
|
287
|
+
return if context.get("__case_result")
|
288
|
+
|
289
|
+
expression = context.get("__case_expression")
|
290
|
+
if expression == value
|
291
|
+
context.add_item(:__case_result, block.fn(context))
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
def hh_when_includes(context, value, block)
|
296
|
+
return if context.get("__case_result")
|
297
|
+
|
298
|
+
expression = context.get("__case_expression")
|
299
|
+
if expression.respond_to?(:include?) && expression.include?(value)
|
300
|
+
context.add_item(:__case_result, block.fn(context))
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
def hh_if_includes(context, expression, element, block_true, block_false = nil)
|
305
|
+
if expression.respond_to?(:include?) && expression.include?(element)
|
306
|
+
block_true.fn(context)
|
307
|
+
elsif block_false
|
308
|
+
block_false.fn(context)
|
309
|
+
else
|
310
|
+
''
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Hiptest
|
2
|
+
class ActionwordIndexer
|
3
|
+
def initialize(project)
|
4
|
+
@project = project
|
5
|
+
@indexed = {}
|
6
|
+
index_actionwords
|
7
|
+
end
|
8
|
+
|
9
|
+
def index_actionwords
|
10
|
+
@project.each_sub_nodes(Hiptest::Nodes::Actionword) do |aw|
|
11
|
+
aw_name = aw.children[:name]
|
12
|
+
indexed_parameters = {}
|
13
|
+
|
14
|
+
aw.children[:parameters].map do |param|
|
15
|
+
param_name = param.children[:name]
|
16
|
+
indexed_parameters[param_name] = param.children[:default]
|
17
|
+
end
|
18
|
+
|
19
|
+
data = {
|
20
|
+
actionword: aw,
|
21
|
+
parameters: indexed_parameters
|
22
|
+
}
|
23
|
+
|
24
|
+
@indexed[aw_name] = data
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_index(name)
|
29
|
+
@indexed[name]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|