Skip to content

Commit f6a953e

Browse files
2 parents faec290 + 8d1932e commit f6a953e

23 files changed

+177
-16
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"eslint.format.enable": true,
33
"editor.codeActionsOnSave": {
4-
"source.fixAll.eslint": true
4+
"source.fixAll.eslint": "explicit"
55
}
66
}

helper.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ export const siteUrl = 'https://surveyjsio-test.azurewebsites.net';
66
// export const examplesURL = 'http://localhost:62946';
77
// export const siteUrl = 'http://localhost:62946';
88

9+
export const screens = {
10+
'Large-Desktop': { width: 1920, height: 1080 },
11+
'Desktop': { width: 1366, height: 768 },
12+
'Tablet': { width: 1024, height: 744 },
13+
'Vertical-Tablet': { width: 744, height: 1024 },
14+
'Mobile': { width: 375, height: 667 }
15+
};
16+
917
export async function compareScreenshot(page: Page, elementSelector: string | Locator | undefined, screenshotName: string, elementIndex = 0, maxDiffPixels?:number, mask?: Array<Locator>) {
1018
let currentElement = elementSelector;
1119
if (!!currentElement && typeof currentElement == 'string') {

package-lock.json

Lines changed: 13 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/markdown-content.spec.ts

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
import { test, expect, acceptCookieBanner, siteUrl as url, compareScreenshot, screens } from '../helper';
2+
3+
test.beforeAll('Setup', async () => {
4+
console.log('Before tests');
5+
test.setTimeout(480000);
6+
});
7+
8+
test('FAQ Overview', async ({ page }) => {
9+
await page.setViewportSize({ width: 1599, height: 768 });
10+
await page.goto(`${url}/faq`);
11+
await acceptCookieBanner(page);
12+
13+
await expect(page.locator('.s-search')).toBeVisible();
14+
await expect(page.locator('.s-search__search-button').first()).toBeVisible();
15+
await expect(page.locator('div:nth-child(3) > .s-search__search-button')).toBeVisible();
16+
await expect(page.getByRole('textbox', { name: 'Search in FAQ...' })).toBeVisible();
17+
18+
const leftSidebar = page.locator('.v2-class---sidebar').first();
19+
await compareScreenshot(page, leftSidebar, 'markdown-content-faq-vnav-1.png');
20+
21+
const rightSidebar = page.locator('.v2-class---anchor-menu').first();
22+
await compareScreenshot(page, rightSidebar, 'markdown-content-faq-anchor-menu-1.png');
23+
24+
const unorderedList = page.locator('.v2-class---list-doc--unordered').first();
25+
await compareScreenshot(page, unorderedList, 'markdown-content-faq-unordered-list.png');
26+
27+
await page.locator('.s-search__search-button').first().click();
28+
await expect(leftSidebar).toBeHidden();
29+
30+
await page.locator('div:nth-child(3) > .s-search__search-button').click();
31+
await expect(rightSidebar).toBeHidden();
32+
33+
await page.locator('.s-search__search-button').first().click();
34+
await expect(leftSidebar).toBeVisible();
35+
36+
await page.locator('div:nth-child(3) > .s-search__search-button').click();
37+
await expect(rightSidebar).toBeVisible();
38+
});
39+
40+
test('FAQ Licensing', async ({ page }) => {
41+
await page.setViewportSize({ width: 1599, height: 768 });
42+
await page.goto(`${url}/faq/licensing`);
43+
await acceptCookieBanner(page);
44+
45+
await expect(page.locator('.s-search')).toBeVisible();
46+
await expect(page.locator('.s-search__search-button').first()).toBeVisible();
47+
await expect(page.locator('div:nth-child(3) > .s-search__search-button')).toBeVisible();
48+
await expect(page.getByRole('textbox', { name: 'Search in FAQ...' })).toBeVisible();
49+
50+
const leftSidebar = page.locator('.v2-class---sidebar').first();
51+
await compareScreenshot(page, leftSidebar, 'markdown-content-faq-vnav-2.png');
52+
53+
const rightSidebar = page.locator('.v2-class---anchor-menu').first();
54+
await compareScreenshot(page, rightSidebar, 'markdown-content-faq-anchor-menu-2.png');
55+
56+
await page.locator('.s-search__search-button').first().click();
57+
await expect(leftSidebar).toBeHidden();
58+
59+
await page.locator('div:nth-child(3) > .s-search__search-button').click();
60+
await expect(rightSidebar).toBeHidden();
61+
62+
await page.locator('.s-search__search-button').first().click();
63+
await expect(leftSidebar).toBeVisible();
64+
65+
await page.locator('div:nth-child(3) > .s-search__search-button').click();
66+
await expect(rightSidebar).toBeVisible();
67+
68+
const article = page.locator('.v2-class---faq-page__article-section').first();
69+
await compareScreenshot(page, article, 'markdown-content-faq-article.png');
70+
71+
const articleTitle = page.locator('.v2-class---header--level-2').first();
72+
await compareScreenshot(page, articleTitle, 'markdown-content-faq-article-title.png');
73+
74+
const tags = page.locator('.v2-class---markdown-content-page__tags').first();
75+
await compareScreenshot(page, tags, 'markdown-content-faq-tags.png');
76+
77+
const pointsList = page.locator('.v2-class---list-doc--unordered').first();
78+
await compareScreenshot(page, pointsList, 'markdown-content-faq-points-list.png');
79+
80+
const bottomNav = page.locator('.v2-class---faq-page__nav').first();
81+
await compareScreenshot(page, bottomNav, 'markdown-content-faq-bottom-nav.png');
82+
});
83+
84+
test('Documentation Overview', async ({ page }) => {
85+
await page.setViewportSize({ width: 1599, height: 768 });
86+
await page.goto(`${url}/documentation`);
87+
await acceptCookieBanner(page);
88+
89+
await expect(page.locator('.s-search')).toBeVisible();
90+
await expect(page.locator('.s-search__search-button').first()).toBeVisible();
91+
await expect(page.locator('div:nth-child(3) > .s-search__search-button')).toBeVisible();
92+
await expect(page.getByRole('textbox', { name: 'Search in documentation...' })).toBeVisible();
93+
94+
const leftSidebar = page.locator('.v2-class---sidebar').first();
95+
await compareScreenshot(page, leftSidebar, 'markdown-content-doc-vnav-1.png');
96+
97+
const rightSidebar = page.locator('.v2-class---anchor-menu').first();
98+
await compareScreenshot(page, rightSidebar, 'markdown-content-doc-anchor-menu-1.png');
99+
100+
const unorderedList = page.locator('.v2-class---list-doc--unordered').first();
101+
await compareScreenshot(page, unorderedList, 'markdown-content-doc-unordered-list.png');
102+
103+
await page.locator('.s-search__search-button').first().click();
104+
await expect(leftSidebar).toBeHidden();
105+
106+
await page.locator('div:nth-child(3) > .s-search__search-button').click();
107+
await expect(rightSidebar).toBeHidden();
108+
109+
await page.locator('.s-search__search-button').first().click();
110+
await expect(leftSidebar).toBeVisible();
111+
112+
await page.locator('div:nth-child(3) > .s-search__search-button').click();
113+
await expect(rightSidebar).toBeVisible();
114+
115+
const articleTitle = page.locator('.v2-class---header--level-1').first();
116+
await compareScreenshot(page, articleTitle, 'markdown-content-doc-article-title.png');
117+
118+
const articleParagraph = page.locator('.v2-class---paragraph').first();
119+
await compareScreenshot(page, articleParagraph, 'markdown-content-doc-article-paragraph.png');
120+
});
121+
122+
test('Stay Updated Overview', async ({ page }) => {
123+
await page.setViewportSize({ width: 1599, height: 768 });
124+
await page.goto(`${url}/stay-updated`);
125+
await acceptCookieBanner(page);
126+
127+
await expect(page.locator('.s-search')).toBeVisible();
128+
await expect(page.locator('.s-search__search-button').first()).toBeVisible();
129+
await expect(page.locator('div:nth-child(3) > .s-search__search-button')).toBeVisible();
130+
await expect(page.getByRole('textbox', { name: 'Search in blog & updates...' })).toBeVisible();
131+
132+
const leftSidebar = page.locator('.v2-class---sidebar').first();
133+
await compareScreenshot(page, leftSidebar, 'markdown-content-blog-vnav-1.png');
134+
135+
const rightSidebar = page.locator('.v2-class---anchor-menu').first();
136+
await compareScreenshot(page, rightSidebar, 'markdown-content-blog-anchor-menu-1.png');
137+
138+
// await page.locator('.s-search__search-button').first().click();
139+
// await expect(leftSidebar).toBeHidden();
140+
141+
// await page.locator('div:nth-child(3) > .s-search__search-button').click();
142+
// await expect(rightSidebar).toBeHidden();
143+
144+
// await page.locator('.s-search__search-button').first().click();
145+
// await expect(leftSidebar).toBeVisible();
146+
147+
// await page.locator('div:nth-child(3) > .s-search__search-button').click();
148+
// await expect(rightSidebar).toBeVisible();
149+
150+
const pinnedArticle = page.locator('.v2-class---markdown-content-page__pinned-article').first();
151+
await compareScreenshot(page, pinnedArticle, 'markdown-content-blog-pinned-article.png');
152+
153+
const articleItem = page.locator('.v2-class---markdown-content-page__articles-list-item').first();
154+
await compareScreenshot(page, articleItem, 'markdown-content-blog-article-item.png');
155+
});
33.9 KB
Loading
31.2 KB
Loading
27.4 KB
Loading
23.2 KB
Loading
9.25 KB
Loading
13.9 KB
Loading

0 commit comments

Comments
 (0)