Skip to content
This repository was archived by the owner on May 22, 2019. It is now read-only.

Commit 3c557bf

Browse files
authored
Merge pull request #176 from Financial-Times/viewports
Viewports
2 parents 2b74a11 + 54b2271 commit 3c557bf

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

config/.pa11yci.js

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
const extend = require('node.extend');
2+
13
const viewports = process.env.PA11Y_VIEWPORTS || [
24
{
3-
width: 1440,
4-
height: 1220
5+
width: 1280,
6+
height: 800
57
}
68
];
79

@@ -30,6 +32,7 @@ const config = {
3032
}
3133
},
3234
timeout: 50000,
35+
wait: 300 || process.env.PA11Y_WAIT,
3336
hideElements: 'iframe[src*=google],iframe[src*=proxy]',
3437
rules: ['Principle1.Guideline1_3.1_3_1_AAA']
3538
},
@@ -74,10 +77,6 @@ smoke.forEach((smokeConfig) => {
7477
url: process.env.TEST_URL + url
7578
}
7679

77-
if (process.env.TEST_URL.includes('local')) {
78-
thisUrl.screenCapture = './pa11y_screenCapture/' + url + '.png';
79-
}
80-
8180
// Do we have test-specific headers?
8281
if (smokeConfig.headers) {
8382
thisUrl.page = {};
@@ -116,8 +115,22 @@ smoke.forEach((smokeConfig) => {
116115

117116
for (let viewport of viewports) {
118117
for (let url of urls) {
119-
url.viewport = viewport;
120-
config.urls.push(url);
118+
119+
const resultUrl = extend(true, {page: {viewport: viewport}}, url);
120+
121+
if (process.env.TEST_URL.includes('local')) {
122+
123+
const path = resultUrl.url.substring(resultUrl.url.lastIndexOf('/'));
124+
125+
let appFlags = 'no-flags';
126+
127+
if (resultUrl.page && resultUrl.page.headers) {
128+
const flags = resultUrl.page.headers['FT-Flags'];
129+
appFlags = flags.substring(0, flags.indexOf(DEFAULT_FLAGS) - 1);
130+
}
131+
resultUrl.screenCapture = `./pa11y_screenCapture/${viewport.width}x${viewport.height}/${appFlags}/${path || 'root'}.png`;
132+
}
133+
config.urls.push(resultUrl);
121134
}
122135
}
123136

0 commit comments

Comments
 (0)