示例#1
0
		it("config area test2", function(done) {
			this.timeout(timeout);
			var c = 0;

			function d() {
				if (++c == 3) done();
			}
			driver.findElement(webdriver.By.css('.info-title')).
			then(function(el) {
				el.getText().then(function(t) {
					assert.equal(t, "scrollback", "showing incorrect room name");
					d();
				});
				el.isDisplayed().
				then(function(v) {
					assert.equal(true, v, "Room name not displayed");
					d();
				});
			});
			driver.findElement(webdriver.By.css('.info-description')).
			then(function(el) {
				el.isDisplayed().
				then(function(v) {
					assert.equal(true, v, "room description not displayed");
					d();
				});
			});

		});
示例#2
0
var runTest = function(cap, driver){
  //on every action we wait a maximum of 10 seconds before thrwosing and error (ajax etc.)
  driver.manage().timeouts().implicitlyWait(30000);
  //Goto the travis deployed site.
  driver.get('https://mf-geoadmin3.dev.bgdi.ch/travis/prod/');
  //type in "Bern" into the search field.
  driver.findElement(webdriver.By.xpath("//*[@type='search']")).sendKeys('Bern');
  //Click on the field "Bern (BE)"
  driver.findElement(webdriver.By.xpath("//*[contains(text(), 'Bern (BE)')]")).click().then(function(){
    driver.sleep(5000);
    //The first test does not have to work on IE 9
    if(!(cap.browser == "IE" && cap.browser_version == "9.0")){

      //If we have a look at the URL
      driver.getCurrentUrl().then(function(url){
        //We should be located in Bern
        assert.equal(url.substring(8,69),  URL_OF_BERN);
      });
    }
  });

  //We click on the "share" button
  driver.findElement(webdriver.By.xpath("//a[@id='shareHeading']")).click();
  //And have a look at the permanent Link
  driver.findElement(webdriver.By.xpath("//*[@ng-model='permalinkValue']")).getAttribute("value").then(function(val){
    //The perma Link should point to Bern
    assert.equal(val.substring(8,69),  URL_OF_BERN);
  }); 
}
 test.it('should append query to title', function() {
   driver.get('http://www.google.com');
   driver.findElement(webdriver.By.name('q')).sendKeys('BrowserStack');
   driver.findElement(webdriver.By.name('btnG')).click();
   driver.wait(function() {
     return driver.getTitle().then(function(title) {
       return 'BrowserStack - Google Search' === title;
     });
   }, 1000);
 });
var runTest = function(cap, driver, target) {
  //We resize our window to simulate iPhone 4 like mobile resolution
  driver.manage().window().setSize(320, 480);
  //Go to the mobile version of map.geo.admin
  driver.get(target + '/mobile.html?lang=de');
  //wait until topics related stuff is loaded. We know this when catalog is there
  driver.findElement(webdriver.By.xpath("//div[@id='zoomButtons']"));
  driver.findElement(webdriver.By.xpath("//div[@id='pulldown']"));
  driver.findElement(webdriver.By.xpath("//img[@alt='small_logo']"));
  //Send "Bern" to the searchbar
  driver.findElement(webdriver.By.xpath("//*[@type='search']")).sendKeys('Bern');
  //Click on the field "Bern"
  driver.findElement(webdriver.By.xpath("//*[contains(text(), 'Bern')]")).click();
};
示例#5
0
function loginGoogle(driver, email, pass, callback) {
	driver.findElement(webdriver.By.css('.main-area .user-area.js-has-user-menu')).click().
	then(function() {
		findVisibleElementByClass(driver, ".google", function(el) {
			var win;
			el.click().
			then(function() {
				return driver.getAllWindowHandles();
			}).then(function(w) {
				win = w;
				return driver.switchTo().window(win[1]);
			}).then(function() {
				return q.delay(5000);
			}).then(function() {
				console.log("entering email");
				return driver.findElement(webdriver.By.id("Email")).sendKeys(email);
			}).then(function() {
				return driver.findElement(webdriver.By.id("Passwd")).sendKeys(pass);
			}).then(function() {
				return driver.findElement(webdriver.By.id("signIn")).click();
			}).then(function() {
				console.log("logging in...");
				driver.switchTo().window(win[0]);
			}).then(function() {
				return q.delay(5000);
			}).then(callback);
		});
	});
}
		it("account settings test(profile)", function(done) {
			this.timeout(4 * timeOut);
			console.log("testing for user area");

			driver.findElement(webdriver.By.css('.user-area')).click().
			then(function() {
				console.log("this is profile testing...");
				return driver.findElement(webdriver.By.css('.userpref')).click();
			}).then(function() {
				return q.delay(3000);
			}).then(function() {
				return driver.findElement(webdriver.By.css('.list-item-profile-settings')).click();
			}).then(function() {
				return driver.findElement(webdriver.By.id('pref-about-me')).sendKeys(random);
			}).then(function() {
				return driver.findElement(webdriver.By.css('.conf-save')).click();
			}).then(function() {
				return q.delay(1000);
			}).then(function() {
				return driver.findElement(webdriver.By.css('.user-area')).click();
			}).then(function() {
				return driver.findElement(webdriver.By.css('.userpref')).click();
			}).then(function() {
				return q.delay(5000);
			}).then(function() {
				return driver.findElement(webdriver.By.id('pref-about-me')).getAttribute("value");
			}).then(function(text) {
				console.log("text", text);
				var b = text.indexOf(random) !== -1;
				assert.equal(b, true, "saving not successful");
				driver.findElement(webdriver.By.css('.conf-save')).click();
				done();
			});
		});
