ci: Improve CI pipeline (#1790)

This commit is contained in:
Niklas von Hertzen 2019-04-06 23:07:52 -07:00 committed by GitHub
parent 24823d0491
commit c45ef099fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 2358 additions and 1023 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
/dist
/tmp
/build
/nbproject/
image.jpg

View File

@ -5,6 +5,7 @@ scripts/
src/
tests/
www/
tmp/
.github/
*.iml
.babelrc
@ -13,6 +14,7 @@ www/
.npmignore
.eslintrc
.travis.yml
azure-pipelines.yml
karma.js
karma.conf.js
webpack.config.js

View File

@ -1,18 +1,15 @@
language: node_js
node_js:
- '7'
- '10'
stages:
- test
- release
env:
global:
- secure: eW41gIqOizwO4pTgWnAAbW75AP7F+CK9qfSed/fSh4sJ9HWMIY1YRIaY8gjr+6jV/f7XVHcXuym6ZxgINYSkVKbF1JKxBJNLOXtSgNbVHSic58pYFvUjwxIBI9aPig9uux1+DbnpWqXFDTcACJSevQZE0xwmjdrSkDLgB0G34v8=
- secure: Y2Av+Gd3z9uQEB36GwdOOuGka0hx0/HeitASEo59z934O8RxnmN9eNTXS7dDT3XtKtwxIyLTOEpS7qlRdWahH28hr/dS4xJj6ao58C+1xMcDs6NAPGmDxUlcJWpcGEsnjmXjQCc3fBioSTdpIBrK/gdvgpNh77UKG74Sk7Z+YGk=
addons:
chrome: stable
firefox: latest
dist: trusty
sudo: true
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
notifications:
webhooks:
urls:
@ -20,38 +17,72 @@ notifications:
on_success: always
on_failure: always
on_start: false
script:
- npm run build
- cd www && npm install && npm run build && cd ..
- npm test
deploy:
- provider: npm
email: niklasvh@gmail.com
api_key:
secure: G/Szpr8q4/D6hp+H/Z9yyluUXtHAwf7LLa1Y07X59/Enlj1h7V5fQ7AW4/iAVM3XbIsrCPWR3dJU9g/ZxpxFg4OovIHVpS2Jr/mahtPYWdHR3pWuSmMW8QD+Twnq2VAFwSgg5Oumq3QxhX3YbCOnZox6+6Uviqk8FO7Z5B0RwW4=
skip_cleanup: true
on:
tags: true
branch: master
repo: niklasvh/html2canvas
- provider: releases
api_key:
secure: "PowO/Jat660k3gHcjgI6DlJz15RM7pLUu11UPsLCtYJ8ZwodppE6Keg0DfVkSFSIZttZor+UssDwP/WOEqfZNLqmXbcj3Gec4xolohet/GOe0KJKKuF/HgggbcxumopxMX6sMVePlMBpkLpHh7tgEAEHBWTlzC1c1a7Xa48fZ7k="
file:
- "dist/html2canvas.js"
- "dist/html2canvas.min.js"
skip_cleanup: true
on:
tags: true
branch: master
repo: niklasvh/html2canvas
- provider: pages
skip_cleanup: true
local_dir: www/public
target_branch: gh-pages
fqdn: html2canvas.hertzen.com
github_token:
secure: "PowO/Jat660k3gHcjgI6DlJz15RM7pLUu11UPsLCtYJ8ZwodppE6Keg0DfVkSFSIZttZor+UssDwP/WOEqfZNLqmXbcj3Gec4xolohet/GOe0KJKKuF/HgggbcxumopxMX6sMVePlMBpkLpHh7tgEAEHBWTlzC1c1a7Xa48fZ7k="
on:
branch: master
repo: niklasvh/html2canvas
install:
- npm ci
cache: npm
jobs:
include:
- stage: test
name: "Browser test - Internet Explorer 11"
os: windows
filter_secrets: false
if: type = push AND repo=niklasvh/html2canvas
script:
- npm run build
- dir "c:\"
- dir "c:\Program Files"
- dir "c:\Program Files\internet explorer"
- dir "c:\Program Files (x86)"
- dir "c:\Program Files (x86)\internet explorer"
- "c:\Program Files (x86)\internet explorer\iexplore.exe" http://blog.hertzen.com/
- TARGET_BROWSER=IE_11 IE_BIN="c:\Program Files (x86)\Internet Explorer\iexplore.exe" npm run karma
- stage: test
name: "Build docs"
script:
- npm run build && cd www && npm install && npm run build && cd ..
- stage: release
name: "Deploy docs"
script: skip
if: type = push AND branch=master AND repo=niklasvh/html2canvas
deploy:
provider: pages
skip_cleanup: true
local_dir: www/public
target_branch: gh-pages
fqdn: html2canvas.hertzen.com
github_token:
secure: "PowO/Jat660k3gHcjgI6DlJz15RM7pLUu11UPsLCtYJ8ZwodppE6Keg0DfVkSFSIZttZor+UssDwP/WOEqfZNLqmXbcj3Gec4xolohet/GOe0KJKKuF/HgggbcxumopxMX6sMVePlMBpkLpHh7tgEAEHBWTlzC1c1a7Xa48fZ7k="
on:
branch: master
repo: niklasvh/html2canvas
- stage: release
name: "GitHub release"
script: skip
if: type = push AND tag IS present AND branch=master AND repo=niklasvh/html2canvas
deploy:
provider: releases
api_key:
secure: "PowO/Jat660k3gHcjgI6DlJz15RM7pLUu11UPsLCtYJ8ZwodppE6Keg0DfVkSFSIZttZor+UssDwP/WOEqfZNLqmXbcj3Gec4xolohet/GOe0KJKKuF/HgggbcxumopxMX6sMVePlMBpkLpHh7tgEAEHBWTlzC1c1a7Xa48fZ7k="
file:
- "dist/html2canvas.js"
- "dist/html2canvas.min.js"
skip_cleanup: true
on:
tags: true
branch: master
repo: niklasvh/html2canvas
- stage: release
name: "npm release"
script: skip
if: type = push AND tag IS present AND branch=master AND repo=niklasvh/html2canvas
deploy:
provider: npm
email: niklasvh@gmail.com
api_key:
secure: G/Szpr8q4/D6hp+H/Z9yyluUXtHAwf7LLa1Y07X59/Enlj1h7V5fQ7AW4/iAVM3XbIsrCPWR3dJU9g/ZxpxFg4OovIHVpS2Jr/mahtPYWdHR3pWuSmMW8QD+Twnq2VAFwSgg5Oumq3QxhX3YbCOnZox6+6Uviqk8FO7Z5B0RwW4=
skip_cleanup: true
on:
tags: true
branch: master
repo: niklasvh/html2canvas
script: skip

View File

@ -4,7 +4,7 @@ html2canvas
[Homepage](https://html2canvas.hertzen.com) | [Downloads](https://github.com/niklasvh/html2canvas/releases) | [Questions](http://stackoverflow.com/questions/tagged/html2canvas?sort=newest) | [Donate](https://www.gittip.com/niklasvh/)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/niklasvh/html2canvas?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Build Status](https://travis-ci.org/niklasvh/html2canvas.svg)](https://travis-ci.org/niklasvh/html2canvas)
[![Build Status](https://dev.azure.com/niklasvh/html2canvas/_apis/build/status/niklasvh.html2canvas?branchName=master)](https://dev.azure.com/niklasvh/html2canvas/_build/latest?definitionId=1&branchName=master)
[![NPM Downloads](https://img.shields.io/npm/dm/html2canvas.svg)](https://www.npmjs.org/package/html2canvas)
[![NPM Version](https://img.shields.io/npm/v/html2canvas.svg)](https://www.npmjs.org/package/html2canvas)

296
azure-pipelines.yml Normal file
View File

@ -0,0 +1,296 @@
trigger:
- master
jobs:
- job: Build
displayName: Build
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: Npm@0
inputs:
command: install
- script: npm run build
displayName: Build
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'dist'
artifactName: dist
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'build'
artifactName: build
- job: Test
displayName: Tests
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: Npm@0
inputs:
command: install
- script: npm run build
displayName: Build
- script: npm run lint
displayName: Lint
- script: npm run flow
displayName: Flow
- script: npm run test:node
displayName: Unit tests
- job: Build_docs
displayName: Build docs
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: Npm@0
inputs:
command: install
- script: npm run build && cd www && npm install && npm run build && cd ..
displayName: Build docs
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'www/public'
artifactName: docs
- job: Browser_Tests_Linux_Firefox_Stable
displayName: Linux Firefox Stable
pool:
vmImage: 'Ubuntu-16.04'
variables:
TARGET_BROWSER: Firefox_Stable
dependsOn: Build
condition: succeeded()
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: Npm@0
inputs:
command: install
- task: DownloadBuildArtifacts@0
displayName: 'Download library'
inputs:
artifactName: dist
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download testrunner'
inputs:
artifactName: build
downloadPath: $(System.DefaultWorkingDirectory)
- script: Xvfb :99 &
displayName: 'Start Xvfb'
- script: DISPLAY=:99 npm run karma
displayName: 'Run Firefox tests - Firefox Stable'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: 'tmp/junit/*.xml'
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
PathtoPublish: 'tmp/reftests'
artifactName: ReftestResults
- job: Browser_Tests_Linux_Chrome_Stable
displayName: Linux Chrome Stable
pool:
vmImage: 'Ubuntu-16.04'
variables:
TARGET_BROWSER: Chrome_Stable
dependsOn: Build
condition: succeeded()
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: Npm@0
inputs:
command: install
- task: DownloadBuildArtifacts@0
displayName: 'Download library'
inputs:
artifactName: dist
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download testrunner'
inputs:
artifactName: build
downloadPath: $(System.DefaultWorkingDirectory)
- script: Xvfb :99 &
displayName: 'Start Xvfb'
- script: DISPLAY=:99 npm run karma
displayName: 'Run Chrome tests - Chrome Stable'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: 'tmp/junit/*.xml'
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
PathtoPublish: 'tmp/reftests'
artifactName: ReftestResults
- job: Browser_Tests_OSX_Safari_Stable
displayName: OSX Safari Stable
pool:
vmImage: 'macOS-10.13'
variables:
TARGET_BROWSER: Safari_Stable
dependsOn: Build
condition: succeeded()
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: Npm@0
inputs:
command: install
- task: DownloadBuildArtifacts@0
displayName: 'Download library'
inputs:
artifactName: dist
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download testrunner'
inputs:
artifactName: build
downloadPath: $(System.DefaultWorkingDirectory)
- script: npm run karma
displayName: 'Run Safari tests - Safari Stable'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: 'tmp/junit/*.xml'
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
PathtoPublish: 'tmp/reftests'
artifactName: ReftestResults
- job: Browser_Tests_Windows_IE9
displayName: Windows Internet Explorer 9 (Emulated)
pool:
vmImage: 'vs2017-win2016'
variables:
TARGET_BROWSER: IE_9
dependsOn: Build
condition: succeeded()
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: Npm@0
inputs:
command: install
- task: DownloadBuildArtifacts@0
displayName: 'Download library'
inputs:
artifactName: dist
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download testrunner'
inputs:
artifactName: build
downloadPath: $(System.DefaultWorkingDirectory)
- script: npm run karma
displayName: 'Run Internet Explorer tests - IE 9'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: 'tmp/junit/*.xml'
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
PathtoPublish: 'tmp/reftests'
artifactName: ReftestResults
- job: Browser_Tests_Windows_IE10
displayName: Windows Internet Explorer 10 (Emulated)
pool:
vmImage: 'vs2017-win2016'
variables:
TARGET_BROWSER: IE_10
dependsOn: Build
condition: succeeded()
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: Npm@0
inputs:
command: install
- task: DownloadBuildArtifacts@0
displayName: 'Download library'
inputs:
artifactName: dist
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download testrunner'
inputs:
artifactName: build
downloadPath: $(System.DefaultWorkingDirectory)
- script: npm run karma
displayName: 'Run Internet Explorer tests - IE 10'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: 'tmp/junit/*.xml'
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
PathtoPublish: 'tmp/reftests'
artifactName: ReftestResults
- job: Browser_Tests_Windows_IE11
displayName: Windows Internet Explorer 11
pool:
vmImage: 'vs2017-win2016'
variables:
TARGET_BROWSER: IE_11
dependsOn: Build
condition: succeeded()
steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'
- task: Npm@0
inputs:
command: install
- task: DownloadBuildArtifacts@0
displayName: 'Download library'
inputs:
artifactName: dist
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download testrunner'
inputs:
artifactName: build
downloadPath: $(System.DefaultWorkingDirectory)
- script: npm run karma
displayName: 'Run Internet Explorer tests - IE 11'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testRunner: JUnit
testResultsFiles: 'tmp/junit/*.xml'
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
PathtoPublish: 'tmp/reftests'
artifactName: ReftestResults

View File

@ -1,82 +1,101 @@
// Karma configuration
// Generated on Sat Aug 05 2017 23:42:26 GMT+0800 (Malay Peninsula Standard Time)
const path = require('path');
const port = 9876;
module.exports = function(config) {
const slLaunchers = (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) ? {} : {
sl_beta_chrome: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 10',
version: 'beta'
},
sl_ie9: {
const launchers = {
SauceLabs_IE9: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '9.0',
platform: 'Windows 7'
},
sl_ie10: {
SauceLabs_IE10: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '10.0',
platform: 'Windows 7'
},
sl_ie11: {
SauceLabs_IE11: {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11.0',
platform: 'Windows 7'
},
sl_edge_15: {
SauceLabs_Edge18: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
version: '15.15063',
version: '18.17763',
platform: 'Windows 10'
},
sl_edge_14: {
base: 'SauceLabs',
browserName: 'MicrosoftEdge',
version: '14.14393',
platform: 'Windows 10'
},
sl_safari: {
base: 'SauceLabs',
browserName: 'safari',
version: '10.1',
platform: 'macOS 10.12'
},
'sl_android_4.4': {
SauceLabs_Android4: {
base: 'SauceLabs',
browserName: 'Browser',
platform: 'Android',
version: '4.4',
device: 'Android Emulator',
},
'sl_ios_10.3_safari': {
SauceLabs_iOS10_3: {
base: 'SauceLabs',
browserName: 'Safari',
platform: 'iOS',
version: '10.3',
device: 'iPhone 7 Plus Simulator'
},
'sl_ios_9.3_safari': {
SauceLabs_iOS9_3: {
base: 'SauceLabs',
browserName: 'Safari',
platform: 'iOS',
version: '9.3',
device: 'iPhone 6 Plus Simulator'
},
IE_9: {
base: 'IE',
'x-ua-compatible': 'IE=EmulateIE9',
flags: ['-extoff']
},
IE_10: {
base: 'IE',
'x-ua-compatible': 'IE=EmulateIE10',
flags: ['-extoff']
},
IE_11: {
base: 'IE',
flags: ['-extoff']
},
Safari_Stable: {
base: 'Safari'
},
Chrome_Stable: {
base: 'Chrome'
},
Firefox_Stable: {
base: 'Firefox'
}
};
const customLaunchers = Object.assign({}, slLaunchers, {
const ciLauncher = launchers[process.env.TARGET_BROWSER];
const customLaunchers = ciLauncher ? {target_browser: ciLauncher} : {
stable_chrome: {
base: 'Chrome'
},
stable_firefox: {
base: 'Firefox'
}
});
};
const injectTypedArrayPolyfills = function(files) {
files.unshift({
pattern: path.resolve(__dirname, './node_modules/js-polyfills/typedarray.js'),
included: true,
served: true,
watched: false
});
};
injectTypedArrayPolyfills.$inject = ['config.files'];
config.set({
@ -86,17 +105,22 @@ module.exports = function(config) {
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],
frameworks: ['mocha', 'inline-mocha-fix'],
// list of files / patterns to load in the browser
files: [
'build/testrunner.js',
{ pattern: './tests/**/*', 'watched': true, 'included': false, 'served': true},
{ pattern: './dist/**/*', 'watched': true, 'included': false, 'served': true},
{ pattern: './node_modules/**/*', 'watched': true, 'included': false, 'served': true}
{ pattern: './node_modules/**/*', 'watched': true, 'included': false, 'served': true},
],
plugins: [
'karma-*',
{
'framework:inline-mocha-fix': ['factory', injectTypedArrayPolyfills]
}
],
// list of files to exclude
exclude: [
@ -112,7 +136,11 @@ module.exports = function(config) {
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'saucelabs'],
reporters: ['dots', 'junit'],
junitReporter: {
outputDir: 'tmp/junit/'
},
// web server port
port,

View File

@ -14,6 +14,12 @@ const bodyParser = require('body-parser');
const cors = require('cors');
const filenamifyUrl = require('filenamify-url');
const mkdirp = require('mkdirp');
const screenshotFolder = './tmp/reftests';
mkdirp.sync(path.resolve(__dirname, screenshotFolder));
const CORS_PORT = 8081;
const corsApp = express();
corsApp.use('/proxy', proxy());
@ -59,9 +65,9 @@ const writeScreenshot = (buffer, body) => {
const filename = `${filenamifyUrl(
body.test.replace(/^\/tests\/reftests\//, '').replace(/\.html$/, ''),
{replacement: '-'}
)}!${body.platform.name}-${body.platform.version}.png`;
)}!${[process.env.TARGET_BROWSER, body.platform.name, body.platform.version].join('-')}.png`;
fs.writeFileSync(path.resolve(__dirname, './tests/results/', filename), buffer);
fs.writeFileSync(path.resolve(__dirname, screenshotFolder, filename), buffer);
};
app.post('/screenshot', (req, res) => {

2751
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -40,20 +40,23 @@
"eslint": "4.2.0",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-prettier": "2.1.2",
"express": "4.15.4",
"express": "^4.16.4",
"filenamify-url": "1.0.0",
"flow-bin": "0.56.0",
"glob": "7.1.2",
"html2canvas-proxy": "1.0.1",
"jquery": "3.2.1",
"karma": "1.7.0",
"karma-chrome-launcher": "2.2.0",
"karma-edge-launcher": "0.4.1",
"karma-firefox-launcher": "1.0.1",
"karma-ie-launcher": "1.0.0",
"karma-mocha": "1.3.0",
"karma-sauce-launcher": "1.1.0",
"mocha": "5.2.0",
"js-polyfills": "^0.1.42",
"karma": "^4.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-edge-launcher": "^0.4.2",
"karma-firefox-launcher": "^1.1.0",
"karma-ie-launcher": "^1.0.0",
"karma-junit-reporter": "^1.2.0",
"karma-mocha": "^1.3.0",
"karma-safari-launcher": "^1.0.0",
"karma-sauce-launcher": "^2.0.2",
"mocha": "^6.0.2",
"platform": "1.3.4",
"prettier": "1.5.3",
"promise-polyfill": "6.0.2",

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'
);
}));
});
}
});
});

1
www/static/CNAME Normal file
View File

@ -0,0 +1 @@
html2canvas.hertzen.com