From 39c6c5975bedf6e1610f7328a088acda9ab3406a Mon Sep 17 00:00:00 2001 From: Adam Abrons Date: Mon, 15 Mar 2010 17:02:54 -0700 Subject: get scenarios running again - open Runner.html in a browser to run them --- scenario/Runner.html | 10 +++++++ scenario/datastore-scenarios.js | 19 ++++++++++++++ scenario/datastore.html | 12 +++++++++ scenario/widgets-scenarios.js | 49 ++++++++++++++++++++++++++++++++++ scenario/widgets.html | 58 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 148 insertions(+) create mode 100644 scenario/Runner.html create mode 100644 scenario/datastore-scenarios.js create mode 100644 scenario/datastore.html create mode 100644 scenario/widgets-scenarios.js create mode 100644 scenario/widgets.html (limited to 'scenario') diff --git a/scenario/Runner.html b/scenario/Runner.html new file mode 100644 index 00000000..fb4b0f8f --- /dev/null +++ b/scenario/Runner.html @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/scenario/datastore-scenarios.js b/scenario/datastore-scenarios.js new file mode 100644 index 00000000..6038070b --- /dev/null +++ b/scenario/datastore-scenarios.js @@ -0,0 +1,19 @@ +angular.scenarioDef.datastore = { + $before:[ + {Given:"dataset", + dataset:{ + Book:[{$id:'moby', name:"Moby Dick"}, + {$id:'gadsby', name:'Great Gadsby'}] + } + }, + {Given:"browser", at:"datastore.html#book=moby"}, + ], + checkLoadBook:[ + {Then:"drainRequestQueue"}, + + {Then:"text", at:"{{book.$id}}", should_be:"moby"}, + {Then:"text", at:"li[$index=0] {{book.name}}", should_be:"Great Gahdsby"}, + {Then:"text", at:"li[$index=0] {{book.name}}", should_be:"Moby Dick"}, + + ] +}; diff --git a/scenario/datastore.html b/scenario/datastore.html new file mode 100644 index 00000000..355d151c --- /dev/null +++ b/scenario/datastore.html @@ -0,0 +1,12 @@ + + + + + + +

{{book.$id}}