示例#7
0
		it("Permissions test", function(done) {
			this.timeout(4 * timeOut);
			/*driver.findElement(webdriver.By.css('.tab-info')).click().
			then(function(){
				console.log("configuring room...");
				return driver.findElement(webdriver.By.css('.configure-button')).click();
			}).then(function(){
				return */
			driver.findElement(webdriver.By.css('.list-item-authorizer-settings')).click()
			/*;
			})*/
			.then(function() {
				return driver.findElement(webdriver.By.id('authorizer-post-guest')).click();
			})
			/*.then(function(){
				return driver.findElement(webdriver.By.id('authorizer-post-users')).click();
			}).then(function(){
				return driver.findElement(webdriver.By.id('authorizer-post-followers')).click();
			})*/
			.then(function() {
				console.log("saved");
				return driver.findElement(webdriver.By.css('.conf-save')).click();
			}).then(function() {
				return driver.findElement(webdriver.By.css('.configure-button')).click();
			}).then(function() {
				return driver.findElement(webdriver.By.css('.list-item-authorizer-settings')).click();
			}).then(function() {
				return driver.findElement(webdriver.By.id('authorizer-post-guest')).isEnabled();
			}).then(function(t) {
				assert.equal(t, true, "saving unsuccessful");
				driver.findElement(webdriver.By.css('.conf-save')).click();
				done();
			});
		});
			}).then(function(text) {
				console.log("text", text);
				var b = text.indexOf(random) !== -1;
				assert.equal(b, true, "saving not successful");
				driver.findElement(webdriver.By.css('.conf-save')).click();
				done();
			});
示例#9
0
			testUtils.logout(driver, function() {
				driver.findElement(webdriver.By.css('.sign-in')).isDisplayed().
				then(function(t) {
					assert.equal(t, true, "logout unsuccessful");
					done();
				});
			});
示例#10
0
		it("select Thread", function(done) {
			this.timeout(timeout);
			var threads, index, messages, id;
			driver.findElements(webdriver.By.css('.thread-item')).
			then(function(t) {
				threads = t;
				index = Math.floor(Math.random() * threads.length - 1) + 1;
				return threads[index].getAttribute('id');
			}).then(function(idd) {
				id = idd.substring(7);
				return threads[index].click();
			}).then(function() {
				return driver.findElements(webdriver.By.css('.chat-item'));
			}).then(function(msgs) {
				messages = msgs;
				return q.delay(5000);
			}).then(function() {
				var c = 0;

				function d() {
					if (++c == messages.length) done();
				}
				messages.forEach(function(message) {
					message.getAttribute("data-thread").
					then(function(threadid) {
						console.log("threadID", threadid);
						assert.equal(threadid, id, "Thread Not loading");
						d();
					});
				});
			});
		});
示例#11
0
			then(function() {
				driver.findElement(webdriver.By.css('.popover-body')).isDisplayed().
				then(function(d) {
					assert(true, d, "sign in options not visible");
					done();
				});
			});
