Skip to content

Commit cf5d710

Browse files
authored
release: fixes
### Fixes - Updated internal dependencies - Improved E2E testing
2 parents 955b24d + dd2ef27 commit cf5d710

File tree

5 files changed

+124
-12
lines changed

5 files changed

+124
-12
lines changed
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
3-
"landingPage": "/wp-admin/admin.php?page=visualizer-setup-wizard&env=preview",
3+
"landingPage": "\/wp-admin\/admin.php?page=visualizer-setup-wizard&env=preview&tab#step-1",
44
"preferredVersions": {
55
"php": "8.0",
66
"wp": "latest"
@@ -9,11 +9,6 @@
99
"networking": true
1010
},
1111
"steps": [
12-
{
13-
"step": "login",
14-
"username": "admin",
15-
"password": "password"
16-
},
1712
{
1813
"step": "installPlugin",
1914
"pluginZipFile": {
@@ -23,6 +18,19 @@
2318
"options": {
2419
"activate": true
2520
}
21+
},
22+
{
23+
"step": "wp-cli",
24+
"command": "wp option update visualizer_fresh_install 1"
25+
},
26+
{
27+
"step": "wp-cli",
28+
"command": "wp option delete visualizer-activated"
29+
},
30+
{
31+
"step": "login",
32+
"username": "admin",
33+
"password": "password"
2634
}
2735
]
2836
}

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,3 +436,6 @@ Examples:
436436

