-
Notifications
You must be signed in to change notification settings - Fork 41
Prepare for 6.23 #2462
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
Prepare for 6.23 #2462
Changes from all commits
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 | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,19 +18,20 @@ describe("Forms page", () => { | |||||||||||||||||||||||||||||||||||||||||||||
| const text = $el.text().trim(); | ||||||||||||||||||||||||||||||||||||||||||||||
| const href = $el.attr('href'); | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| if (href && (text.includes('upgrading to PRO') || text.includes( 'Get 60% Off Pro!' ) || text.match(/GET \d+% OFF|SAVE \d+%/))) { | ||||||||||||||||||||||||||||||||||||||||||||||
| if (href && (text.includes('upgrading to PRO') || text.match('Get 60% Off Pro!') || text.match(/GET \d+% OFF|SAVE \d+%/))) { | ||||||||||||||||||||||||||||||||||||||||||||||
| cy.origin('https://formidableforms.com', { args: { href } }, ({ href }) => { | ||||||||||||||||||||||||||||||||||||||||||||||
| cy.visit(href); | ||||||||||||||||||||||||||||||||||||||||||||||
| cy.get('h1').should(($h1) => { | ||||||||||||||||||||||||||||||||||||||||||||||
| const headingText = $h1.text(); | ||||||||||||||||||||||||||||||||||||||||||||||
| expect([ | ||||||||||||||||||||||||||||||||||||||||||||||
| 'The Only WordPress Form Maker & Application Builder Plugin', | ||||||||||||||||||||||||||||||||||||||||||||||
| 'Upgrade Today to Unlock the Full Power of Formidable Forms' | ||||||||||||||||||||||||||||||||||||||||||||||
| 'Upgrade Today to Unlock the Full Power of Formidable Forms', | ||||||||||||||||||||||||||||||||||||||||||||||
| 'The Most Advanced WordPress Form builder' | ||||||||||||||||||||||||||||||||||||||||||||||
| ]).to.include(headingText); | ||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
24
to
31
Contributor
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. 🛠️ Refactor suggestion Make heading check trim- and case-insensitive to avoid brittle failures The external page H1 may have minor case/copy tweaks or whitespace. Normalize and check against allowed variants case-insensitively. Apply this diff: - cy.get('h1').should(($h1) => {
- const headingText = $h1.text();
- expect([
- 'The Only WordPress Form Maker & Application Builder Plugin',
- 'Upgrade Today to Unlock the Full Power of Formidable Forms',
- 'The Most Advanced WordPress Form builder'
- ]).to.include(headingText);
- });
+ cy.get('h1').should(($h1) => {
+ const headingText = $h1.text().trim();
+ const allowedHeadings = [
+ 'The Only WordPress Form Maker & Application Builder Plugin',
+ 'Upgrade Today to Unlock the Full Power of Formidable Forms',
+ 'The Most Advanced WordPress Form Builder'
+ ];
+ expect(allowedHeadings.map(h => h.toLowerCase())).to.include(headingText.toLowerCase());
+ });📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| throw new Error(`Unexpected banner text or missing href: "${text}"`); | ||||||||||||||||||||||||||||||||||||||||||||||
| throw new Error(`Unexpected banner text or missing href: "${text}"`); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
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.
🛠️ Refactor suggestion
Harden banner detection with a single case-insensitive regex
Switching to match() is fine, but the current combination is brittle due to case/wording variants. A single case-insensitive regex keeps intent while reducing flakiness.
Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents