it('should show a secondary tab when selected', function () {
   var todoJsTab = tractor.findElement(protractor.By.css('[annotate="todo.annotation"] ul.nav-tabs li:nth-child(2) a'));
   todoJsTab.click()
   tractor.driver.sleep(500);
   var todojs = tractor.findElement(protractor.By.css('[annotate="todo.annotation"] .tab-pane:nth-child(2)'));
   expect(todojs.getCssValue('display')).toEqual('block');
 });
          it('should be displayed for ' + value, function () {
            var popoverButton = browser.findElement(protractor.By.css('.download-modal [popover-title="'+value+'"]'));
            popoverButton.click();

            var popover = browser.findElement(protractor.By.css('.popover'));
            expect(popover.getCssValue('display')).toEqual('block');
          });
      it('should show a secondary tab when selected', function () {
        var listBtn = tractor.findElement(protractor.By.css('[annotate="project.annotation"] ul.nav-tabs li:nth-child(3) a'));
        listBtn.click();

        var listTab = tractor.findElement(protractor.By.css('#list-html'));
        expect(listTab.getCssValue('display')).toEqual('block');
      });
 it('should show a secondary tab when selected', function () {
   var listBtn = tractor.findElement(protractor.By.css('[annotate="project.annotation"] ul.nav-tabs li:nth-child(2) a'));
   listBtn.click();
   tractor.driver.sleep(500);
   var listTab = tractor.findElement(protractor.By.css('[module="project"] .tab-pane:nth-child(2)'));
   expect(listTab.getCssValue('display')).toEqual('block');
 });
      it('show a popover when hovering over a highlighted area', function () {
        var noCode = tractor.findElement(protractor.By.css('code.nocode'))
        noCode.click()

        var popover = tractor.findElement(protractor.By.css('.popover'))
        expect(popover.getText()).toEqual('ng-app\nTells AngularJS to be active in this portion of the page. In this case the entire document.');
      });
      it('should update the Hello text after entering a name', function () {
        var el = tractor.findElement(protractor.By.model('yourName'));
        el.click()
        el.sendKeys('Jeff')

        var bound = tractor.findElement(protractor.By.css('[app-run="hello.html"] h1'));
        expect(bound.getText()).toEqual('Hello Jeff!');
      });
      it('should update the Hello text after entering a name', function () {
        var el = tractor.findElement(protractor.By.input('yourName'));
        el.click()
        el.sendKeys('Jeff')

        var bound = tractor.findElement(protractor.By.css('.container > *:nth-child(4) h1'));
        expect(bound.getText()).toEqual('Hello Jeff!');
      });
Esempio n. 8
0
 it('should add a new todo when added through text field', function () {
   var el = browser.findElement(protractor.By.model('todoList.todoText'));
   el.click();
   el.sendKeys('Write tests!');
   el.sendKeys(webdriver.Key.RETURN);
   var lastTodo = browser.findElement(protractor.By.css('[ng-repeat="todo in todoList.todos"]:nth-child(3) span'));
   expect(lastTodo.getText()).toEqual('Write tests!');
 });
 beforeEach(function () {
   var downloadBtn = tractor.findElement(protractor.By.css('.hero-unit .btn-primary')), done;
   downloadBtn.click();
   tractor.driver.sleep(500);
   cdnInput = tractor.findElement(protractor.By.css('#cdnURL'));
   cdnInput.getAttribute('value')
   cdnInput.getText().then(function (text) {
     stableVersion = text.toString().split('/').splice(-2,1)[0];
   });
 });
Esempio n. 10
0
    it('should show me a list of books', function() {
      ptor.findElement(protractor.By.repeater('book in books').row(1)).getText().then(function(text) {
          expect(text).toEqual('Great Expectations by Dickens');
      });

      ptor.findElement(protractor.By.repeater('book in books').row(2)).getText().then(function(text) {
          expect(text).toEqual('Foundation Series by Asimov');
      });

      ptor.findElement(protractor.By.repeater('book in books').row(3)).getText().then(function(text) {
          expect(text).toEqual('Treasure Island by Stephenson');
      });
    });
		it('should not let user named hambone to login', function(){
			ptor.findElement(protractor.By.className('username')).sendKeys('hambone');
			ptor.findElement(protractor.By.className('password')).sendKeys('hambone')
				.then(function(text){
					ptor.findElement(protractor.By.className('btn')).click()
						.then(function(){
							ptor.getCurrentUrl()
								.then(function(url){
									expect(url).toEqual(baseUrl + '/');
								});
						});
				});
		}, timeout);