示例#12
0
				setTimeout(function() {
					console.log("set Element");
					driver.findElement(webdriver.By.id("sb-user")).getText().then(function(t) {
						console.log("text: ", t);
						assert.equal(config.personaUser.username, t, "Login unsuccessful");
						done();
					});	
				}, 5000);
示例#13
0
		it("Thread area test2", function(done) {
			this.timeout(timeout);
			driver.findElements(webdriver.By.css('.thread-item')).
			then(function(threads) {
				assert.equal(true, threads.length > 1, "No threads");
				done();
			});
		});
示例#14
0
			then(function() {
				driver.findElement(webdriver.By.css('.minimize-room-title')).isDisplayed().
				then(function(t) {
					assert.equal(t, true, "page is not loaded");
					driver.quit();
					done();
				});
			});
示例#15
0
		it("People area test2", function(done) {
			this.timeout(timeout);
			driver.findElements(webdriver.By.css('.person')).then(function(ps) {
				console.log("Number of people", ps.length);
				assert.equal(true, ps.length > 1, "people area don't have online/offline users");
				done();
			});
		});
示例#16
0
		it("People area test1", function(done) {
			driver.findElement(webdriver.By.css('.pane-people'))
			.isDisplayed()
			.then(function(v) {
				assert.equal(true, v, "people pane is not visible");
				done();
			});
		});
示例#17
0
				searchBox.sendKeys(webdriver.Key.RETURN). then(function() {
					driver.findElement(webdriver.By.css('.chat-area')).getText().then(function(text) {
						console.log("text", text);
						console.log("index=", text.indexOf("" + random));
						assert.notEqual(-1, text.indexOf("" + random), "Message sending failed");
						done();
					});
				});
示例#18
0
function logout(driver, callback) {
	driver.findElement(webdriver.By.css('.main-area .user-area.js-has-user-menu')).click().
	then(function() {
		return driver.findElement(webdriver.By.css('.logout')).click();
	}).then(function() {
		return driver.findElement(webdriver.By.css('.dialog-action-go-back-as-guest')).click();
	}).then(function() {
		return q.delay(2000);
	}).then(callback);
}
示例#19
0
		it("thread id test", function(done) {
			driver.findElements(webdriver.By.css('.chat-item')).then(function(e) {
				console.log("Number of messages: ", e.length);
				//check last message got thread-id
				e[e.length - 1].getAttribute("data-thread").then(function(threadId) {
					console.log("thread Id", threadId);
					assert.equal(33, threadId.length, "Last message did not got threadId");
					done();
				});
			});
		});
示例#20
0
		it("login Menu test", function(done) {
			this.timeout(timeout);
			driver.findElement(webdriver.By.css('.user-area')).click().
			then(function() {
				driver.findElement(webdriver.By.css('.popover-body')).isDisplayed().
				then(function(d) {
					assert(true, d, "sign in options not visible");
					done();
				});
			});
		});
示例#21
0
var runTest = function(cap, driver, target) {
  //Set the timeout to x ms
  var TIMEOUT = 40000;
  driver.manage().timeouts().implicitlyWait(TIMEOUT);
  //We maximize our window to be sure to be in full resolution
  driver.manage().window().maximize();
  //Go to the deployed site.
  driver.get(target + '/?lang=de');
  //Wait until topics related stuff is loaded. We know this when catalog is there
  driver.findElement(webdriver.By.xpath("//a[contains(text(), 'Grundlagen und Planung')]"));
};
示例#22
0
			testUtils.loginPersona(driver, config.personaUser.email, config.personaUser.password, function() {
				driver.findElement(webdriver.By.id("noroom-view-create")).click()
				.then(function() {
					return q.delay(5000);
				}).then(function() {
					driver.findElement(webdriver.By.css(".info-title")).getText().then(function(t) {
						assert.equal(t, roomName, "Room creation unsuccessful");
						done();
					});
				});					
			});
示例#23
0
		it("Testing for room existance", function(done) {
			this.timeout(4 * timeout);
			var room = Math.floor(Math.random() * config.facebookUser.rooms.length);
			driver.findElement(webdriver.By.id('room-item-' + config.facebookUser.rooms[room])).click().
			then(function() {
				return driver.findElement(webdriver.By.id('room-title')).getText();
			}).then(function(t) {
				console.log(t);
				assert.equal(t, config.facebookUser.rooms[room], "room does not exists");
				done();
			});
		});
