Skip to content

Conversation

Rubaiyat-E-Mohammad
Copy link
Contributor

@Rubaiyat-E-Mohammad Rubaiyat-E-Mohammad commented Aug 15, 2025

Summary by CodeRabbit

  • Tests
    • Standardized test data generation to ensure consistent minimum-length values across flows.
    • Unified handling of social/profile fields in registration and vendor journeys; updated defaults for select fields.
  • Chores
    • Removed unused dependencies from test suites.
  • Style
    • Minor formatting cleanups in test files.

Copy link

coderabbitai bot commented Aug 15, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary of changes
Word generation utility
tests/e2e/pages/base.ts
Import faker; add static placeholder Base.generateWordWithMinLength(number); add instance method generateWordWithMinLength(minLength=5) that loops on faker.word.words(1) until length threshold.
Post form uses helper
tests/e2e/pages/postForm.ts
Replace faker.word.words(1) with this.generateWordWithMinLength(5) for Repeat Field; remove extra blank lines.
Registration flows and social fields
tests/e2e/pages/regForm.ts
Remove top-level constants; use RegistrationForm.* throughout; generate multiple social fields via this.generateWordWithMinLength(5); add try/catch population for LinkedIn/Instagram in Lite; unify vendor/WCFM social field generation.
Test data defaults
tests/e2e/utils/testData.ts
Set rfXtwitter, rfFacebook, rfLinkedIn, rfInstagram defaults to empty strings (from faker.word.words(1)); minor formatting.
Spec cleanup
tests/e2e/tests/regFormSettingsTestPro.spec.ts
Remove unused fs import; no behavior changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

A whisk of whiskers, a hop through the night,
I forged a word-maker to get names just right.
Socials now sparkle, not faker by chance,
Empty at birth, then taught to dance.
Tests thump-thump—my paws approve. 🐇✨

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Rubaiyat-E-Mohammad Rubaiyat-E-Mohammad changed the title Changes for some issues with faker tests data generation! [Test Automation] Changes for some issues with faker tests data generation! Aug 15, 2025
@sapayth sapayth merged commit 2199d22 into weDevsOfficial:develop Aug 15, 2025
2 checks passed
Copy link

@coderabbitai coderabbitai bot left a 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 simplification

The 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 filling

LinkedIn 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 name

Small 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 1526acb and 09bd155.

📒 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 Field

Switching 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 email

newEmail now sourced from RegistrationForm.rfEmail improves consistency with centralized test data.

Comment on lines +8 to +10
static generateWordWithMinLength(arg0: number): string {
throw new Error('Method not implemented.');
}
Copy link

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).

Comment on lines 312 to +321
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);
Copy link

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.

Suggested change
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.

Comment on lines 326 to 336
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) {
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

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.

Suggested change
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.

Comment on lines +225 to +228
rfXtwitter: '',
rfFacebook: '',
rfLinkedIn: '',
rfInstagram: '',
Copy link

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.

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