Skip to content

Commit f10b659

Browse files
committed
5317: instagram template tests and changed slide fixtures
1 parent fb32d73 commit f10b659

File tree

2 files changed

+123
-28
lines changed

2 files changed

+123
-28
lines changed

assets/template/fixtures/slide-fixtures.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -889,11 +889,11 @@ const slideFixtures = [
889889
},
890890
darkModeEnabled: false,
891891
content: {
892-
duration: 5000,
892+
duration: 1000,
893893
hashtagText: "#myhashtag",
894-
orientation: "landscape",
895-
imageWidth: 40.0,
896-
entryDuration: 10,
894+
orientation: "vertical",
895+
imageWidth: 20,
896+
entryDuration: 4,
897897
maxEntries: 5,
898898
mediaContain: true,
899899
},
@@ -934,32 +934,32 @@ const slideFixtures = [
934934
},
935935
darkModeEnabled: false,
936936
content: {
937-
duration: 5000,
938-
hashtagText: "#myhashtag",
937+
duration: 1000,
938+
hashtagText: "",
939939
orientation: "landscape",
940-
imageWidth: 40.0,
941-
entryDuration: 10,
940+
imageWidth: 40,
941+
entryDuration: 1,
942942
maxEntries: "",
943943
mediaContain: true,
944944
},
945945
feedData: [
946946
{
947-
text: "#mountains #horizon",
948-
textMarkup:
949-
'<div class="text">Sed nulla lorem, varius sodales justo ac, ultrices placerat nunc.</div>\n<div class="tags"><span class="tag">#mountains</span> <span class="tag">#horizon</span> Lorem ipsum ...</div>',
950-
mediaUrl: "/fixtures/template/images/mountain1.jpeg",
951-
videoUrl: null,
952-
username: "username",
953-
createdTime: "2022-02-03T08:50:07",
947+
username: "username1",
954948
},
955949
{
956-
text: "#mountains #horizon #sky",
957-
textMarkup:
958-
'<div class="text">Aenean consequat sem ut tortor auctor, eget volutpat libero consequat. Donec lacinia varius quam, ut efficitur diam ultrices et. Aliquam eget augue at felis rhoncus egestas. Sed porttitor elit a tellus tempus, sed tempus sapien finibus. Nam at dapibus sem. Aliquam sit amet feugiat ex. Ut dapibus, mi eu fermentum dignissim, sem ipsum vulputate est, sit amet euismod orci odio pharetra massa.</div>\n<div class="tags"><span class="tag">#mountains</span> <span class="tag">#horizon</span> <span class="tag">#sky</span> Lorem ipsum and mountains ...</div>',
959-
mediaUrl: "/fixtures/template/images/mountain2.jpeg",
960-
videoUrl: null,
961950
username: "username2",
962-
createdTime: "2022-01-03T08:50:07",
951+
},
952+
{
953+
username: "username3",
954+
},
955+
{
956+
username: "username4",
957+
},
958+
{
959+
username: "username5",
960+
},
961+
{
962+
username: "username6",
963963
},
964964
],
965965
},
Lines changed: 102 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,108 @@
1+
12
import { test, expect } from "@playwright/test";
23

