提交 d95ace7a 编写于 作者: shutao-dc's avatar shutao-dc

pages.test.js部分scroll-view示例自动化截图功能转到scroll-view目录xx.test.js示例中。截图时限制滚动条显示 防止滚动条截图可能消失问题

上级 b5c380fd
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('component-native-scroll-view', () => {
describe('component-native-scroll-view-props', () => {
let page;
beforeAll(async () => {
......@@ -82,4 +82,15 @@ describe('component-native-scroll-view', () => {
expect(scrollLeft-930).toBeGreaterThanOrEqual(0)
})
//截图对比
it('scroll-view-props-screenshot', async () => {
//禁止滚动条
await page.setData({
showScrollbar: false
})
await page.waitFor(300);
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
})
});
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('test title', () => {
describe('component-native-scroll-view-refresher', () => {
if (process.env.uniTestPlatformInfo.startsWith('android')) {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher');
await page.waitFor(300);
});
it('scroll-view-refresher-screenshot', async () => {
//禁止滚动条
await page.setData({
showScrollbar: false
})
await page.waitFor(300);
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
})
it('check_refresher', async () => {
await page.setData({
......
......@@ -3,7 +3,7 @@
<page-head title="scroll-view 下拉刷新"></page-head>
<scroll-view class="scroll" refresher-enabled=true :refresher-triggered="refresherTriggered"
@refresherrefresh="onRefresherrefresh" @refresherabort="onRefresherabort" @refresherrestore="onRefresherrestore"
@refresherpulling="onRefresherpulling" @scrolltolower="onScrolltolower">
@refresherpulling="onRefresherpulling" @scrolltolower="onScrolltolower" :show-scrollbar="showScrollbar">
<view v-for="key in scrollData" :key="key">
<view class="scroll-item">
<text class="scroll-item-title">{{key}}</text>
......@@ -18,7 +18,8 @@
return {
scrollData: [] as Array<string>,
refresherTriggered: false,
refresherrefresh: false
refresherrefresh: false,
showScrollbar: true
};
},
onLoad() {
......
describe('component-native-scroll-view', () => {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/scroll-view/scroll-view');
await page.waitFor(300);
});
it('scroll-view-screenshot', async () => {
//禁止滚动条
await page.setData({
showScrollbar: false
})
await page.waitFor(300);
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
});
});
......@@ -11,7 +11,7 @@
</view>
<view>
<scroll-view :scroll-top="scrollTop" direction="vertical" class="scroll-Y" scroll-with-animation="true"
@scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll">
@scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" :show-scrollbar="showScrollbar">
<view class="scroll-view-item uni-bg-red"><text class="text">A</text></view>
<view class="scroll-view-item uni-bg-green"><text class="text">B</text></view>
<view class="scroll-view-item uni-bg-blue"><text class="text">C</text></view>
......@@ -26,7 +26,7 @@
<text class="uni-subtitle-text">横向滚动</text>
</view>
<view>
<scroll-view class="scroll-view_H" direction="horizontal" @scroll="scroll" :scroll-left="120">
<scroll-view class="scroll-view_H" direction="horizontal" @scroll="scroll" :scroll-left="120" :show-scrollbar="showScrollbar">
<view class="scroll-view-item_H uni-bg-red"><text class="text">A</text></view>
<view class="scroll-view-item_H uni-bg-green"><text class="text">B</text></view>
<view class="scroll-view-item_H uni-bg-blue"><text class="text">C</text></view>
......@@ -70,6 +70,7 @@
return {
scrollTop: 0,
oldScrollTop: 0,
showScrollbar: true
}
},
methods: {
......
......@@ -22,10 +22,7 @@ const pages = [
'/pages/component/rich-text/rich-text-tags',
'/pages/component/rich-text/rich-text',
'/pages/component/scroll-view/scroll-view-custom-refresher-props',
'/pages/component/scroll-view/scroll-view-props',
'/pages/component/scroll-view/scroll-view-refresher-props',
'/pages/component/scroll-view/scroll-view-refresher',
'/pages/component/scroll-view/scroll-view',
'/pages/component/slider/slider',
'/pages/component/slider-100/slider-100',
'/pages/component/swiper/swiper',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册