📑 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:
-
Menu items should be accessible
-
Checks if the menu exists
- ✅ If a menu is found, it loops through all links inside it.
- ❌ If no menu is found, logs ”❌ No header menu found on this page.”
-
Checks for dead links
- ✅ If a link is valid
(not empty, #, or javascript:void(0))
, it sends a request to check its status. - ❌ If a link is broken or empty, logs ”❌ Dead link found in header menu:
{link text}
” and adds it to deadLinks. - ❌ If a request gets a non-200 status, logs ”❌ Dead link found in header menu:
{link text}
with status:{status}
” and adds it to deadLinks.
- ✅ If a link is valid
-
Final Assertion
- ✅ If no dead links, logs ”✅ Header link “
${text}
” is working.” - ❌ If dead links exist, logs all issues and fails the test with
assert.fail()
.
- ✅ If no dead links, logs ”✅ Header link “
-
-
Mobile header must not match agent image information in the clients phone and email address
-
Checks if a mobile header exists
- ✅ If found, extracts text for phone numbers and emails
- ⚠️ If missing, logs “Mobile header does not exist”
-
Validates phone numbers
- ℹ️ Logs detected numbers in “Detected phone numbers in mobile header”
- ⚠️ If any match Agent Image numbers, logs “Mobile header phone number(s) match Agent Image”
- ❌ If matches exist, logs all issues and asserts expec
(matchingPhoneNumbers.length).to.eq(0)
-
Validates emails
- ℹ️ Logs detected emails in “Detected email(s) in mobile header”
- ⚠️ If any match Agent Image emails, logs “Mobile header email found that matches Agent Image”
- ❌ If matches exist, logs all issues and asserts
expect(matchingEmail).to.be.null
-
Final Assertion
- ✅ If no matches, logs ”✅ No matching phone numbers or email found in the mobile header”
-
-
Footer copyright should use client or company name. Domains are not allowed
-
Checks if copyright text exists
- ✅ If found, extracts and logs the text
- ❌ If missing, logs “No copyright section found in the footer” and fails the test
(expect(true).to.be.false)
-
Checks for disallowed domains
- ✅ Logs “No domains found in the copyright section” if clean
- ✅ If no exact domain matches are found, logs ”✅ No exact domain matches found in the copyright section”
- ❌ If a domain is detected without a path, logs ”❌ Found exact domain match:
{domain}
(Full URL: {URL})
” and fails the test - ✅ If a domain is detected but includes a path, logs ”✅ Allowed:
{domain}
(Full URL: {URL})
” as an exception
-
-
Contact page placeholder contact info must not match Agent Image phone and email
-
Extraction
- ✅ Extracts and logs the page text.
- ✅ Extracts and logs detected phone numbers and emails for validation.
-
Checks for Agent Image phone numbers
- ✅ Logs ”🔍 Checking phone
{index}
:{number}
” for each detected phone number. - ❌ If a match is found, logs ”❌ Matched phone number:
{number}
” and records the issue.
- ✅ Logs ”🔍 Checking phone
-
Checks for Agent Image emails
- ✅ Logs 🔍 Checking email
{index}
:{email}
” for each detected email. - ❌ If a match is found, logs ”❌ Matched email:
{email}
” and records the issue.
- ✅ Logs 🔍 Checking email
-
Final validation
- ❌ If any issues are detected, logs ”🚨 The following contact details matched Agent Image:” followed by each issue and fails the test.
- ✅ If no matches are found, logs ”✅ No matching Agent Image phone numbers or emails found on the Contact Page."" and passes the test.
-
-
Checks robots.txt
-
Requests and checks response status
- ✅ If response is 200, proceeds with content validation
- ❌ If missing or incorrect, fails the test
(expect(response.status).to.eq(200))
-
Validates required rules
- ✅ If all rules exist, logs “All required lines are present in robots.txt”
- ❌ If any rule is missing, logs “Missing lines in robots.txt:
{list of missing rules}
” and throws an error
-
-
Checks Agent Image footer credits
-
Checks if the copyright text exists
- ✅ If found, extracts and logs the text
- ❌ If missing, logs “No copyright section found in the footer” and fails the test
(expect(true).to.be.false)
-
Validates footer credit types
- ✅ If the footer contains “Real Estate Website Design by Agent Image,” asserts that it’s a real estate website
- ✅ If the footer contains “Real Estate Internet Marketing by Agent Image,” asserts that it’s an SEO client
- ✅ If the footer contains “Website Design by Agent Image,” asserts that it’s a non-real estate website.
- ❌ If none of these texts are found, logs “Footer credit missing or incorrect. Confirm with PM”
-
-
Menu Items should be in text form
-
Checks if the menu exists
- ✅ If a standard menu
(.menu, .site-menu)
is found, loops through all links inside it - ✅ If a burger menu
(button[aria-label="Header Burger Button"])
is found, clicks it and verifies the off-canvas menu - ❌ If no menu is found, logs “No menu exists on this page”
- ✅ If a standard menu
-
Validates menu items
- ✅ Loops through each menu item and ensures it contains text
- ✅ If the text is found, logs ”✅
{text}
should be a string” - ❌ If the menu is empty or missing, logs “No menu found after clicking the burger button”
-
-
Copyright year should display the current year
-
Checks if the copyright year exists
- ✅ If a footer copyright section is found, extracts and cleans the text
- ✅ Logs the cleaned text for debugging
- ❌ If no copyright section is found, logs “No copyright section found in the footer” and fails the test
(expect(true).to.be.false)
-
Validates the current year
- ✅ If the current year is found in the footer text, logs ”✅ Footer should contain the current year:
{currentYear}
” - ❌ If the year is missing, fails the test
- ✅ If the current year is found in the footer text, logs ”✅ Footer should contain the current year:
-
-
Sitemap should display all pages in alphabetical order
-
Checks if the sitemap page exists
- ✅ Visits the sitemap page and waits for it to load
- ❌ If the sitemap list is missing, logs an error
-
Validates main page order
- ✅ If main pages are sorted alphabetically, logs ”✅ Main Page(s) are in alphabetical order:
{parentTexts}
” - ❌ If out of order, logs ”❌ Main Page(s) must be in alphabetical order:
{parentTexts}
” and adds it to failed assertions
- ✅ If main pages are sorted alphabetically, logs ”✅ Main Page(s) are in alphabetical order:
-
Final Assertion
- ✅ If all pages are correctly ordered, logs ”✅ All pages are in alphabetical order”
- ❌ If any failed assertions exist, logs all issues and fails the test
-
-
Footer menu should never be dead links. Use landing pages if necessary
-
Checks if the footer menu exists
- ✅ If a footer menu is found, loops through all links inside it
- ❌ If no footer menu is found, logs “No footer menu found on this page” and fails the test
(expect(true).to.be.false)
-
Checks for dead links
- ✅ If a link is valid
(not empty, #, or javascript:void(0))
, it sends a request to check its status - ❌ If a link is broken or empty, logs “Dead link found in footer menu:
{link text}
” and adds it to deadLinks - ❌ If a request gets a non-200 status, logs “Dead link found in footer menu:
{link text}
with status:{status}
” and adds it to deadLinks
- ✅ If a link is valid
-
Final Assertion
- ✅ If no dead links, logs “All footer links are working”
- ❌ If dead links exist, logs all issues and fails the test with assert.fail()
-
-
Fixed header should not exceed 100px by standard
- Checks if the fixed header height exceeds 100px
- ✅ Scrolls to the center of the page and waits for the header to load
- ✅ If within the limit, logs: ”✅ Test Passed: Fixed header is within limit
({height}px)
.” - ❌ If it exceeds 100px, logs: ”❌ Test Failed: Fixed Header is too large
({height}px)
.”
- Checks if the fixed header height exceeds 100px
🚨 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
-
Checks if the sitemap.xml file is accessible
- ✅ Sends a request to the sitemap URL
- ✅ If the request returns a 200 status, confirms that the sitemap exists
- ❌ If the request fails, logs an error and fails the test
-
Validates sitemap content
- ✅ If the response contains XML content, logs “Sitemap content type is XML.”
- ❌ If the response is missing XML headers, logs “Unexpected content type for sitemap.”
-
Checks for correct XML structure
- ✅ If
<sitemapindex>
is found in the response body, confirms that the sitemap is structured correctly - ❌ If
<sitemapindex>
is missing, logs “Sitemap index is missing or incorrect.”
- ✅ If
-
-
Scan the site using SSL Test . Grades must be A.
-
Scans the website using SSL Labs
- Visits SSL Labs SSL Test and inputs the target website.
- Clicks “Submit” to start the scan.
-
Handles cache clearing if required
- Checks for a “Clear Cache” button before proceeding.
- If found, logs: ”🔄 Clear cache button found. Clicking it…” and clicks it.
- If not found, logs: ”✅ No cache to clear. Proceeding with test…”.
-
Waits for the test to complete
- Monitors the page for #warningBox (indicating the test is still running).
- Waits up to ~8 minutes
(50 retries, 10s each)
. - Logs progress: ”⏳ Test still running… (X retries left)”.
- When done, logs: ”✅ Test completed! Proceeding to results…”.
- If test is not done and reaches 0 retries, logs ”⏳ Test did not finish within the expected time!”. And fails test.
-
Processes test results and validates grades
- Extracts server IP addresses and their corresponding grades.
- Logs results per server: “Server
{number}
:{IP}
” and “Grade:{Grade}
”. - If any server receives a grade lower than A, logs: ”❌ Server
{number}
({IP})
has grade:{Grade}
”. - If all servers pass, logs: ”✅ All servers received Grade A!”.
- ❌ Fails if any server receives a grade lower than A, logs: ”🚨 Test Failed! The following servers did not receive Grade A:”.
- Assertion fails with: ”🚨 SSL Test Failed!
{X}
servers received lower grades.”.
-
Passes if all servers receive Grade A
- Logs: ”✅ SSL Test Passed! All servers received Grade A.”.
- Assertion confirms that no servers received lower grades.
-
🔧 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 Site24x7 Blacklist Check
- Checks if the domain is blacklisted using Site24x7
- ✅ Visits the Site24x7 Blacklist Check tool and enters the domain
- ✅ Clicks the check button and waits for the results
- ⚠️ If the site is blacklisted, check the results manually (not explicitly handled in the script but should be manually verified)
- Checks if the domain is blacklisted using Site24x7
-
Checks if the Duplicator plugin exists and whether it is activated or not
- Checks if the Duplicator plugin exists and whether it is activated
- ✅ Navigates to the Plugins page and searches for “Duplicator”
- ❌ If the plugin is found, logs “Duplicator plugin found”
- ❌ If the plugin is activated, logs “Duplicator plugin is activated”
- ✅ If the plugin is found but not activated, logs “Duplicator plugin is not activated”
- ✅ If the plugin is missing, logs “Duplicator plugin not found”
- ⚠️ If the plugin is found, manually Remove installer data
- Checks if the Duplicator plugin exists and whether it is activated
-
Reading Settings: “Discourage search engines from indexing this site” should be unchecked
- Checks if “Discourage search engines from indexing this site” is unchecked
- ✅ Navigates to the “Reading” settings page
- ✅ If the checkbox is unchecked, the test passes
- ❌ If the checkbox is checked, logs “Search engine discouragement is enabled” and fails the test
- Checks if “Discourage search engines from indexing this site” is unchecked
-
WordPress version should be the latest version
- Checks if WordPress is up to date
- ✅ Navigates to the Updates page and extracts the current WordPress version
- ✅ Logs “Current WordPress Version:
{version number}
” - ✅ If the response confirms the latest version, the test passes
- ❌ If the response does not confirm the latest version, logs “WordPress is not up to date” and fails the test
- Checks if WordPress is up to date
-
Checks for any duplicate and unused plugins
- Checks for any duplicate and unused plugins
- ✅ Logs “No duplicate plugins found” if there are no duplicates
- ❌ If duplicates are found, logs “Duplicate plugins:
{plugin names}
” and flags them - ✅ Logs “No unused plugins found” if all plugins are active
- ❌ If inactive plugins are found, logs “Unused plugins:
{plugin names}
” and flags them
- Checks for any duplicate and unused plugins
-
Checks if Contact Form 7 is correctly configured
- Checks if Contact Form 7 is correctly set up
- ✅ If at least one contact form exists and has no errors, logs ”✅ All contact forms are correctly configured. No configuration errors found”
- ❌ If no contact forms exist, logs ”❌ No contact forms found” and fails the test
- ❌ If configuration errors are found, logs ”❌ Configuration errors detected in
{number}
contact form(s)” and fails the test
- Checks if Contact Form 7 is correctly set up
-
Checks the email address of the WP Admin
- Checks if the WP Admin email is correctly set
- ✅ If the email matches an expected value, logs ”✔ Matched admin email:
{email}
.” - ❌ If the email does not match any expected value, logs ”❌ Admin email mismatch! Found:
{email}
, Expected:{list of expected emails}
” and fails the test.
- ✅ If the email matches an expected value, logs ”✔ Matched admin email:
- Checks if the WP Admin email is correctly set