3-
test("Instagram 0", async ({ page }) => {
4-
await page.goto("/template/instagram-0");
4+
test.describe("instagram-0: ui tests", () => {
5+
test.beforeEach(async ({ page }) => {
6+
await page.goto("/template/instagram-0");
7+
});
58

6-
// TODO
7-
});
9+
test('Should display changing content', async ({ page }) => {
10+
let image = await page.locator('.image.media-contain');
11+
await expect(image).toHaveCSS('background-image', new RegExp('fixtures/template/images/mountain1.jpeg'));
12+
await expect(image).toHaveCSS('animation', '1.5s ease 0s 1 normal none running fade-in');
13+
let userName = await page.locator('.author');
14+
await expect(userName).toHaveText('username');
15+
let descriptionText = await page.locator('.description .text');
16+
await expect(descriptionText).toHaveText(/Sed nulla lorem, varius sodales justo ac, ultrices placerat nunc./);
17+
let firstTag = await page.locator('.tags .tag').nth(0);
18+
let secondTag = await page.locator('.tags .tag').nth(1);
19+
await expect(firstTag).toContainText('#mountains');
20+
await expect(secondTag).toContainText('#horizon');
21+
let brandTag = await page.locator('.brand-tag');
22+
await expect(brandTag).toHaveText('#myhashtag');
23+
await page.waitForTimeout(2000);
24+
image = await page.locator('.image.media-contain');
25+
await expect(image).toHaveCSS('background-image', new RegExp('fixtures/template/images/mountain1.jpeg'));
26+
await expect(image).toHaveCSS('animation', '1.5s ease 0s 1 normal none running fade-in');
27+
userName = await page.locator('.author');
28+
firstTag = await page.locator('.tags .tag').nth(0);
29+
await expect(firstTag).toContainText('mountains');
30+
secondTag = await page.locator('.tags .tag').nth(1);
31+
await expect(secondTag).toContainText('#horizon');
32+
let thirdTag = await page.locator('.tags .tag').nth(2);
33+
await expect(thirdTag).toContainText('#sky');
34+
await expect(userName).toHaveText('username2');
35+
descriptionText = await page.locator('.description .text');
36+
await expect(descriptionText).toHaveText(/Aenean consequat sem ut tortor auctor, eget volutpat libero consequat. Donec lacinia varius quam, ut efficitur diam ultrices et. Aliquam eget augue at felis rhoncus egestas. Sed porttitor elit a tellus tempus, sed tempus sapien finibus. Nam at dapibus sem. Aliquam sit amet feugiat ex. Ut dapibus, mi eu fermentum dignissim, sem ipsum vulputate est, sit amet euismod orci odio pharetra massa./);
37+
brandTag = await page.locator('.brand-tag');
38+
await expect(brandTag).toHaveText('#myhashtag');
39+
await page.waitForTimeout(3000);
40+
let video = await page.locator('video');
41+
await expect(video).toHaveAttribute('autoplay', '');
42+
await expect(video).toHaveAttribute('loop', '');
43+
userName = await page.locator('.author');
44+
await expect(userName).toHaveText('username2');
45+
descriptionText = await page.locator('.description .text');
46+
await expect(descriptionText).toHaveText(/Interdum et malesuada fames ac ante ipsum primis/);
47+
firstTag = await page.locator('.tags .tag').nth(0);
48+
await expect(firstTag).toContainText('#video');
49+
brandTag = await page.locator('.brand-tag');
50+
await expect(brandTag).toHaveText('#myhashtag');
51+
})
52+
53+
test('Should display brand tag', async ({ page }) => {
54+
const brandTag = await page.locator('.brand-tag');
55+
await expect(brandTag).toHaveText('#myhashtag');
56+
});
857

9-
test("Instagram 1", async ({ page }) => {
10-
await page.goto("/template/instagram-1-no-max-entries");
58+
test('Should display brand shape', async ({ page }) => {
59+
const brandShape = await page.locator('.shape svg');
60+
await expect(brandShape).toBeVisible();
61+
});
1162

12-
// TODO
63+
test('Should have vertical class set', async ({ page }) => {
64+
let instagramTemplate = await page.locator('.template-instagram-feed');
65+
await expect(instagramTemplate).toHaveClass('template-instagram-feed vertical show');
66+
});
67+
test('Should have image width style set', async ({ page }) => {
68+
let instagramTemplate = await page.locator('.template-instagram-feed');
69+
await expect(instagramTemplate).toHaveCSS('--percentage-wide', '20%');
70+
await expect(instagramTemplate).toHaveCSS('--percentage-narrow', '80%');
71+
});
1372
});
73+
74+
test.describe("instagram-1-no-max-entries: ui tests", () => {
75+
test.beforeEach(async ({ page }) => {
76+
await page.goto("/template/instagram-1-no-max-entries");
77+
});
78+
79+
test('Max entries not set', async ({ page }) => {
80+
let userName = await page.locator('.author');
81+
await expect(userName).toHaveText('username1');
82+
await page.waitForTimeout(1000);
83+
userName = await page.locator('.author');
84+
await expect(userName).toHaveText('username2');
85+
await page.waitForTimeout(1000);
86+
userName = await page.locator('.author');
87+
await expect(userName).toHaveText('username3');
88+
await page.waitForTimeout(1000);
89+
userName = await page.locator('.author');
90+
await expect(userName).toHaveText('username4');
91+
await page.waitForTimeout(1000);
92+
userName = await page.locator('.author');
93+
await expect(userName).toHaveText('username5');
94+
await page.waitForTimeout(1000);
95+
userName = await page.locator('.author');
96+
await expect(userName).toHaveText('username5');
97+
});
98+
99+
test('Should have landscape class set', async ({ page }) => {
100+
let instagramTemplate = await page.locator('.template-instagram-feed');
101+
await expect(instagramTemplate).toHaveClass('template-instagram-feed landscape hide');
102+
});
103+
test('Should have image width style set', async ({ page }) => {
104+
let instagramTemplate = await page.locator('.template-instagram-feed');
105+
await expect(instagramTemplate).toHaveCSS('--percentage-wide', '40%');
106+
await expect(instagramTemplate).toHaveCSS('--percentage-narrow', '60%');
107+
});
108+
});

0 commit comments

Comments
 (0)