show-modal.test.js 18.2 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
  if (platformInfo.indexOf('15.5') != -1 || platformInfo.indexOf('13.7') != -1) {
    it('暂时规避 ios 15.5 & 13.7 测试异常', () => {
9 10 11 12
      expect(1).toBe(1)
    })
    return
  }
13

杜庆泉's avatar
杜庆泉 已提交
14
  beforeAll(async () => {
15
    page = await program.reLaunch('/pages/API/show-modal/show-modal')
DCloud-WZF's avatar
DCloud-WZF 已提交
16
    await page.waitFor('view');
杜庆泉's avatar
杜庆泉 已提交
17 18 19 20 21

  });


  it("onload-modal-test", async () => {
22
    if (isApp) {
23
      await page.waitFor(500);
杜庆泉's avatar
杜庆泉 已提交
24 25
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
26
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
27 28

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


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

63
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
64 65
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
66
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
67 68

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

  })


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

104
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
105 106
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
107
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
108 109

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

  })


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

145
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
146 147
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
148
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
149 150

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

  })


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

186
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
187 188
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
189
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
190 191

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

  })


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

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

  })


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

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

  })


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

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

  })


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

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

  })


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

387
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
388 389
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
390
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
391 392

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

  })


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

428
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
429 430
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
431
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
432 433

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

  })


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

469
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
470 471
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
472
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
473 474

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

  })


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

510
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
511 512
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
513
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
514 515

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

  })


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

551
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
552 553
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
554
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
555 556

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

  })


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

592
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
593 594
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
595
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
596 597

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

  })



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

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

  })


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

674
    if (isApp) {
杜庆泉's avatar
杜庆泉 已提交
675 676
      const res = await page.callMethod('jest_getWindowInfo')
      const windowHeight = res.windowHeight * res.pixelRatio;
677
      const windowWidth = res.windowWidth * res.pixelRatio;
杜庆泉's avatar
杜庆泉 已提交
678 679

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

  })


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

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

  })

});