background-image.test.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. describe('background-image-test', () => {
  2. let page;
  3. beforeAll(async () => {
  4. page = await program.reLaunch('/pages/CSS/background/background-image');
  5. await page.waitFor(600);
  6. });
  7. it('background-image-screenshot', async () => {
  8. await page.waitFor(300);
  9. const image = await program.screenshot({
  10. fullPage: true
  11. });
  12. expect(image).toSaveImageSnapshot();
  13. });
  14. it('background-image-select', async () => {
  15. await page.callMethod('updateBackgroundSelect')
  16. await page.waitFor(300);
  17. const image = await program.screenshot({
  18. fullPage: true
  19. });
  20. expect(image).toSaveImageSnapshot();
  21. });
  22. it('动态切换 background color', async () => {
  23. await page.callMethod('setBackgroundColor')
  24. await page.waitFor(300);
  25. const image = await program.screenshot({
  26. fullPage: true
  27. });
  28. expect(image).toSaveImageSnapshot();
  29. })
  30. it('动态切换 background color/image', async () => {
  31. await page.callMethod('setBackgroundImage')
  32. await page.waitFor(300);
  33. const image = await program.screenshot({
  34. fullPage: true
  35. });
  36. expect(image).toSaveImageSnapshot();
  37. })
  38. });