From 1abdc097b235366759a889bdcc68359653a9b8a3 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Thu, 19 May 2011 17:33:25 +0200 Subject: JSTD adapter for running e2e tests Couple of changes into angular.scenario runner: - add autotest config (runs tests when document ready) - update ObjectModel (forwards events) - use only one ObjectModel instance for all outputters - expose error msg and line number in ObjectModel.Spec and ObjectModel.Step - fix generating spec.ids - fix 'html' output so that it does not mutate ObjectModel Couple of changes into docs / generator: - rename copy -> copyTpl - move docs/static into docs/examples (to avoid conflict with jstd proxy) Running all docs e2e tests: ======================================================== 1/ compile angular-scenario, jstd-scenario-adapter >> rake compile 2/ build docs >> rake docs 3/ start jstd server >> ./server-scenario.sh 4/ capture some browser 5/ run node server to serve static content >> node ../lib/nodeserver/server.js 6/ run tests >> ./test-scenario.sh --- Rakefile | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index fff9ce1c..31307c4f 100644 --- a/Rakefile +++ b/Rakefile @@ -53,7 +53,7 @@ ANGULAR_SCENARIO = [ 'src/scenario/output/Html.js', 'src/scenario/output/Json.js', 'src/scenario/output/Xml.js', - 'src/scenario/output/Object.js', + 'src/scenario/output/Object.js' ] BUILD_DIR = 'build' @@ -94,6 +94,30 @@ task :compile_scenario => :init do end end +desc 'Compile JSTD Scenario Adapter' +task :compile_jstd_scenario_adapter => :init do + + deps = [ + 'src/jstd-scenario-adapter/angular.prefix', + 'src/jstd-scenario-adapter/Adapter.js', + 'src/jstd-scenario-adapter/angular.suffix', + ] + + concat = 'cat ' + deps.flatten.join(' ') + + File.open(path_to('jstd-scenario-adapter.js'), 'w') do |f| + f.write(%x{#{concat}}) + end + + # TODO(vojta) use jstd configuration when implemented + # (instead of including jstd-adapter-config.js) + File.open(path_to('jstd-scenario-adapter-config.js'), 'w') do |f| + f.write("/**\r\n" + + " * Configuration for jstd scenario adapter \n */\n" + + "var jstdScenarioAdapter = {\n relativeUrlPrefix: '/build/docs/'\n};\n") + end +end + desc 'Generate IE css js patch' task :generate_ie_compat => :init do @@ -152,7 +176,7 @@ end desc 'Compile JavaScript' -task :compile => [:init, :compile_scenario, :generate_ie_compat] do +task :compile => [:init, :compile_scenario, :compile_jstd_scenario_adapter, :generate_ie_compat] do deps = [ 'src/angular.prefix', @@ -195,7 +219,9 @@ task :package => [:clean, :compile, :docs] do path_to('angular.js'), path_to('angular.min.js'), path_to('angular-ie-compat.js'), - path_to('angular-scenario.js') + path_to('angular-scenario.js'), + path_to('jstd-scenario-adapter.js'), + path_to('jstd-scenario-adapter-config.js'), ].each do |src| dest = src.gsub(/^[^\/]+\//, '').gsub(/((\.min)?\.js)$/, "-#{version}\\1") FileUtils.cp(src, pkg_dir + '/' + dest) -- cgit v1.2.3