PluginProbe ʕ •ᴥ•ʔ
Starter Sites & Templates by Neve / 1.4.1
Starter Sites & Templates by Neve v1.4.1
1.4.1 1.4.0 1.3.0 1.2.29 1.2.28 1.2.6 1.2.7 1.2.8 1.2.9 trunk 1.0.10 1.0.11 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.3 1.2.4 1.2.5
templates-patterns-collection / e2e-tests / specs / onboarding.spec.js
templates-patterns-collection / e2e-tests / specs Last commit date
onboarding.spec.js 2 weeks ago
onboarding.spec.js
181 lines
1 /**
2 * WordPress dependencies
3 */
4 import { test, expect } from '@wordpress/e2e-test-utils-playwright';
5
6 test.describe('Onboarding', () => {
7 const ONBOARDING_URL = 'themes.php?page=neve-onboarding';
8
9 const waitForStarterData = ( page ) =>
10 page.waitForResponse(
11 ( response ) =>
12 response.url().includes('/wp-json/ti-demo-data/data') &&
13 response.status() === 200,
14 { timeout: 45000 }
15 );
16
17 const openFirstSiteAndWaitForData = async ( page ) => {
18 const starterDataResponse = waitForStarterData( page );
19 await page.locator('.ss-card-wrap').first().click();
20 await starterDataResponse;
21 await page.waitForSelector('.ob-site-settings.fetching', {
22 state: 'hidden',
23 });
24 await expect(page.locator('.ob-error-wrap')).toHaveCount(0);
25 };
26
27 test('Sub-menu in Admin page', async ({ page, admin }) => {
28 await admin.visitAdminPage('/');
29
30 await page.getByRole('link', { name: 'Appearance' }).click();
31 await page.getByRole('link', { name: 'Starter Templates' }).click();
32
33 const currentURL = page.url();
34 expect(currentURL).toContain(ONBOARDING_URL);
35 });
36
37 test('Site Listing Page Rendering', async ({ page, admin }) => {
38 await admin.visitAdminPage(ONBOARDING_URL);
39
40 await expect(page.locator('#ob-search-ss')).toBeVisible();
41 await expect(page.getByRole('button', { name: 'Builder Logo' })).toBeVisible(); // Check editor selector.
42 await expect(page.locator('.components-button').first()).toBeVisible(); // Check logo.
43 await expect(page.getByRole('button', { name: 'Exit to dashboard' })).toBeVisible();
44 expect(await page.locator('.ob-cat-wrap button').count()).toBeGreaterThan(0);
45
46 // Check if we have Starter Sites listed. And some of the are PRO.
47 expect(await page.locator('.ss-card-wrap').count()).toBeGreaterThan(0);
48 expect(await page.locator('.ss-card .ss-badge').count()).toBeGreaterThan(0);
49
50 // 'All' and 'Free' should show after you select a category.
51 // Match exactly: card page-shot buttons (e.g. "Gallery", "Ballet Blog",
52 // "All Courses") also contain "all" as a substring, so a non-exact name
53 // match resolves to multiple elements once the grid renders a full page.
54 await page.locator('.ob-cat-wrap').first().click();
55 await expect(page.getByRole('button', { name: 'All', exact: true })).toBeVisible();
56 await expect(page.getByRole('button', { name: 'Free', exact: true })).toBeVisible();
57
58 // Check card structure.
59 const firstListedSiteCard = page.locator('.ss-card-wrap').first();
60 await expect(firstListedSiteCard.locator('.ss-image')).toBeVisible();
61 const bgImage = await firstListedSiteCard
62 .locator('.ss-image')
63 .evaluate((el) => window.getComputedStyle(el).getPropertyValue('background-image'));
64 expect(bgImage).not.toBe('none');
65 await expect(firstListedSiteCard.locator('.ss-title')).not.toBeEmpty();
66 });
67
68 test('Site Import Customization Rendering', async ({ page, admin }) => {
69 await admin.visitAdminPage(ONBOARDING_URL);
70 await openFirstSiteAndWaitForData( page );
71
72 // Customize design step.
73 await expect(page.getByRole('button', { name: 'Select or upload image' })).toBeVisible();
74
75 await expect(page.getByRole('heading', { name: 'Color Palette' })).toBeVisible();
76 expect(await page.locator('.ob-palette').count()).toBeGreaterThan(0); // Check if we have some color pallet available.
77
78 await expect(page.getByRole('heading', { name: 'Typography' })).toBeVisible();
79 expect(await page.locator('.ob-ctrl-wrap.font button').count()).toBe(7); // Check if we have some font family options available.
80
81 // Check if the first option is selected, select another option, reset and check again
82 const firstPalletColorOption = page.locator('.ob-palette').first();
83 await expect(firstPalletColorOption).toHaveClass(/ob-active/);
84
85 const secondPalletColorOption = page.locator('.ob-palette').nth(1);
86 await secondPalletColorOption.click();
87 await expect(secondPalletColorOption).toHaveClass(/ob-active/);
88
89 let resetButton = page.locator('.ob-ctrl-head > .components-button').first();
90 await resetButton.click();
91 await expect(firstPalletColorOption).toHaveClass(/ob-active/);
92
93 const firstFontFamilyOption = page.locator('.ob-ctrl-wrap.font button').first();
94 await expect(firstFontFamilyOption).toHaveClass(/ob-active/);
95
96 const secondFontFamilyOption = page.locator('.ob-ctrl-wrap.font button').nth(1);
97 await secondFontFamilyOption.click();
98 await expect(secondFontFamilyOption).toHaveClass(/ob-active/);
99
100 resetButton = page
101 .locator('div')
102 .filter({ hasText: /^Typography$/ })
103 .getByRole('button');
104 await resetButton.click();
105 await expect(firstFontFamilyOption).toHaveClass(/ob-active/);
106 });
107
108 test('Site Import Plugins Rendering', async ({ page, admin }) => {
109 await admin.visitAdminPage(ONBOARDING_URL);
110 await openFirstSiteAndWaitForData( page );
111 await page.getByRole('button', { name: 'Continue' }).click();
112
113 expect(await page.locator('.ob-feature-card').count()).toBe(6);
114 expect(
115 await page.locator('.ob-feature-card.ob-disabled[aria-checked="true"]').count(),
116 ).toBeGreaterThan(0); // We have some required plugin that are active by default.
117
118 // Check if we can select a plugin to install.
119 const cachePlugin = page.getByRole('checkbox', { name: 'Caching Supercharge your site' });
120 await cachePlugin.click();
121 await expect(cachePlugin).toHaveAttribute('aria-checked', 'true');
122
123 await page.getByRole('button', { name: 'Import Website' }).click();
124
125 await expect(page.getByRole('button', { name: 'Start Import' })).toBeVisible();
126 await expect(page.getByRole('button', { name: 'Cancel' })).toBeVisible();
127
128 await page.getByRole('button', { name: 'Cancel' }).click();
129 await expect(page.getByRole('button', { name: 'Start Import' })).toBeHidden();
130 });
131
132 test('Site Import Process', async ({ page, admin }) => {
133 await admin.visitAdminPage(ONBOARDING_URL);
134 await openFirstSiteAndWaitForData( page );
135 await page.getByRole('button', { name: 'Continue' }).click();
136 const cachePlugin = page.getByRole('checkbox', { name: 'Caching Supercharge your site' });
137 await cachePlugin.click();
138 await page.getByRole('button', { name: 'Import Website' }).click();
139
140 await page.getByRole('button', { name: 'Start Import' }).click();
141
142 await expect(
143 page.getByRole('heading', { name: 'We are importing your new' }),
144 ).toBeVisible();
145
146 await page.waitForSelector('.ob-import-done', { timeout: 60000 });
147
148 await expect(page.getByRole('textbox', { name: 'Enter your email' })).toBeVisible();
149 await expect(page.locator('#inspector-select-control-1')).toBeVisible(); // User experience selector.
150 await expect(page.locator('#inspector-select-control-2')).toBeVisible(); // Reason the build selector.
151
152 await expect(page.getByRole('button', { name: 'Submit and view site' })).toBeVisible();
153 await expect(page.getByRole('button', { name: 'Skip and view site' })).toBeVisible();
154
155 await page.getByRole('button', { name: 'Skip and view site' }).click();
156
157 await page.waitForURL((url) => !url.toString().includes(ONBOARDING_URL));
158 expect(page.url()).not.toContain(ONBOARDING_URL);
159 });
160
161 test( 'Back Button navigation', async ({ page, admin }) => {
162 await admin.visitAdminPage(ONBOARDING_URL);
163 await openFirstSiteAndWaitForData( page );
164 await page.getByRole('button', { name: 'Continue' }).click();
165
166 await page.getByRole('button', { name: 'Go back' }).click();
167 await page.getByRole('button', { name: 'Go back' }).click();
168
169 await expect( page.getByRole('heading', { name: 'Choose a design' }) ).toBeVisible();
170 });
171
172 test( 'Exit from Site Import Steps', async ({ page, admin }) => {
173 await admin.visitAdminPage(ONBOARDING_URL);
174 await openFirstSiteAndWaitForData( page );
175 await page.getByRole('button', { name: 'Continue' }).click();
176
177 await page.locator('button:has(span.dashicons-no-alt)' ).click();
178 await expect( page.getByRole('heading', { name: 'Choose a design' }) ).toBeVisible();
179 });
180 });
181