show-modal.test.js 18.4 KB
Newer Older
杜庆泉's avatar
杜庆泉 已提交
1 2 3
describe('API-loading', () => {

  let page;
4
  const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
5
  const isApp = process.env.UNI_OS_NAME === "android" || process.env.UNI_OS_NAME === "ios";
杜庆泉's avatar
杜庆泉 已提交
6

7 8 9 10 11 12 13 14
  if (
    platformInfo.indexOf('15.5') != -1 ||
    platformInfo.indexOf('14.5') != -1 ||
    platformInfo.indexOf('13.7') != -1 ||
    platformInfo.indexOf('12.4') != -1
  ) {
    // TODO: 排查 ios 不兼容版本 测试异常原因
    it('ios 15.5 14.5 13.7 12.4 测试异常', () => {
15 16 17 18
      expect(1).toBe(1)
    })
    return
  }
19

杜庆泉's avatar
杜庆泉 已提交
20
  beforeAll(async () => {
21
    page = await program.reLaunch('/pages/API/show-modal/show-modal')
DCloud-WZF's avatar
DCloud-WZF 已提交
22
    await page.waitFor('view');
杜庆泉's avatar
杜庆泉 已提交
23 24 25 26 27

  });


  it("onload-modal-test", async () => {
28
    if (isApp) {
29
      await page.waitFor(500);
杜庆泉's avatar
杜庆泉 已提交
30 31
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
32
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
33 34

      const image = await program.screenshot({
35
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
36 37 38
        area: {
          x: 0,
          y: 200,
39 40
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
41 42
        },
      });
43
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
44 45
    }else{
      const image = await program.screenshot({
46
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
47 48
        fullPage: true
      });
49
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
    }
  })


  it("modal-test-current-0", async () => {

    await page.setData({
      current: 0,
      showCancelSelect: false,
      cancelTextSelect: false,
      confirmTextSelect: false,
      editableSelect: false,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

69
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
70 71
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
72
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
73 74

      const image = await program.screenshot({
75
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
76 77 78
        area: {
          x: 0,
          y: 200,
79 80
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
81 82
        },
      });
83
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
84 85
    }else{
      const image = await program.screenshot({
86
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
87 88
        fullPage: true
      });
89
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    }

  })


  it("modal-test-current-1", async () => {

    await page.setData({
      current: 1,
      showCancelSelect: false,
      cancelTextSelect: false,
      confirmTextSelect: false,
      editableSelect: false,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

110
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
111 112
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
113
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
114 115

      const image = await program.screenshot({
116
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
117 118 119
        area: {
          x: 0,
          y: 200,
120 121
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
122 123
        },
      });
124
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
125 126
    }else{
      const image = await program.screenshot({
127
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
128 129
        fullPage: true
      });
130
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
    }

  })


  it("modal-test-current-2", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: false,
      cancelTextSelect: false,
      confirmTextSelect: false,
      editableSelect: false,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

151
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
152 153
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
154
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
155 156

      const image = await program.screenshot({
157
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
158 159 160
        area: {
          x: 0,
          y: 200,
161 162
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
163 164
        },
      });
165
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
166 167
    }else{
      const image = await program.screenshot({
168
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
169 170
        fullPage: true
      });
171
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
    }

  })


  it("modal-test-current-2-showCancel", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: false,
      confirmTextSelect: false,
      editableSelect: false,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

192
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
193 194
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
195
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
196 197

      const image = await program.screenshot({
198
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
199 200 201
        area: {
          x: 0,
          y: 200,
202 203
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
204 205
        },
      });
206
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
207 208
    }else{
      const image = await program.screenshot({
209
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
210 211
        fullPage: true
      });
212
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
    }

  })


  it("modal-test-current-2-showCancel-cancelText", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: true,
      confirmTextSelect: false,
      editableSelect: false,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

233
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
234 235
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
236
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
237
      const image = await program.screenshot({
238
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
239 240 241
        area: {
          x: 0,
          y: 200,
242 243
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
244 245
        },
      });
246
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
247 248
    }else{
      const image = await program.screenshot({
249
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
250 251
        fullPage: true
      });
252
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
    }

  })


  it("modal-test-current-2-showCancel-cancelText-confirmText", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: true,
      confirmTextSelect: true,
      editableSelect: false,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

273
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
274 275
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
276
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
277
      const image = await program.screenshot({
278
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
279 280 281
        area: {
          x: 0,
          y: 200,
282 283
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
284 285
        },
      });
286
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
287 288
    }else{
      const image = await program.screenshot({
289
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
290 291
        fullPage: true
      });
292
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
    }

  })


  it("modal-test-current-2-showCancel-cancelText-confirmText-editable-placeholder", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: true,
      confirmTextSelect: true,
      editableSelect: true,
      placeholderTextSelect: true,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

313
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
314 315
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
316
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
317
      const image = await program.screenshot({
318
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
319 320 321
        area: {
          x: 0,
          y: 200,
322 323
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
324 325
        },
      });
326
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
327 328
    }else{
      const image = await program.screenshot({
329
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
330 331
        fullPage: true
      });
332
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
    }

  })


  it("modal-test-current-2-showCancel-confirmText-editable-placeholder", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: false,
      confirmTextSelect: true,
      editableSelect: true,
      placeholderTextSelect: true,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

353
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
354 355
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
356
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
357
      const image = await program.screenshot({
358
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
359 360 361
        area: {
          x: 0,
          y: 200,
362 363
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
364 365
        },
      });
366
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
367 368
    }else{
      const image = await program.screenshot({
369
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
370 371
        fullPage: true
      });
372
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392
    }

  })


  it("modal-test-current-2-showCancel-editable-placeholder", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: false,
      confirmTextSelect: false,
      editableSelect: true,
      placeholderTextSelect: true,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

393
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
394 395
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
396
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
397 398

      const image = await program.screenshot({
399
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
400 401 402
        area: {
          x: 0,
          y: 200,
403 404
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
405 406
        },
      });
407
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
408 409
    }else{
      const image = await program.screenshot({
410
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
411 412
        fullPage: true
      });
413
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
    }

  })


  it("modal-test-current-2-showCancel-placeholder", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: false,
      confirmTextSelect: false,
      editableSelect: false,
      placeholderTextSelect: true,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

434
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
435 436
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
437
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
438 439

      const image = await program.screenshot({
440
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
441 442 443
        area: {
          x: 0,
          y: 200,
444 445
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
446 447
        },
      });
448
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
449 450
    }else{
      const image = await program.screenshot({
451
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
452 453
        fullPage: true
      });
454
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474
    }

  })


  it("modal-test-current-2-showCancel", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: false,
      confirmTextSelect: false,
      editableSelect: false,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

475
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
476 477
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
478
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
479 480

      const image = await program.screenshot({
481
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
482 483 484
        area: {
          x: 0,
          y: 200,
485 486
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
487 488
        },
      });
489
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
490 491
    }else{
      const image = await program.screenshot({
492
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
493 494
        fullPage: true
      });
495
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
    }

  })


  it("modal-test-current-2-showCancel-cancelText-editable-placeholder", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: true,
      confirmTextSelect: false,
      editableSelect: true,
      placeholderTextSelect: true,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

516
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
517 518
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
519
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
520 521

      const image = await program.screenshot({
522
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
523 524 525
        area: {
          x: 0,
          y: 200,
526 527
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
528 529
        },
      });
530
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
531 532
    }else{
      const image = await program.screenshot({
533
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
534 535
        fullPage: true
      });
536
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
    }

  })


  it("modal-test-current-2-showCancel-cancelText-placeholder", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: true,
      confirmTextSelect: false,
      editableSelect: false,
      placeholderTextSelect: true,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

557
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
558 559
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
560
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
561 562

      const image = await program.screenshot({
563
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
564 565 566
        area: {
          x: 0,
          y: 200,
567 568
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
569 570
        },
      });
571
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
572 573
    }else{
      const image = await program.screenshot({
574
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
575 576
        fullPage: true
      });
577
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597
    }

  })


  it("modal-test-current-2-showCancel-cancelText", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: true,
      confirmTextSelect: false,
      editableSelect: false,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

598
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
599 600
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
601
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
602 603

      const image = await program.screenshot({
604
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
605 606 607
        area: {
          x: 0,
          y: 200,
608 609
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
610 611
        },
      });
612
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
613 614
    }else{
      const image = await program.screenshot({
615
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
616 617
        fullPage: true
      });
618
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639
    }

  })



  it("modal-test-current-2-showCancel-cancelText-confirmText-placeholder", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: true,
      confirmTextSelect: true,
      editableSelect: false,
      placeholderTextSelect: true,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

640
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
641 642
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
643
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
644
      const image = await program.screenshot({
645
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
646 647 648
        area: {
          x: 0,
          y: 200,
649 650
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
651 652
        },
      });
653
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
654 655
    }else{
      const image = await program.screenshot({
656
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
657 658
        fullPage: true
      });
659
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679
    }

  })


  it("modal-test-current-2-showCancel-cancelText-confirmText", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: true,
      confirmTextSelect: true,
      editableSelect: false,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

680
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
681 682
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
683
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
684 685

      const image = await program.screenshot({
686
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
687 688 689
        area: {
          x: 0,
          y: 200,
690 691
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
692 693
        },
      });
694
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
695 696
    }else{
      const image = await program.screenshot({
697
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
698 699
        fullPage: true
      });
700
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720
    }

  })


  it("modal-test-current-2-showCancel-cancelText-confirmText-editable", async () => {

    await page.setData({
      current: 2,
      showCancelSelect: true,
      cancelTextSelect: true,
      confirmTextSelect: true,
      editableSelect: true,
      placeholderTextSelect: false,
    })

    const btnModalButton = await page.$('#btn-modal-show')
    await btnModalButton.tap()
    await page.waitFor(500);

721
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
722 723
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
724
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
725
      const image = await program.screenshot({
726
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
727 728 729
        area: {
          x: 0,
          y: 200,
730 731
          height: windowHeight - 200,
          width:windowWidth
杜庆泉's avatar
杜庆泉 已提交
732 733
        },
      });
734
      expect(image).toSaveImageSnapshot();
杜庆泉's avatar
杜庆泉 已提交
735 736
    }else{
      const image = await program.screenshot({
737
        deviceShot: true,
杜庆泉's avatar
杜庆泉 已提交
738 739
        fullPage: true
      });
740
      expect(image).toSaveImageSnapshot()
杜庆泉's avatar
杜庆泉 已提交
741 742 743 744 745
    }

  })

});