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

Add Playwright E2E to hide welcome panel using the dismis button #8049

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions tests/e2e/specs/dashboard/hide-welcome-panel.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Dashboard Welcome Panel', () => {
test.beforeEach( async ( { page, admin } ) => {
await admin.visitAdminPage( '/index.php' );

// Check if the Welcome Panel is visible
const welcomePanel = page.locator( '#welcome-panel' );
if ( ! ( await welcomePanel.isVisible() ) ) {
// Open the "Screen Options" tab
const screenOptionsTab = page.locator( '#show-settings-link' );
await screenOptionsTab.click();

// Check the "Welcome Panel" option if it exists
const welcomePanelCheckbox = page.locator(
'#wp_welcome_panel-hide'
);

if ( await welcomePanelCheckbox.isChecked() ) {
// If already checked, just reload the page
await page.reload();
} else {
// Check the box to make the Welcome Panel visible
await welcomePanelCheckbox.check();
// Close the "Screen Options" tab
await screenOptionsTab.click();
// Refresh the page to reflect changes
await page.reload();
}
}
} );

test( 'hides the welcome panel using the dismiss button', async ( {
page,
} ) => {
// Check if the Welcome Panel is visible
const welcomePanel = page.locator( '#welcome-panel' );

// Click the dismiss button on the Welcome Panel
await page.locator( '#welcome-panel .welcome-panel-close' ).click();

// Verify that the Welcome Panel is no longer visible
await expect( welcomePanel ).not.toBeVisible();

} );
} );
Loading