No Description

flip.test.js 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**
  2. * @jest-environment puppeteer
  3. * @flow
  4. */
  5. import { scroll, screenshot } from '../utils/puppeteer.js';
  6. it('should flip from right to bottom', async () => {
  7. const page = await browser.newPage();
  8. await page.goto(`${TEST_URL}/modifiers/flip/main.html`);
  9. await scroll(page, '.scroll1', 400);
  10. expect(await screenshot(page)).toMatchImageSnapshot();
  11. });
  12. it('should flip from -end to -start variation', async () => {
  13. const page = await browser.newPage();
  14. await page.goto(`${TEST_URL}/modifiers/flip/checkVariation.html`);
  15. expect(await screenshot(page)).toMatchImageSnapshot();
  16. });
  17. it('should flip from -end to -start variation while maintaining main axis flipping', async () => {
  18. const page = await browser.newPage();
  19. await page.goto(`${TEST_URL}/modifiers/flip/checkVariation.html`);
  20. await scroll(page, 'html', 200);
  21. expect(await screenshot(page)).toMatchImageSnapshot();
  22. });
  23. it('larger: should be flipped to -end variation', async () => {
  24. const page = await browser.newPage();
  25. await page.goto(`${TEST_URL}/modifiers/flip/checkVariation-larger.html`);
  26. await scroll(page, 'html', 0);
  27. expect(await screenshot(page)).toMatchImageSnapshot();
  28. });
  29. it('larger: should be flipped to -start variation when -end does not fit', async () => {
  30. const page = await browser.newPage();
  31. await page.goto(`${TEST_URL}/modifiers/flip/checkVariation-larger.html`);
  32. await scroll(page, 'html', 500);
  33. expect(await screenshot(page)).toMatchImageSnapshot();
  34. });
  35. it('shorter: should be flipped to -start variation', async () => {
  36. const page = await browser.newPage();
  37. await page.goto(`${TEST_URL}/modifiers/flip/checkVariation-shorter.html`);
  38. await scroll(page, 'html', 0);
  39. expect(await screenshot(page)).toMatchImageSnapshot();
  40. });
  41. it('shorter: should be flipped to original -end variation when it fits', async () => {
  42. const page = await browser.newPage();
  43. await page.goto(`${TEST_URL}/modifiers/flip/checkVariation-shorter.html`);
  44. await scroll(page, 'html', 600);
  45. expect(await screenshot(page)).toMatchImageSnapshot();
  46. });
  47. it('should not flip variations with `flipVariations: false`', async () => {
  48. const page = await browser.newPage();
  49. await page.goto(`${TEST_URL}/modifiers/flip/flipVariations-false.html`);
  50. expect(await screenshot(page)).toMatchImageSnapshot();
  51. });
  52. it('should flip from right to bottom', async () => {
  53. const page = await browser.newPage();
  54. await page.goto(`${TEST_URL}/modifiers/flip/alt-boundary.html`);
  55. await scroll(page, '.scroll1', 400);
  56. expect(await screenshot(page)).toMatchImageSnapshot();
  57. });
  58. it('should not flip to the top', async () => {
  59. const page = await browser.newPage();
  60. await page.goto(`${TEST_URL}/modifiers/flip/altAxis-false.html`);
  61. expect(await screenshot(page)).toMatchImageSnapshot();
  62. });