Skip to content

Commit

Permalink
release: fixes
Browse files Browse the repository at this point in the history
### Fixes
- Updated internal dependencies
- Improved E2E testing
  • Loading branch information
preda-bogdan authored Apr 1, 2024
2 parents 955b24d + dd2ef27 commit cf5d710
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 12 deletions.
20 changes: 14 additions & 6 deletions .wordpress-org/blueprints/blueprint.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/wp-admin/admin.php?page=visualizer-setup-wizard&env=preview",
"landingPage": "\/wp-admin\/admin.php?page=visualizer-setup-wizard&env=preview&tab#step-1",
"preferredVersions": {
"php": "8.0",
"wp": "latest"
Expand All @@ -9,11 +9,6 @@
"networking": true
},
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "installPlugin",
"pluginZipFile": {
Expand All @@ -23,6 +18,19 @@
"options": {
"activate": true
}
},
{
"step": "wp-cli",
"command": "wp option update visualizer_fresh_install 1"
},
{
"step": "wp-cli",
"command": "wp option delete visualizer-activated"
},
{
"step": "login",
"username": "admin",
"password": "password"
}
]
}
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,6 @@ Examples:

> [!NOTE]
> 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)
> [!NOTE]
> 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).
16 changes: 10 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 86 additions & 0 deletions tests/e2e/specs/onboarding.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
* WordPress dependencies
*/
import {test, expect} from '@wordpress/e2e-test-utils-playwright';

const { deleteAllCharts } = require('../utils/common');

async function setOption( page, optionName, optionValue ) {
await page.waitForSelector( `#${ optionName }` );
const previousValue = await page.$eval(
`#${ optionName }`,
( element ) => element.value
);

await page.focus( `#${ optionName }` );
await page.type( `#${ optionName }`, optionValue );

await Promise.all( [
page.click( '#Update' ),
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
] );
}

test.describe( 'Onboarding', () => {

test.beforeEach( async ( { page, admin, requestUtils } ) => {
await deleteAllCharts( requestUtils );
await admin.visitAdminPage( 'options.php' );
await setOption( page,'visualizer_fresh_install', '1' );
} );

test( 'Check the setup wizard', async ( { page, admin} ) => {
await admin.visitAdminPage( 'admin.php?page=visualizer-setup-wizard#step-1' );

// Step 1
await expect(page.getByLabel('Pie/Donut chart', { exact: true })).toBeVisible();
await page.getByLabel('Bar chart', { exact: true }).check();
await expect(page.getByLabel('Line chart', { exact: true })).toBeVisible();
await expect(page.getByLabel('Bar chart', { exact: true })).toBeVisible();
await page.getByLabel('Next', { exact: true }).click();
await page.getByLabel('Next', { exact: true }).click();
await page.getByLabel('Next', { exact: true }).click();
await page.getByLabel('Next', { exact: true }).click();
await expect(page.getByText('Discover the power of PRO! 11')).toBeVisible();
await expect(page.getByRole('button', { name: 'Save And Continue ' })).toBeVisible();
await expect(page.getByRole('link', { name: ' Go to dashboard' })).toBeVisible();
await page.getByRole('button', { name: 'Save And Continue ' }).click();

// Step 2
await expect(page.getByLabel('You\'re almost done! We use').locator('h2')).toContainText('You\'re almost done!');
await expect(page.getByRole('heading', { name: 'Importing demo data' })).toBeVisible();
await expect(page.getByText('Done! Demo data imported')).toBeVisible();
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');
await page.getByRole('button', { name: 'Continue ' }).click();

// Step 3
await expect(page.getByRole('heading')).toContainText('Insert chart into the draft page');
await expect(page.getByRole('button', { name: 'Create a draft page We will' })).toBeVisible();
await page.getByRole('button', { name: 'Create a draft page We will' }).click();
await expect(page.getByRole('heading', { name: 'Chart preview' })).toBeVisible();
await page.getByRole('button', { name: 'Create a draft page We will' }).click();
await page.getByRole('button', { name: 'Save And Continue ' }).click();

// Step 4
await expect(page.getByRole('heading')).toContainText('Extra Features');
await expect(page.getByRole('button', { name: 'Enable perfomance features' })).toBeVisible();
await page.getByRole('button', { name: 'Enable perfomance features' }).click();
await expect(page.getByLabel('Extra Features We\'re').getByRole('listitem')).toContainText('Improve your website speed and images by 80% with Optimole');
await expect(page.getByRole('button', { name: 'Improve now' })).toBeVisible();
await page.getByRole('checkbox').uncheck();
await expect(page.getByLabel('Extra Features We\'re')).toContainText('Skip Improvement');
await page.getByRole('button', { name: 'Skip Improvement' }).click();

// Step 5
await expect(page.getByRole('heading')).toContainText('Updates, tutorials, special offers & more');
await expect(page.getByLabel('Updates, tutorials, special')).toContainText('Get exclusive access of Visualizer newsletter');
await expect(page.getByLabel('Updates, tutorials, special').locator('img')).toBeVisible();
await expect(page.getByPlaceholder('[email protected]')).toBeVisible();
await page.getByPlaceholder('[email protected]').click();
await page.getByPlaceholder('[email protected]').fill('[email protected]');
await expect(page.getByLabel('Updates, tutorials, special')).toContainText('Send Me Access');
await expect(page.getByLabel('Updates, tutorials, special')).toContainText('Skip, Don’t give me access');
await page.getByRole('button', { name: 'Skip, Don’t give me access' }).click();
} );

} );
11 changes: 11 additions & 0 deletions tests/e2e/specs/upsell.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,15 @@ test.describe( 'Upsell', () => {
searchParams = new URLSearchParams(href);
expect( searchParams.get('utm_campaign') ).toBe('chart-permissions');
});

test( 'featured tab in Install Plugin (SDK)', async ( { admin, page } ) => {
await admin.visitAdminPage( 'plugin-install.php' );

// Those should be visible only when a PRO product is installed.
await expect( page.getByText('Image Optimization by Optimole') ).toBeHidden();
await expect( page.locator('#the-list div').filter({ hasText: 'Otter Blocks' }).nth(1) ).toBeHidden();

await expect( page.getByLabel('Install Image Optimization by') ).toBeHidden();
await expect( page.getByLabel('Install Otter Blocks') ).toBeHidden();
});
} );

0 comments on commit cf5d710

Please sign in to comment.