-
Notifications
You must be signed in to change notification settings - Fork 151
[Test Automation] Changes for some issues with faker tests data generation! #1681
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
Conversation
WalkthroughAdds a word-generation helper to Base and updates tests to use it. Refactors registration form tests to source values from RegistrationForm and dynamically generate social fields. Adjusts default social field test data to empty strings. Minor formatting and an unused import removal. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 4
🧹 Nitpick comments (3)
tests/e2e/pages/base.ts (1)
290-297
: Helper looks good; optional simplificationThe instance helper is fine. If you want to avoid the loop, consider generating from an alphabetic pool with a guaranteed length.
Example:
- let word = faker.word.words(1); - while (word.length < minLength) { - word = faker.word.words(1); - } - return word; + return faker.string.alpha({ length: { min: minLength, max: Math.max(minLength, 10) } });This avoids potential long loops when short words are picked repeatedly.
tests/e2e/pages/regForm.ts (2)
340-352
: Deduplicate LinkedIn/Instagram fillingLinkedIn and Instagram are filled both here and earlier (Lines 326–336). Keep one block to reduce flakiness and make intent clear. If you apply the fix suggested for Lines 326–336 to handle X/Facebook, leaving LinkedIn/Instagram here is fine; otherwise, remove this duplicate.
715-720
: Use valid, consistent social base URLs; note a typo in the data field nameSmall polish:
- x.com: prefer https://x.com/ rather than https://www.x.com/... (www.x.com typically redirects but isn’t canonical).
- Consider linkedin path consistency: many UIs expect https://www.linkedin.com/in/.
- The VendorRegistrationForm property is spelled wcfmMemberLiknkedin (typo); consider renaming to wcfmMemberLinkedin for clarity (requires updates in testData and usage sites).
Apply this diff for base URLs:
- await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.facebookField, VendorRegistrationForm.wcfmMemberFacebook = `https://www.facebook.com/${this.generateWordWithMinLength(5)}`); - await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.twitterField, VendorRegistrationForm.wcfmMemberTwitter = `https://www.x.com/${this.generateWordWithMinLength(5)}`); - await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.googleField, VendorRegistrationForm.wcfmMemberGoogle = `https://www.google.com/${this.generateWordWithMinLength(5)}`); - await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.linkedinField, VendorRegistrationForm.wcfmMemberLiknkedin = `https://www.linkedin.com/${this.generateWordWithMinLength(5)}`); - await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.youtubeField, VendorRegistrationForm.wcfmMemberYoutube = `https://www.youtube.com/${this.generateWordWithMinLength(5)}`); - await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.instagramField, VendorRegistrationForm.wcfmMemberInstagram = `https://www.instagram.com/${this.generateWordWithMinLength(5)}`); + await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.facebookField, VendorRegistrationForm.wcfmMemberFacebook = `https://www.facebook.com/${this.generateWordWithMinLength(5)}`); + await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.twitterField, VendorRegistrationForm.wcfmMemberTwitter = `https://x.com/${this.generateWordWithMinLength(5)}`); + await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.googleField, VendorRegistrationForm.wcfmMemberGoogle = `https://www.google.com/${this.generateWordWithMinLength(5)}`); + await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.linkedinField, VendorRegistrationForm.wcfmMemberLiknkedin = `https://www.linkedin.com/in/${this.generateWordWithMinLength(5)}`); + await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.youtubeField, VendorRegistrationForm.wcfmMemberYoutube = `https://www.youtube.com/${this.generateWordWithMinLength(5)}`); + await this.validateAndFillStrings(Selectors.vendorRegistrationForms.wcfmMember.frontendForm.instagramField, VendorRegistrationForm.wcfmMemberInstagram = `https://www.instagram.com/${this.generateWordWithMinLength(5)}`);If you want, I can prepare a follow-up PR to rename wcfmMemberLiknkedin across the codebase.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (5)
tests/e2e/pages/base.ts
(2 hunks)tests/e2e/pages/postForm.ts
(1 hunks)tests/e2e/pages/regForm.ts
(3 hunks)tests/e2e/tests/regFormSettingsTestPro.spec.ts
(0 hunks)tests/e2e/utils/testData.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- tests/e2e/tests/regFormSettingsTestPro.spec.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/e2e/pages/regForm.ts (1)
tests/e2e/utils/testData.ts (2)
RegistrationForm
(356-356)VendorRegistrationForm
(357-357)
🔇 Additional comments (2)
tests/e2e/pages/postForm.ts (1)
244-245
: LGTM: Centralized word generation for Repeat FieldSwitching Repeat Field to use this.generateWordWithMinLength(5) de-flakes tests caused by too-short words. Good reuse of the Base helper.
tests/e2e/pages/regForm.ts (1)
223-223
: LGTM: Use shared test data for emailnewEmail now sourced from RegistrationForm.rfEmail improves consistency with centralized test data.
static generateWordWithMinLength(arg0: number): string { | ||
throw new Error('Method not implemented.'); | ||
} |
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.
💡 Verification agent
🧩 Analysis chain
Remove or implement the static method to avoid runtime throws
static generateWordWithMinLength currently throws. If any code mistakenly calls Base.generateWordWithMinLength(...), tests will fail non-deterministically. Either remove it or implement it consistently with the instance method to prevent surprises.
Apply one of the following diffs:
Option A — Implement the static method:
- static generateWordWithMinLength(arg0: number): string {
- throw new Error('Method not implemented.');
- }
+ static generateWordWithMinLength(minLength: number = 5): string {
+ let word = faker.word.words(1);
+ while (word.length < minLength) {
+ word = faker.word.words(1);
+ }
+ return word;
+ }
Option B — Remove the static method if unused:
- static generateWordWithMinLength(arg0: number): string {
- throw new Error('Method not implemented.');
- }
Check whether the static method is called anywhere:
🏁 Script executed:
#!/bin/bash
# Expect no results; if present, prefer Option A above.
rg -n -C2 '\bBase\.generateWordWithMinLength\s*\(' --type=ts
Length of output: 62
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "PWD: $(pwd)"
FILE=tests/e2e/pages/base.ts
echo
echo "=== Check for expected file ==="
if [ -f "$FILE" ]; then
echo "Found $FILE"
echo "---- $FILE (first 240 lines) ----"
sed -n '1,240p' "$FILE" || true
else
echo "$FILE not found at expected path. Searching for files named base.ts..."
if command -v rg >/dev/null 2>&1; then
rg -n --hidden --glob '!node_modules' 'base\.ts' || true
else
find . -type f -iname 'base.ts' -print || true
fi
fi
echo
echo "=== Search for occurrences of generateWordWithMinLength ==="
if command -v rg >/dev/null 2>&1; then
rg -n --hidden --glob '!node_modules' 'generateWordWithMinLength' || true
else
grep -RIn --exclude-dir=node_modules 'generateWordWithMinLength' . || true
fi
echo
echo "=== Search for direct static calls: Base.generateWordWithMinLength(...) ==="
if command -v rg >/dev/null 2>&1; then
rg -n --hidden --glob '!node_modules' '\bBase\.generateWordWithMinLength\s*\(' || true
else
grep -RIn --exclude-dir=node_modules -E '\bBase\.generateWordWithMinLength\s*\(' . || true
fi
echo
echo "=== Search for class Base definitions/usages ==="
if command -v rg >/dev/null 2>&1; then
rg -n --hidden --glob '!node_modules' 'class\s+Base\b' -S || true
rg -n --hidden --glob '!node_modules' '\bnew\s+Base\b' -S || true
else
grep -RIn --exclude-dir=node_modules -E 'class[[:space:]]+Base\b' . || true
grep -RIn --exclude-dir=node_modules -E '\bnew[[:space:]]+Base\b' . || true
fi
Length of output: 15188
Remove unused static generateWordWithMinLength from tests/e2e/pages/base.ts
I searched the repo: there are no direct static calls to Base.generateWordWithMinLength(...). An instance method generateWordWithMinLength(minLength = 5) exists (tests/e2e/pages/base.ts:291) and is used via this.generateWordWithMinLength(...) in multiple files, so the static stub can be removed to avoid confusion or accidental runtime throws.
Files referencing the instance method (examples):
- tests/e2e/pages/regForm.ts:328, 335, 342, 349
- tests/e2e/pages/regForm.ts:715–720
- tests/e2e/pages/postForm.ts:244
- tests/e2e/pages/base.ts:291 (instance implementation)
- tests/e2e/pages/base.ts:8 (static stub to remove)
Apply this diff to remove the unused static stub:
--- a/tests/e2e/pages/base.ts
+++ b/tests/e2e/pages/base.ts
@@
- static generateWordWithMinLength(arg0: number): string {
- throw new Error('Method not implemented.');
- }
If you prefer keeping a static helper, implement it consistently with the instance method; otherwise remove the stub.
🤖 Prompt for AI Agents
In tests/e2e/pages/base.ts around lines 8 to 10, remove the unused static stub
method generateWordWithMinLength(arg0: number): string { throw new Error('Method
not implemented.'); } because the class already provides an instance method
generateWordWithMinLength(minLength = 5) used throughout the tests; simply
delete the static declaration (or if you prefer keeping a static helper,
implement it to delegate to the instance implementation or duplicate the same
logic instead of throwing).
try { | ||
// Enter X (Twitter) | ||
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter, xTwitter); | ||
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter, RegistrationForm.rfXtwitter); | ||
} catch (error) { | ||
console.log("X (Twitter) field is not present"); | ||
} | ||
|
||
try { | ||
// Enter Facebook | ||
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook, facebook); | ||
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook, RegistrationForm.rfFacebook); |
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.
💡 Verification agent
🧩 Analysis chain
X (Twitter) and Facebook are filled with empty strings — generate values instead
Because RegistrationForm.rfXtwitter and RegistrationForm.rfFacebook are now empty by default (testData.ts Lines 225–226), these calls will submit blank strings. If these inputs must be non-empty or you want to avoid ambiguity, generate like you already do for LinkedIn/Instagram.
Apply this diff to generate reasonable values:
- // Enter X (Twitter)
- await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter, RegistrationForm.rfXtwitter);
+ // Enter X (Twitter)
+ await this.validateAndFillStrings(
+ Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter,
+ RegistrationForm.rfXtwitter = `https://x.com/${this.generateWordWithMinLength(5)}`
+ )
...
- // Enter Facebook
- await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook, RegistrationForm.rfFacebook);
+ // Enter Facebook
+ await this.validateAndFillStrings(
+ Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook,
+ RegistrationForm.rfFacebook = `https://www.facebook.com/${this.generateWordWithMinLength(5)}`
+ )
If you intend these to be optional/blank, confirm with a quick scan:
🏁 Script executed:
#!/bin/bash
# Check for validations asserting non-empty X/Facebook fields
rg -n -C3 'rfXtwitter|rfFacebook' --type=ts
Length of output: 2787
Generate non-empty values for X (Twitter) and Facebook — tests are currently submitting blank strings
Short: tests/e2e/utils/testData.ts sets rfXtwitter and rfFacebook to '' and tests/e2e/pages/regForm.ts uses those values, so blank strings will be submitted. Please generate values (like LinkedIn/Instagram).
Files to fix
- tests/e2e/utils/testData.ts — rfXtwitter / rfFacebook set to '' (lines ~225–226)
- tests/e2e/pages/regForm.ts — validateAndFillStrings uses RegistrationForm.rfXtwitter and RegistrationForm.rfFacebook (lines ~313–321)
- tests/e2e/pages/selectors.ts — selectors exist for these fields (lines ~991–992)
Suggested diff
- try {
- // Enter X (Twitter)
- await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter, RegistrationForm.rfXtwitter);
- } catch (error) {
- console.log("X (Twitter) field is not present");
- }
+ try {
+ // Enter X (Twitter)
+ await this.validateAndFillStrings(
+ Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter,
+ RegistrationForm.rfXtwitter = `https://x.com/${this.generateWordWithMinLength(5)}`
+ );
+ } catch (error) {
+ console.log("X (Twitter) field is not present");
+ }
...
- try {
- // Enter Facebook
- await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook, RegistrationForm.rfFacebook);
- } catch (error) {
- console.log("Facebook field is not present");
- }
+ try {
+ // Enter Facebook
+ await this.validateAndFillStrings(
+ Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook,
+ RegistrationForm.rfFacebook = `https://www.facebook.com/${this.generateWordWithMinLength(5)}`
+ );
+ } catch (error) {
+ console.log("Facebook field is not present");
+ }
If these fields are intentionally optional/blank, confirm and ignore; otherwise apply the change so tests don't submit empty strings.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
try { | |
// Enter X (Twitter) | |
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter, xTwitter); | |
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter, RegistrationForm.rfXtwitter); | |
} catch (error) { | |
console.log("X (Twitter) field is not present"); | |
} | |
try { | |
// Enter Facebook | |
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook, facebook); | |
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook, RegistrationForm.rfFacebook); | |
try { | |
// Enter X (Twitter) | |
await this.validateAndFillStrings( | |
Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter, | |
RegistrationForm.rfXtwitter = `https://x.com/${this.generateWordWithMinLength(5)}` | |
); | |
} catch (error) { | |
console.log("X (Twitter) field is not present"); | |
} | |
try { | |
// Enter Facebook | |
await this.validateAndFillStrings( | |
Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook, | |
RegistrationForm.rfFacebook = `https://www.facebook.com/${this.generateWordWithMinLength(5)}` | |
); | |
} catch (error) { | |
console.log("Facebook field is not present"); | |
} |
🤖 Prompt for AI Agents
In tests/e2e/pages/regForm.ts around lines 312–321 and
tests/e2e/utils/testData.ts around lines ~225–226, the test is submitting empty
strings for rfXtwitter and rfFacebook; update tests/e2e/utils/testData.ts to
generate non-empty realistic values (e.g., "xUser123" or "@x_user" for
rfXtwitter and "facebookUser123" or a full URL for rfFacebook) instead of '' and
then keep tests/e2e/pages/regForm.ts as-is so validateAndFillStrings fills those
new values; if these fields are optional intentionally, add a comment in
testData explaining why they remain blank and skip filling in regForm.ts
accordingly.
try { | ||
// Enter X (Twitter) | ||
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfLinkedIn, linkedIn); | ||
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfLinkedIn, RegistrationForm.rfLinkedIn = this.generateWordWithMinLength(5)); | ||
} catch (error) { | ||
console.log("Linkedin field is not present"); | ||
} | ||
|
||
try { | ||
// Enter Facebook | ||
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfInstagram, instagram); | ||
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfInstagram, RegistrationForm.rfInstagram = this.generateWordWithMinLength(5)); | ||
} catch (error) { |
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
Block mislabels and wrong fields (fills LinkedIn/Instagram under Twitter/Facebook comments); also duplicated later
This block’s comments say “Enter X (Twitter)” and “Enter Facebook” but actually fills LinkedIn and Instagram. Additionally, LinkedIn/Instagram are filled again in Lines 340–352. Keep one LinkedIn/Instagram fill and fix this block to X/Facebook, or remove it entirely to avoid confusion.
Suggested correction (if you want this block to handle X/Facebook generation):
- try {
- // Enter X (Twitter)
- await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfLinkedIn, RegistrationForm.rfLinkedIn = this.generateWordWithMinLength(5));
- } catch (error) {
- console.log("Linkedin field is not present");
- }
-
- try {
- // Enter Facebook
- await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfInstagram, RegistrationForm.rfInstagram = this.generateWordWithMinLength(5));
- } catch (error) {
- console.log("Instagram field is not present");
- }
+ try {
+ // Enter X (Twitter)
+ await this.validateAndFillStrings(
+ Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter,
+ RegistrationForm.rfXtwitter = `https://x.com/${this.generateWordWithMinLength(5)}`
+ );
+ } catch (error) {
+ console.log("X (Twitter) field is not present");
+ }
+
+ try {
+ // Enter Facebook
+ await this.validateAndFillStrings(
+ Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook,
+ RegistrationForm.rfFacebook = `https://www.facebook.com/${this.generateWordWithMinLength(5)}`
+ );
+ } catch (error) {
+ console.log("Facebook field is not present");
+ }
Alternatively, if you prefer to keep X/Facebook blank, remove this block and keep the later LinkedIn/Instagram block (Lines 340–352).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
try { | |
// Enter X (Twitter) | |
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfLinkedIn, linkedIn); | |
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfLinkedIn, RegistrationForm.rfLinkedIn = this.generateWordWithMinLength(5)); | |
} catch (error) { | |
console.log("Linkedin field is not present"); | |
} | |
try { | |
// Enter Facebook | |
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfInstagram, instagram); | |
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfInstagram, RegistrationForm.rfInstagram = this.generateWordWithMinLength(5)); | |
} catch (error) { | |
try { | |
// Enter X (Twitter) | |
await this.validateAndFillStrings( | |
Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter, | |
RegistrationForm.rfXtwitter = `https://x.com/${this.generateWordWithMinLength(5)}` | |
); | |
} catch (error) { | |
console.log("X (Twitter) field is not present"); | |
} | |
try { | |
// Enter Facebook | |
await this.validateAndFillStrings( | |
Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook, | |
RegistrationForm.rfFacebook = `https://www.facebook.com/${this.generateWordWithMinLength(5)}` | |
); | |
} catch (error) { | |
console.log("Facebook field is not present"); | |
} |
🤖 Prompt for AI Agents
In tests/e2e/pages/regForm.ts around lines 326 to 336, the block's comments say
"Enter X (Twitter)" and "Enter Facebook" but the code fills LinkedIn and
Instagram and those two are duplicated later (lines 340–352); either (A) change
this block to actually fill X and Facebook by replacing the LinkedIn/Instagram
selectors and RegistrationForm assignments with the X and Facebook
selectors/fields (using generateWordWithMinLength(5)), or (B) remove this entire
block so the later LinkedIn/Instagram fills remain the single source of truth;
ensure no duplicate assignments remain and that comments match the actual fields
filled.
rfXtwitter: '', | ||
rfFacebook: '', | ||
rfLinkedIn: '', | ||
rfInstagram: '', |
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.
💡 Verification agent
🧩 Analysis chain
Empty social defaults may lead to blank submissions in FE flows
Setting rfXtwitter/rfFacebook/rfLinkedIn/rfInstagram to empty strings aligns with “generate at runtime,” but the FE flow currently uses these values directly for X and Facebook (see regForm.ts Lines 312–321). This will fill blank strings into those fields. If the fields are optional, fine; otherwise, generate non-empty values (similar to LinkedIn/Instagram) before filling.
Run this to confirm any static/non-empty expectations for these two fields and to locate all usages:
As a concrete fix, consider generating values for X/Facebook in regForm.ts (see suggested diffs in that file’s comments).
🏁 Script executed:
#!/bin/bash
# 1) Find all usages of these fields to ensure they're generated before use
rg -n -C3 '\brfXtwitter\b|\brfFacebook\b' --type=ts
# 2) Check for any "required" or validation context around these selectors
rg -n -C3 'rfXtwitter|rfFacebook|required|validate' --type=ts
Length of output: 298398
Generate non-empty values for X / Facebook before filling
Short summary: I verified that tests/e2e/utils/testData.ts sets rfXtwitter and rfFacebook to empty strings and tests/e2e/pages/regForm.ts calls validateAndFillStrings with those values — that will insert blank strings into the FE fields. LinkedIn/Instagram are generated at runtime, so X/Facebook should be generated too or skipped when empty.
Files/locations to fix
- tests/e2e/utils/testData.ts — rfXtwitter: '' and rfFacebook: '' (lines ~225–226)
- tests/e2e/pages/regForm.ts — fills rfXtwitter (line ~314) and rfFacebook (line ~321); rfLinkedIn / rfInstagram are generated at runtime (lines ~328 / ~335)
Suggested minimal fix (preferred): generate values immediately before filling in regForm.ts — mirror LinkedIn/Instagram approach. Replace the two try blocks with:
try {
// Enter X (Twitter)
RegistrationForm.rfXtwitter = RegistrationForm.rfXtwitter || this.generateWordWithMinLength(5);
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfXtwitter, RegistrationForm.rfXtwitter);
} catch (error) {
console.log("X (Twitter) field is not present");
}
try {
// Enter Facebook
RegistrationForm.rfFacebook = RegistrationForm.rfFacebook || this.generateWordWithMinLength(5);
await this.validateAndFillStrings(Selectors.registrationForms.completeUserRegistrationFormFrontend.rfFacebook, RegistrationForm.rfFacebook);
} catch (error) {
console.log("Facebook field is not present");
}
Alternative: set non-empty defaults in tests/e2e/utils/testData.ts (e.g. faker.internet.userName() or similar) so test data aren't empty.
Action: apply one of the fixes above so validateAndFillStrings doesn't unconditionally write empty strings into the FE fields.
🤖 Prompt for AI Agents
In tests/e2e/pages/regForm.ts around lines ~314–335 (and related defaults in
tests/e2e/utils/testData.ts lines ~225–228), rfXtwitter and rfFacebook are empty
so validateAndFillStrings will write blank values; fix by generating non-empty
values immediately before filling (mirror rfLinkedIn/rfInstagram): in each try
block set RegistrationForm.rfXtwitter = RegistrationForm.rfXtwitter ||
this.generateWordWithMinLength(5) and RegistrationForm.rfFacebook =
RegistrationForm.rfFacebook || this.generateWordWithMinLength(5) respectively,
then call validateAndFillStrings as before and keep the existing catch logs;
alternatively, set non-empty defaults in tests/e2e/utils/testData.ts (e.g.
faker.internet.userName() or similar) so the test data are not empty.
Summary by CodeRabbit