📑 Working with Test Cases: AI Production Team
Cypress test cases are designed to check different parts of the website. Below are the two main tests:
🖥️ Front End Testing – AIWebsite.PublishedSite.test.js
This test suite focuses on the live website’s front end.
- It verifies UI elements, page functionality, navigation, and ensures that everything is working as expected from a user’s perspective.
- These tests simulate real user interactions, such as clicking buttons, filling out forms, and verifying content.
✅ Test Cases for Front End Testing:
-
Mobile header must not match “agent image” information in the clients phone and email address
-
Sets viewport to mobile resolution (390x844)
- ✅ Checks for mobile header elements using various selectors
- ⚠️ If mobile header is missing, logs “Mobile header does not exist”
-
Extracts and validates phone numbers
- ✅ Extracts phone numbers using regex pattern and filters valid ones
- ℹ️ Logs detected numbers in “Detected phone numbers in mobile header”
- ❌ If any match Agent Image numbers, logs “Mobile header phone number(s) found that match Agent Image”
- ❌ If matches exist, fails the test with detailed error message
-
Extracts and validates emails
- ✅ Extracts emails using regex pattern
- ℹ️ Logs detected emails in “Detected email(s) in mobile header”
- ❌ If any match Agent Image email, logs “Mobile header email found that matches Agent Image”
- ❌ If matches exist, fails the test with detailed error message
-
Final Assertion
- ✅ If no matches, logs ”✅ No matching phone numbers or email found in the mobile header”
- ❌ If issues detected, fails with assertion showing all detected issues
-
-
Contact page placeholder contact info must not match Agent Image phone and email
-
Attempts to visit contact page
- ✅ First tries
/contact
URL - ✅ If 404, falls back to
/get-in-touch/
URL - ℹ️ Logs which contact URL is being used
- ✅ First tries
-
Extracts contact information
-
✅ Extracts page text for phone number analysis
-
✅ Extracts emails specifically from
mailto:
links -
ℹ️ Logs extraction process
- Validates phone numbers
- ✅ Loops through detected phone numbers and checks each against Agent Image numbers
- ✅ Logs ”🔍 Checking phone X:
{number}
” for each number - ❌ If match found, logs ”❌ Matched phone number:
{number}
”
-
Validates emails
- ✅ Loops through detected emails and checks each against Agent Image emails
- ✅ Logs ”🔍 Checking email X:
{email}
” for each email - ❌ If match found, logs ”❌ Matched email:
{email}
”
-
-
Final validation
- ✅ If no matches, logs ”✅ No matching Agent Image phone numbers or emails found on the Contact Page”
- ❌ If issues detected, logs ”🚨 The following contact details matched Agent Image:” and fails the test
-
-
Checks robots.txt
-
Requests and validates robots.txt file
- ✅ Sends request to
/robots.txt
endpoint - ✅ If response is 200, proceeds with content validation
- ❌ If missing or incorrect status, fails the test
- ✅ Sends request to
-
Validates required rules using regex patterns
- ✅ Checks for all required directives including User-agent, Crawl-delay, Disallow rules
- ✅ Uses flexible regex patterns to match various formatting
- ✅ If all rules exist, logs ”✅ All required lines are present in robots.txt”
- ❌ If any rule is missing, logs ”❌ Missing lines in robots.txt” and throws error
-
-
Menu Items should be in text form
-
Checks for different menu types
-
✅ First checks for standard menu
(.menu, .site-menu)
-
✅ If not found, checks for burger menu button
-
❌ If no menu found, logs ”❌ No menu exists on this page”
- Validates menu items for standard menu
- ✅ Loops through each menu link and validates text content
- ✅ If text is valid, logs ”✅ ‘
{text}
’ is in text form” - ❌ If text is empty or invalid, logs ”❌ ‘
{text}
’ is NOT in text form”
-
-
Validates menu items for burger menu
- ✅ Clicks burger button and waits for off-canvas menu
- ✅ Validates menu items in off-canvas menu
- ❌ If no menu appears after clicking, logs ”❌ No menu found after clicking the burger button”
-
Final Assertion
- ✅ If all menu items are valid, logs ”✅ All menu links are in text form”
- ❌ If any issues found, fails test with “Some menu items are not in text form”
-
-
Sitemap should display all pages in alphabetical order
-
Visits sitemap page
- ✅ Navigates to
/sitemap
URL and waits for load - ❌ If sitemap list is missing, logs error
- ✅ Navigates to
-
Validates alphabetical order
-
✅ Uses
Intl.Collator
for proper alphabetical comparison- ✅ Normalizes titles by removing special characters for comparison
- ✅ Skips pages that start with special characters
- ✅ Logs ”✅ Skipped (starts with special character): ‘
{title}
’” for skipped items
-
Checks order and logs results
- ✅ For each page, compares with previous page in alphabetical order
- ✅ Logs ”✅ ‘
{prev}
’ is correctly before ‘{current}
’” for correct order - ❌ If out of order, logs ”❌ ‘
{prev}
’ should come after ‘{current}
’”
-
-
Final Assertion
- ✅ If all pages correctly ordered, logs ”✅ All pages (excluding special-char titles) are in alphabetical order”
- ❌ If any failed assertions, logs all issues and fails test
-
-
Fixed header should not exceed 100px by standard
- Sets up test environment
-
✅ Sets viewport to 1920x1080 for consistent testing
-
✅ Handles popups that might interfere with scrolling
-
✅ Scrolls to bottom twice to ensure fixed header is triggered
- Checks fixed header height
- ✅ Uses multiple selectors to find fixed header elements
- ✅ Measures
outerHeight
of the first found fixed header - ✅ Logs ”🧐 Checking Fixed Header height:
{height}
px”
-
Validates height limit
- ✅ If within 100px limit, logs ”✅ Test Passed: Fixed header is within limit (
{height}
px)” - ❌ If exceeds 100px, logs ”❌ Test Failed: Fixed Header is too large (
{height}
px)”
- ✅ If within 100px limit, logs ”✅ Test Passed: Fixed header is within limit (
-
❌ Fails test if header exceeds 100px limit
-
- Sets up test environment
🚨 If the cy.scrollTo()
function is taking too long to load, hover your mouse over the App Preview
window in Cypress. Some sites have popups that interfere with scrolling behavior, and hovering over the preview can help bypass them.
-
Checks the sitemap.xml
-
Requests sitemap.xml file
- ✅ Sends request to
/sitemap_index.xml
endpoint - ✅ If request returns 200 status, confirms sitemap exists
- ❌ If request fails, logs error and fails test
- ✅ Sends request to
-
Validates sitemap content
- ✅ Checks that content-type includes ‘xml’
- ✅ Verifies response body contains
<sitemapindex
opening tag - ✅ Confirms proper XML structure for sitemap index
-
-
Should ensure that all phone numbers are clickable on desktop and mobile views
-
Tests multiple viewports
-
✅ Tests on desktop (1280x720) and mobile (375x667) viewports
-
✅ Logs ”🔍 Checking phone links on
{viewport}
view” for each viewport -
Validates phone number selectors
- ✅ Checks
.aios-ai-phone
and.amh-phone
selectors - ✅ Only tests visible phone number elements
- ⚠️ Logs “⚠️ [
{viewport}
] Selector not found:{selector}
” if selector missing
- ✅ Checks
-
Validates phone link format
- ✅ Ensures each phone number has
tel:
href format - ✅ Checks that elements are not disabled
- ✅ Logs ”✅ [
{viewport}
]{selector}
— Phone ‘{number}
’ is clickable” for valid phones - ⚠️ Logs “⚠️ [
{viewport}
]{selector}
— Skipped ‘{number}
’ because it is not visible” for hidden elements
- ✅ Ensures each phone number has
-
-
Should ensure all phone numbers have correct links and are not linked to Agent Image numbers on both desktop and mobile
-
Tests on multiple viewports
-
✅ Tests on desktop (1280x720) and mobile (375x667) viewports
-
✅ Logs ”🔍 Checking phone links on
{viewport}
view” for each viewport -
Validates phone number formatting
- ✅ Extracts and normalizes phone numbers from href and display text
- ✅ Handles country code detection and formatting
- ✅ Logs detailed formatting information for debugging
-
Validates phone number matching
- ✅ Ensures displayed number matches href format
- ✅ Logs ”✅ Phone number ‘
{display}
’ matches href ‘{href}
’” for valid matches - ❌ Fails if displayed number doesn’t match href format
-
Validates against prohibited numbers
- ✅ Checks that phone numbers are not in Agent Image prohibited list
- ✅ Logs ”✅ Phone number ‘
{display}
’ is not in prohibited numbers” for valid numbers - ❌ Fails if any phone number matches prohibited Agent Image numbers
-
-
Site should be mobile friendly, no error under SEO
- Runs PageSpeed Insights test
-
✅ Visits Google PageSpeed Insights and inputs website URL
-
✅ Clicks “Analyze” button to start test
-
✅ Waits for test completion by checking for
.lh-scores-header
- Monitors test progress
- ✅ Waits up to 50 retries (150 seconds) for test completion
- ✅ Logs ”⏳ Test still running… (
{retries}
retries left)” during wait - ✅ Logs ”✅ Test completed! Checking SEO score…” when done
- ❌ If test doesn’t complete, throws error about timeout
-
Validates SEO score
- ✅ Extracts SEO score from
#seo .lh-gauge__percentage
- ✅ Logs ”🔍 SEO Score:
{score}
” for debugging - ✅ If score is 100, logs ”✅ SEO Mobile Friendly Passed”
- ❌ If score is not 100, logs ”🚨 Test Failed! SEO Score is
{score}
, expected 100”
- ✅ Extracts SEO score from
-
- Runs PageSpeed Insights test
-
Site should be HTML5 validated
-
Runs HTML5 validation
-
✅ Visits W3C HTML5 validator and inputs website URL
-
✅ Clicks submit button to start validation
-
✅ Waits for results to populate (up to 60 seconds)
- Monitors validation progress
- ✅ Waits for
#results
to contain validation results - ✅ Logs ”⏳ Test still running… (
{retries}
retries left)” during wait - ✅ Logs ”✅ Test completed! Checking for validation results…” when done
-
Validates HTML errors
- ✅ Counts HTML errors using
#results li.error
selector - ✅ Logs ”❌ Number of HTML Errors:
{count}
” for debugging - ✅ Checks for
.failure
message and logs if present
- ✅ Counts HTML errors using
-
-
Final validation
- ✅ If no errors, logs ”✅ HTML5 Validation Passed! No errors or warnings”
- ❌ If errors found, logs ”🚨 HTML5 Validation Failed!” and fails test
-
🔧 WP-Admin Testing – AIWebsite.WP-Admin.test.js
This test suite focuses on WordPress admin functionalities.
- It ensures that admins can log in, manage content, update settings, and perform backend tasks without issues.
- These tests interact with the WordPress dashboard, verifying features such as plugin settings, post creation, and site configurations.
✅ Test Cases for WP-Admin Testing:
-
The domain must pass https://www.site24x7.com/tools/blacklist-check.html
-
Performs blacklist check using Site24x7
- ✅ Visits Site24x7 Blacklist Check tool and enters the domain
- ✅ Clicks check button and waits 10 seconds for results
- ✅ Verifies that domain blacklist results are visible
-
Validates domain blacklist results
- ✅ Checks that domain results table has entries
- ✅ Loops through each result row and validates
aria-label
- ✅ Ensures all results show “Status: trusted”
- ❌ Fails if any result contains negative indicators like ‘Untrusted’, ‘Blacklisted’, ‘Blocked’, ‘Listed’
-
Validates IP blacklist results
- ✅ Ensures IP blacklist results remain hidden (
display: none
) - ✅ Logs ”✅ IP blacklist check passed - no IP blacklisting detected”
- ✅ Ensures IP blacklist results remain hidden (
-
Final validation
- ✅ If all checks pass, logs ”✅ Domain blacklist check passed - all providers show trusted status”
-
-
There should be no errors on the WordPress Dashboard
-
Checks for WordPress dashboard errors
-
✅ Looks for error elements using selectors
.error
and.notice.notice-error
-
✅ Searches within
#wpbody-content
area specifically -
✅ If no errors found, logs ”✅ No errors found on the WordPress Dashboard”
- Collects and reports errors
- ❌ If errors found, loops through each error element
- ❌ Extracts error text and logs “Error
{number}
: ❌ -{error text}
” - ❌ Collects all error messages into array for final reporting
-
-
Final assertion
- ✅ If no errors, test passes with success message
- ❌ If errors found, fails test with detailed error list showing total count and all messages
-
-
Yoast SEO (After plugin update): “Activate breadcrumbs” should be checked
-
Navigates to Yoast SEO settings
- ✅ Clicks on “Yoast SEO” in WordPress menu
- ✅ Navigates to Advanced section via submenu
- ✅ Clicks on “Advanced” tab in Yoast navigation
-
Finds and clicks Breadcrumbs section
- ✅ Uses multiple selectors to find breadcrumbs navigation
- ✅ Loops through breadcrumb selectors until valid one found
- ✅ Clicks on “Breadcrumbs” option once found
-
Validates breadcrumbs toggle
- ✅ Checks that breadcrumbs toggle button has
aria-checked="true"
- ✅ If activated, logs ”✅ Breadcrumbs toggle is activated”
- ❌ If not activated, fails test with assertion error
- ✅ Checks that breadcrumbs toggle button has
-
-
Checks if the Duplicator plugin exists and whether it is activated or not
-
Navigates to Plugins page
- ✅ Clicks “Plugins” in WordPress menu
- ✅ Searches through plugin titles for “Duplicator”
-
Validates plugin status
- ✅ If plugin not found, logs ”✅ Duplicator plugin not found (plugin is optional)”
- ✅ If plugin found, checks row actions to determine if activated
- ✅ If deactivated (shows “Activate” action), logs ”✅ Duplicator plugin is deactivated (as expected)”
- ❌ If activated (shows “Deactivate” action), logs ”❌ Duplicator plugin is activated (should be deactivated)”
-
Final assertion
- ✅ Test passes if plugin is not found or is deactivated
- ❌ Test fails if plugin is found and activated
-
-
Reading Settings: “Discourage search engines from indexing this site” should be unchecked
-
Navigates to Reading settings
- ✅ Clicks “Settings” in WordPress menu
- ✅ Clicks “Reading” in submenu with force option
- ✅ Locates the search engine discouragement checkbox
-
Validates checkbox state
- ✅ Checks that
#blog_public
checkbox is not checked - ✅ If unchecked, test passes
- ❌ If checked, test fails indicating search engines are being discouraged
- ✅ Checks that
-
-
WordPress version should be the latest version
-
Checks for Updates page
- ✅ First tries to find “Updates” tab in WordPress menu
- ✅ If found, navigates to Updates page for version check
- ⚠️ If not found, uses fallback method with footer version check
-
Method 1: Updates page check
- ✅ Extracts current version from
.wp-current-version
element - ✅ Logs “Current WordPress Version:
{version}
” - ✅ Checks
.response
text for “You have the latest version of WordPress” - ✅ If up to date, test passes
- ✅ Extracts current version from
-
Method 2: Fallback check
- ✅ Extracts version from footer
#footer-upgrade
element - ✅ Logs ”📎 Current WordPress Version (from footer):
{version}
” - ✅ Checks for warning notices indicating outdated version
- ✅ If no warning found, assumes version is up to date
- ❌ If warning found, logs warning text and fails test
- ✅ Extracts version from footer
-
-
Checks for any duplicate and unused plugins
-
Analyzes installed plugins
-
✅ Collects all plugin names from plugin titles
-
✅ Identifies duplicates by comparing plugin names
-
✅ Identifies unused plugins by checking for “Activate” action links
- Reports findings
- ✅ Logs ”✅ No duplicate plugins found” if none detected
- ❌ Logs ”❌ Duplicate plugins found:
{plugin names}
” if found - ✅ Logs ”✅ No unused plugins found” if all active
- ❌ Logs ”❌ Unused plugins found:
{plugin names}
” if inactive plugins detected
-
-
Final validation
- ✅ Test passes if no duplicates and no unused plugins
- ❌ Test fails if any duplicates or unused plugins found
-
-
Checks if Contact Form 7 is correctly configured
-
Navigates to Contact Forms
- ✅ Clicks “Contact” in WordPress menu
- ✅ Checks for existing contact forms
-
Validates contact forms
-
❌ If no contact forms found, logs ”❌ No contact forms found” and fails test
-
✅ If forms exist, checks for configuration errors using
.config-error
selector -
✅ Counts total configuration errors across all forms
- Final assertion
- ✅ If no errors, logs ”✅ All contact forms are correctly configured. No configuration errors found”
- ❌ If errors found, logs ”❌ Configuration errors detected in
{count}
contact form(s)” and fails test
-
-
-
Checks the email address of the WP Admin
-
Navigates to General Settings
- ✅ Clicks “Settings” in WordPress menu
- ✅ Extracts current admin email from
#new_admin_email
field
-
Validates admin email
-
✅ Compares current email against expected values:
-
✅ Performs case-insensitive comparison
- Final assertion
- ✅ If email matches expected value, logs ”✔ Matched admin email:
{email}
” - ❌ If email doesn’t match, logs ”❌ Admin email mismatch! Found:
{email}
, Expected:{expected list}
” and fails test
-
-
📋 Changelog
Version 1.1.9
- WordPress Admin Test Reliability Improvements:
- Fixed assertion logic for Duplicator plugin existence and activation check
- Fixed unused plugins assertions in duplicate and unused plugins check
- Added result assertions and optimized execution flow for domain blacklist check
- Published Site Test Enhancements:
- Added fallback to
/get-in-touch/
when/contact
returns 404 for contact page placeholder test - Added CSS selector for fixed header height test
- Removed website credentials from test array for security
- Added fallback to
- Configuration Updates:
- Increased responseTimeout to prevent early test failures
- Increased pageLoadTimeout to prevent early test failures
Version 1.1.8
- Fixed fallback check for missing WordPress Updates section
- Removed unnecessary test in WP Admin
- Removed false-positive tests in PublishedSite
Version 1.1.7
- Prevented +1 from appending to non-US phone numbers
- Handled phone numbers with country code prefixes
Version 1.1.6
- Added test for clickable phone numbers on all devices
- Added test to verify mobile menu is functional
Version 1.1.5
- Added test to prevent phone numbers linking to Agent Image
Version 1.1.4
- Fixed header, footer, and menu items using new CSS selectors
Version 1.1.3
- Added SEO mobile-friendly test
- Added HTML5 validation test
Version 1.1.2
- Added WordPress error scan test
- Added Yoast SEO breadcrumbs test
Version 1.1.1
- Added dead link detection for menu items
- Updated sitemap checker with detailed failure logs
Version 1.1.0
- Added robots.txt validation
- Simplified menu item assertion logic
Version 1.0.9
- Updated Mochawesome and related packages
Version 1.0.8
- Updated WordPress version checker
- Removed unreliable auto-update check
Version 1.0.7
- Added command to handle popups before tests run
Version 1.0.6
- Added SSL Labs test for server configuration rating
Version 1.0.5
- Refined header height checker
- Added alphabetical order check for sitemap
Version 1.0.4
- Added header height, contact placeholder, and footer format tests
Version 1.0.3
- Improved Cypress timeouts and test stability
Version 1.0.1
- Updated sitemap and copyright validation test
- Added dead link detection for menus
Version 1.0.0
- Initial setup for PublishedSite and WP Admin test suites