Commit 5f71cad8fe1bba04b08413ba1810992e28b6c41c

Authored by Leonardo Merlin
1 parent b9bce81a

Add some tests to event area at 'inicio'

e2e/pages/inicio.po.js 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +module.exports = (function() {
  2 + 'use strict';
  3 +
  4 + var PageObject = function() {
  5 + this.video = element(by.css('.video-player'));
  6 +
  7 + this.agenda = element(by.css('.event-list'));
  8 + };
  9 +
  10 + return (new PageObject());
  11 +})();
e2e/pages/inicio.spec.js
@@ -3,8 +3,7 @@ @@ -3,8 +3,7 @@
3 'use strict'; 3 'use strict';
4 4
5 describe('The index page', function () { 5 describe('The index page', function () {
6 - var page = browser.get('/');  
7 - 6 + var page = require('./inicio.po.js');
8 // beforeEach(function () { 7 // beforeEach(function () {
9 // browser.get('/'); 8 // browser.get('/');
10 // }); 9 // });
@@ -14,27 +13,59 @@ @@ -14,27 +13,59 @@
14 }); 13 });
15 14
16 describe('Component: Main Video', function(){ 15 describe('Component: Main Video', function(){
17 - it('should have a alt text', function() {});  
18 - it('should have a thumb background image (for async)', function() {});  
19 - it('should have a button play trigger', function() {});  
20 - it('should be accessible', function() {}); 16 + it('should have a thumb background image (for async)', function() {
  17 + expect(page.video.element(by.css('.video-thumbnail'))).toBeDefined();
  18 + expect(page.video.element(by.css('.video-thumbnail')).getCssValue('background-image')).toContain('youtube-background.png');
  19 + expect(page.video.element(by.css('.video-thumbnail')).getAttribute('aria-hidden')).toBe('true');
  20 + });
  21 +
  22 + it('should have a button play trigger', function() {
  23 + expect(page.video.element(by.css('.video-play-button'))).toBeDefined();
  24 + expect(page.video.element(by.css('.video-play-button')).getAttribute('aria-label')).toBeDefined();
  25 + });
21 }); 26 });
22 27
23 describe('Component: Agenda', function(){ 28 describe('Component: Agenda', function(){
24 - it('should have a title', function() {});  
25 - it('should have a icon', function() {});  
26 - it('should show the number of scheduled chats', function() {});  
27 - it('should have a open trigger', function() {});  
28 - it('should be accessible', function() {}); 29 + it('should have a tab-trigger', function() {
  30 + expect(page.agenda.element(by.css('.event-tab--trigger'))).toBeDefined();
  31 + expect(page.agenda.element(by.css('.event-tab--title'))).toBeDefined();
  32 + expect(page.agenda.element(by.css('.event-tab--icon'))).toBeDefined();
  33 + expect(page.agenda.element(by.css('.event-tab--icon')).element(by.css('.glyphicon'))).toBeDefined();
  34 + expect(page.agenda.element(by.css('.event-tab--icon')).element(by.css('.glyphicon')).getAttribute('aria-hidden')).toBe('true');
  35 + expect(page.agenda.element(by.css('.event-tab--button'))).toBeDefined();
  36 + expect(page.agenda.element(by.css('.event-tab--total-scheduled'))).toBeDefined();
  37 + expect(page.agenda.element(by.css('.event-tab--total-scheduled'))).toMatch(/(\d)*/);
  38 + });
29 39
30 describe('Component: Agenda / Open-panel', function(){ 40 describe('Component: Agenda / Open-panel', function(){
31 - it('should have a close trigger', function() {});  
32 - it('should have the date/time of scheduled chat', function() {});  
33 - it('should have the title of scheduled chat', function() {});  
34 - it('should have a subscribe button to scheduled chat', function() {});  
35 - it('should show the number of subscribers on each item', function() {});  
36 - it('should show 5 itens at most', function() {});  
37 - it('should be accessible', function() {}); 41 + it('should have a header', function() {
  42 + // the 2 lines below need to open panel and make elements visibles
  43 + expect(page.agenda.element(by.model('eventListCtrl.isListVisible'))).toBeDefined();
  44 + page.agenda.element(by.css('.event-tab--trigger')).click();
  45 +
  46 + expect(page.agenda.element(by.css('.event-list--title'))).toBeDefined();
  47 + expect(page.agenda.element(by.css('.event-list--title')).getText()).toEqual('Bate-papo com ministr@s');
  48 + expect(page.agenda.element(by.css('.event-list--icon'))).toBeDefined();
  49 + expect(page.agenda.element(by.css('.event-list--icon')).element(by.css('.glyphicon'))).toBeDefined();
  50 + expect(page.agenda.element(by.css('.event-list--icon')).element(by.css('.glyphicon')).getAttribute('aria-hidden')).toBe('true');
  51 + expect(page.agenda.element(by.css('.event-list--minimize'))).toBeDefined();
  52 + expect(page.agenda.element(by.css('.event-list--minimize')).element(by.css('.glyphicon'))).toBeDefined();
  53 + expect(page.agenda.element(by.css('.event-list--minimize')).element(by.css('.glyphicon')).getAttribute('aria-hidden')).toBe('true');
  54 + });
  55 +
  56 + it('should have a table with content', function() {
  57 + // date/time
  58 + expect(page.agenda.element(by.css('.event-list--minimize')).element(by.css('.glyphicon')).getAttribute('aria-hidden')).toBe('true');
  59 + // title
  60 + // subscribe button
  61 + // total of subscribers
  62 + // show only 5 itens
  63 + });
  64 + // it('should have the title of scheduled chat', function() {});
  65 + // it('should have a subscribe button to scheduled chat', function() {});
  66 + // it('should show the number of subscribers on each item', function() {});
  67 + // it('should show 5 itens at most', function() {});
  68 + // it('should be accessible', function() {});
38 }); 69 });
39 70
40 describe('Component: Agenda / with Hangout', function(){ 71 describe('Component: Agenda / with Hangout', function(){
protractor.conf.js
@@ -30,12 +30,12 @@ @@ -30,12 +30,12 @@
30 browser.addMockModule('disableNgAnimate', disableNgAnimate); 30 browser.addMockModule('disableNgAnimate', disableNgAnimate);
31 31
32 // Disable debug info 32 // Disable debug info
33 - var disableDebugInfo = function() {  
34 - angular.module('disableDebugInfo', []).run(['$compileProvider', function($compileProvider) {  
35 - $compileProvider.debugInfoEnabled(false);  
36 - }]);  
37 - };  
38 - browser.addMockModule('disableDebugInfo', disableDebugInfo); 33 + // var disableDebugInfo = function() {
  34 + // angular.module('disableDebugInfo', []).run(['$compileProvider', function($compileProvider) {
  35 + // $compileProvider.debugInfoEnabled(false);
  36 + // }]);
  37 + // };
  38 + // browser.addMockModule('disableDebugInfo', disableDebugInfo);
39 39
40 // Store the name of the browser that's currently being used. 40 // Store the name of the browser that's currently being used.
41 browser.getCapabilities().then(function(caps) { 41 browser.getCapabilities().then(function(caps) {
@@ -52,10 +52,10 @@ @@ -52,10 +52,10 @@
52 // The timeout in milliseconds for each script run on the browser. This should 52 // The timeout in milliseconds for each script run on the browser. This should
53 // be longer than the maximum time your application needs to stabilize between 53 // be longer than the maximum time your application needs to stabilize between
54 // tasks. 54 // tasks.
55 - allScriptsTimeout: 11000, 55 + allScriptsTimeout: 15000,
56 56
57 // How long to wait for a page to load. 57 // How long to wait for a page to load.
58 - getPageTimeout: 10000, 58 + getPageTimeout: 12000,
59 59
60 // Spec patterns are relative to the current working directly when 60 // Spec patterns are relative to the current working directly when
61 // protractor is called. 61 // protractor is called.
src/app/components/event-list/event-list.html
@@ -2,12 +2,13 @@ @@ -2,12 +2,13 @@
2 <div class="event-tab--trigger" ng-show="!eventListCtrl.isListVisible" ng-click="eventListCtrl.toggleView()"> 2 <div class="event-tab--trigger" ng-show="!eventListCtrl.isListVisible" ng-click="eventListCtrl.toggleView()">
3 <div class="event-tab--header"> 3 <div class="event-tab--header">
4 <div class="event-tab--icon"> 4 <div class="event-tab--icon">
5 - <span class="glyphicon glyphicon-calendar" arria-hidden="true"></span> 5 + <span class="glyphicon glyphicon-calendar" aria-hidden="true"></span>
6 </div> 6 </div>
7 <div class="event-tab--title">Bate-Papo com ministr@s</div> 7 <div class="event-tab--title">Bate-Papo com ministr@s</div>
8 </div> 8 </div>
9 <button class="btn btn-link event-tab--button"> 9 <button class="btn btn-link event-tab--button">
10 - <span>18 bate-papos agendados</span> 10 + <span class="event-tab--total-scheduled">18</span>
  11 + <span>bate-papos agendados</span>
11 <span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span> 12 <span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span>
12 </button> 13 </button>
13 </div> 14 </div>
@@ -17,9 +18,7 @@ @@ -17,9 +18,7 @@
17 <div class="event-list--icon"> 18 <div class="event-list--icon">
18 <div class="glyphicon glyphicon-calendar" aria-hidden="true"></div> 19 <div class="glyphicon glyphicon-calendar" aria-hidden="true"></div>
19 </div> 20 </div>
20 - <h2 class="event-list--title">  
21 - Bate-papo com ministr@s  
22 - </h2> 21 + <h2 class="event-list--title">Bate-papo com ministr@s</h2>
23 <div class="event-list--minimize"> 22 <div class="event-list--minimize">
24 <button type="button" class="btn btn-link" ng-click="eventListCtrl.toggleView()"> 23 <button type="button" class="btn btn-link" ng-click="eventListCtrl.toggleView()">
25 <span>Minimizar</span> 24 <span>Minimizar</span>
src/app/pages/inicio/inicio.html
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <div class="embed-responsive embed-responsive-16by9"> 6 <div class="embed-responsive embed-responsive-16by9">
7 <div class="js-iframe" ng-show="pageInicio.content" ng-bind-html="pageInicio.content"></div> 7 <div class="js-iframe" ng-show="pageInicio.content" ng-bind-html="pageInicio.content"></div>
8 <div class="video-background" ng-click="pageInicio.showVideo()"> 8 <div class="video-background" ng-click="pageInicio.showVideo()">
9 - <div class="video-thumbnail" style="background-image:url(/assets/images/youtube-background.png)"></div> 9 + <div class="video-thumbnail" aria-hidden="true" style="background-image:url(/assets/images/youtube-background.png)"></div>
10 <button class="video-play-button" aria-live="assertive" aria-label="Assistir o vídeo tutorial Dialoga Brasil"> 10 <button class="video-play-button" aria-live="assertive" aria-label="Assistir o vídeo tutorial Dialoga Brasil">
11 <svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-play-button-bg" d="m .66,37.62 c 0,0 .66,4.70 2.70,6.77 2.58,2.71 5.98,2.63 7.49,2.91 5.43,.52 23.10,.68 23.12,.68 .00,-1.3e-5 14.29,-0.02 23.81,-0.71 1.32,-0.15 4.22,-0.17 6.81,-2.89 2.03,-2.07 2.70,-6.77 2.70,-6.77 0,0 .67,-5.52 .67,-11.04 l 0,-5.17 c 0,-5.52 -0.67,-11.04 -0.67,-11.04 0,0 -0.66,-4.70 -2.70,-6.77 C 62.03,.86 59.13,.84 57.80,.69 48.28,0 34.00,0 34.00,0 33.97,0 19.69,0 10.18,.69 8.85,.84 5.95,.86 3.36,3.58 1.32,5.65 .66,10.35 .66,10.35 c 0,0 -0.55,4.50 -0.66,9.45 l 0,8.36 c .10,4.94 .66,9.45 .66,9.45 z" fill="#1f1f1e" fill-opacity="0.9"></path><path d="m 26.96,13.67 18.37,9.62 -18.37,9.55 -0.00,-19.17 z" fill="#fff"></path><path d="M 45.02,23.46 45.32,23.28 26.96,13.67 43.32,24.34 45.02,23.46 z" fill="#ccc"></path></svg> 11 <svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-play-button-bg" d="m .66,37.62 c 0,0 .66,4.70 2.70,6.77 2.58,2.71 5.98,2.63 7.49,2.91 5.43,.52 23.10,.68 23.12,.68 .00,-1.3e-5 14.29,-0.02 23.81,-0.71 1.32,-0.15 4.22,-0.17 6.81,-2.89 2.03,-2.07 2.70,-6.77 2.70,-6.77 0,0 .67,-5.52 .67,-11.04 l 0,-5.17 c 0,-5.52 -0.67,-11.04 -0.67,-11.04 0,0 -0.66,-4.70 -2.70,-6.77 C 62.03,.86 59.13,.84 57.80,.69 48.28,0 34.00,0 34.00,0 33.97,0 19.69,0 10.18,.69 8.85,.84 5.95,.86 3.36,3.58 1.32,5.65 .66,10.35 .66,10.35 c 0,0 -0.55,4.50 -0.66,9.45 l 0,8.36 c .10,4.94 .66,9.45 .66,9.45 z" fill="#1f1f1e" fill-opacity="0.9"></path><path d="m 26.96,13.67 18.37,9.62 -18.37,9.55 -0.00,-19.17 z" fill="#fff"></path><path d="M 45.02,23.46 45.32,23.28 26.96,13.67 43.32,24.34 45.02,23.46 z" fill="#ccc"></path></svg>
12 </button> 12 </button>