testapp_spec.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*global jasmine*/
  2. var excludes = [
  3. "map_events.html",
  4. "map_fit_bounds.html",
  5. "map_lazy_init.html",
  6. "map-lazy-load.html",
  7. "marker_with_dynamic_position.html",
  8. "marker_with_ng_repeat_dynamic.html"
  9. ];
  10. function using(values, func){
  11. for (var i = 0, count = values.length; i < count; i++) {
  12. if (Object.prototype.toString.call(values[i]) !== '[object Array]') {
  13. values[i] = [values[i]];
  14. }
  15. func.apply(this, values[i]);
  16. jasmine.currentEnv_.currentSpec.description += ' (with using ' + values[i].join(', ') + ')';
  17. }
  18. }
  19. describe('testapp directory', function() {
  20. 'use strict';
  21. //var urls = ["aerial-rotate.html", "aerial-simple.html", "hello_map.html", "map_control.html"];
  22. var files = require('fs').readdirSync(__dirname + "/../../testapp");
  23. var urls = files.filter(function(filename) {
  24. return filename.match(/\.html$/) && excludes.indexOf(filename) === -1;
  25. });
  26. console.log('urls', urls);
  27. using(urls, function(url){
  28. it('testapp/'+url, function() {
  29. browser.get(url);
  30. browser.wait( function() {
  31. return browser.executeScript( function() {
  32. var el = document.querySelector("map");
  33. var scope = angular.element(el).scope();
  34. //return scope.map.getCenter().lat();
  35. return scope.map.getCenter();
  36. }).then(function(result) {
  37. return result;
  38. });
  39. }, 5000);
  40. //element(by.css("map")).evaluate('map.getCenter().lat()').then(function(lat) {
  41. // console.log('lat', lat);
  42. // expect(lat).toNotEqual(0);
  43. //});
  44. browser.manage().logs().get('browser').then(function(browserLog) {
  45. (browserLog.length > 0) && console.log('log: ' + require('util').inspect(browserLog));
  46. expect(browserLog).toEqual([]);
  47. });
  48. });
  49. });
  50. });