Skip to content
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

Update login tests for new logics #965

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

amurKontur
Copy link
Contributor

@amurKontur amurKontur commented Jan 22, 2025

Summary by CodeRabbit

  • New Features

    • Added a new constant for a Google Forms survey URL in login tests.
    • Updated click method in MCDA popup with specific click coordinates.
  • Refactor

    • Simplified constructor in the HelperBase class.
    • Minor parameter renaming in the pricing page method.
  • Tests

    • Updated URL validation logic for button assertions in pricing page tests.

Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

Walkthrough

The pull request encompasses modifications across multiple e2e test files, focusing on refining test specifications and page object implementations. Changes include introducing a new survey URL constant in the login specification, updating the HelperBase class constructor for more concise property initialization, adjusting the click method in the MCDA popup to specify click coordinates, and making a minor parameter renaming in the pricing page method.

Changes

File Change Summary
e2e/login.spec.ts Added linkToSurveyProd constant for dynamic URL validation in project environment checks
e2e/page-objects/helperBase.ts Simplified constructor by directly declaring page as a public readonly property
e2e/page-objects/mcdaPopup.ts Updated createMCDA method to include specific click coordinates (x: 15, y: 15) when clicking save button
e2e/page-objects/pricingPage.ts Renamed text parameter to textEl in forEach loop within checkPageAndTextsAvailability method

Poem

🐰 In the realm of code, where tests reside,
Tweaks and changes softly glide
Coordinates clicked, constructors refined
A rabbit's touch, precision defined
E2E magic, dancing with grace! 🧪✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d856d63 and 65fffd5.

⛔ Files ignored due to path filters (4)
  • e2e/locationWithPro.spec.ts-snapshots/As-PRO-User-I-can-click-Locate-me-button-at-Kontur-Atlas-and-get-zoomed-to-my-location-1-chromium-pro-linux.png is excluded by !**/*.png, !**/*.png
  • e2e/locationWithPro.spec.ts-snapshots/As-PRO-User-I-can-click-Locate-me-button-at-Kontur-Atlas-and-get-zoomed-to-my-location-prod-1-chromium-pro-linux.png is excluded by !**/*.png, !**/*.png
  • e2e/locationWithPro.spec.ts-snapshots/As-PRO-User-I-can-click-Locate-me-button-at-Smart-City-and-get-zoomed-to-my-location-1-chromium-pro-linux.png is excluded by !**/*.png, !**/*.png
  • e2e/locationWithPro.spec.ts-snapshots/As-PRO-User-I-can-click-Locate-me-button-at-Smart-City-and-get-zoomed-to-my-location-prod-1-chromium-pro-linux.png is excluded by !**/*.png, !**/*.png
📒 Files selected for processing (1)
  • e2e/page-objects/mcdaPopup.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Run e2e tests
🔇 Additional comments (2)
e2e/page-objects/mcdaPopup.ts (2)

116-116: Remove specific click coordinates unless necessary.

The specific click coordinates (15,15) appear unnecessary and could make the test more brittle. No other click actions in the codebase use specific coordinates, and there's no documentation explaining why they're needed here. Consider using a simple click() with just the delay if needed for animations.


86-86: Document and verify the need for increased delay.

The delay increase from 50ms to 90ms in pressSequentially might indicate timing issues. Consider:

  1. Adding a comment explaining why this increase was necessary
  2. Using proper wait conditions (e.g., waiting for network requests, animations, or state changes) instead of relying on arbitrary delays
✅ Verification successful

Input simulation delay is appropriately used with proper wait conditions

The increased delay is used specifically for input simulation, and it's properly followed by an explicit wait condition (listbox.waitFor({ state: 'visible' })). This pattern is consistent with other input simulations in the codebase where delays are used for reliable input handling rather than for timing synchronization.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for similar delay patterns in e2e tests
rg "pressSequentially.*delay.*[0-9]+" -g "e2e/**/*.ts"

Length of output: 334


Script:

