pages.test.js 5.3 KB
Newer Older
1 2 3 4 5 6 7 8
let pageIndex = 0
const pages = [
  // component
  '/pages/component/button/button',
  '/pages/component/checkbox/checkbox',
  '/pages/component/general-attribute/general-attribute',
  '/pages/component/general-event/general-event',
  '/pages/component/image/image-format',
9
  // '/pages/component/image/image-large', // 截图过大
10
  '/pages/component/image/image-mode',
11
  // '/pages/component/image/image-path', // 网络资源加载,单独测试例截图
12
  '/pages/component/image/image',
13
  // '/pages/component/input/input', // 自动获取焦点,单独测试例截图
14 15 16 17
  '/pages/component/list-view/list-view',
  '/pages/component/navigator/navigate',
  '/pages/component/navigator/navigator',
  '/pages/component/navigator/redirect',
18
  // '/pages/component/picker-view/picker-view', //动态内容
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
  '/pages/component/progress/progress',
  '/pages/component/radio/radio',
  '/pages/component/rich-text/rich-text-complex',
  '/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',
  '/pages/component/switch/switch',
  '/pages/component/text/text-props',
  '/pages/component/text/text',
  '/pages/component/textarea/textarea',
36
  // '/pages/component/video/video',
37
  '/pages/component/view/view',
38
  // '/pages/component/web-view/web-view', // 动态内容
39
  // '/pages/component/web-view-local/web-view-local', // 依赖加载完成回调,单独测试例截图
40
  '/pages/component/general-event/transition-event',
41 42 43 44 45 46 47 48 49 50 51 52 53 54
  
  // CSS
  '/pages/CSS/background/background-color',
  '/pages/CSS/background/background-image',
  '/pages/CSS/border/complex-border/complex-border',
  '/pages/CSS/border/border-bottom',
  '/pages/CSS/border/border-color',
  '/pages/CSS/border/border-left',
  '/pages/CSS/border/border-radius',
  '/pages/CSS/border/border-right',
  '/pages/CSS/border/border-style',
  '/pages/CSS/border/border-top',
  '/pages/CSS/border/border-width',
  '/pages/CSS/border/border',
55
  // '/pages/CSS/box-shadow/box-shadow',
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
  '/pages/CSS/display/flex',
  '/pages/CSS/display/none',
  '/pages/CSS/flex/align-content',
  '/pages/CSS/flex/align-items',
  '/pages/CSS/flex/flex-basis',
  '/pages/CSS/flex/flex-direction',
  '/pages/CSS/flex/flex-flow',
  '/pages/CSS/flex/flex-grow',
  '/pages/CSS/flex/flex-shrink',
  '/pages/CSS/flex/flex',
  '/pages/CSS/flex/justify-content',
  '/pages/CSS/layout/height',
  '/pages/CSS/layout/max-height',
  '/pages/CSS/layout/max-width',
  '/pages/CSS/layout/min-height',
  '/pages/CSS/layout/min-width',
  '/pages/CSS/layout/position',
  '/pages/CSS/layout/visibility',
  '/pages/CSS/layout/width',
  '/pages/CSS/layout/z-index',
  '/pages/CSS/margin/margin-bottom',
  '/pages/CSS/margin/margin-left',
  '/pages/CSS/margin/margin-right',
  '/pages/CSS/margin/margin-top',
  '/pages/CSS/margin/margin',
  '/pages/CSS/padding/padding-bottom',
  '/pages/CSS/padding/padding-left',
  '/pages/CSS/padding/padding-right',
  '/pages/CSS/padding/padding-top',
  '/pages/CSS/padding/padding',
  '/pages/CSS/text/color',
87
  // '/pages/CSS/text/font-family', // 网络资源加载,单独测试例截图
88 89 90 91 92 93 94 95 96 97 98 99 100
  '/pages/CSS/text/font-size',
  '/pages/CSS/text/font-style',
  '/pages/CSS/text/font-weight',
  '/pages/CSS/text/letter-spacing',
  '/pages/CSS/text/line-height',
  '/pages/CSS/text/text-align',
  '/pages/CSS/text/text-decoration-line',
  '/pages/CSS/text/text-overflow',
  '/pages/CSS/transform/rotate',
  '/pages/CSS/transform/scale',
  '/pages/CSS/transform/translate',
  '/pages/CSS/transition/transition',
  
DCloud-yyl's avatar
DCloud-yyl 已提交
101 102 103 104 105
  // tabBar  //改动频繁,不再测试
  // '/pages/tabBar/API',
  // '/pages/tabBar/component',
  // '/pages/tabBar/CSS',
  // '/pages/tabBar/template',
106 107
  
  // template
108
  // '/pages/template/calendar/calendar', // 动态内容
109 110
  '/pages/template/custom-refresher/custom-refresher',
  '/pages/template/custom-tab-bar/custom-tab-bar',
111
  // '/pages/template/drop-card/drop-card',
112
  '/pages/template/half-screen/half-screen',
113
  // '/pages/template/list-news/list-news', // 网络资源加载,单独测试例截图
114
  // '/pages/template/long-list/long-list', // 动态内容
115 116 117 118 119 120
  '/pages/template/navbar-lite/navbar-lite',
  '/pages/template/pull-zoom-image/pull-zoom-image',
  '/pages/template/scroll-fold-nav/scroll-fold-nav',
  '/pages/template/scroll-sticky/scroll-sticky',
  '/pages/template/swiper-list/swiper-list',
  '/pages/template/swiper-list2/swiper-list2',
121
  // '/pages/template/swiper-vertical-video/swiper-vertical-video'
shutao-dc's avatar
shutao-dc 已提交
122 123 124
  
  // api
  '/pages/API/element-draw/element-draw',
125 126
]

127
let page;
DCloud-WZF's avatar
DCloud-WZF 已提交
128
describe("page screenshot test", () => {
129 130 131 132
  beforeAll(async () => {
    console.log("page screenshot test start");
  });
  beforeEach(async () => {
133
    page = await program.reLaunch(pages[pageIndex]);
134 135 136 137 138 139 140 141
    await page.waitFor(1000);
  });
  afterEach(() => {
    pageIndex++;
  });
  afterAll(() => {
    console.log("page screenshot test finish");
  });
DCloud-WZF's avatar
DCloud-WZF 已提交
142
  test.each(pages)("%s", async () => {
143
    const image = await program.screenshot({
DCloud-WZF's avatar
DCloud-WZF 已提交
144
      fullPage: true,
145
    });
146
    expect(image).toMatchImageSnapshot();
147
    await page.waitFor(500);
DCloud-WZF's avatar
DCloud-WZF 已提交
148 149
  });
});