ci: Improve CI pipeline (#1790)

This commit is contained in:
MoyuScript
2019-04-06 23:07:52 -07:00
parent 0730d4165a
commit d480566c82
12 changed files with 2358 additions and 1023 deletions

View File

@ -0,0 +1,2 @@
[Safari]/tests/reftests/acid2.html
[Safari]/tests/reftests/background/encoded.html

View File

@ -75,7 +75,7 @@ const assertPath = (result, expected, desc) => {
.filter(test => {
return (
!Array.isArray(reftests.ignoredTests[test]) ||
reftests.ignoredTests[test].indexOf(query.browser) === -1
reftests.ignoredTests[test].indexOf(platform.name) === -1
);
})
.forEach(url => {
@ -342,79 +342,37 @@ const assertPath = (result, expected, desc) => {
}
if (window.__karma__) {
const MAX_CHUNK_SIZE = 75000;
return new Promise((resolve, reject) => {
const xhr =
'withCredentials' in new XMLHttpRequest()
? new XMLHttpRequest()
: new XDomainRequest();
const sendScreenshot = (tries, body, server) => {
return new Promise((resolve, reject) => {
const xhr =
'withCredentials' in new XMLHttpRequest()
? new XMLHttpRequest()
: new XDomainRequest();
xhr.onload = () => {
if (
typeof xhr.status !== 'number' ||
xhr.status === 200
) {
resolve();
} else {
reject(
`Failed to send screenshot with status ${xhr.status}`
);
}
};
xhr.onerror = reject;
xhr.open('POST', server, true);
xhr.send(body);
}).catch(e => {
if (tries > 0) {
// Older edge browsers and some safari browsers have issues sending large xhr through saucetunnel
const data = canvas.toDataURL();
const totalCount = Math.ceil(
data.length / MAX_CHUNK_SIZE
);
return Promise.all(
Array.apply(
null,
Array(totalCount)
).map((x, part) =>
sendScreenshot(
0,
JSON.stringify({
screenshot: data.substr(
part * MAX_CHUNK_SIZE,
MAX_CHUNK_SIZE
),
part,
totalCount,
test: url,
platform: {
name: platform.name,
version: platform.version
}
}),
'http://localhost:8000/screenshot/chunk'
)
)
xhr.onload = () => {
if (
typeof xhr.status !== 'number' ||
xhr.status === 200
) {
resolve();
} else {
reject(
`Failed to send screenshot with status ${xhr.status}`
);
}
};
xhr.onerror = reject;
return Promise.reject(e);
});
};
return sendScreenshot(
1,
JSON.stringify({
xhr.open('POST', 'http://localhost:8000/screenshot', true);
xhr.send(JSON.stringify({
screenshot: canvas.toDataURL(),
test: url,
platform: {
name: platform.name,
version: platform.version
}
}),
'http://localhost:8000/screenshot'
);
}));
});
}
});
});