示例#24
0
			then(function(searchBox) {
				var random = Math.random();
				searchBox.sendKeys('hello Testing message from script: ' + random);
				driver.findElement(webdriver.By.css('.chat-send')).click().
				then(function() {
					driver.findElement(webdriver.By.css('.chat-area')).getText().
					then(function(text) {
						console.log("text", text);
						console.log("index=", text.indexOf("" + random));
						assert.notEqual(-1, text.indexOf("" + random), "Message sending failed");
						done();
					});
				});
			});
示例#25
0
		it("config area test1", function(done) {
			this.timeout(timeout);
			driver.findElement(webdriver.By.css('.tab-info'))
				.then(function(tab) {
					return tab.click();
				}).then(function() {
					return driver.findElement(webdriver.By.css('.pane-info'));
				}).then(function(el) {
					return el.isDisplayed();
				}).then(function(v) {
					assert.equal(true, v, "Info area not visible after clicking info tab");
					done();
				});
		});
示例#26
0
		it("Testing for create room", function(done) {
			this.timeout(4 * timeout);
			var roomName = "t" + generator.names(8);
			driver.findElement(webdriver.By.css('.js-create-room')).click().
			then(function() {
				return driver.findElement(webdriver.By.id('createroom-id')).sendKeys(roomName);
			}).then(function() {
				return driver.findElement(webdriver.By.id('createroom-save')).click();
			}).then(function() {
				return driver.findElement(webdriver.By.id('room-title')).getText();
			}).then(function(t) {
				console.log(t);
				assert.equal(t, roomName, "Some problem is there");
				done();
			});
		});
示例#27
0
		it("Message Load test", function(done) {
			driver.findElements(webdriver.By.css('.chat-item')).then(function(e) {
				var c = 0;
				function d() {
					if (e.length === ++c) {
						done();
					}
				}
				e.forEach(function(el) {
					el.getAttribute("id").
					then(function(id) {
						d();
						assert.equal(true, id.length > 0, "ID Not added");
					});
				});
				console.log("Number of messages: ", e.length);
				assert.equal(true, e.length > 1, "No Messages displayed on load");
			});
		});
示例#28
0
			setTimeout(function() {
				driver.findElements(webdriver.By.css('.chat-item')).then(function(e) {
					var c = 0;
					function d() {
						if (e.length === ++c) {
							done();
						}
					}
					e.forEach(function(el) {
						el.getAttribute("id").
						then(function(id) {
							console.log("ID: ", id + "," + ids[c]);
							assert.equal(true, id.length > 0, "ID Not added");
							assert.notEqual(id, ids[c], "Not scrolling..");
							d();
						});
					});
					console.log("Number of messages: ", e.length);
					assert.equal(true, e.length > 1, "No Messages displayed on load");
				});
			}, 15000);
示例#29
0
/**
 * Find one visible element by css
 */
function findVisibleElementByClass(driver, name, cb) {
	driver.findElements(webdriver.By.css(name)).
	then(function (el) {
		var element;
		var c = 0;
		function done() {
			if (++c === el.length) {
				cb(element);
			}
		}
		el.forEach(function (e) {
			e.isDisplayed().then(function (a) {
				if (a) {
					element = e;
				}
				done();
			});
		});

	});
}
		it("account settings test(Email)", function(done) {
			this.timeout(4 * timeOut);
			console.log("testing for user area");
			driver.findElement(webdriver.By.css('.user-area')).click().
			then(function() {
				console.log("this is Email testing...");
				return driver.findElement(webdriver.By.css('.userpref')).click();
			}).then(function() {
				return driver.findElement(webdriver.By.css('.list-item-email-settings')).click();
			}).then(function() {
				return driver.findElement(webdriver.By.css('.radio-item')).click();
			}).then(function() {
				return driver.findElement(webdriver.By.css('.conf-save')).click();
			}).then(function() {
				return q.delay(2000);
			}).then(function() {
				return driver.findElement(webdriver.By.css(".sb-user")).isDisplayed();
			}).then(function(t) {
				assert.equal(t, true, "saving unsuccessful");
				done();
			});
		});