From 7aef2d54e0a48fae18a289813f699962d8310565 Mon Sep 17 00:00:00 2001 From: Julie Date: Sat, 11 Jan 2014 16:59:15 -0800 Subject: test(docs): convert example end to end doc tests from scenario runner to protractor Thanks to jeffbcross, petebacondarwin, btford, jdeboer, tbosch for contributions! Closes #6023 --- src/ngRoute/directive/ngView.js | 11 ++++++----- src/ngRoute/route.js | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src/ngRoute') diff --git a/src/ngRoute/directive/ngView.js b/src/ngRoute/directive/ngView.js index 41ed9f31..a88d205d 100644 --- a/src/ngRoute/directive/ngView.js +++ b/src/ngRoute/directive/ngView.js @@ -151,16 +151,17 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory); } - + it('should load and compile correct template', function() { - element('a:contains("Moby: Ch1")').click(); - var content = element('.doc-example-live [ng-view]').text(); + element(by.linkText('Moby: Ch1')).click(); + var content = element(by.css('.doc-example-live [ng-view]')).getText(); expect(content).toMatch(/controller\: ChapterCntl/); expect(content).toMatch(/Book Id\: Moby/); expect(content).toMatch(/Chapter Id\: 1/); - element('a:contains("Scarlet")').click(); - content = element('.doc-example-live [ng-view]').text(); + element(by.partialLinkText('Scarlet')).click(); + + content = element(by.css('.doc-example-live [ng-view]')).getText(); expect(content).toMatch(/controller\: BookCntl/); expect(content).toMatch(/Book Id\: Scarlet/); }); diff --git a/src/ngRoute/route.js b/src/ngRoute/route.js index 278182da..51404fbc 100644 --- a/src/ngRoute/route.js +++ b/src/ngRoute/route.js @@ -345,17 +345,17 @@ function $RouteProvider(){ } - + it('should load and compile correct template', function() { - element('a:contains("Moby: Ch1")').click(); - var content = element('.doc-example-live [ng-view]').text(); + element(by.linkText('Moby: Ch1')).click(); + var content = element(by.css('.doc-example-live [ng-view]')).getText(); expect(content).toMatch(/controller\: ChapterCntl/); expect(content).toMatch(/Book Id\: Moby/); expect(content).toMatch(/Chapter Id\: 1/); - element('a:contains("Scarlet")').click(); - sleep(2); // promises are not part of scenario waiting - content = element('.doc-example-live [ng-view]').text(); + element(by.partialLinkText('Scarlet')).click(); + + content = element(by.css('.doc-example-live [ng-view]')).getText(); expect(content).toMatch(/controller\: BookCntl/); expect(content).toMatch(/Book Id\: Scarlet/); }); -- cgit v1.2.3