Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E Tests: Run tests against WP 5.9 RC1 #10101

Merged
merged 14 commits into from
Jan 11, 2022
4 changes: 4 additions & 0 deletions .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ jobs:
- browser: 'chrome'
wp: 'latest'
snapshots: true
- browser: 'chrome'
wp: '5.9-RC1'
experimental: true
snapshots: false
- browser: 'chrome'
wp: '5.5'
snapshots: false
Expand Down
12 changes: 8 additions & 4 deletions packages/e2e-test-utils/src/trashAllTerms.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ async function trashAllTerms(taxonomy) {

await visitAdminPage('edit-tags.php', `taxonomy=${taxonomy}`);

await page.waitForSelector('[id^=cb-select-all-]');
await page.click('[id^=cb-select-all-]');
await page.select('#bulk-action-selector-top', 'delete');
await Promise.all([page.waitForNavigation(), page.click('#doaction')]);
// If this selector doesn't exist there are no terms for us to delete.
const bulkSelector = await page.$('#bulk-action-selector-top');
if (bulkSelector) {
await page.waitForSelector('[id^=cb-select-all-]');
await page.click('[id^=cb-select-all-]');
await page.select('#bulk-action-selector-top', 'delete');
await Promise.all([page.waitForNavigation(), page.click('#doaction')]);
}

await setCurrentUser(currentUser.username, currentUser.password);
}
Expand Down
27 changes: 19 additions & 8 deletions packages/e2e-test-utils/src/visitBlockWidgetScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,28 @@ async function visitBlockWidgetScreen() {
await visitAdminPage('widgets.php');

// Disable welcome guide if it is enabled.
const isWelcomeGuideActive = await page.evaluate(() =>
wp.data
.select('core/edit-widgets')
.__unstableIsFeatureActive('welcomeGuide')
);
// The former selector is for WP < 5.9
const isWelcomeGuideActive = await page.evaluate(() => {
return (
wp.data
.select('core/edit-widgets')
?.__unstableIsFeatureActive?.('welcomeGuide') ||
wp.data
.select('core/interface')
?.isFeatureActive?.('core/edit-widgets', 'welcomeGuide')
);
});

if (isWelcomeGuideActive) {
await page.evaluate(() =>
// The former action is for WP < 5.9
await page.evaluate(() => {
wp.data
.dispatch('core/edit-widgets')
.__unstableToggleFeature('welcomeGuide')
);
?.__unstableToggleFeature?.('welcomeGuide');
wp.data
.dispatch('core/interface')
?.toggleFeature?.('core/edit-widgets', 'welcomeGuide');
});
}
}
export default visitBlockWidgetScreen;
6 changes: 6 additions & 0 deletions packages/e2e-tests/src/config/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ const ALLOWED_ERROR_MESSAGES = [

// Another Firefox warning.
'Layout was forced before the page was fully loaded',

// Upsteam issue in gutenberg and twentytwenty theme.
'Stylesheet twentytwenty-block-editor-styles-css was not properly added.',

// TODO(#9240): Fix usage in the web stories block.
"select( 'core' ).getAuthors() is deprecated since version 5.9.",
];

export function addAllowedErrorMessage(message) {
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/src/specs/wordpress/blockWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Web Stories Widget Block', () => {
it('should insert a new web stories block', async () => {
await visitBlockWidgetScreen();
await expect(page).toClick('button[aria-label="Add block"]');
await page.type('.block-editor-inserter__search-input', 'Web Stories');
await page.type('input[placeholder="Search"]', 'Web Stories');
spacedmonkey marked this conversation as resolved.
Show resolved Hide resolved
await expect(page).toClick('button span', { text: 'Web Stories' });

await page.waitForSelector('.web-stories-block-configuration-panel');
Expand Down