-
Notifications
You must be signed in to change notification settings - Fork 12
Add eslint and prettier for checking cypress tests #200
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
Add eslint and prettier for checking cypress tests #200
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis pull request introduces updates to the end-to-end testing infrastructure by modifying the Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
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: 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
- Use data-test attributes instead of class selectors
- Extract magic numbers to named constants
- 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 scriptsConsider adding:
- A combined script that runs both lint and format checks
- A combined fix script
- 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
⛔ Files ignored due to path filters (1)
tests/e2e_tests/package-lock.jsonis 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
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: ravenwing <kolodzinski.krzys@gmail.com>
Summary by CodeRabbit
New Features
package.jsonfile for managing development dependencies and scripts in thetests/e2e_testsdirectory.Bug Fixes
package-lock.jsonandpackage.jsonfrom the.gitignorefile.Style
Chores