Esempio n. 12
0
  it('should greet using binding', function(done) {
    var ptor = this.ptor;

    ptor.get('http://localhost:3000/');

    ptor.findElement(protractor.By.input('yourName')).sendKeys('Julie');

    ptor.findElement(protractor.By.binding('{{yourName}}')).
      getText().then(function(text) {
        expect(text).to.eql('Hello Julie!');
        done();
      });
  });
        it('should let user input an address', function(){
            ptor.findElement(protractor.By.className('username')).sendKeys('hambone');
            ptor.findElement(protractor.By.className('password')).sendKeys('hambone')
                .then(function(text){
                    ptor.findElement(protractor.By.className('btn')).click()
                        .then(function(){
                            helpers.waitForNavigation(baseUrl + '/welcome');
                            ptor.sleep(5000);
                            ptor.findElement(protractor.By.className('search')).sendKeys('hamboning, kentucky')
                        });

                });

        }, timeout);
		it('should let user visit welcome after login', function(){
			ptor.findElement(protractor.By.className('username')).sendKeys('hambone');
			ptor.findElement(protractor.By.className('password')).sendKeys('hambone')
				.then(function(text){
					ptor.findElement(protractor.By.className('btn')).click()
						.then(function(){
							helpers.waitForNavigation(baseUrl + '/welcome');
							ptor.getCurrentUrl()
								.then(function(url){
									expect(url).toEqual(baseUrl + '/welcome');
								});
						});
				});
		}, timeout);
 setTimeout(function () {
   var lightbox = tractor.findElement(protractor.By.css('.modal'));
   lightbox.getCssValue('display').then(function (display) {
     expect(display).to.equal('block');
     done();
   });
 }, 500);
 it('should have a navbar with links in it', function (done) {
   var homeBtn = tractor.findElement(protractor.By.css('.navbar .nav>li.active > a'));
   homeBtn.getAttribute('href').then(function (href) {
     expect(href).to.equal('http://angularjs.org/');
     done();
   });
 });
Esempio n. 17
0
 el.sendKeys('Jeff').then(function (type) {
   var bound = tractor.findElement(protractor.By.css('.container > *:nth-child(4) h1'));
   bound.getText().then(function (text) {
     expect(text).to.equal('Hello Jeff!');
     done();
   });            
 });
 it('should show a count of all projects greater than 0', function (done) {
   var count = tractor.findElement(protractor.By.css('.bwa-count'));
   count.getText().then(function (text) {
     expect(parseInt(text, 10)).to.be.greaterThan(0);
     done();
   });
 });
Esempio n. 19
0
 setTimeout(function () {
   cdnInput = tractor.findElement(protractor.By.input('cdnURL'));
   cdnInput.getAttribute('value').then(function (text) {
     stableVersion = text.split('/').splice(-2,1)[0];
     done();
   });
 }, 500);
 projectLink.click().then(function () {
   var lightbox = tractor.findElement(protractor.By.css('.modal'));
   lightbox.getCssValue('display').then(function (display) {
     expect(display).toEqual('block');
     done();
   });
 });
      it('should sort projects alphabetically by name when name sort is selected', function (done) {
        tractor.get(HOST);
        var option
          , names = []
          , prev
          , ordered = true
          , completed = 0;

        option = tractor.findElement(protractor.By.css('[ng-model="sortPrep"] option[value="1"]'));
        option.click().then(function () {
          //Check order of first four items.
          tractor.findElements(protractor.By.css('[ng-repeat="project in projectCol"] h2')).then(function (headings) {
            headings.forEach(function (element, i) {
              element.getText().then(function (text) {
                if (typeof prev !== 'undefined' && text[0].toLowerCase() < prev) {
                  ordered = false;
                }

                prev = text[0].toLowerCase();
                completed++;

                if (completed === headings.length) {
                  expect(ordered).toBe(true);
                  done();
                }
              });
            });
          });
        });
      });
				.then(function(){
					helpers.waitForNavigation(baseUrl + '/signup');
					ptor.findElement(protractor.By.className('username')).sendKeys('mnopqrstuvwxyz')
					ptor.findElement(protractor.By.className('password')).sendKeys('mmmm')
					ptor.findElement(protractor.By.className('verify')).sendKeys('qqq')
						.then(function(){

							ptor.findElement(protractor.By.className('btn')).click()
								.then(function(){
									ptor.findElement(protractor.By.className('error')).getText()
										.then(function(text){
											expect(text).toEqual('password must match');
										});
								});
						});
				});
				.then(function(){
					helpers.waitForNavigation(baseUrl + '/signup');
					ptor.findElement(protractor.By.className('username')).sendKeys('m')
					ptor.findElement(protractor.By.className('password')).sendKeys('m')
					ptor.findElement(protractor.By.className('verify')).sendKeys('m')
						.then(function(){

							ptor.findElement(protractor.By.className('btn')).click()
								.then(function(){
									ptor.findElement(protractor.By.className('error')).getText()
										.then(function(text){
											expect(text).toEqual('invalid username. try letters and numbers. minimum allowed is 3');
										});
								});
						});
				});
 it('should have the correct version of angularjs loaded', function() {
   //This only runs if an environment variable tells us to check
   if (process.env.CHECK_SCRIPT_TAG !== 'true') return;
   var scriptTag = tractor.findElement(protractor.By.css('script#angularScript'));
   expect(scriptTag.getAttribute('src')).
       toContain(process.env.ANGULAR_VERSION);
 })
      it('should allow downloading uncompressed angular', function () {
        var uncompressedBtn = tractor.findElement(
            protractor.By.css(
                '.download-modal .modal-body > dl button.uncompressed'));
        uncompressedBtn.click()

        expect(cdnInput.getAttribute('value')).toContain('angular.js');
      });
Esempio n. 26
0
 it('should redirect me to the home page and I should see a message', function() {
   ptor.findElement(
     protractor.By.repeater('item in items').row(1)).
     getText().then(function(text) {
       text = text.match(/.*/)[0].replace(' ','');
       expect(text).toEqual('Mazda');
     });
 });
 search.sendKeys('YouTube on PS3').then(function () {
   var result1 = tractor.findElement(protractor.By.css('bwa-project > div > h2'));
   result1.getText().then(function (text) {
     expect(text).to.equal('YouTube on PS3');
     search.clear();
     done();
   });
 });
				.then(function(){
					helpers.waitForNavigation(baseUrl + '/signup');
					ptor.findElement(protractor.By.className('username')).sendKeys('hambone')
					ptor.findElement(protractor.By.className('password')).sendKeys('hambone')
					ptor.findElement(protractor.By.className('verify')).sendKeys('hambone')
						.then(function(){

							ptor.findElement(protractor.By.className('btn')).click()
								.then(function(){
									helpers.waitForNavigation(baseUrl + '/welcome');
									ptor.getCurrentUrl()
										.then(function(url){

											expect(url).toEqual(baseUrl + '/welcome');
										});
								});
						});
				});
                .then(function(text){
                    ptor.findElement(protractor.By.className('btn')).click()
                        .then(function(){
                            helpers.waitForNavigation(baseUrl + '/welcome');
                            ptor.sleep(5000);
                            ptor.findElement(protractor.By.className('search')).sendKeys('hamboning, kentucky')
                        });

                });
				.then(function(text){
					ptor.findElement(protractor.By.className('btn')).click()
						.then(function(){
							ptor.getCurrentUrl()
								.then(function(url){
									expect(url).toEqual(baseUrl + '/');
								});
						});
				});