Skip to content

Commit 1974b4c

Browse files
test: add e2e tests for Feedzy Classic Block aspect ratios
1 parent 283064d commit 1974b4c

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
import { test, expect } from '@wordpress/e2e-test-utils-playwright';
5+
6+
test.describe('Feedzy Classic Block', () => {
7+
test('check aspect ratio default', async ({ editor, page, admin }) => {
8+
await admin.createNewPost();
9+
10+
await editor.insertBlock({
11+
name: 'feedzy-rss-feeds/feedzy-block',
12+
attributes: {
13+
feeds: 'https://www.nasa.gov/feeds/iotd-feed/',
14+
max: 1,
15+
},
16+
});
17+
18+
const postId = await editor.publishPost();
19+
await page.goto(`/?p=${postId}`);
20+
21+
const image = page.locator('.feedzy-rss .rss_image img');
22+
await expect(image).toHaveAttribute(
23+
'style',
24+
'height:150px;width:150px;'
25+
);
26+
});
27+
28+
test('check aspect ratio (3/2)', async ({ editor, page, admin }) => {
29+
await admin.createNewPost();
30+
31+
await editor.insertBlock({
32+
name: 'feedzy-rss-feeds/feedzy-block',
33+
attributes: {
34+
aspectRatio: '3/2',
35+
feeds: 'https://www.nasa.gov/feeds/iotd-feed/',
36+
max: 1,
37+
},
38+
});
39+
40+
const postId = await editor.publishPost();
41+
await page.goto(`/?p=${postId}`);
42+
43+
const image = page.locator('.feedzy-rss .rss_image img');
44+
await expect(image).toHaveAttribute('style', /aspect-ratio:\s*3\/2;/i);
45+
});
46+
47+
test('check aspect ratio auto', async ({ editor, page, admin }) => {
48+
await admin.createNewPost();
49+
50+
await editor.insertBlock({
51+
name: 'feedzy-rss-feeds/feedzy-block',
52+
attributes: {
53+
aspectRatio: 'auto',
54+
feeds: 'https://www.nasa.gov/feeds/iotd-feed/',
55+
max: 1,
56+
},
57+
});
58+
59+
const postId = await editor.publishPost();
60+
await page.goto(`/?p=${postId}`);
61+
62+
const image = page.locator('.feedzy-rss .rss_image img');
63+
await expect(image).toHaveAttribute('style', /aspect-ratio:\s*auto;/i);
64+
});
65+
});

0 commit comments

Comments
 (0)