diff --git a/public/docs/_examples/architecture/e2e-spec.ts b/public/docs/_examples/architecture/e2e-spec.ts index a99f24e177..66ea2a1081 100644 --- a/public/docs/_examples/architecture/e2e-spec.ts +++ b/public/docs/_examples/architecture/e2e-spec.ts @@ -7,13 +7,13 @@ describe('Architecture', function () { browser.get(''); }); - function itReset(name: string, func: (v: void) => any) { + function itReset(name: string, func: () => any) { it(name, function() { browser.get('').then(func); }); } - it('should display correct title: ' + title, function () { + it(`should display correct title: ${title}`, function () { expect(element(by.css('h2')).getText()).toEqual(title); }); diff --git a/public/docs/_examples/attribute-directives/e2e-spec.ts b/public/docs/_examples/attribute-directives/e2e-spec.ts index 54d6a90eea..b15d85220f 100644 --- a/public/docs/_examples/attribute-directives/e2e-spec.ts +++ b/public/docs/_examples/attribute-directives/e2e-spec.ts @@ -7,7 +7,7 @@ describe('Attribute directives', function () { browser.get(''); }); - it('should display correct title: ' + _title, function () { + it(`should display correct title: ${_title}`, function () { expect(element(by.css('h1')).getText()).toEqual(_title); }); diff --git a/public/docs/_examples/hierarchical-dependency-injection/e2e-spec.ts b/public/docs/_examples/hierarchical-dependency-injection/e2e-spec.ts index 57f782de49..1342869429 100644 --- a/public/docs/_examples/hierarchical-dependency-injection/e2e-spec.ts +++ b/public/docs/_examples/hierarchical-dependency-injection/e2e-spec.ts @@ -29,19 +29,18 @@ describe('Hierarchical dependency injection', function () { testEdit(false); }); - function testEdit(shouldSave) { - let inputEle; + function testEdit(shouldSave: boolean) { // select 2nd ele let heroEle = element.all(by.css('heroes-list li')).get(1); // get the 2nd span which is the name of the hero let heroNameEle = heroEle.all(by.css('hero-card span')).get(1); let editButtonEle = heroEle.element(by.cssContainingText('button','edit')); editButtonEle.click().then(function() { - inputEle = heroEle.element(by.css('hero-editor input')); + let inputEle = heroEle.element(by.css('hero-editor input')); // return inputEle.sendKeys("foo"); return sendKeys(inputEle, "foo"); }).then(function() { - buttonName = shouldSave ? 'save' : 'cancel'; + let buttonName = shouldSave ? 'save' : 'cancel'; let buttonEle = heroEle.element(by.cssContainingText('button', buttonName)); return buttonEle.click(); }).then(function() { diff --git a/public/docs/_examples/homepage-hello-world/e2e-spec.ts b/public/docs/_examples/homepage-hello-world/e2e-spec.ts index fd18afadc5..4200429a4f 100644 --- a/public/docs/_examples/homepage-hello-world/e2e-spec.ts +++ b/public/docs/_examples/homepage-hello-world/e2e-spec.ts @@ -7,18 +7,17 @@ describe('Homepage Hello World', function () { // Does it even launch? let expectedLabel = 'Name:'; - it('should display the label: ' + expectedLabel, function () { + it(`should display the label: ${expectedLabel}`, function () { expect(element(by.css('label')).getText()).toEqual(expectedLabel); }); it('should display entered name', function () { let testName = 'Bobby Joe'; - let newValue; let nameEle = element.all(by.css('input')).get(0); nameEle.getAttribute('value').then(function(value) { // nameEle.sendKeys(testName); // should work but doesn't sendKeys(nameEle, testName); // utility that does work - newValue = value + testName; // old input box value + new name + let newValue = value + testName; // old input box value + new name expect(nameEle.getAttribute('value')).toEqual(newValue); }).then(function() { // Check the interpolated message built from name diff --git a/public/docs/_examples/homepage-tabs/e2e-spec.ts b/public/docs/_examples/homepage-tabs/e2e-spec.ts index a481b5c74c..71f8bcd262 100644 --- a/public/docs/_examples/homepage-tabs/e2e-spec.ts +++ b/public/docs/_examples/homepage-tabs/e2e-spec.ts @@ -7,7 +7,7 @@ describe('Homepage Tabs', function () { // Does it even launch? let expectedAppTitle = 'Tabs Demo'; - it('should display app title: ' + expectedAppTitle, function () { + it(`should display app title: ${expectedAppTitle}`, function () { expect(element(by.css('h4')).getText()).toEqual(expectedAppTitle); }); diff --git a/public/docs/_examples/homepage-todo/e2e-spec.ts b/public/docs/_examples/homepage-todo/e2e-spec.ts index 4776f653a8..28b3db24e5 100644 --- a/public/docs/_examples/homepage-todo/e2e-spec.ts +++ b/public/docs/_examples/homepage-todo/e2e-spec.ts @@ -7,7 +7,7 @@ describe('Homepage Todo', function () { // Does it even launch? let expectedAppTitle = 'Todo'; - it('should display app title: ' + expectedAppTitle, function () { + it(`should display app title: ${expectedAppTitle}`, function () { expect(element(by.css('h2')).getText()).toEqual(expectedAppTitle); }); diff --git a/public/docs/_examples/lifecycle-hooks/e2e-spec.ts b/public/docs/_examples/lifecycle-hooks/e2e-spec.ts index a1e9a098a1..763fb3e5a0 100644 --- a/public/docs/_examples/lifecycle-hooks/e2e-spec.ts +++ b/public/docs/_examples/lifecycle-hooks/e2e-spec.ts @@ -61,7 +61,7 @@ describe('Lifecycle hooks', function () { let powerInputEle = inputEles.get(0); let titleEle = doCheckViewEle.element(by.css('p')); let changeLogEles = doCheckViewEle.all(by.css('div')); - let logCount; + let logCount: number; expect(titleEle.getText()).toContain('Windstorm can sing'); changeLogEles.count().then(function(count) { @@ -92,7 +92,7 @@ describe('Lifecycle hooks', function () { let commentEle = parentEle.element(by.className('comment')); let logEles = parentEle.all(by.css('h4 ~ div')); let childViewInputEle = parentEle.element(by.css('my-child input')); - let logCount; + let logCount: number; expect(childViewInputEle.getAttribute('value')).toContain('Magneta'); expect(commentEle.isPresent()).toBe(false, 'comment should not be in DOM'); @@ -121,7 +121,7 @@ describe('Lifecycle hooks', function () { let commentEle = parentEle.element(by.className('comment')); let logEles = parentEle.all(by.css('h4 ~ div')); let childViewInputEle = parentEle.element(by.css('my-child input')); - let logCount; + let logCount: number; expect(childViewInputEle.getAttribute('value')).toContain('Magneta'); expect(commentEle.isPresent()).toBe(false, 'comment should not be in DOM'); diff --git a/public/docs/_examples/pipes/e2e-spec.ts b/public/docs/_examples/pipes/e2e-spec.ts index 560791671b..9b626d48bb 100644 --- a/public/docs/_examples/pipes/e2e-spec.ts +++ b/public/docs/_examples/pipes/e2e-spec.ts @@ -65,7 +65,7 @@ describe('Pipes', function () { it('should support flying heroes (pure) ', function () { let nameEle = element(by.css('flying-heroes input[type="text"]')); - let canFlyCheckEle = element(by.css('flying-heroes #can-fly')); + let canFlyCheckEle = element(by.css('flying-heroes #can-fly')); let mutateCheckEle = element(by.css('flying-heroes #mutate')); let resetEle = element(by.css('flying-heroes button')); let flyingHeroesEle = element.all(by.css('flying-heroes #flyers div')); diff --git a/public/docs/_examples/quickstart/e2e-spec.ts b/public/docs/_examples/quickstart/e2e-spec.ts index 53f587645e..d38d6a3157 100644 --- a/public/docs/_examples/quickstart/e2e-spec.ts +++ b/public/docs/_examples/quickstart/e2e-spec.ts @@ -3,12 +3,11 @@ describe('QuickStart E2E Tests', function () { let expectedMsg = 'My First Angular 2 App'; - beforeEach(function () { browser.get(''); }); - it('should display: ' + expectedMsg, function () { + it(`should display: ${expectedMsg}`, function () { expect(element(by.css('h1')).getText()).toEqual(expectedMsg); }); diff --git a/public/docs/_examples/router-deprecated/e2e-spec.js b/public/docs/_examples/router-deprecated/e2e-spec.js deleted file mode 100644 index 1cb536b53e..0000000000 --- a/public/docs/_examples/router-deprecated/e2e-spec.js +++ /dev/null @@ -1,111 +0,0 @@ -/// -describe('Router', function () { - beforeAll(function () { - browser.get(''); - }); - function getPageStruct() { - hrefEles = element.all(by.css('my-app a')); - return { - hrefs: hrefEles, - routerParent: element(by.css('my-app > undefined')), - routerTitle: element(by.css('my-app > undefined > h2')), - crisisHref: hrefEles.get(0), - crisisList: element.all(by.css('my-app > undefined > undefined li')), - crisisDetail: element(by.css('my-app > undefined > undefined > div')), - crisisDetailTitle: element(by.css('my-app > undefined > undefined > div > h3')), - heroesHref: hrefEles.get(1), - heroesList: element.all(by.css('my-app > undefined li')), - heroDetail: element(by.css('my-app > undefined > div')), - heroDetailTitle: element(by.css('my-app > undefined > div > h3')), - }; - } - it('should be able to see the start screen', function () { - var page = getPageStruct(); - expect(page.hrefs.count()).toEqual(2, 'should be two dashboard choices'); - expect(page.crisisHref.getText()).toEqual("Crisis Center"); - expect(page.heroesHref.getText()).toEqual("Heroes"); - }); - it('should be able to see crises center items', function () { - var page = getPageStruct(); - expect(page.crisisList.count()).toBe(4, "should be 4 crisis center entries at start"); - }); - it('should be able to see hero items', function () { - var page = getPageStruct(); - page.heroesHref.click().then(function () { - expect(page.routerTitle.getText()).toContain('HEROES'); - expect(page.heroesList.count()).toBe(6, "should be 6 heroes"); - }); - }); - it('should be able to toggle the views', function () { - var page = getPageStruct(); - page.crisisHref.click().then(function () { - expect(page.crisisList.count()).toBe(4, "should be 4 crisis center entries"); - return page.heroesHref.click(); - }).then(function () { - expect(page.heroesList.count()).toBe(6, "should be 6 heroes"); - }); - }); - it('should be able to edit and save details from the crisis center view', function () { - crisisCenterEdit(2, true); - }); - it('should be able to edit and cancel details from the crisis center view', function () { - crisisCenterEdit(3, false); - }); - it('should be able to edit and save details from the heroes view', function () { - var page = getPageStruct(); - var heroEle, heroText; - page.heroesHref.click().then(function () { - heroEle = page.heroesList.get(4); - return heroEle.getText(); - }).then(function (text) { - expect(text.length).toBeGreaterThan(0, 'should have some text'); - // remove leading id from text - heroText = text.substr(text.indexOf(' ')).trim(); - return heroEle.click(); - }).then(function () { - expect(page.heroesList.count()).toBe(0, "should no longer see crisis center entries"); - expect(page.heroDetail.isPresent()).toBe(true, 'should be able to see crisis detail'); - expect(page.heroDetailTitle.getText()).toContain(heroText); - var inputEle = page.heroDetail.element(by.css('input')); - return sendKeys(inputEle, '-foo'); - }).then(function () { - expect(page.heroDetailTitle.getText()).toContain(heroText + '-foo'); - var buttonEle = page.heroDetail.element(by.css('button')); - return buttonEle.click(); - }).then(function () { - expect(heroEle.getText()).toContain(heroText + '-foo'); - }); - }); - function crisisCenterEdit(index, shouldSave) { - var page = getPageStruct(); - var crisisEle, crisisText; - page.crisisHref.click() - .then(function () { - crisisEle = page.crisisList.get(index); - return crisisEle.getText(); - }).then(function (text) { - expect(text.length).toBeGreaterThan(0, 'should have some text'); - // remove leading id from text - crisisText = text.substr(text.indexOf(' ')).trim(); - return crisisEle.click(); - }).then(function () { - expect(page.crisisList.count()).toBe(0, "should no longer see crisis center entries"); - expect(page.crisisDetail.isPresent()).toBe(true, 'should be able to see crisis detail'); - expect(page.crisisDetailTitle.getText()).toContain(crisisText); - var inputEle = page.crisisDetail.element(by.css('input')); - return sendKeys(inputEle, '-foo'); - }).then(function () { - expect(page.crisisDetailTitle.getText()).toContain(crisisText + '-foo'); - var buttonEle = page.crisisDetail.element(by.cssContainingText('button', shouldSave ? 'Save' : 'Cancel')); - return buttonEle.click(); - }).then(function () { - if (shouldSave) { - expect(crisisEle.getText()).toContain(crisisText + '-foo'); - } - else { - expect(crisisEle.getText()).not.toContain(crisisText + '-foo'); - } - }); - } -}); -//# sourceMappingURL=e2e-spec.js.map \ No newline at end of file diff --git a/public/docs/_examples/router-deprecated/e2e-spec.ts b/public/docs/_examples/router-deprecated/e2e-spec.ts index 241074ec8f..85b0598df5 100644 --- a/public/docs/_examples/router-deprecated/e2e-spec.ts +++ b/public/docs/_examples/router-deprecated/e2e-spec.ts @@ -6,7 +6,7 @@ describe('Router', function () { }); function getPageStruct() { - hrefEles = element.all(by.css('my-app a')); + let hrefEles = element.all(by.css('my-app a')); return { hrefs: hrefEles, @@ -66,7 +66,8 @@ describe('Router', function () { it('should be able to edit and save details from the heroes view', function () { let page = getPageStruct(); - let heroEle, heroText; + let heroEle: protractor.ElementFinder; + let heroText: string; page.heroesHref.click().then(function() { heroEle = page.heroesList.get(4); return heroEle.getText(); @@ -90,9 +91,10 @@ describe('Router', function () { }) }); - function crisisCenterEdit(index, shouldSave) { + function crisisCenterEdit(index: number, shouldSave: boolean) { let page = getPageStruct(); - let crisisEle, crisisText; + let crisisEle: protractor.ElementFinder; + let crisisText: string; page.crisisHref.click() .then(function () { crisisEle = page.crisisList.get(index); diff --git a/public/docs/_examples/router/e2e-spec.ts b/public/docs/_examples/router/e2e-spec.ts index e0749f1d0f..780b5e229a 100644 --- a/public/docs/_examples/router/e2e-spec.ts +++ b/public/docs/_examples/router/e2e-spec.ts @@ -6,7 +6,7 @@ describe('Router', function () { }); function getPageStruct() { - hrefEles = element.all(by.css('my-app a')); + let hrefEles = element.all(by.css('my-app a')); return { hrefs: hrefEles, @@ -66,7 +66,8 @@ describe('Router', function () { it('should be able to edit and save details from the heroes view', function () { let page = getPageStruct(); - let heroEle, heroText; + let heroEle: protractor.ElementFinder; + let heroText: string; page.heroesHref.click().then(function() { heroEle = page.heroesList.get(4); return heroEle.getText(); @@ -90,9 +91,10 @@ describe('Router', function () { }) }); - function crisisCenterEdit(index, shouldSave) { + function crisisCenterEdit(index: number, shouldSave: boolean) { let page = getPageStruct(); - let crisisEle, crisisText; + let crisisEle: protractor.ElementFinder; + let crisisText: string; page.crisisHref.click() .then(function () { crisisEle = page.crisisList.get(index); diff --git a/public/docs/_examples/server-communication/e2e-spec.ts b/public/docs/_examples/server-communication/e2e-spec.ts index ef1dc3e304..417be6f6e8 100644 --- a/public/docs/_examples/server-communication/e2e-spec.ts +++ b/public/docs/_examples/server-communication/e2e-spec.ts @@ -70,7 +70,7 @@ describe('Server Communication', function () { }); }); - function testForRefreshedResult(keyPressed, done) { + function testForRefreshedResult(keyPressed: string, done: () => void) { testForResult('my-wiki', keyPressed, false, done) } }); @@ -101,17 +101,17 @@ describe('Server Communication', function () { }); - function testForNewResult(keyPressed, done) { + function testForNewResult(keyPressed: string, done: () => void) { testForResult('my-wiki-smart', keyPressed, false, done) } - function testForStaleResult(keyPressed, done) { + function testForStaleResult(keyPressed: string, done: () => void) { testForResult('my-wiki-smart', keyPressed, true, done) } }); - function testForResult(componentTagName, keyPressed, hasListBeforeSearch, done) { + function testForResult(componentTagName: string, keyPressed: string, hasListBeforeSearch: boolean, done: () => void) { let searchWait = 1000; // Wait for wikipedia but not so long that tests timeout let wikiComponent = element(by.tagName(componentTagName)); expect(wikiComponent).toBeDefined('<' + componentTagName + '> must exist'); diff --git a/public/docs/_examples/structural-directives/e2e-spec.ts b/public/docs/_examples/structural-directives/e2e-spec.ts index 032b923f60..607990a68b 100644 --- a/public/docs/_examples/structural-directives/e2e-spec.ts +++ b/public/docs/_examples/structural-directives/e2e-spec.ts @@ -32,7 +32,7 @@ describe('Structural Directives', function () { let ngIfSiblingEle = ngIfParentEle.element(by.css('heavy-loader')); let cssButtonEle = element(by.cssContainingText('button', 'show | hide')); let cssSiblingEle = cssButtonEle.element(by.xpath('..')).element(by.css('heavy-loader')); - let setConditionText; + let setConditionText: string; setConditionButtonEle.getText().then(function(text) { setConditionText = text; expect(ngIfButtonEle.isPresent()).toBe(true, 'should be able to find ngIfButton'); diff --git a/public/docs/_examples/styleguide/e2e-spec.ts b/public/docs/_examples/styleguide/e2e-spec.ts index b936b9fd23..48691bdb8a 100644 --- a/public/docs/_examples/styleguide/e2e-spec.ts +++ b/public/docs/_examples/styleguide/e2e-spec.ts @@ -6,7 +6,7 @@ describe('Getting Started E2E Tests', function() { let expectedMsg = 'My First Angular 2 App'; // tests shared across languages - function sharedTests(basePath) { + function sharedTests(basePath: string) { beforeEach(function () { browser.get(basePath + 'index.html'); }); diff --git a/public/docs/_examples/toh-5/e2e-spec.ts b/public/docs/_examples/toh-5/e2e-spec.ts index f3955097b4..4266a2b5ce 100644 --- a/public/docs/_examples/toh-5/e2e-spec.ts +++ b/public/docs/_examples/toh-5/e2e-spec.ts @@ -5,9 +5,8 @@ describe('Tutorial', function () { browser.get(''); }); - function getPageStruct() { - hrefEles = element.all(by.css('my-app a')); + let hrefEles = element.all(by.css('my-app a')); return { hrefs: hrefEles, @@ -54,7 +53,7 @@ describe('Tutorial', function () { expect(page.myDashboardParent.isPresent()).toBe(true, 'dashboard element should be available'); let heroEle = page.topHeroes.get(3); let heroDescrEle = heroEle.element(by.css('h4')); - let heroDescr; + let heroDescr: string; return heroDescrEle.getText().then(function(text) { heroDescr = text; return heroEle.click(); @@ -70,7 +69,8 @@ describe('Tutorial', function () { let page = getPageStruct(); expect(page.myDashboardParent.isPresent()).toBe(true, 'dashboard element should be present'); let viewDetailsButtonEle = page.myHeroesParent.element(by.cssContainingText('button', 'View Details')); - let heroEle, heroDescr; + let heroEle: protractor.ElementFinder; + let heroDescr: string; page.myHeroesHref.click().then(function() { expect(page.myDashboardParent.isPresent()).toBe(false, 'dashboard element should NOT be present'); expect(page.myHeroesParent.isPresent()).toBe(true, 'myHeroes element should be present'); @@ -93,7 +93,7 @@ describe('Tutorial', function () { }); }); - function editDetails(page, origValue, textToAdd) { + function editDetails(page: any, origValue: string, textToAdd: string) { expect(page.myDashboardParent.isPresent()).toBe(false, 'dashboard element should NOT be present'); expect(page.myHeroesParent.isPresent()).toBe(false, 'myHeroes element should NOT be present'); expect(page.heroDetail.isDisplayed()).toBe(true, 'should be able to see hero-details'); diff --git a/public/docs/_examples/upgrade-phonecat-2-hybrid/e2e-spec.ts b/public/docs/_examples/upgrade-phonecat-2-hybrid/e2e-spec.ts index 09f9bc6b7e..6ff865ac8c 100644 --- a/public/docs/_examples/upgrade-phonecat-2-hybrid/e2e-spec.ts +++ b/public/docs/_examples/upgrade-phonecat-2-hybrid/e2e-spec.ts @@ -1,4 +1,4 @@ -/// +/// 'use strict'; // Angular E2E Testing Guide: diff --git a/public/docs/_examples/user-input/e2e-spec.ts b/public/docs/_examples/user-input/e2e-spec.ts index 7ef2dcec24..22f8d96f63 100644 --- a/public/docs/_examples/user-input/e2e-spec.ts +++ b/public/docs/_examples/user-input/e2e-spec.ts @@ -7,7 +7,7 @@ describe('User Input Tests', function () { it('should support the click event', function () { let mainEle = element(by.css('click-me')); - let buttonEle =element(by.css('click-me button')); + let buttonEle = element(by.css('click-me button')); expect(mainEle.getText()).not.toContain('You are my hero!'); buttonEle.click().then(function() { expect(mainEle.getText()).toContain('You are my hero!'); @@ -16,7 +16,7 @@ describe('User Input Tests', function () { it('should support the click event with an event payload', function () { let mainEle = element(by.css('click-me2')); - let buttonEle =element(by.css('click-me2 button')); + let buttonEle = element(by.css('click-me2 button')); expect(mainEle.getText()).not.toContain('Event target is '); buttonEle.click().then(function() { expect(mainEle.getText()).toContain('Event target is BUTTON'); @@ -86,7 +86,7 @@ describe('User Input Tests', function () { let inputEle = mainEle.element(by.css('input')); let addButtonEle = mainEle.element(by.css('button')); let heroEles = mainEle.all(by.css('li')); - let numHeroes; + let numHeroes: number; expect(heroEles.count()).toBeGreaterThan(0); heroEles.count().then(function(count) { numHeroes = count;