提交 a1803cd2 编写于 作者: P pissang

test(visual): fix puppeteer@9 screenshot resize bug.

Add package.json to fix the dependencies
Optimize test cases
上级 3e1dd6ca
......@@ -49,13 +49,13 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
require([
'echarts',
/*'map/js/china', */
/* './data/nutrients.json' */
], function (echarts) {
var option;
// $.getJSON('./data/nutrients.json', function (data) {});
option = {
xAxis: {},
......
......@@ -87,13 +87,11 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
$.ajax({
url: 'data/svg/Veins_Medical_Diagram_clip_art.svg',
dataType: 'text'
}).done(function (svg) {
require([
'echarts',
'data/svg/Veins_Medical_Diagram_clip_art.svg'
], function (echarts, svg) {
var option;
echarts.registerMap('seatmap', {
svg: svg
});
......@@ -201,8 +199,6 @@ under the License.
}
});
});
</script>
......@@ -212,14 +208,11 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
$.ajax({
url: 'data/svg/Sicily_prehellenic_topographic_map.svg',
dataType: 'text'
}).done(function (svg) {
require([
'echarts',
'data/svg/Sicily_prehellenic_topographic_map.svg'
], function (echarts, svg) {
var option;
echarts.registerMap('sicily', {
svg: svg
});
......@@ -332,8 +325,6 @@ under the License.
listenAndPrintEvent(chart);
});
});
</script>
......@@ -346,10 +337,11 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
fetch('data/svg/Map_of_Iceland.svg').then(response => response.text()).then((svg) => {
require([
'echarts',
'data/svg/Map_of_Iceland.svg'
], function (echarts, svg) {
var option;
echarts.registerMap('Map_of_Iceland', {
svg: svg
});
......@@ -474,7 +466,6 @@ under the License.
});
});
</script>
......@@ -489,11 +480,11 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
fetch('data/svg/Beef_cuts_France.svg').then(response => response.text()).then((svg) => {
require([
'echarts',
'data/svg/Beef_cuts_France.svg'
], function (echarts, svg) {
var option;
echarts.registerMap('Beef_cuts_France', {
svg: svg
......@@ -570,7 +561,6 @@ under the License.
});
});
</script>
......@@ -583,10 +573,11 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
fetch('data/svg/MacOdrum-LV5-floorplan-web.svg').then(response => response.text()).then((svg) => {
require([
'echarts',
'data/svg/MacOdrum-LV5-floorplan-web.svg'
], function (echarts, svg) {
var option;
echarts.registerMap('MacOdrum-LV5-floorplan-web', {
svg: svg
});
......@@ -691,7 +682,6 @@ under the License.
}
});
});
</script>
......@@ -699,9 +689,11 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
fetch('data/svg/ksia-ext-plan-min.svg').then(response => response.text()).then((svg) => {
require([
'echarts',
'data/svg/ksia-ext-plan-min.svg'
], function (echarts, svg) {
var option;
echarts.registerMap('ksia-ext-plan', {
svg: svg
......@@ -894,16 +886,9 @@ under the License.
}
});
});
</script>
</body>
</html>
......@@ -527,13 +527,10 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
$.ajax({
url: 'data/svg/flight-seats.svg',
dataType: 'text'
}).done(function (svg) {
require([
'echarts',
'data/svg/flight-seats.svg'
], function (echarts, svg) {
echarts.registerMap('flight-seats', {
svg: svg
});
......@@ -587,8 +584,6 @@ under the License.
listenAndPrintEvent(chart);
});
});
</script>
......@@ -597,13 +592,10 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
$.ajax({
url: 'data/svg/seatmap-example.svg',
dataType: 'text'
}).done(function (svg) {
require([
'echarts',
'data/svg/seatmap-example.svg'
], function (echarts, svg) {
echarts.registerMap('seatmap', {
svg: svg
});
......@@ -651,10 +643,7 @@ under the License.
});
listenAndPrintEvent(chart);
});
});
</script>
......@@ -662,13 +651,11 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
$.ajax({
url: 'data/svg/seatmap-example.svg',
dataType: 'text'
}).done(function (svg) {
require([
'echarts',
'data/svg/seatmap-example.svg'
], function (echarts, svg) {
var option;
echarts.registerMap('seatmap', {
svg: svg
});
......@@ -724,10 +711,7 @@ under the License.
});
listenAndPrintEvent(chart);
});
});
</script>
......
......@@ -39,7 +39,7 @@
var exportsPlaceholder = {};
var ALLOWED_EXTS = [
'gexf', 'txt', 'csv', // text
'gexf', 'txt', 'csv', 'svg', // text
'js', 'json'
];
......
......@@ -110,6 +110,9 @@ async function takeScreenshot(page, fullPage, fileUrl, desc, isExpected, minor)
let screenshotPath = path.join(getScreenshotDir(), `${screenshotName}-${screenshotPrefix}.png`);
await page.screenshot({
path: screenshotPath,
// https://github.com/puppeteer/puppeteer/issues/7043
// https://github.com/puppeteer/puppeteer/issues/6921#issuecomment-829586680
captureBeyondViewport: false,
fullPage
});
......@@ -214,7 +217,10 @@ async function runTestPage(browser, testOpt, version, runtimeCode, isExpected) {
});
try {
await page.setViewport({width: 800, height: 600});
await page.setViewport({
width: 800,
height: 600
});
await page.goto(`${origin}/test/${fileUrl}?__RENDERER__=${program.renderer}`, {
waitUntil: 'networkidle2',
timeout: 10000
......
{
"name": "apache-echarts-visual-regression-test",
"version": "1.0.0",
"description": "Apache ECharts Visual Regression Test",
"devDependencies": {
"puppeteer": "^9.1.1"
}
}
......@@ -203,7 +203,7 @@ function checkPuppeteer() {
try {
const packageConfig = require('puppeteer/package.json');
console.log(`puppeteer version: ${packageConfig.version}`);
return semver.satisfies(packageConfig.version, '>=5.5.0');
return semver.satisfies(packageConfig.version, '>=9.0.0');
}
catch (e) {
return false;
......@@ -214,7 +214,7 @@ function checkPuppeteer() {
async function start() {
if (!checkPuppeteer()) {
// TODO Check version.
console.error(`Can't find puppeteer >= 5.5.0, use 'npm install puppeteer --no-save' to install or update`);
console.error(`Can't find puppeteer >= 9.0.0, run 'npm install' to update in the 'test/runTest' folder`);
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册