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
Merged

E2E Tests: Run tests against WP 5.9 RC1 #10101

merged 14 commits into from
Jan 11, 2022

Conversation

spacedmonkey
Copy link
Contributor

Context

Summary

Relevant Technical Choices

To-do

User-facing changes

Testing Instructions

  • This is a non-user-facing change and requires no QA

This PR can be tested by following these steps:

Reviews

Does this PR have a security-related impact?

Does this PR change what data or activity we track or use?

Does this PR have a legal-related impact?

Checklist

  • This PR addresses an existing issue and I have linked this PR to it in ZenHub
  • I have tested this code to the best of my abilities
  • I have verified accessibility to the best of my abilities (docs)
  • I have verified i18n and l10n (translation, right-to-left layout) to the best of my abilities
  • This code is covered by automated tests (unit, integration, and/or e2e) to verify it works as intended (docs)
  • I have added documentation where necessary
  • I have added a matching Type: XYZ label to the PR

Fixes #

@spacedmonkey spacedmonkey added Type: Infrastructure Changes impacting testing infrastructure or build tooling Pod: WP & Infra Package: E2E Tests /packages/e2e-tests labels Jan 5, 2022
@spacedmonkey spacedmonkey self-assigned this Jan 5, 2022
@swissspidy
Copy link
Collaborator

@spacedmonkey Tests against RC 1 are failing now because of this change in core: https://core.trac.wordpress.org/ticket/54181

In trashAllTerms(), #bulk-action-selector-top is used, which in WP 5.9+ won't be displayed anymore if there are no terms.

So we need to make it a bit more robust.

@swissspidy
Copy link
Collaborator

The Web Stories Widget Block e2e test fails because the Twenty-Twenty Two theme does not support widgets.

We might want to consider installing/activating Twenty Twenty-One by default in bin/local-env/install-wordpress.sh and then have dedicated E2E tests for block-based themes.

@spacedmonkey
Copy link
Contributor Author

The Web Stories Widget Block e2e test fails because the Twenty-Twenty Two theme does not support widgets.

How is that possible, we are using 2020 for e2e test ain't we?

@swissspidy
Copy link
Collaborator

Ah, you're right. Then I suppose some selectors have simple changed.

.block-editor-inserter__search-input no longer exists.

Maybe .block-editor-inserter__search input works.

@swissspidy swissspidy marked this pull request as draft January 6, 2022 15:22
@swissspidy
Copy link
Collaborator

I am converting this to a draft simply to avoid generating unnecessary Percy snapshots while this is WIP.

@spacedmonkey spacedmonkey marked this pull request as ready for review January 7, 2022 14:36
@swissspidy

This comment has been minimized.

@spacedmonkey

This comment has been minimized.

Comment on lines 31 to 41
const isWelcomeGuideActive = await page.evaluate((version) => {
// TODO Change after 5.9 release.
if ('latest' === version) {
return wp.data
.select('core/edit-widgets')
.__unstableIsFeatureActive('welcomeGuide');
}
return wp.data
.select('core/interface')
.isFeatureActive('core/edit-widgets', 'welcomeGuide');
}, WPVersion);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the version check really needed? Didn't it work the way you had it before, by checking whether the functions exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love another way around doing this check.

Copy link
Collaborator

@swissspidy swissspidy Jan 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm sounds like all that is needed is some conditional check, perhaps easiest with optional chaining (?.) ,to avoid the isFeatureActive is not a function error.

// Disable welcome guide if it is enabled.

// 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) {
  // The former action is for WP < 5.9
  await page.evaluate(() => {
    wp.data.dispatch('core/edit-widgets')?.__unstableToggleFeature?.('welcomeGuide');
    wp.data.dispatch( 'core/interface' )?.toggleFeature?.( 'core/edit-widgets', 'welcomeGuide' );
  });
}

@swissspidy swissspidy changed the title Run e2e tests against WP 5.9 RC1. E2E Tests: Run tests against WP 5.9 RC1 Jan 11, 2022
@swissspidy swissspidy merged commit 3d5cab5 into main Jan 11, 2022
@swissspidy swissspidy deleted the try/e2e-wp-5.9 branch January 11, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: E2E Tests /packages/e2e-tests Type: Infrastructure Changes impacting testing infrastructure or build tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants