Skip to content

Conversation

@Dawid-Sroka
Copy link
Collaborator

@Dawid-Sroka Dawid-Sroka commented Dec 18, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new ESLint configuration for end-to-end tests.
    • Added a new package.json file for managing development dependencies and scripts in the tests/e2e_tests directory.
  • Bug Fixes

    • Removed entries for package-lock.json and package.json from the .gitignore file.
  • Style

    • Improved code formatting and consistency across various test files, including adjustments to quote styles and function syntax.
  • Chores

    • Added a new Prettier configuration file for formatting options in the end-to-end tests.

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces updates to the end-to-end testing infrastructure by modifying the .gitignore file, adding new configuration files for ESLint and Prettier, and establishing a package.json for managing development dependencies and scripts. Additionally, multiple Cypress test files have been reformatted for consistency, focusing on the use of single quotes, semicolons, and improved readability. These changes enhance code quality and maintainability within the test suite.

Changes

File Change Summary
.gitignore Removed entries for **/package-lock.json and **/package.json
tests/e2e_tests/.prettierrc.js Added new Prettier configuration with specific formatting rules
tests/e2e_tests/eslint.config.mjs Introduced new ESLint configuration with Cypress and Prettier plugins
tests/e2e_tests/package.json Added development dependencies and scripts for linting and formatting
tests/e2e_tests/cypress/e2e/basic-test/ Multiple files updated with consistent formatting (single quotes, semicolons, arrow function syntax)

Possibly related PRs

  • Add eslint and prettier for checking cypress tests #200: The changes in this PR involve modifications to the .gitignore file, specifically the removal of entries for **/package-lock.json and **/package.json, which directly relates to the changes made in the main PR that also removed these entries from the .gitignore file.

Suggested reviewers

  • raven-wing

Poem

🐰 Hopping through code with glee,
Linters and Prettier set us free!
Semicolons dance, quotes align,
Our tests now shine, line by line!
Coding rabbit's testing delight! 🧪


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 54ba227 and e1e2838.

📒 Files selected for processing (1)
  • tests/e2e_tests/eslint.config.mjs (1 hunks)

🪧 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

@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

🔭 Outside diff range comments (1)
tests/e2e_tests/cypress/e2e/basic-test/navigation-test.cy.js (1)

Line range hint 11-24: Improve test reliability and maintainability

  1. Use data-test attributes instead of class selectors
  2. Extract magic numbers to named constants
  3. Avoid direct DOM manipulation with jQuery methods

Apply these changes:

-      cy.get('.navbar-brand').then(logo => {
+      const VERTICAL_TOLERANCE = 3;
+      cy.get('[data-test="logo"]').then(logo => {
         const logoPosition = logo.position();
         const logoHeight = logo.outerHeight();
         const logoCenter = logoPosition.top + logoHeight / 2;
         cy.log('Logo Center:', logoCenter);

-        cy.get('.navbar-toggler').each(($hamburger, index) => {
+        cy.get('[data-test="hamburger-menu"]').each(($hamburger, index) => {
           const hamburgerPosition = $hamburger.position();
           const hamburgerHeight = $hamburger.outerHeight();
           const hamburgerCenter = hamburgerPosition.top + hamburgerHeight / 2;
           cy.log(`Hamburger Center ${index + 1}:`, hamburgerCenter);

-          expect(hamburgerCenter).to.be.closeTo(logoCenter, 3);
+          expect(hamburgerCenter).to.be.closeTo(logoCenter, VERTICAL_TOLERANCE);
         });
       });
🧹 Nitpick comments (1)
tests/e2e_tests/package.json (1)

9-14: Consider enhancing npm scripts

Consider adding:

  1. A combined script that runs both lint and format checks
  2. A combined fix script
  3. A pre-commit hook script

Add these scripts:

   "scripts": {
     "lint": "eslint cypress/e2e/basic-test/*",
     "lint-fix": "eslint cypress/e2e/basic-test/* --fix",
     "prettier": "prettier --check cypress/e2e/basic-test/*",
-    "prettier-fix": "prettier --write cypress/e2e/basic-test/*"
+    "prettier-fix": "prettier --write cypress/e2e/basic-test/*",
+    "check": "npm run prettier && npm run lint",
+    "fix": "npm run prettier-fix && npm run lint-fix",
+    "pre-commit": "npm run check"
   }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 221cd60 and 5ee089a.

⛔ Files ignored due to path filters (1)
  • tests/e2e_tests/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • .gitignore (0 hunks)
  • tests/e2e_tests/.prettierrc.js (1 hunks)
  • tests/e2e_tests/cypress/e2e/basic-test/commons.js (2 hunks)
  • tests/e2e_tests/cypress/e2e/basic-test/map-test.cy.js (2 hunks)
  • tests/e2e_tests/cypress/e2e/basic-test/mobile-box-test.cy.js (1 hunks)
  • tests/e2e_tests/cypress/e2e/basic-test/navigation-test.cy.js (3 hunks)
  • tests/e2e_tests/cypress/e2e/basic-test/popup-test.cy.js (1 hunks)
  • tests/e2e_tests/eslint.config.mjs (1 hunks)
  • tests/e2e_tests/package.json (1 hunks)
💤 Files with no reviewable changes (1)
  • .gitignore
✅ Files skipped from review due to trivial changes (5)
  • tests/e2e_tests/.prettierrc.js
  • tests/e2e_tests/cypress/e2e/basic-test/popup-test.cy.js
  • tests/e2e_tests/cypress/e2e/basic-test/mobile-box-test.cy.js
  • tests/e2e_tests/cypress/e2e/basic-test/map-test.cy.js
  • tests/e2e_tests/cypress/e2e/basic-test/commons.js

Dawid-Sroka and others added 2 commits December 18, 2024 14:19
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: ravenwing <kolodzinski.krzys@gmail.com>
@raven-wing raven-wing merged commit 4c39fbb into Problematy:main Dec 18, 2024
2 checks passed
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.

BUG: even if function in e2e test doesn't exist it may be possible to add import

2 participants