#!/bin/bash
# Get context around pressSequentially usage
echo "=== pressSequentially in mcdaPopup.ts ==="
rg "pressSequentially" -B 3 -A 3 e2e/page-objects/mcdaPopup.ts

echo -e "\n=== pressSequentially in mapPage.ts ==="
rg "pressSequentially" -B 3 -A 3 e2e/page-objects/mapPage.ts

echo -e "\n=== Looking for wait conditions ==="
rg "wait[A-Z][a-zA-Z]*" -g "e2e/**/*.ts"

Length of output: 8004

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

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

Copy link

Preview environments for this PR:

These previews are automatically updated with each commit.

Note: After a new deployment, it may take a few minutes for the changes to propagate and for caches to update. During this time, you might experience temporary loading issues or see an older version of the app. If the app fails to load, please wait a few minutes and try again.

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.04%. Comparing base (d469784) to head (65fffd5).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #965   +/-   ##
=======================================
  Coverage   10.04%   10.04%           
=======================================
  Files         668      668           
  Lines       29398    29395    -3     
  Branches     1235     1235           
=======================================
  Hits         2954     2954           
+ Misses      25915    25912    -3     
  Partials      529      529           
Components Coverage Δ
UI Components 0.26% <ø> (+<0.01%) ⬆️
Core Logic 17.81% <ø> (+<0.01%) ⬆️
Features 1.13% <ø> (ø)
Utilities 45.77% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codecov bot commented Jan 22, 2025

Bundle Report

Changes will decrease total bundle size by 10 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
konturio/disaster-ninja-fe-esm 5.41MB 10 bytes (-0.0%) ⬇️

Copy link
Contributor

@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: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e63b26 and d856d63.

⛔ Files ignored due to path filters (4)
  • e2e/locationWithPro.spec.ts-snapshots/As-PRO-User-I-can-click-Locate-me-button-at-Kontur-Atlas-and-get-zoomed-to-my-location-1-chromium-pro-darwin.png is excluded by !**/*.png, !**/*.png
  • e2e/locationWithPro.spec.ts-snapshots/As-PRO-User-I-can-click-Locate-me-button-at-Kontur-Atlas-and-get-zoomed-to-my-location-prod-1-chromium-pro-darwin.png is excluded by !**/*.png, !**/*.png
  • e2e/locationWithPro.spec.ts-snapshots/As-PRO-User-I-can-click-Locate-me-button-at-Smart-City-and-get-zoomed-to-my-location-1-chromium-pro-darwin.png is excluded by !**/*.png, !**/*.png
  • e2e/locationWithPro.spec.ts-snapshots/As-PRO-User-I-can-click-Locate-me-button-at-Smart-City-and-get-zoomed-to-my-location-prod-1-chromium-pro-darwin.png is excluded by !**/*.png, !**/*.png
📒 Files selected for processing (4)
  • e2e/login.spec.ts (2 hunks)
  • e2e/page-objects/helperBase.ts (1 hunks)
  • e2e/page-objects/mcdaPopup.ts (1 hunks)
  • e2e/page-objects/pricingPage.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Run e2e tests
  • GitHub Check: Run e2e tests
🔇 Additional comments (2)
e2e/page-objects/helperBase.ts (1)

23-23: LGTM! Nice TypeScript syntax improvement.

Good use of TypeScript's parameter property syntax to reduce boilerplate in the constructor.

e2e/page-objects/pricingPage.ts (1)

18-18: LGTM! Improved parameter naming.

Good rename from 'text' to 'textEl' as it better indicates that the parameter is a DOM element.

e2e/login.spec.ts Show resolved Hide resolved
e2e/login.spec.ts Show resolved Hide resolved
e2e/page-objects/mcdaPopup.ts Show resolved Hide resolved
@amurKontur amurKontur merged commit c6f9383 into main Jan 22, 2025
15 of 20 checks passed
@amurKontur amurKontur deleted the 20651-fe-update-login-tests-for-new-logics branch January 22, 2025 16:00
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