Commit b14ab1e614fb4d583afa90cb598e361620f79069
1 parent
dd33a889
Exists in
master
and in
8 other branches
Refact a11y tests to a better manutenibility
Showing
3 changed files
with
27 additions
and
9 deletions
Show diff stats
e2e/pages/layout.js
@@ -3,28 +3,30 @@ module.exports = function(){ | @@ -3,28 +3,30 @@ module.exports = function(){ | ||
3 | 3 | ||
4 | describe('The common layout', function () { | 4 | describe('The common layout', function () { |
5 | 5 | ||
6 | + var page = require('./layout.js'); | ||
7 | + | ||
6 | describe('Accessibility (a11y) top bar', function(){ | 8 | describe('Accessibility (a11y) top bar', function(){ |
7 | it('should have a "skip-to-content" anchor', function() { | 9 | it('should have a "skip-to-content" anchor', function() { |
8 | - expect(element(by.id('skip-to-content')).getText()).toEqual('Ir para o conteúdo 1'); | 10 | + expect(page.skipToContent.getText()).toEqual('Ir para o conteúdo 1'); |
9 | }); | 11 | }); |
10 | it('should have a "skip-to-navigation" anchor', function() { | 12 | it('should have a "skip-to-navigation" anchor', function() { |
11 | - expect(element(by.id('skip-to-navigation')).getText()).toEqual('Ir para o menu 2'); | 13 | + expect(page.skipToNavigation.getText()).toEqual('Ir para o menu 2'); |
12 | }); | 14 | }); |
13 | it('should have a "skip-to-search" anchor', function() { | 15 | it('should have a "skip-to-search" anchor', function() { |
14 | - expect(element(by.id('skip-to-search')).getText()).toEqual('Ir para a busca 3'); | 16 | + expect(page.skipToSearch.getText()).toEqual('Ir para a busca 3'); |
15 | }); | 17 | }); |
16 | it('should have a "skip-to-footer" anchor', function() { | 18 | it('should have a "skip-to-footer" anchor', function() { |
17 | - expect(element(by.id('skip-to-footer')).getText()).toEqual('Ir para o rodapé 4'); | 19 | + expect(page.skipToFooter.getText()).toEqual('Ir para o rodapé 4'); |
18 | }); | 20 | }); |
19 | 21 | ||
20 | it('should have a accessibility anchor', function() { | 22 | it('should have a accessibility anchor', function() { |
21 | - expect(element(by.id('siteaction-accessibility')).getText()).toEqual('Acessibilidade'); | 23 | + expect(page.actionAccessibility.getText()).toEqual('Acessibilidade'); |
22 | }); | 24 | }); |
23 | it('should have a adjust contrast anchor', function() { | 25 | it('should have a adjust contrast anchor', function() { |
24 | - expect(element(by.id('siteaction-contraste')).getText()).toEqual('Alto Contraste'); | 26 | + expect(page.actionContrast.getText()).toEqual('Alto Contraste'); |
25 | }); | 27 | }); |
26 | it('should have a sitemap anchor', function() { | 28 | it('should have a sitemap anchor', function() { |
27 | - expect(element(by.id('siteaction-mapadosite')).getText()).toEqual('Mapa do Site'); | 29 | + expect(page.actionSitemap.getText()).toEqual('Mapa do Site'); |
28 | }); | 30 | }); |
29 | }); | 31 | }); |
30 | 32 |
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | +module.exports = (function() { | ||
2 | + 'use strict'; | ||
3 | + | ||
4 | + var PageObject = function() { | ||
5 | + this.skipToContent = element(by.id('skip-to-content')); | ||
6 | + this.skipToNavigation = element(by.id('skip-to-navigation')); | ||
7 | + this.skipToSearch = element(by.id('skip-to-search')); | ||
8 | + this.skipToFooter = element(by.id('skip-to-footer')); | ||
9 | + | ||
10 | + this.actionAccessibility = element(by.id('siteaction-accessibility')); | ||
11 | + this.actionContrast = element(by.id('siteaction-contrast')); | ||
12 | + this.actionSitemap = element(by.id('siteaction-sitemap')); | ||
13 | + }; | ||
14 | + | ||
15 | + return (new PageObject()); | ||
16 | +})(); |
src/app/components/a11y-bar/a11y-bar.html
@@ -36,10 +36,10 @@ | @@ -36,10 +36,10 @@ | ||
36 | <a id="siteaction-accessibility" href="#" title="Acessibilidade" accesskey="5" ng-click="actionAccessibility()">Acessibilidade</a> | 36 | <a id="siteaction-accessibility" href="#" title="Acessibilidade" accesskey="5" ng-click="actionAccessibility()">Acessibilidade</a> |
37 | </li> | 37 | </li> |
38 | <li> | 38 | <li> |
39 | - <a id="siteaction-contraste" href="#" title="Alto Contraste" accesskey="6" ng-click="actionContrast()">Alto Contraste</a> | 39 | + <a id="siteaction-contrast" href="#" title="Alto Contraste" accesskey="6" ng-click="actionContrast()">Alto Contraste</a> |
40 | </li> | 40 | </li> |
41 | <li> | 41 | <li> |
42 | - <a id="siteaction-mapadosite" ui-sref="mapa-do-site" title="Mapa do Site" accesskey="7" ng-click="actionSitemap()">Mapa do Site</a> | 42 | + <a id="siteaction-sitemap" ui-sref="mapa-do-site" title="Mapa do Site" accesskey="7" ng-click="actionSitemap()">Mapa do Site</a> |
43 | </li> | 43 | </li> |
44 | </ul> | 44 | </ul> |
45 | </div> | 45 | </div> |