+
  • +
  • {{book.name}}
  • + + + diff --git a/scenario/widgets-scenarios.js b/scenario/widgets-scenarios.js new file mode 100644 index 00000000..663b06da --- /dev/null +++ b/scenario/widgets-scenarios.js @@ -0,0 +1,49 @@ +angular.scenarioDef.widgets = { + $before:[ + {Given:"browser", at:"widgets.html"} + ], + checkWidgetBinding:[ + {Then:"text", at:"{{name}}", should_be:""}, + {When:"enter", text:"John", at:":input[name=name]"}, + {Then:"text", at:"{{name}}", should_be:"John"}, + + {Then:"text", at:"{{gender}}", should_be:""}, + {When:"click", at:"input:radio[value=male]"}, + {Then:"text", at:"{{gender}}", should_be:"male"}, + + {Then:"text", at:"{{tea}}", should_be:"on"}, + {When:"click", at:"input[name=tea]"}, + {Then:"text", at:"{{tea}}", should_be:""}, + + {Then:"text", at:"{{coffee}}", should_be:""}, + {When:"click", at:"input[name=coffee]"}, + {Then:"text", at:"{{coffee}}", should_be:"on"}, + + {Then:"text", at:"{{count}}", should_be:0}, + {When:"click", at:"form :button"}, + {When:"click", at:"form :submit"}, + {When:"click", at:"form :image"}, + {Then:"text", at:"{{count}}", should_be:3}, + + {Then:"text", at:"{{select}}", should_be:"A"}, + {When:"select", at:"select[name=select]", option:"B"}, + {Then:"text", at:"{{select}}", should_be:"B"}, + + {Then:"text", at:"{{multiple}}", should_be:"[]"}, + {When:"select", at:"select[name=multiple]", option:"A"}, + {Then:"text", at:"{{multiple}}", should_be:["A"]}, + {When:"select", at:"select[name=multiple]", option:"B"}, + {Then:"text", at:"{{multiple}}", should_be:["A", "B"]}, + {When:"select", at:"select[name=multiple]", option:"A"}, + {Then:"text", at:"{{multiple}}", should_be:["B"]}, + + {Then:"text", at:"{{hidden}}", should_be:"hiddenValue"}, + + {Then:"text", at:"{{password}}", should_be:"passwordValue"}, + {When:"enter", text:"reset", at:":input[name=password]"}, + {Then:"text", at:"{{password}}", should_be:"reset"}, + ], + checkNewWidgetEmpty:[ + {Then:"text", at:"{{name}}", should_be:""}, + ] +}; diff --git a/scenario/widgets.html b/scenario/widgets.html new file mode 100644 index 00000000..cb28e78c --- /dev/null +++ b/scenario/widgets.html @@ -0,0 +1,58 @@ + + + + + + + + + +

    + name: name={{name}}
    +

    +

    + Female + Male + gender={{gender}} +

    +

    + tea={{tea}}
    + coffee={{coffee}}
    +

    +

    +

    + + + + action + count={{count}} +
    +

    +

    + + select={{select}} +

    +

    + + multiple={{multiple}} +

    +

    + + Hidden field = {{hidden}} +

    +

    + + Password field = {{password}} +

    + + -- cgit v1.2.3 From 9e1f085ba6e224893abc04be181f8748939bfe77 Mon Sep 17 00:00:00 2001 From: Adam Abrons Date: Mon, 15 Mar 2010 17:05:45 -0700 Subject: datastore scenario failing as expected --- scenario/Runner.html | 2 +- scenario/datastore.html | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'scenario') diff --git a/scenario/Runner.html b/scenario/Runner.html index fb4b0f8f..c5eb6205 100644 --- a/scenario/Runner.html +++ b/scenario/Runner.html @@ -3,7 +3,7 @@ - + diff --git a/scenario/datastore.html b/scenario/datastore.html index 355d151c..525d3636 100644 --- a/scenario/datastore.html +++ b/scenario/datastore.html @@ -1,7 +1,12 @@ - + + + +

    {{book.$id}}

    -- cgit v1.2.3 From 258ca5f16581f0e8befa493644225a02ae2fc002 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 26 Mar 2010 16:27:18 -0700 Subject: moved all uneeded files out, widgets.html works, tests horribly broken --- scenario/style.css | 7 +++ scenario/widgets.html | 128 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 84 insertions(+), 51 deletions(-) create mode 100644 scenario/style.css (limited to 'scenario') diff --git a/scenario/style.css b/scenario/style.css new file mode 100644 index 00000000..956bdc52 --- /dev/null +++ b/scenario/style.css @@ -0,0 +1,7 @@ +th { + text-align: left; +} + +tr { + border: 1px solid black; +} diff --git a/scenario/widgets.html b/scenario/widgets.html index cb28e78c..21060ebf 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -1,58 +1,84 @@ - - - - + + -

    - name: name={{name}}
    -

    -

    - Female - Male - gender={{gender}} -

    -

    - tea={{tea}}
    - coffee={{coffee}}
    -

    -

    -

    - - - - action - count={{count}} -
    -

    -

    - - select={{select}} -

    -

    - - multiple={{multiple}} -

    -

    - - Hidden field = {{hidden}} -

    -

    - - Password field = {{password}} -

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    DescriptionTestResult
    Input text field
    basictext.basic={{text.basic}}
    passwordtext.password={{text.password}}
    hiddenhidden={{hidden}}
    Input selection field
    radio + Female
    + Male +
    gender={{gender}}
    checkbox + Tea
    + Coffe +
    checkbox={{checkbox}}
    select + + select={{select}}
    multiselect + + multiselect={{multiselect}}
    Buttons
    ng-action +
    +
    +
    +
    + action +
    +
    button={{button}}
    -- cgit v1.2.3 From 85f13d602e31424b2e2d18172872f14a24c31135 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 1 Apr 2010 14:10:28 -0700 Subject: work on $location and autobind --- scenario/widgets.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index 21060ebf..5c11a2ee 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -2,9 +2,9 @@ - + - + -- cgit v1.2.3 From d717020911a350a5ea3c0a985c57d56c8fcad607 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 2 Apr 2010 11:10:36 -0700 Subject: widgets now work properly --- scenario/widgets.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index 5c11a2ee..c2042b68 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -32,7 +32,7 @@ @@ -42,7 +42,9 @@ Tea
    Coffe - + @@ -71,10 +73,10 @@ -- cgit v1.2.3 From 35ca4fcb9c49e505e28669e951e01ddedb01d7db Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 2 Apr 2010 11:49:48 -0700 Subject: radio now works with repeaters --- scenario/widgets.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index c2042b68..64e48c54 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -5,7 +5,7 @@ -
    Descriptionradio Female
    - Male + Male
    gender={{gender}}
    checkbox={{checkbox}} +
    checkbox={{checkbox}}
    +
    selectng-action
    -
    -
    -
    - action +
    +
    +
    + action
    button={{button}}
    +
    -- cgit v1.2.3 From a80a61839a66d244c8bb14bbe2975746e02516c8 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Sat, 3 Apr 2010 17:04:36 -0700 Subject: injection is now working --- scenario/widgets.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index 64e48c54..73674be9 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -4,8 +4,8 @@ - -
    Description Test
    + +
    @@ -14,7 +14,7 @@ - + @@ -70,7 +70,7 @@ - + - + -- cgit v1.2.3 From 22d93e0a3bc2a6dc0f64c63c68bc8f8489ea9068 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 20 Apr 2010 18:14:13 -0700 Subject: fixes to enable ie --- scenario/widgets.html | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index b83670b8..5449b218 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -1,11 +1,11 @@ - + - +
    Description Test
    Input text field
    basic text.basic={{text.basic}}
    Buttons
    ng-actionng-change
    ng-click

    -- cgit v1.2.3 From 7a4b48020688060debe9cb0f9c17615d7585cbe7 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 5 Apr 2010 11:46:53 -0700 Subject: added ng:switch widget --- scenario/application-account.html | 4 ++++ scenario/application.html | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 scenario/application-account.html create mode 100644 scenario/application.html (limited to 'scenario') diff --git a/scenario/application-account.html b/scenario/application-account.html new file mode 100644 index 00000000..8520d07c --- /dev/null +++ b/scenario/application-account.html @@ -0,0 +1,4 @@ +
    +account page goes here! +
    + diff --git a/scenario/application.html b/scenario/application.html new file mode 100644 index 00000000..be6390f6 --- /dev/null +++ b/scenario/application.html @@ -0,0 +1,19 @@ + + + + + + + + [ login + | account + ] + + +
    login screen
    + +
    + +
    $location={{$location}}
    + + -- cgit v1.2.3 From 2107eafcde390eebbf59e829194626c488de9e29 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 5 Apr 2010 20:53:33 -0700 Subject: added hover service --- scenario/widgets.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index 73674be9..6cb8df05 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -2,12 +2,13 @@ + - + -- cgit v1.2.3 From ee327a1f4f75f57c2a2c6166520c092d4942ffe0 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 6 Apr 2010 14:04:08 -0700 Subject: few fixes to make tests pass with jquery --- scenario/widgets.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index 6cb8df05..ab27e490 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -2,7 +2,7 @@ - + @@ -82,6 +82,16 @@ + + + + + +
    DescriptionDescription Test Result
    button={{button}}
    Repeaters
    ng-repeat +
      +
    • {{name}}
    • +
    +
    -- cgit v1.2.3 From 6ea1ac7b05a4079bcda0356e095703d36ccdf6b3 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 7 Apr 2010 14:13:10 -0700 Subject: added $invalidWidget service --- scenario/widgets.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index ab27e490..b83670b8 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -15,7 +15,7 @@
    Input text field
    basic text.basic={{text.basic}}
    @@ -72,12 +72,12 @@ - @@ -93,5 +93,6 @@
    Description
    Buttons
    ng-change
    ng-click
    - + +


    - action + action
    button={{button}}
    +--> -- cgit v1.2.3 From 8b29156a2ddcc738f9b0cf8dfc48a8648474884d Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 21 Apr 2010 14:29:05 -0700 Subject: ie6 now passes --- scenario/widgets.html | 1 - 1 file changed, 1 deletion(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index 5449b218..43b1ddbb 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -93,6 +93,5 @@ ---> -- cgit v1.2.3 From fe434307d15d697a5ffade51bad068f6443965b2 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 22 Apr 2010 17:11:56 -0700 Subject: tests work under jquery and without --- scenario/widgets.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index 43b1ddbb..1341f7cb 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -1,9 +1,9 @@ - + -- cgit v1.2.3 From fce48eb60a47be87a3d95e0750e54c19c2a346d0 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 27 Apr 2010 11:18:08 -0700 Subject: resources now use browser mock --- scenario/application-account.html | 4 +++- scenario/application.html | 17 ++++++++++++++++- scenario/widgets.html | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'scenario') diff --git a/scenario/application-account.html b/scenario/application-account.html index 8520d07c..a43deffc 100644 --- a/scenario/application-account.html +++ b/scenario/application-account.html @@ -1,4 +1,6 @@ -
    +
    account page goes here! + +
    diff --git a/scenario/application.html b/scenario/application.html index be6390f6..6b6ced69 100644 --- a/scenario/application.html +++ b/scenario/application.html @@ -3,6 +3,18 @@ + [ login @@ -11,9 +23,12 @@
    login screen
    - +
    + + (( input name )) +
    $location={{$location}}
    diff --git a/scenario/widgets.html b/scenario/widgets.html index 1341f7cb..61badf1c 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -1,4 +1,4 @@ - + -- cgit v1.2.3 From c7913a4b7a3f5ffb0ea6bb1e636ac9d4a0e75c32 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 29 Apr 2010 17:28:33 -0700 Subject: added $xhr service with bulk and cache, hooked up $resource --- scenario/cross-site-post/People.json | 4 ++++ scenario/cross-site-post/index.html | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 scenario/cross-site-post/People.json create mode 100644 scenario/cross-site-post/index.html (limited to 'scenario') diff --git a/scenario/cross-site-post/People.json b/scenario/cross-site-post/People.json new file mode 100644 index 00000000..de51fd83 --- /dev/null +++ b/scenario/cross-site-post/People.json @@ -0,0 +1,4 @@ +[ + { name: 'Misko', favorite: ['water melon', 'persimmon', 'passion fruit'] }, + { name: 'Lenka', favorite: ['strawberry'] } +] diff --git a/scenario/cross-site-post/index.html b/scenario/cross-site-post/index.html new file mode 100644 index 00000000..3ff6af85 --- /dev/null +++ b/scenario/cross-site-post/index.html @@ -0,0 +1,10 @@ + + + + + + + +
    people = {{people}}
    + + -- cgit v1.2.3 From 5dda723185a9037b7e92828d32430c21838ee216 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 10 May 2010 20:24:20 -0700 Subject: improved handling of text fields when formater fails to prevent clobering of field --- scenario/widgets.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'scenario') diff --git a/scenario/widgets.html b/scenario/widgets.html index 61badf1c..242fd9e6 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -15,7 +15,10 @@
    - + -- cgit v1.2.3 From 5215e2095cfd42a0363eb02eded34e03fa2b0cd3 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 20 May 2010 15:55:41 -0700 Subject: basic end to end runner --- scenario/Runner.html | 3 +-- scenario/widgets-scenario2.js | 54 +++++++++++++++++++++++++++++++++++++++++++ scenario/widgets-scenarios.js | 22 +++++++++--------- scenario/widgets.html | 3 +-- 4 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 scenario/widgets-scenario2.js (limited to 'scenario') diff --git a/scenario/Runner.html b/scenario/Runner.html index c5eb6205..5502283a 100644 --- a/scenario/Runner.html +++ b/scenario/Runner.html @@ -2,8 +2,7 @@ - - + diff --git a/scenario/widgets-scenario2.js b/scenario/widgets-scenario2.js new file mode 100644 index 00000000..e24cabad --- /dev/null +++ b/scenario/widgets-scenario2.js @@ -0,0 +1,54 @@ +browser = { + navigateTo: function(url){ + $scenario.addStep('Navigate to: ' + url, function(done){ + var self = this; + self.testFrame.load(function(){ + self.testFrame.unbind(); + self.testDocument = self.testWindow.angular.element(self.testWindow.document); + done(); + }); + if (this.testFrame.attr('src') == url) { + this.testWindow.location.reload(); + } else { + this.testFrame.attr('src', url); + } + }); + } +}; + +function input(selector) { + return { + enter: function(value){ + $scenario.addStep("Set input text of '" + selector + "' to value '" + value + "'", function(done){ + var input = this.testDocument.find('input[name=' + selector + ']'); + input.val(value); + input.trigger('change'); + done(); + }); + } + }; +} + +function expect(selector) { + return { + toEqual: function(expected) { + $scenario.addStep("Expect that " + selector + " equals '" + expected + "'", function(done){ + var attrName = selector.substring(2, selector.length - 2); + var binding = this.testDocument.find('span[ng-bind=' + attrName + ']'); + if (binding.text() != expected) { + this.result.fail("Expected '" + expected + "' but was '" + binding.text() + "'"); + } + done(); + }); + } + }; +} + +describe('widgets', function(){ + it('should verify that basic widgets work', function(){ + browser.navigateTo('widgets.html'); + expect('{{text.basic}}').toEqual(''); + input('text.basic').enter('John'); + expect('{{text.basic}}').toEqual('JohnXX'); + }); +}); diff --git a/scenario/widgets-scenarios.js b/scenario/widgets-scenarios.js index 663b06da..a1e6c0ed 100644 --- a/scenario/widgets-scenarios.js +++ b/scenario/widgets-scenarios.js @@ -3,28 +3,28 @@ angular.scenarioDef.widgets = { {Given:"browser", at:"widgets.html"} ], checkWidgetBinding:[ - {Then:"text", at:"{{name}}", should_be:""}, - {When:"enter", text:"John", at:":input[name=name]"}, - {Then:"text", at:"{{name}}", should_be:"John"}, - - {Then:"text", at:"{{gender}}", should_be:""}, - {When:"click", at:"input:radio[value=male]"}, + {Then:"text", at:"{{text.basic}}", should_be:""}, + {When:"enter", text:"John", at:":input[name=text.basic]"}, + {Then:"text", at:"{{text.basic}}", should_be:"John"}, + {Then:"text", at:"{{gender}}", should_be:"male"}, - + {When:"click", at:"input:radio[value=female]"}, + {Then:"text", at:"{{gender}}", should_be:"female"}, + {Then:"text", at:"{{tea}}", should_be:"on"}, {When:"click", at:"input[name=tea]"}, {Then:"text", at:"{{tea}}", should_be:""}, - + {Then:"text", at:"{{coffee}}", should_be:""}, {When:"click", at:"input[name=coffee]"}, {Then:"text", at:"{{coffee}}", should_be:"on"}, - + {Then:"text", at:"{{count}}", should_be:0}, {When:"click", at:"form :button"}, {When:"click", at:"form :submit"}, {When:"click", at:"form :image"}, {Then:"text", at:"{{count}}", should_be:3}, - + {Then:"text", at:"{{select}}", should_be:"A"}, {When:"select", at:"select[name=select]", option:"B"}, {Then:"text", at:"{{select}}", should_be:"B"}, @@ -36,7 +36,7 @@ angular.scenarioDef.widgets = { {Then:"text", at:"{{multiple}}", should_be:["A", "B"]}, {When:"select", at:"select[name=multiple]", option:"A"}, {Then:"text", at:"{{multiple}}", should_be:["B"]}, - + {Then:"text", at:"{{hidden}}", should_be:"hiddenValue"}, {Then:"text", at:"{{password}}", should_be:"passwordValue"}, diff --git a/scenario/widgets.html b/scenario/widgets.html index 242fd9e6..5c3afa21 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -16,8 +16,7 @@ -- cgit v1.2.3 From f6c67e28c94033edf6a16eb6508de54679cb49db Mon Sep 17 00:00:00 2001 From: Andres Ornelas Mesta Date: Mon, 24 May 2010 13:54:32 -0700 Subject: happy --- scenario/widgets-scenario2.js | 5 +++-- scenario/widgets.html | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'scenario') diff --git a/scenario/widgets-scenario2.js b/scenario/widgets-scenario2.js index e24cabad..b966b270 100644 --- a/scenario/widgets-scenario2.js +++ b/scenario/widgets-scenario2.js @@ -4,7 +4,7 @@ browser = { var self = this; self.testFrame.load(function(){ self.testFrame.unbind(); - self.testDocument = self.testWindow.angular.element(self.testWindow.document); + self.testDocument = jQuery(self.testWindow.document); done(); }); if (this.testFrame.attr('src') == url) { @@ -23,6 +23,7 @@ function input(selector) { var input = this.testDocument.find('input[name=' + selector + ']'); input.val(value); input.trigger('change'); + this.testWindow.angular.element(input[0]).trigger('change'); done(); }); } @@ -49,6 +50,6 @@ describe('widgets', function(){ browser.navigateTo('widgets.html'); expect('{{text.basic}}').toEqual(''); input('text.basic').enter('John'); - expect('{{text.basic}}').toEqual('JohnXX'); + expect('{{text.basic}}').toEqual('John'); }); }); diff --git a/scenario/widgets.html b/scenario/widgets.html index 5c3afa21..4d0f30b0 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -2,7 +2,6 @@ - -- cgit v1.2.3 From 3fab5d9879272b9f991a67c8135754f00c055834 Mon Sep 17 00:00:00 2001 From: Andres Ornelas Date: Mon, 24 May 2010 15:25:30 -0700 Subject: added error handling on scenario definition --- scenario/Runner.html | 2 +- scenario/widgets-scenario.js | 20 +++++++++++++++ scenario/widgets-scenario2.js | 55 ------------------------------------------ scenario/widgets-scenarios.js | 49 ------------------------------------- scenario/widgets-scenarios.old | 49 +++++++++++++++++++++++++++++++++++++ scenario/widgets.html | 4 +-- 6 files changed, 72 insertions(+), 107 deletions(-) create mode 100644 scenario/widgets-scenario.js delete mode 100644 scenario/widgets-scenario2.js delete mode 100644 scenario/widgets-scenarios.js create mode 100644 scenario/widgets-scenarios.old (limited to 'scenario') diff --git a/scenario/Runner.html b/scenario/Runner.html index 5502283a..ffa08af9 100644 --- a/scenario/Runner.html +++ b/scenario/Runner.html @@ -2,7 +2,7 @@ - + diff --git a/scenario/widgets-scenario.js b/scenario/widgets-scenario.js new file mode 100644 index 00000000..9e23d4df --- /dev/null +++ b/scenario/widgets-scenario.js @@ -0,0 +1,20 @@ +describe('widgets', function(){ + it('should verify that basic widgets work', function(){ + browser.navigateTo('widgets.html'); + + expect('{{text.basic}}').toEqual(''); + input('text.basic').enter('John'); + expect('{{text.basic}}').toEqual('John'); + + expect('{{text.password}}').toEqual(''); + input('text.password').enter('secret'); + expect('{{text.password}}').toEqual('secret'); + + expect('{{text.hidden}}').toEqual('hiddenValue'); + + expect('{{gender}}').toEqual('male'); + input('gender').select('female'); + expect('{{gender}}').toEqual('female'); + + }); +}); diff --git a/scenario/widgets-scenario2.js b/scenario/widgets-scenario2.js deleted file mode 100644 index b966b270..00000000 --- a/scenario/widgets-scenario2.js +++ /dev/null @@ -1,55 +0,0 @@ -browser = { - navigateTo: function(url){ - $scenario.addStep('Navigate to: ' + url, function(done){ - var self = this; - self.testFrame.load(function(){ - self.testFrame.unbind(); - self.testDocument = jQuery(self.testWindow.document); - done(); - }); - if (this.testFrame.attr('src') == url) { - this.testWindow.location.reload(); - } else { - this.testFrame.attr('src', url); - } - }); - } -}; - -function input(selector) { - return { - enter: function(value){ - $scenario.addStep("Set input text of '" + selector + "' to value '" + value + "'", function(done){ - var input = this.testDocument.find('input[name=' + selector + ']'); - input.val(value); - input.trigger('change'); - this.testWindow.angular.element(input[0]).trigger('change'); - done(); - }); - } - }; -} - -function expect(selector) { - return { - toEqual: function(expected) { - $scenario.addStep("Expect that " + selector + " equals '" + expected + "'", function(done){ - var attrName = selector.substring(2, selector.length - 2); - var binding = this.testDocument.find('span[ng-bind=' + attrName + ']'); - if (binding.text() != expected) { - this.result.fail("Expected '" + expected + "' but was '" + binding.text() + "'"); - } - done(); - }); - } - }; -} - -describe('widgets', function(){ - it('should verify that basic widgets work', function(){ - browser.navigateTo('widgets.html'); - expect('{{text.basic}}').toEqual(''); - input('text.basic').enter('John'); - expect('{{text.basic}}').toEqual('John'); - }); -}); diff --git a/scenario/widgets-scenarios.js b/scenario/widgets-scenarios.js deleted file mode 100644 index a1e6c0ed..00000000 --- a/scenario/widgets-scenarios.js +++ /dev/null @@ -1,49 +0,0 @@ -angular.scenarioDef.widgets = { - $before:[ - {Given:"browser", at:"widgets.html"} - ], - checkWidgetBinding:[ - {Then:"text", at:"{{text.basic}}", should_be:""}, - {When:"enter", text:"John", at:":input[name=text.basic]"}, - {Then:"text", at:"{{text.basic}}", should_be:"John"}, - - {Then:"text", at:"{{gender}}", should_be:"male"}, - {When:"click", at:"input:radio[value=female]"}, - {Then:"text", at:"{{gender}}", should_be:"female"}, - - {Then:"text", at:"{{tea}}", should_be:"on"}, - {When:"click", at:"input[name=tea]"}, - {Then:"text", at:"{{tea}}", should_be:""}, - - {Then:"text", at:"{{coffee}}", should_be:""}, - {When:"click", at:"input[name=coffee]"}, - {Then:"text", at:"{{coffee}}", should_be:"on"}, - - {Then:"text", at:"{{count}}", should_be:0}, - {When:"click", at:"form :button"}, - {When:"click", at:"form :submit"}, - {When:"click", at:"form :image"}, - {Then:"text", at:"{{count}}", should_be:3}, - - {Then:"text", at:"{{select}}", should_be:"A"}, - {When:"select", at:"select[name=select]", option:"B"}, - {Then:"text", at:"{{select}}", should_be:"B"}, - - {Then:"text", at:"{{multiple}}", should_be:"[]"}, - {When:"select", at:"select[name=multiple]", option:"A"}, - {Then:"text", at:"{{multiple}}", should_be:["A"]}, - {When:"select", at:"select[name=multiple]", option:"B"}, - {Then:"text", at:"{{multiple}}", should_be:["A", "B"]}, - {When:"select", at:"select[name=multiple]", option:"A"}, - {Then:"text", at:"{{multiple}}", should_be:["B"]}, - - {Then:"text", at:"{{hidden}}", should_be:"hiddenValue"}, - - {Then:"text", at:"{{password}}", should_be:"passwordValue"}, - {When:"enter", text:"reset", at:":input[name=password]"}, - {Then:"text", at:"{{password}}", should_be:"reset"}, - ], - checkNewWidgetEmpty:[ - {Then:"text", at:"{{name}}", should_be:""}, - ] -}; diff --git a/scenario/widgets-scenarios.old b/scenario/widgets-scenarios.old new file mode 100644 index 00000000..a1e6c0ed --- /dev/null +++ b/scenario/widgets-scenarios.old @@ -0,0 +1,49 @@ +angular.scenarioDef.widgets = { + $before:[ + {Given:"browser", at:"widgets.html"} + ], + checkWidgetBinding:[ + {Then:"text", at:"{{text.basic}}", should_be:""}, + {When:"enter", text:"John", at:":input[name=text.basic]"}, + {Then:"text", at:"{{text.basic}}", should_be:"John"}, + + {Then:"text", at:"{{gender}}", should_be:"male"}, + {When:"click", at:"input:radio[value=female]"}, + {Then:"text", at:"{{gender}}", should_be:"female"}, + + {Then:"text", at:"{{tea}}", should_be:"on"}, + {When:"click", at:"input[name=tea]"}, + {Then:"text", at:"{{tea}}", should_be:""}, + + {Then:"text", at:"{{coffee}}", should_be:""}, + {When:"click", at:"input[name=coffee]"}, + {Then:"text", at:"{{coffee}}", should_be:"on"}, + + {Then:"text", at:"{{count}}", should_be:0}, + {When:"click", at:"form :button"}, + {When:"click", at:"form :submit"}, + {When:"click", at:"form :image"}, + {Then:"text", at:"{{count}}", should_be:3}, + + {Then:"text", at:"{{select}}", should_be:"A"}, + {When:"select", at:"select[name=select]", option:"B"}, + {Then:"text", at:"{{select}}", should_be:"B"}, + + {Then:"text", at:"{{multiple}}", should_be:"[]"}, + {When:"select", at:"select[name=multiple]", option:"A"}, + {Then:"text", at:"{{multiple}}", should_be:["A"]}, + {When:"select", at:"select[name=multiple]", option:"B"}, + {Then:"text", at:"{{multiple}}", should_be:["A", "B"]}, + {When:"select", at:"select[name=multiple]", option:"A"}, + {Then:"text", at:"{{multiple}}", should_be:["B"]}, + + {Then:"text", at:"{{hidden}}", should_be:"hiddenValue"}, + + {Then:"text", at:"{{password}}", should_be:"passwordValue"}, + {When:"enter", text:"reset", at:":input[name=password]"}, + {Then:"text", at:"{{password}}", should_be:"reset"}, + ], + checkNewWidgetEmpty:[ + {Then:"text", at:"{{name}}", should_be:""}, + ] +}; diff --git a/scenario/widgets.html b/scenario/widgets.html index 4d0f30b0..86269e86 100644 --- a/scenario/widgets.html +++ b/scenario/widgets.html @@ -26,8 +26,8 @@ - - + + -- cgit v1.2.3 From 2cce1ffc15ae6483da9cf354f7a5d2d26317427e Mon Sep 17 00:00:00 2001 From: Andres Ornelas Date: Tue, 25 May 2010 13:05:23 -0700 Subject: fixed collapsed issue --- scenario/widgets-scenario.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scenario') diff --git a/scenario/widgets-scenario.js b/scenario/widgets-scenario.js index 9e23d4df..f4488190 100644 --- a/scenario/widgets-scenario.js +++ b/scenario/widgets-scenario.js @@ -14,7 +14,12 @@ describe('widgets', function(){ expect('{{gender}}').toEqual('male'); input('gender').select('female'); + input('gender').isChecked('female'); expect('{{gender}}').toEqual('female'); +// expect('{{tea}}').toBeChecked(); +// input('gender').select('female'); +// expect('{{gender}}').toEqual('female'); + }); }); -- cgit v1.2.3 From 5992e81b2e302c3b3375567e347227f6a9496585 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 25 May 2010 14:23:52 -0700 Subject: added rake task to create a single file for scenario runner --- scenario/Runner-compiled.html | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 scenario/Runner-compiled.html (limited to 'scenario') diff --git a/scenario/Runner-compiled.html b/scenario/Runner-compiled.html new file mode 100644 index 00000000..98dbea69 --- /dev/null +++ b/scenario/Runner-compiled.html @@ -0,0 +1,9 @@ + + + + + + + + + -- cgit v1.2.3 From 0e88e35e5c76420c48a487718558d33e452ea1eb Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Sun, 30 May 2010 15:45:33 -0700 Subject: remove the uneeded call to createScope when evaluating expressions --- scenario/perf.html | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 scenario/perf.html (limited to 'scenario') diff --git a/scenario/perf.html b/scenario/perf.html new file mode 100644 index 00000000..c2f26317 --- /dev/null +++ b/scenario/perf.html @@ -0,0 +1,32 @@ + + + + + + + + + +
    + + + -- cgit v1.2.3 From c7d64f6d124f10c66309042c2d77896215ed43b8 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Sun, 30 May 2010 16:34:59 -0700 Subject: improve error handling with elements --- scenario/perf.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scenario') diff --git a/scenario/perf.html b/scenario/perf.html index c2f26317..1b0e40b4 100644 --- a/scenario/perf.html +++ b/scenario/perf.html @@ -8,7 +8,7 @@ PerfCntl.prototype = { createItems: function(){ var items = []; - for ( var i = 0; i < 100; i++) { + for ( var i = 0; i < 1000; i++) { var item = { name: "" + Math.random(), parts: [Math.random(), Math.random()] -- cgit v1.2.3 From 2e33e89a77d115ff17f5841ec328b1c1e4228161 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Sun, 30 May 2010 19:42:21 -0700 Subject: added compiled getterFN for better performance --- scenario/perf.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scenario') diff --git a/scenario/perf.html b/scenario/perf.html index 1b0e40b4..e4edc00f 100644 --- a/scenario/perf.html +++ b/scenario/perf.html @@ -25,7 +25,7 @@
    -- cgit v1.2.3 From 6143b04384680d17f38c2d5894a9b9961ea33288 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 31 May 2010 00:58:29 -0700 Subject: removed few key foreach and replaced thime with for loop for performance. --- scenario/perf.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scenario') diff --git a/scenario/perf.html b/scenario/perf.html index e4edc00f..cd676918 100644 --- a/scenario/perf.html +++ b/scenario/perf.html @@ -24,7 +24,8 @@
    -- cgit v1.2.3 From a29c5e4c7fd5e708c28e70e974bf873621d5277c Mon Sep 17 00:00:00 2001 From: Shyam Seshadri Date: Wed, 2 Jun 2010 15:04:26 -0700 Subject: Revert "removed few key foreach and replaced thime with for loop for performance." This reverts commit 6143b04384680d17f38c2d5894a9b9961ea33288. --- scenario/perf.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'scenario') diff --git a/scenario/perf.html b/scenario/perf.html index cd676918..e4edc00f 100644 --- a/scenario/perf.html +++ b/scenario/perf.html @@ -24,8 +24,7 @@
    -- cgit v1.2.3 From 39312d1fe3a27b248f98f6f26577fcd7e2c64f85 Mon Sep 17 00:00:00 2001 From: Shyam Seshadri Date: Wed, 2 Jun 2010 15:05:34 -0700 Subject: Revert "Revert "removed few key foreach and replaced thime with for loop for performance."" This reverts commit a29c5e4c7fd5e708c28e70e974bf873621d5277c. --- scenario/perf.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scenario') diff --git a/scenario/perf.html b/scenario/perf.html index e4edc00f..cd676918 100644 --- a/scenario/perf.html +++ b/scenario/perf.html @@ -24,7 +24,8 @@
    -- cgit v1.2.3
    Input text field
    basic + + + text.basic={{text.basic}}
    basic - - + text.basic={{text.basic}}
    hiddenhidden={{hidden}}text.hidden={{text.hidden}}
    Input selection field