Skip to content

Fix: title assertion fails against the current homepage - #2

Open
jochen-testingbot wants to merge 1 commit into
masterfrom
fix/title-assertion
Open

jochen-testingbot wants to merge 1 commit into
masterfrom
fix/title-assertion

Conversation

@jochen-testingbot

Copy link
Copy Markdown
Contributor

Part of https://testingbot-team.atlassian.net/browse/TB-1008 (docs audit). This repo is the Selenium + Java sample project in the signup onboarding.

Problem

mvn test, run as the README says, failed all 3 tests:

java.lang.AssertionError: expected [Cross Browser Testing & Mobile App Testing | TestingBot] but found [TestingBot: Cross Browser Testing and Mobile App Testing]
Tests run: 3, Failures: 3

(TestNG's assertEquals(actual, expected) order makes the message look reversed: the live title is Cross Browser Testing & Mobile App Testing | TestingBot.) An exact title match breaks every time marketing changes the title.

Change

Assert that the title contains TestingBot, with the actual title in the failure message.

Verification

Clean maven:3.9-eclipse-temurin-21 container, mvn -B test (the data provider was switched to serial inside the container only, to respect the shared account's concurrency):

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS
95c067b60b41-6912cbb1c6b1-5c87279ca3e2-179424240067-72357349 microsoftedge 151 WIN10 success=True
9b38b7b9e60e-16ec0e8829ef-d31c40c47303-179424242068-18767014 googlechrome 151 VENTURA success=True
9bf613d03a20-1fba4d74cb5c-3f3bee6decb2-179424243539-12500212 firefox 153 WIN11 success=True

The homepage title is now 'Cross Browser Testing & Mobile App Testing | TestingBot',
so the exact-match assertion failed all three runs of mvn test.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approved

The title assertion now tolerates expected marketing-title changes while still verifying the page is TestingBot and providing clearer failure diagnostics, with no active review issues identified.

No open issues 🎉

What changed in this PR

Updates the Selenium/TestNG homepage title check to tolerate TestingBot marketing-title changes while still verifying the page belongs to TestingBot.

Changes:

  • Captures the current page title.
  • Replaces the brittle exact-title assertion with a TestingBot substring check.
  • Includes the actual title in assertion failure messages.
File Description
src/​test/​java/​com/​yourcompany/​Tests/​SimpleTest.java Makes the homepage title assertion resilient to title wording changes and improves failure diagnostics.

Review effort: Lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants