-
Notifications
You must be signed in to change notification settings - Fork 243
Internal: Test home page [TMZ-895] #524
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
Changes from 4 commits
75885f8
03ba0ea
150f003
f14a691
500e6cd
86d8603
69689df
84a7716
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { parallelTest as test } from '../../parallelTest.ts'; | ||
| import { expect } from '@playwright/test'; | ||
|
|
||
| test.describe( 'Hello Theme Admin Home Page', () => { | ||
| test.beforeEach( async ( { page } ) => { | ||
| await page.goto( '/wp-admin/admin.php?page=hello-elementor' ); | ||
| } ); | ||
|
|
||
| test( 'should display Welcome to Hello Theme message and take screenshot', async ( { page } ) => { | ||
| const welcomeSection = page.locator( 'text=Go Pro, Go Limitless' ).locator( '..' ).locator( '..' ); | ||
| await expect.soft( welcomeSection ).toHaveScreenshot( 'welcome-section.png' ); | ||
| } ); | ||
|
|
||
| test( 'should display Quick Links section', async ( { page } ) => { | ||
| const quickLinksHeading = page.locator( 'h6:has-text("Quick Links")' ); | ||
| await expect( quickLinksHeading ).toBeVisible(); | ||
| await expect( quickLinksHeading ).toContainText( 'Quick Links' ); | ||
| const quickLinksSection = page.locator( 'text=Quick Links' ).locator( '..' ).locator( '..' ); | ||
| await expect( quickLinksSection ).toContainText( 'These quick actions will get your site airborne in a flash.' ); | ||
| const expectedQuickLinks = [ | ||
| 'Site Name', | ||
| 'Site Logo', | ||
| 'Site Favicon', | ||
| 'Site Colors', | ||
| 'Site Fonts', | ||
| ]; | ||
| for ( const linkText of expectedQuickLinks ) { | ||
| const linkElement = page.locator( `h6:has-text("${ linkText }")` ); | ||
| await expect( linkElement ).toBeVisible(); | ||
| } | ||
| } ); | ||
|
|
||
| test( 'should navigate to correct pages from Quick Links', async ( { page } ) => { | ||
| const quickLinksTests = [ | ||
| { | ||
| linkText: 'Site Name', | ||
| expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=settings-site-identity/, | ||
| expectedPageSection: '.elementor-control-section_settings-site-identity', | ||
| }, | ||
| { | ||
| linkText: 'Site Logo', | ||
| expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=settings-site-identity/, | ||
| expectedPageSection: '.elementor-control-section_settings-site-identity', | ||
| }, | ||
| { | ||
| linkText: 'Site Favicon', | ||
| expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=settings-site-identity/, | ||
| expectedPageSection: '.elementor-control-section_settings-site-identity', | ||
| }, | ||
| { | ||
| linkText: 'Site Colors', | ||
| expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=global-colors/, | ||
| expectedPageSection: '.elementor-control-section_global_colors', | ||
| }, | ||
| { | ||
| linkText: 'Site Fonts', | ||
| expectedUrlPattern: /post\.php\?post=\d+&action=elementor.*active-tab=global-typography/, | ||
| expectedPageSection: '.elementor-control-section_text_style', | ||
| }, | ||
| ]; | ||
| for ( const linkTest of quickLinksTests ) { | ||
| await page.goto( '/wp-admin/admin.php?page=hello-elementor' ); | ||
| const linkElement = page.locator( `h6:has-text("${ linkTest.linkText }") a` ); | ||
| await expect( linkElement ).toBeVisible(); | ||
|
|
||
| await Promise.all( [ | ||
| page.waitForURL( linkTest.expectedUrlPattern ), | ||
| linkElement.click(), | ||
| ] ); | ||
|
|
||
| expect( page.url() ).toMatch( linkTest.expectedUrlPattern ); | ||
| await page.waitForSelector( '#elementor-kit-panel' ); | ||
|
Check failure on line 72 in tests/playwright/tests/admin/hello-theme-admin-home.test.ts
|
||
| const location = page.locator( linkTest.expectedPageSection ); | ||
| await expect( location ).toBeVisible(); | ||
| } | ||
| } ); | ||
| } ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,10 @@ | ||
| #!/bin/bash | ||
| set -eox pipefail | ||
|
|
||
| echo "=== SETUP.SH DEBUG ===" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to make this change? These change might be a bit sensitive, because I have made changes in the same files.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hein-obox let's talk tomorrow was trying to get tests to run
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will roll back as they are failing anyway, but locally they were ok |
||
| echo "Current working directory:" | ||
| pwd | ||
| echo "" | ||
|
|
||
| echo "WordPress themes directory contents:" | ||
| ls -la /var/www/html/wp-content/themes/ || echo "Could not list themes directory" | ||
| echo "" | ||
|
|
||
| echo "Checking for hello-elementor theme specifically:" | ||
| if [ -d "/var/www/html/wp-content/themes/hello-elementor" ]; then | ||
| echo "✅ hello-elementor directory found" | ||
| echo "Contents:" | ||
| ls -la /var/www/html/wp-content/themes/hello-elementor/ | head -10 | ||
| echo "" | ||
|
|
||
| echo "Checking for style.css:" | ||
| if [ -f "/var/www/html/wp-content/themes/hello-elementor/style.css" ]; then | ||
| echo "✅ style.css found" | ||
| echo "Theme header:" | ||
| head -10 /var/www/html/wp-content/themes/hello-elementor/style.css | ||
| else | ||
| echo "❌ style.css missing" | ||
| fi | ||
| else | ||
| echo "❌ hello-elementor directory not found" | ||
| echo "Available theme directories:" | ||
| ls -la /var/www/html/wp-content/themes/ | ||
| fi | ||
| echo "" | ||
|
|
||
| wp plugin activate elementor | ||
| echo "Available themes (via WP-CLI):" | ||
| wp theme list | ||
| echo "" | ||
|
|
||
| echo "Attempting to activate hello-theme theme..." | ||
| wp theme activate hello-theme || { | ||
| echo "❌ Failed to activate hello-theme, trying hello-elementor..." | ||
| wp theme activate hello-elementor || { | ||
| echo "❌ Both activation attempts failed. Final theme list:" | ||
| wp theme list | ||
| echo "❌ Available theme directories in WordPress:" | ||
| ls -la /var/www/html/wp-content/themes/ | ||
| echo "❌ Theme activation completely failed" | ||
| exit 1 | ||
| } | ||
| } | ||
| wp theme activate hello-theme | ||
|
|
||
| WP_CLI_CONFIG_PATH=hello-elementor-config/wp-cli.yml wp rewrite structure '/%postname%/' --hard | ||
| WP_CLI_CONFIG_PATH=hello-theme-config/wp-cli.yml wp rewrite structure '/%postname%/' --hard | ||
|
|
||
| # Remove the Guttenberg welcome guide popup | ||
| wp user meta add admin wp_persisted_preferences 'a:2:{s:14:\"core/edit-post\";a:2:{b:1;s:12:\"welcomeGuide\";b:0;}}' | ||
|
|
@@ -63,7 +17,8 @@ wp option set elementor_onboarded true | |
|
|
||
| # Add user meta so the announcement popup will not be displayed - ED-9723 | ||
| for id in $(wp user list --field=ID) | ||
| do wp user meta add "$id" "announcements_user_counter" 999 | ||
| do wp user meta add "$id" "announcements_user_counter" 999 | ||
| wp user meta add "$id" "elementor_onboarded" "a:1:{s:27:\"ai-get-started-announcement\";b:1;}" | ||
| done | ||
|
|
||
| wp cache flush | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to make this change? These change might be a bit sensitive, because I have made changes in the same files.