437437
> [!NOTE]
438438
> Make sure to respect the [schema](https://github.com/WordPress/wordpress-playground/blob/trunk/packages/playground/blueprints/public/blueprint-schema.json). You can validate your blueprint using a schema validator: [online](https://www.jsonschemavalidator.net/), [CLI](https://ajv.js.org/packages/ajv-cli.html)
439+
440+
> [!NOTE]
441+
> To test the blueprint, you can publish the branch and append the `blueprint.json` path to the URL: `https://playground.wordpress.net/?plugin=visualizer&blueprint-url=`. [Example](https://playground.wordpress.net/?plugin=visualizer&blueprint-url=https://raw.githubusercontent.com/Codeinwp/visualizer/fix/blueprint-redirect/.wordpress-org/blueprints/blueprint.json).

composer.lock

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

tests/e2e/specs/onboarding.spec.ts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
import {test, expect} from '@wordpress/e2e-test-utils-playwright';
5+
6+
const { deleteAllCharts } = require('../utils/common');
7+
8+
async function setOption( page, optionName, optionValue ) {
9+
await page.waitForSelector( `#${ optionName }` );
10+
const previousValue = await page.$eval(
11+
`#${ optionName }`,
12+
( element ) => element.value
13+
);
14+
15+
await page.focus( `#${ optionName }` );
16+
await page.type( `#${ optionName }`, optionValue );
17+
18+
await Promise.all( [
19+
page.click( '#Update' ),
20+
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
21+
] );
22+
}
23+
24+
test.describe( 'Onboarding', () => {
25+
26+
test.beforeEach( async ( { page, admin, requestUtils } ) => {
27+
await deleteAllCharts( requestUtils );
28+
await admin.visitAdminPage( 'options.php' );
29+
await setOption( page,'visualizer_fresh_install', '1' );
30+
} );
31+
32+
test( 'Check the setup wizard', async ( { page, admin} ) => {
33+
await admin.visitAdminPage( 'admin.php?page=visualizer-setup-wizard#step-1' );
34+
35+
// Step 1
36+
await expect(page.getByLabel('Pie/Donut chart', { exact: true })).toBeVisible();
37+
await page.getByLabel('Bar chart', { exact: true }).check();
38+
await expect(page.getByLabel('Line chart', { exact: true })).toBeVisible();
39+
await expect(page.getByLabel('Bar chart', { exact: true })).toBeVisible();
40+
await page.getByLabel('Next', { exact: true }).click();
41+
await page.getByLabel('Next', { exact: true }).click();
42+
await page.getByLabel('Next', { exact: true }).click();
43+
await page.getByLabel('Next', { exact: true }).click();
44+
await expect(page.getByText('Discover the power of PRO! 11')).toBeVisible();
45+
await expect(page.getByRole('button', { name: 'Save And Continue ' })).toBeVisible();
46+
await expect(page.getByRole('link', { name: ' Go to dashboard' })).toBeVisible();
47+
await page.getByRole('button', { name: 'Save And Continue ' }).click();
48+
49+
// Step 2
50+
await expect(page.getByLabel('You\'re almost done! We use').locator('h2')).toContainText('You\'re almost done!');
51+
await expect(page.getByRole('heading', { name: 'Importing demo data' })).toBeVisible();
52+
await expect(page.getByText('Done! Demo data imported')).toBeVisible();
53+
await expect(page.getByLabel('You\'re almost done! We use')).toContainText('Import data from other Charts, WordPress, DataBase, or Manual Data with Visualizer Premium version');
54+
await page.getByRole('button', { name: 'Continue ' }).click();
55+
56+
// Step 3
57+
await expect(page.getByRole('heading')).toContainText('Insert chart into the draft page');
58+
await expect(page.getByRole('button', { name: 'Create a draft page We will' })).toBeVisible();
59+
await page.getByRole('button', { name: 'Create a draft page We will' }).click();
60+
await expect(page.getByRole('heading', { name: 'Chart preview' })).toBeVisible();
61+
await page.getByRole('button', { name: 'Create a draft page We will' }).click();
62+
await page.getByRole('button', { name: 'Save And Continue ' }).click();
63+
64+
// Step 4
65+
await expect(page.getByRole('heading')).toContainText('Extra Features');
66+
await expect(page.getByRole('button', { name: 'Enable perfomance features' })).toBeVisible();
67+
await page.getByRole('button', { name: 'Enable perfomance features' }).click();
68+
await expect(page.getByLabel('Extra Features We\'re').getByRole('listitem')).toContainText('Improve your website speed and images by 80% with Optimole');
69+
await expect(page.getByRole('button', { name: 'Improve now' })).toBeVisible();
70+
await page.getByRole('checkbox').uncheck();
71+
await expect(page.getByLabel('Extra Features We\'re')).toContainText('Skip Improvement');
72+
await page.getByRole('button', { name: 'Skip Improvement' }).click();
73+
74+
// Step 5
75+
await expect(page.getByRole('heading')).toContainText('Updates, tutorials, special offers & more');
76+
await expect(page.getByLabel('Updates, tutorials, special')).toContainText('Get exclusive access of Visualizer newsletter');
77+
await expect(page.getByLabel('Updates, tutorials, special').locator('img')).toBeVisible();
78+
await expect(page.getByPlaceholder('[email protected]')).toBeVisible();
79+
await page.getByPlaceholder('[email protected]').click();
80+
await page.getByPlaceholder('[email protected]').fill('[email protected]');
81+
await expect(page.getByLabel('Updates, tutorials, special')).toContainText('Send Me Access');
82+
await expect(page.getByLabel('Updates, tutorials, special')).toContainText('Skip, Don’t give me access');
83+
await page.getByRole('button', { name: 'Skip, Don’t give me access' }).click();
84+
} );
85+
86+
} );

tests/e2e/specs/upsell.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,15 @@ test.describe( 'Upsell', () => {
7878
searchParams = new URLSearchParams(href);
7979
expect( searchParams.get('utm_campaign') ).toBe('chart-permissions');
8080
});
81+
82+
test( 'featured tab in Install Plugin (SDK)', async ( { admin, page } ) => {
83+
await admin.visitAdminPage( 'plugin-install.php' );
84+
85+
// Those should be visible only when a PRO product is installed.
86+
await expect( page.getByText('Image Optimization by Optimole') ).toBeHidden();
87+
await expect( page.locator('#the-list div').filter({ hasText: 'Otter Blocks' }).nth(1) ).toBeHidden();
88+
89+
await expect( page.getByLabel('Install Image Optimization by') ).toBeHidden();
90+
await expect( page.getByLabel('Install Otter Blocks') ).toBeHidden();
91+
});
8192
} );

0 commit comments

Comments
 (0)