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

src/components/__tests__: correct time setting in TaskListCoordinator tests #561

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

maceksimon
Copy link
Contributor

@maceksimon maceksimon commented Sep 16, 2024

Tests for TaskListCoordinator currently fail because the date is not set before component initialization.

Update time setting so that clock sets date before component initialization.

Cy components tests error message:

  <TaskListCoordinator>
    ✓ has translation for all strings (35ms)
    desktop
      1) renders component
      2) allows to show past tasks
    mobile
      3) renders component
      4) allows to show past tasks


  1 passing (4m)
  4 failing

  1) <TaskListCoordinator>
       desktop
         renders component:

      AssertionError: Timed out retrying after 60000ms: Not enough elements found. Found '2', expected '3'.
      + expected - actual

      -2
      +3
      
      at coreTests/ (/home/runner/work/ride-to-work-by-bike-frontend/ride-to-work-by-bike-frontend/src/components/__tests__/TaskListCoordinator.cy.js:59:10)
      at getRet (http://localhost:9001/__cypress/runner/cypress_runner.js:119259:20)
      at tryCatcher (http://localhost:9001/__cypress/runner/cypress_runner.js:1807:23)
      at __webpack_modules__</module.exports/Promise.try (http://localhost:9001/__cypress/runner/cypress_runner.js:4315:29)
      at thenFn (http://localhost:9001/__cypress/runner/cypress_runner.js:119270:60)
      at then (http://localhost:9001/__cypress/runner/cypress_runner.js:119521:21)
      at wrapped (http://localhost:9001/__cypress/runner/cypress_runner.js:138450:19)
      at __webpack_modules__</runCommand (http://localhost:9001/__cypress/runner/cypress_runner.js:144371:15)
      at tryCatcher (http://localhost:9001/__cypress/runner/cypress_runner.js:1807:23)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromiseFromHandler (http://localhost:9001/__cypress/runner/cypress_runner.js:1519:31)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromise (http://localhost:9001/__cypress/runner/cypress_runner.js:1576:18)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromiseCtx (http://localhost:9001/__cypress/runner/cypress_runner.js:1613:10)
      at _drainQueueStep (http://localhost:9001/__cypress/runner/cypress_runner.js:2411:12)
      at _drainQueue (http://localhost:9001/__cypress/runner/cypress_runner.js:2400:24)
      at __webpack_modules__</Async.prototype._drainQueues (http://localhost:9001/__cypress/runner/cypress_runner.js:2416:16)
      at __webpack_modules__</Async/this.drainQueues (http://localhost:9001/__cypress/runner/cypress_runner.js:2286:14)

  2) <TaskListCoordinator>
       desktop
         allows to show past tasks:

      AssertionError: Timed out retrying after 60000ms: Too many elements found. Found '4', expected '3'.
      + expected - actual

      -4
      +3
      
      at coreTests/ (/home/runner/work/ride-to-work-by-bike-frontend/ride-to-work-by-bike-frontend/src/components/__tests__/TaskListCoordinator.cy.js:93:10)
      at getRet (http://localhost:9001/__cypress/runner/cypress_runner.js:119259:20)
      at tryCatcher (http://localhost:9001/__cypress/runner/cypress_runner.js:1807:23)
      at __webpack_modules__</module.exports/Promise.try (http://localhost:9001/__cypress/runner/cypress_runner.js:4315:29)
      at thenFn (http://localhost:9001/__cypress/runner/cypress_runner.js:119270:60)
      at then (http://localhost:9001/__cypress/runner/cypress_runner.js:119521:21)
      at wrapped (http://localhost:9001/__cypress/runner/cypress_runner.js:138450:19)
      at __webpack_modules__</runCommand (http://localhost:9001/__cypress/runner/cypress_runner.js:144371:15)
      at tryCatcher (http://localhost:9001/__cypress/runner/cypress_runner.js:1807:23)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromiseFromHandler (http://localhost:9001/__cypress/runner/cypress_runner.js:1519:31)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromise (http://localhost:9001/__cypress/runner/cypress_runner.js:1576:18)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromiseCtx (http://localhost:9001/__cypress/runner/cypress_runner.js:1613:10)
      at _drainQueueStep (http://localhost:9001/__cypress/runner/cypress_runner.js:2411:12)
      at _drainQueue (http://localhost:9001/__cypress/runner/cypress_runner.js:2400:24)
      at __webpack_modules__</Async.prototype._drainQueues (http://localhost:9001/__cypress/runner/cypress_runner.js:2416:16)
      at __webpack_modules__</Async/this.drainQueues (http://localhost:9001/__cypress/runner/cypress_runner.js:2286:14)

  3) <TaskListCoordinator>
       mobile
         renders component:

      AssertionError: Timed out retrying after 60000ms: Not enough elements found. Found '2', expected '3'.
      + expected - actual

      -2
      +3
      
      at coreTests/ (/home/runner/work/ride-to-work-by-bike-frontend/ride-to-work-by-bike-frontend/src/components/__tests__/TaskListCoordinator.cy.js:59:10)
      at getRet (http://localhost:9001/__cypress/runner/cypress_runner.js:119259:20)
      at tryCatcher (http://localhost:9001/__cypress/runner/cypress_runner.js:1807:23)
      at __webpack_modules__</module.exports/Promise.try (http://localhost:9001/__cypress/runner/cypress_runner.js:4315:29)
      at thenFn (http://localhost:9001/__cypress/runner/cypress_runner.js:119270:60)
      at then (http://localhost:9001/__cypress/runner/cypress_runner.js:119521:21)
      at wrapped (http://localhost:9001/__cypress/runner/cypress_runner.js:138450:19)
      at __webpack_modules__</runCommand (http://localhost:9001/__cypress/runner/cypress_runner.js:144371:15)
      at tryCatcher (http://localhost:9001/__cypress/runner/cypress_runner.js:1807:23)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromiseFromHandler (http://localhost:9001/__cypress/runner/cypress_runner.js:1519:31)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromise (http://localhost:9001/__cypress/runner/cypress_runner.js:1576:18)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromiseCtx (http://localhost:9001/__cypress/runner/cypress_runner.js:1613:10)
      at _drainQueueStep (http://localhost:9001/__cypress/runner/cypress_runner.js:2411:12)
      at _drainQueue (http://localhost:9001/__cypress/runner/cypress_runner.js:2400:24)
      at __webpack_modules__</Async.prototype._drainQueues (http://localhost:9001/__cypress/runner/cypress_runner.js:2416:16)
      at __webpack_modules__</Async/this.drainQueues (http://localhost:9001/__cypress/runner/cypress_runner.js:2286:14)

  4) <TaskListCoordinator>
       mobile
         allows to show past tasks:

      AssertionError: Timed out retrying after 60000ms: Too many elements found. Found '4', expected '3'.
      + expected - actual

      -4
      +3
      
      at coreTests/ (/home/runner/work/ride-to-work-by-bike-frontend/ride-to-work-by-bike-frontend/src/components/__tests__/TaskListCoordinator.cy.js:93:10)
      at getRet (http://localhost:9001/__cypress/runner/cypress_runner.js:119259:20)
      at tryCatcher (http://localhost:9001/__cypress/runner/cypress_runner.js:1807:23)
      at __webpack_modules__</module.exports/Promise.try (http://localhost:9001/__cypress/runner/cypress_runner.js:4315:29)
      at thenFn (http://localhost:9001/__cypress/runner/cypress_runner.js:119270:60)
      at then (http://localhost:9001/__cypress/runner/cypress_runner.js:119521:21)
      at wrapped (http://localhost:9001/__cypress/runner/cypress_runner.js:138450:19)
      at __webpack_modules__</runCommand (http://localhost:9001/__cypress/runner/cypress_runner.js:144371:15)
      at tryCatcher (http://localhost:9001/__cypress/runner/cypress_runner.js:1807:23)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromiseFromHandler (http://localhost:9001/__cypress/runner/cypress_runner.js:1519:31)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromise (http://localhost:9001/__cypress/runner/cypress_runner.js:1576:18)
      at __webpack_modules__</module.exports/Promise.prototype._settlePromiseCtx (http://localhost:9001/__cypress/runner/cypress_runner.js:1613:10)
      at _drainQueueStep (http://localhost:9001/__cypress/runner/cypress_runner.js:2411:12)
      at _drainQueue (http://localhost:9001/__cypress/runner/cypress_runner.js:2400:24)
      at __webpack_modules__</Async.prototype._drainQueues (http://localhost:9001/__cypress/runner/cypress_runner.js:2416:16)
      at __webpack_modules__</Async/this.drainQueues (http://localhost:9001/__cypress/runner/cypress_runner.js:2286:14)




  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        5                                                                                │
  │ Passing:      1                                                                                │
  │ Failing:      4                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  4                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     4 minutes, 1 second                                                              │
  │ Spec Ran:     TaskListCoordinator.cy.js                                                        │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘

@tmszi tmszi added bug Something isn't working component tests Cypress component tests labels Sep 17, 2024
@tmszi tmszi merged commit 5013769 into auto-mat:main Sep 17, 2024
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component tests Cypress component tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants