# Instructions

- Following Playwright test failed.
- Explain why, be concise, respect Playwright best practices.
- Provide a snippet of code with the fix, if possible.

# Test info

- Name: src/manager/tests/e2e/customer/customer-edit-general.spec.ts >> removes the note
- Location: src/manager/tests/e2e/customer/customer-edit-general.spec.ts:19:7

# Error details

```
Error: expect(locator).toHaveCount(expected) failed

Locator:  getByTestId('app-page').getByTestId('app-page-content').locator('.ui-data-grid').locator('[data-test-id=ui-data-grid-table]:not(.disabled):not(.loading):not(.fetching)').getByTestId('ui-data-grid-table-with-data').locator('tr')
Expected: 1
Received: 7
Timeout:  20000ms

Call log:
  - Expect "toHaveCount" with timeout 20000ms
  - waiting for getByTestId('app-page').getByTestId('app-page-content').locator('.ui-data-grid').locator('[data-test-id=ui-data-grid-table]:not(.disabled):not(.loading):not(.fetching)').getByTestId('ui-data-grid-table-with-data').locator('tr')
    2 × locator resolved to 0 elements
      - unexpected value "0"
    22 × locator resolved to 7 elements
       - unexpected value "7"

```

# Page snapshot

```yaml
- generic [ref=e1]:
  - generic [ref=e6]:
    - navigation [ref=e7]:
      - generic [ref=e9]:
        - link [ref=e10] [cursor=pointer]:
          - /url: /
        - generic [ref=e11]:
          - generic [ref=e12]: KINNOVIS
          - generic [ref=e13]:
            - generic [ref=e14]: Manager
            - button [ref=e15] [cursor=pointer]:
              - img [ref=e16]
      - list [ref=e19]:
        - generic [ref=e21]: Dashboard
        - link "Tasks" [ref=e22] [cursor=pointer]:
          - /url: /tasks
          - img [ref=e25]
          - generic [ref=e28]: Tasks
        - link "Facility maps" [ref=e29] [cursor=pointer]:
          - /url: /facility-map
          - generic [ref=e31]: 󰧾
          - generic [ref=e33]: Facility maps
        - link "Analytics" [ref=e34] [cursor=pointer]:
          - /url: /dashboard
          - generic [ref=e36]: 󱖶
          - generic [ref=e38]: Analytics
        - generic [ref=e40]: Sales
        - link "Bookings" [ref=e41] [cursor=pointer]:
          - /url: /bookings
          - generic [ref=e43]: 󰇡
          - generic [ref=e45]: Bookings
        - link "Customers" [ref=e46] [cursor=pointer]:
          - /url: /customers
          - generic [ref=e48]: 󰀏
          - generic [ref=e50]: Customers
        - link "Invoices" [ref=e51] [cursor=pointer]:
          - /url: /invoices
          - generic [ref=e53]: 󰷉
          - generic [ref=e55]: Invoices
        - link "Credit notes" [ref=e56] [cursor=pointer]:
          - /url: /credit-notes
          - img [ref=e59]
          - generic [ref=e62]: Credit notes
        - link "Units" [ref=e63] [cursor=pointer]:
          - /url: /units
          - generic [ref=e65]: 󰍀
          - generic [ref=e67]: Units
        - generic [ref=e69]: Site management
        - link "Locations" [ref=e70] [cursor=pointer]:
          - /url: /locations
          - generic [ref=e72]: 󰟙
          - generic [ref=e74]: Locations
        - link "Unit types" [ref=e75] [cursor=pointer]:
          - /url: /unit-types
          - generic [ref=e77]: 󰆧
          - generic [ref=e79]: Unit types
        - link "Protection Plans" [ref=e80] [cursor=pointer]:
          - /url: /insurances
          - generic [ref=e82]: 󰳌
          - generic [ref=e84]: Protection Plans
        - link "Deposits" [ref=e85] [cursor=pointer]:
          - /url: /deposits
          - generic [ref=e87]: 󱙆
          - generic [ref=e89]: Deposits
        - link "Products" [ref=e90] [cursor=pointer]:
          - /url: /products
          - generic [ref=e92]: 󰄑
          - generic [ref=e94]: Products
        - link "Discounts" [ref=e95] [cursor=pointer]:
          - /url: /discounts
          - generic [ref=e97]: 󰓼
          - generic [ref=e99]: Discounts
        - generic [ref=e100]:
          - option "Emails" [ref=e101] [cursor=pointer]:
            - generic [ref=e103]: 󰻨
            - generic [ref=e105]: Emails
            - generic [ref=e109]: 󰅀
          - text: 󱡰 󰁥
        - generic [ref=e111]: Admin
        - link "Integrations" [ref=e112] [cursor=pointer]:
          - /url: /connected-apps
          - generic [ref=e114]: 󱘖
          - generic [ref=e116]: Integrations
        - link "User & Roles" [ref=e117] [cursor=pointer]:
          - /url: /users
          - generic [ref=e119]: 󰭘
          - generic [ref=e121]: User & Roles
        - generic [ref=e122]:
          - option "Booking Portal" [ref=e123] [cursor=pointer]:
            - generic [ref=e125]: 󱃁
            - generic [ref=e127]: Booking Portal
            - generic [ref=e131]: 󰅀
          - text: 󰖟 󰟙
        - generic [ref=e132]:
          - option "JaneAI" [ref=e133] [cursor=pointer]:
            - generic [ref=e135]: 󱙺
            - generic [ref=e137]: JaneAI
            - generic [ref=e141]: 󰅀
          - text: 󱜹
        - generic [ref=e143]: Feedback
        - link "Voting Portal" [ref=e144] [cursor=pointer]:
          - /url: /voting-portal
          - generic [ref=e146]: 󰔔
          - generic [ref=e148]: Voting Portal
      - generic [ref=e150]:
        - button "AS Andreas Stadler andreas.stadler@storeroom.at" [ref=e153] [cursor=pointer]:
          - generic [ref=e156]: AS
          - generic [ref=e157]:
            - generic [ref=e158]: Andreas Stadler
            - generic "andreas.stadler@storeroom.at" [ref=e159]
          - generic [ref=e160]: 󰇙
          - generic:
            - text: 󰗊 󰅀
            - text: 󰷖 󰍃
        - button [ref=e161] [cursor=pointer]:
          - generic [ref=e163]: 󰋽
    - main [ref=e164]:
      - generic [ref=e166]:
        - generic [ref=e168]:
          - generic [ref=e170]: Customers
          - generic [ref=e172]:
            - link "Create customer" [ref=e173] [cursor=pointer]:
              - /url: /customers/create
              - generic [ref=e174]:
                - generic [ref=e175]: 󰐕
                - text: Create customer
            - button [ref=e176] [cursor=pointer]:
              - generic [ref=e180]: 󰍝
        - generic [ref=e182]:
          - generic [ref=e184]:
            - button "Filters Reset filters" [ref=e185] [cursor=pointer]:
              - generic [ref=e186]:
                - heading "Filters" [level=3] [ref=e189]
                - generic [ref=e191]:
                  - button "Reset filters" [ref=e193]:
                    - generic [ref=e194]:
                      - generic [ref=e195]: 󰑐
                      - text: Reset filters
                  - generic [ref=e199]: 󰅀
            - generic [ref=e205]:
              - generic [ref=e210]:
                - generic [ref=e212]: 󰍉
                - textbox "Search" [active] [ref=e214]: Paulette_Baumbach13@hotmail.com
                - button "Clear Search" [ref=e216] [cursor=pointer]: 󰅙
                - generic:
                  - generic: Search
              - combobox [ref=e220]:
                - generic [ref=e221]:
                  - generic: Location
                  - combobox "Location" [ref=e223]
                - button [ref=e225] [cursor=pointer]: 󰍝
              - combobox [ref=e229]:
                - generic [ref=e230]:
                  - generic: Has past due invoice(s)
                  - combobox "Has past due invoice(s)" [ref=e232]
                - button [ref=e234] [cursor=pointer]: 󰍝
              - combobox [ref=e238]:
                - generic [ref=e239]:
                  - generic: Status
                  - combobox "Status" [ref=e241]
                - button [ref=e243] [cursor=pointer]: 󰍝
          - generic [ref=e245]:
            - table [ref=e249]:
              - rowgroup [ref=e250]:
                - row "Customer no. Name Location(s) Email address Phone number Status Past due invoice(s) Created at" [ref=e251]:
                  - columnheader "Customer no." [ref=e252]:
                    - button "Customer no." [ref=e253] [cursor=pointer]:
                      - generic [ref=e255]: Customer no.
                      - generic [ref=e258]: 󰁝
                  - columnheader "Name" [ref=e259]:
                    - button "Name" [ref=e260] [cursor=pointer]:
                      - generic [ref=e262]: Name
                      - generic [ref=e265]: 󰁝
                  - columnheader "Location(s)" [ref=e266]:
                    - button "Location(s)" [ref=e267] [cursor=pointer]:
                      - generic [ref=e269]: Location(s)
                      - generic [ref=e272]: 󰁝
                  - columnheader "Email address" [ref=e273]:
                    - button "Email address" [ref=e274] [cursor=pointer]:
                      - generic [ref=e276]: Email address
                      - generic [ref=e279]: 󰁝
                  - columnheader "Phone number" [ref=e280]:
                    - generic [ref=e283]: Phone number
                  - columnheader "Status" [ref=e284]:
                    - button "Status" [ref=e285] [cursor=pointer]:
                      - generic [ref=e287]: Status
                      - generic [ref=e290]: 󰁝
                  - columnheader "Past due invoice(s)" [ref=e291]:
                    - button "Past due invoice(s)" [ref=e292] [cursor=pointer]:
                      - generic [ref=e294]: Past due invoice(s)
                      - generic [ref=e297]: 󰁝
                  - columnheader "Created at" [ref=e298]:
                    - button "Created at" [ref=e299] [cursor=pointer]:
                      - generic [ref=e301]: Created at
                      - generic [ref=e304]: 󰁝
                - row [ref=e305]:
                  - columnheader [ref=e306]
              - rowgroup [ref=e307]:
                - row "1451-4943-30 Manuel Gutkowski Vienna South paulette_baumbach13@hotmail.com +43 5276 782996 Lead None 25 May 2026" [ref=e308]:
                  - cell "1451-4943-30" [ref=e309]:
                    - link "1451-4943-30" [ref=e310] [cursor=pointer]:
                      - /url: /customers/1451494330
                      - generic [ref=e311]: 1451-4943-30
                  - cell "Manuel Gutkowski" [ref=e312]:
                    - link "Manuel Gutkowski" [ref=e313] [cursor=pointer]:
                      - /url: /customers/1451494330
                      - generic [ref=e314]: Manuel Gutkowski
                  - cell "Vienna South" [ref=e315]:
                    - link "Vienna South" [ref=e316] [cursor=pointer]:
                      - /url: /customers/1451494330
                      - generic [ref=e320]: Vienna South
                  - cell "paulette_baumbach13@hotmail.com" [ref=e321]:
                    - link "paulette_baumbach13@hotmail.com" [ref=e322] [cursor=pointer]:
                      - /url: /customers/1451494330
                      - generic [ref=e325]: paulette_baumbach13@hotmail.com
                  - cell "+43 5276 782996" [ref=e326]:
                    - link "+43 5276 782996" [ref=e327] [cursor=pointer]:
                      - /url: /customers/1451494330
                      - generic [ref=e330]: +43 5276 782996
                  - cell "Lead" [ref=e331]:
                    - link "Lead" [ref=e332] [cursor=pointer]:
                      - /url: /customers/1451494330
                      - generic [ref=e335]: Lead
                  - cell "None" [ref=e336]:
                    - link "None" [ref=e337] [cursor=pointer]:
                      - /url: /customers/1451494330
                      - generic [ref=e340]: None
                  - cell "25 May 2026" [ref=e341]:
                    - link "25 May 2026" [ref=e342] [cursor=pointer]:
                      - /url: /customers/1451494330
                      - generic [ref=e343]: 25 May 2026
                - row "1076-4358-79 O'Keefe-Harvey Vienna North ngleichner@hotmail.com +43 37527398516555113 Lead None 25 May 2026" [ref=e344]:
                  - cell "1076-4358-79" [ref=e345]:
                    - link "1076-4358-79" [ref=e346] [cursor=pointer]:
                      - /url: /customers/1076435879
                      - generic [ref=e347]: 1076-4358-79
                  - cell "O'Keefe-Harvey" [ref=e348]:
                    - link "O'Keefe-Harvey" [ref=e349] [cursor=pointer]:
                      - /url: /customers/1076435879
                      - generic [ref=e350]: O'Keefe-Harvey
                  - cell "Vienna North" [ref=e351]:
                    - link "Vienna North" [ref=e352] [cursor=pointer]:
                      - /url: /customers/1076435879
                      - generic [ref=e356]: Vienna North
                  - cell "ngleichner@hotmail.com" [ref=e357]:
                    - link "ngleichner@hotmail.com" [ref=e358] [cursor=pointer]:
                      - /url: /customers/1076435879
                      - generic [ref=e361]: ngleichner@hotmail.com
                  - cell "+43 37527398516555113" [ref=e362]:
                    - link "+43 37527398516555113" [ref=e363] [cursor=pointer]:
                      - /url: /customers/1076435879
                      - generic [ref=e366]: +43 37527398516555113
                  - cell "Lead" [ref=e367]:
                    - link "Lead" [ref=e368] [cursor=pointer]:
                      - /url: /customers/1076435879
                      - generic [ref=e371]: Lead
                  - cell "None" [ref=e372]:
                    - link "None" [ref=e373] [cursor=pointer]:
                      - /url: /customers/1076435879
                      - generic [ref=e376]: None
                  - cell "25 May 2026" [ref=e377]:
                    - link "25 May 2026" [ref=e378] [cursor=pointer]:
                      - /url: /customers/1076435879
                      - generic [ref=e379]: 25 May 2026
                - row "9020-5377-3 Littel Ltd Vienna North crussel@hotmail.com +43 65054464195060013 Lead None 25 May 2026" [ref=e380]:
                  - cell "9020-5377-3" [ref=e381]:
                    - link "9020-5377-3" [ref=e382] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e383]: 9020-5377-3
                  - cell "Littel Ltd" [ref=e384]:
                    - link "Littel Ltd" [ref=e385] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e386]: Littel Ltd
                  - cell "Vienna North" [ref=e387]:
                    - link "Vienna North" [ref=e388] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e392]: Vienna North
                  - cell "crussel@hotmail.com" [ref=e393]:
                    - link "crussel@hotmail.com" [ref=e394] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e397]: crussel@hotmail.com
                  - cell "+43 65054464195060013" [ref=e398]:
                    - link "+43 65054464195060013" [ref=e399] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e402]: +43 65054464195060013
                  - cell "Lead" [ref=e403]:
                    - link "Lead" [ref=e404] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e407]: Lead
                  - cell "None" [ref=e408]:
                    - link "None" [ref=e409] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e412]: None
                  - cell "25 May 2026" [ref=e413]:
                    - link "25 May 2026" [ref=e414] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e415]: 25 May 2026
                - row "7638-9607-8 Keagan Becker Vienna South fmurphy@skiles.com +43 79761982152133409 Lead None 25 May 2026" [ref=e416]:
                  - cell "7638-9607-8" [ref=e417]:
                    - link "7638-9607-8" [ref=e418] [cursor=pointer]:
                      - /url: /customers/763896078
                      - generic [ref=e419]: 7638-9607-8
                  - cell "Keagan Becker" [ref=e420]:
                    - link "Keagan Becker" [ref=e421] [cursor=pointer]:
                      - /url: /customers/763896078
                      - generic [ref=e422]: Keagan Becker
                  - cell "Vienna South" [ref=e423]:
                    - link "Vienna South" [ref=e424] [cursor=pointer]:
                      - /url: /customers/763896078
                      - generic [ref=e428]: Vienna South
                  - cell "fmurphy@skiles.com" [ref=e429]:
                    - link "fmurphy@skiles.com" [ref=e430] [cursor=pointer]:
                      - /url: /customers/763896078
                      - generic [ref=e433]: fmurphy@skiles.com
                  - cell "+43 79761982152133409" [ref=e434]:
                    - link "+43 79761982152133409" [ref=e435] [cursor=pointer]:
                      - /url: /customers/763896078
                      - generic [ref=e438]: +43 79761982152133409
                  - cell "Lead" [ref=e439]:
                    - link "Lead" [ref=e440] [cursor=pointer]:
                      - /url: /customers/763896078
                      - generic [ref=e443]: Lead
                  - cell "None" [ref=e444]:
                    - link "None" [ref=e445] [cursor=pointer]:
                      - /url: /customers/763896078
                      - generic [ref=e448]: None
                  - cell "25 May 2026" [ref=e449]:
                    - link "25 May 2026" [ref=e450] [cursor=pointer]:
                      - /url: /customers/763896078
                      - generic [ref=e451]: 25 May 2026
                - row "1967-6573-73 Amira Rosenbaum Vienna North dangelo.fadel@hotmail.com +43 49472911308958626 Lead None 25 May 2026" [ref=e452]:
                  - cell "1967-6573-73" [ref=e453]:
                    - link "1967-6573-73" [ref=e454] [cursor=pointer]:
                      - /url: /customers/1967657373
                      - generic [ref=e455]: 1967-6573-73
                  - cell "Amira Rosenbaum" [ref=e456]:
                    - link "Amira Rosenbaum" [ref=e457] [cursor=pointer]:
                      - /url: /customers/1967657373
                      - generic [ref=e458]: Amira Rosenbaum
                  - cell "Vienna North" [ref=e459]:
                    - link "Vienna North" [ref=e460] [cursor=pointer]:
                      - /url: /customers/1967657373
                      - generic [ref=e464]: Vienna North
                  - cell "dangelo.fadel@hotmail.com" [ref=e465]:
                    - link "dangelo.fadel@hotmail.com" [ref=e466] [cursor=pointer]:
                      - /url: /customers/1967657373
                      - generic [ref=e469]: dangelo.fadel@hotmail.com
                  - cell "+43 49472911308958626" [ref=e470]:
                    - link "+43 49472911308958626" [ref=e471] [cursor=pointer]:
                      - /url: /customers/1967657373
                      - generic [ref=e474]: +43 49472911308958626
                  - cell "Lead" [ref=e475]:
                    - link "Lead" [ref=e476] [cursor=pointer]:
                      - /url: /customers/1967657373
                      - generic [ref=e479]: Lead
                  - cell "None" [ref=e480]:
                    - link "None" [ref=e481] [cursor=pointer]:
                      - /url: /customers/1967657373
                      - generic [ref=e484]: None
                  - cell "25 May 2026" [ref=e485]:
                    - link "25 May 2026" [ref=e486] [cursor=pointer]:
                      - /url: /customers/1967657373
                      - generic [ref=e487]: 25 May 2026
                - row "9712-4931-2 Hane Group Vienna South corbin.marquardt@gmail.com +43 36363622749091364 Lead None 25 May 2026" [ref=e488]:
                  - cell "9712-4931-2" [ref=e489]:
                    - link "9712-4931-2" [ref=e490] [cursor=pointer]:
                      - /url: /customers/971249312
                      - generic [ref=e491]: 9712-4931-2
                  - cell "Hane Group" [ref=e492]:
                    - link "Hane Group" [ref=e493] [cursor=pointer]:
                      - /url: /customers/971249312
                      - generic [ref=e494]: Hane Group
                  - cell "Vienna South" [ref=e495]:
                    - link "Vienna South" [ref=e496] [cursor=pointer]:
                      - /url: /customers/971249312
                      - generic [ref=e500]: Vienna South
                  - cell "corbin.marquardt@gmail.com" [ref=e501]:
                    - link "corbin.marquardt@gmail.com" [ref=e502] [cursor=pointer]:
                      - /url: /customers/971249312
                      - generic [ref=e505]: corbin.marquardt@gmail.com
                  - cell "+43 36363622749091364" [ref=e506]:
                    - link "+43 36363622749091364" [ref=e507] [cursor=pointer]:
                      - /url: /customers/971249312
                      - generic [ref=e510]: +43 36363622749091364
                  - cell "Lead" [ref=e511]:
                    - link "Lead" [ref=e512] [cursor=pointer]:
                      - /url: /customers/971249312
                      - generic [ref=e515]: Lead
                  - cell "None" [ref=e516]:
                    - link "None" [ref=e517] [cursor=pointer]:
                      - /url: /customers/971249312
                      - generic [ref=e520]: None
                  - cell "25 May 2026" [ref=e521]:
                    - link "25 May 2026" [ref=e522] [cursor=pointer]:
                      - /url: /customers/971249312
                      - generic [ref=e523]: 25 May 2026
                - row "5764-8143-9 Rex Cassin Vienna South koch.gaylord@yahoo.com +43 13733913580719581 Lead None 25 May 2026" [ref=e524]:
                  - cell "5764-8143-9" [ref=e525]:
                    - link "5764-8143-9" [ref=e526] [cursor=pointer]:
                      - /url: /customers/576481439
                      - generic [ref=e527]: 5764-8143-9
                  - cell "Rex Cassin" [ref=e528]:
                    - link "Rex Cassin" [ref=e529] [cursor=pointer]:
                      - /url: /customers/576481439
                      - generic [ref=e530]: Rex Cassin
                  - cell "Vienna South" [ref=e531]:
                    - link "Vienna South" [ref=e532] [cursor=pointer]:
                      - /url: /customers/576481439
                      - generic [ref=e536]: Vienna South
                  - cell "koch.gaylord@yahoo.com" [ref=e537]:
                    - link "koch.gaylord@yahoo.com" [ref=e538] [cursor=pointer]:
                      - /url: /customers/576481439
                      - generic [ref=e541]: koch.gaylord@yahoo.com
                  - cell "+43 13733913580719581" [ref=e542]:
                    - link "+43 13733913580719581" [ref=e543] [cursor=pointer]:
                      - /url: /customers/576481439
                      - generic [ref=e546]: +43 13733913580719581
                  - cell "Lead" [ref=e547]:
                    - link "Lead" [ref=e548] [cursor=pointer]:
                      - /url: /customers/576481439
                      - generic [ref=e551]: Lead
                  - cell "None" [ref=e552]:
                    - link "None" [ref=e553] [cursor=pointer]:
                      - /url: /customers/576481439
                      - generic [ref=e556]: None
                  - cell "25 May 2026" [ref=e557]:
                    - link "25 May 2026" [ref=e558] [cursor=pointer]:
                      - /url: /customers/576481439
                      - generic [ref=e559]: 25 May 2026
            - generic [ref=e562]:
              - generic [ref=e563]:
                - generic [ref=e564]: "Items per page:"
                - combobox [ref=e567]:
                  - generic [ref=e569] [cursor=pointer]:
                    - generic [ref=e571]: "10"
                    - combobox "Items per page:": "10"
                  - generic [ref=e573]: 󰍝
              - generic [ref=e574]: 1-7 of 7
              - generic [ref=e575]:
                - button [disabled]:
                  - generic:
                    - generic: 󰘀
                - button [disabled]:
                  - generic:
                    - generic: 󰅁
                - button [disabled]:
                  - generic:
                    - generic: 󰅂
                - button [disabled]:
                  - generic:
                    - generic: 󰘁
  - generic:
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
    - tooltip
```

# Test source

```ts
  1   | import { faker } from '@faker-js/faker';
  2   | import { getCustomerCreateData, getCustomerPhone } from '@/manager/modules/customer/customer-factories';
  3   | import { test } from '@/manager/modules/customer/customer-fixtures';
  4   | import { applyCustomerEditGeneral } from '@/manager/modules/customer/customer-mappers';
  5   | import { formatCustomerName } from '@/manager/modules/customer/customer-utils';
  6   | import { customerEditGeneralHappyTestCases } from '@/manager/modules/customer/test-cases/customer-edit-general-happy-test-cases';
  7   | import {
  8   |   expectDataTableChipsColumnToHaveText,
  9   |   expectDataTableTextColumnToHaveText,
  10  | } from '@/manager/modules/ui/data-table/data-table-assertions';
  11  | import { customerTableColumnTestIds } from '@/manager/modules/ui/data-table/data/data-table-column-test-ids';
  12  | import { expectMultiLocatorToHaveText, expectSingleLocatorToHaveText } from '@/manager/shared/utils/expect-utils';
  13  | import { countries } from '@/shared/data/seed-countries';
  14  | import { vatTypes } from '@/shared/data/seed-vat-types';
  15  | import { formatAddress, formatDate, formatId, formatPhone } from '@/shared/utils/formatters';
  16  | import { expect } from '@/shared/utils/matchers';
  17  | 
  18  | for (const tc of customerEditGeneralHappyTestCases) {
  19  |   test(tc.description, async ({ createCustomer, customerDetailsPage }) => {
  20  |     const customer = await createCustomer(getCustomerCreateData(tc.initialOptions));
  21  |     const newCustomer = applyCustomerEditGeneral(customer, tc.changes);
  22  |     const customerFullName = formatCustomerName(newCustomer.firstName, newCustomer.lastName);
  23  |     const customerTitle = newCustomer.type === 'business' ? newCustomer.companyName : customerFullName;
  24  |     const customerPhone = formatPhone(newCustomer.phone);
  25  |     const customerAddress = formatAddress(
  26  |       newCustomer.street,
  27  |       newCustomer.postalCode,
  28  |       newCustomer.city,
  29  |       newCustomer.country.name
  30  |     );
  31  |     const customerId = formatId(newCustomer.id, '-', 4);
  32  |     const customerCreatedAt = formatDate(newCustomer.createdAt);
  33  |     const customerLocationNames = newCustomer.locations.map((l) => l.name);
  34  | 
  35  |     await customerDetailsPage.goto(customer.id);
  36  | 
  37  |     const newDetailsPage = await test.step('edit customer general', async () => {
  38  |       const dialog = await customerDetailsPage.openCustomerEditGeneralDialog();
  39  |       return dialog.edit(tc.changes);
  40  |     });
  41  | 
  42  |     await test.step('verify new customer on details page', async () => {
  43  |       await expectSingleLocatorToHaveText(newDetailsPage.title, customerTitle);
  44  |       await expectSingleLocatorToHaveText(newDetailsPage.status, newCustomer.status);
  45  |       await expectMultiLocatorToHaveText(newDetailsPage.generalCard.locations, customerLocationNames);
  46  |       await expectSingleLocatorToHaveText(newDetailsPage.generalCard.type, newCustomer.type);
  47  | 
  48  |       if (newCustomer.type === 'business') {
  49  |         await expectSingleLocatorToHaveText(newDetailsPage.generalCard.companyName, newCustomer.companyName);
  50  |         await expectSingleLocatorToHaveText(newDetailsPage.generalCard.vatType, newCustomer.vatType?.name);
  51  |         await expectSingleLocatorToHaveText(newDetailsPage.generalCard.vatNumber, newCustomer.vatNumber);
  52  |       } else {
  53  |         await expect(newDetailsPage.generalCard.companyName).toBeHidden();
  54  |         await expect(newDetailsPage.generalCard.vatType).toBeHidden();
  55  |         await expect(newDetailsPage.generalCard.vatNumber).toBeHidden();
  56  |       }
  57  | 
  58  |       await expectSingleLocatorToHaveText(newDetailsPage.generalCard.name, customerFullName);
  59  |       await expectSingleLocatorToHaveText(newDetailsPage.generalCard.email, newCustomer.email);
  60  |       await expectSingleLocatorToHaveText(newDetailsPage.generalCard.phoneNumber, customerPhone);
  61  |       await expectSingleLocatorToHaveText(newDetailsPage.generalCard.language, newCustomer.language.id);
  62  |       await expectSingleLocatorToHaveText(newDetailsPage.generalCard.address, customerAddress);
  63  |       await expectSingleLocatorToHaveText(newDetailsPage.generalCard.note, newCustomer.note);
  64  |     });
  65  | 
  66  |     await test.step('verify new customer on list page', async () => {
  67  |       const listPage = await newDetailsPage.returnToCustomerListPage();
  68  | 
  69  |       await listPage.searchTextField.fill(newCustomer.email);
  70  | 
> 71  |       await expect(listPage.dataTable.getRows()).toHaveCount(1);
      |                                                  ^ Error: expect(locator).toHaveCount(expected) failed
  72  |       await expectDataTableTextColumnToHaveText(listPage.dataTable, customerTableColumnTestIds.id, customerId);
  73  |       await expectDataTableTextColumnToHaveText(listPage.dataTable, customerTableColumnTestIds.name, customerTitle);
  74  |       await expectDataTableChipsColumnToHaveText(
  75  |         listPage.dataTable,
  76  |         customerTableColumnTestIds.locations,
  77  |         customerLocationNames
  78  |       );
  79  |       await expectDataTableTextColumnToHaveText(
  80  |         listPage.dataTable,
  81  |         customerTableColumnTestIds.email,
  82  |         newCustomer.email
  83  |       );
  84  |       await expectDataTableTextColumnToHaveText(
  85  |         listPage.dataTable,
  86  |         customerTableColumnTestIds.phoneNumber,
  87  |         customerPhone
  88  |       );
  89  |       await expectDataTableChipsColumnToHaveText(
  90  |         listPage.dataTable,
  91  |         customerTableColumnTestIds.status,
  92  |         newCustomer.status
  93  |       );
  94  |       await expectDataTableTextColumnToHaveText(
  95  |         listPage.dataTable,
  96  |         customerTableColumnTestIds.createdAt,
  97  |         customerCreatedAt
  98  |       );
  99  |     });
  100 |   });
  101 | }
  102 | 
  103 | test('edits the email', async ({ createCustomer, customerDetailsPage }) => {
  104 |   const customer = await createCustomer(getCustomerCreateData());
  105 |   const newEmail = faker.internet.email();
  106 | 
  107 |   await customerDetailsPage.goto(customer.id);
  108 | 
  109 |   const newDetailsPage = await test.step('edit customer email', async () => {
  110 |     const dialog = await customerDetailsPage.openCustomerEditGeneralDialog();
  111 |     return dialog.edit({ email: newEmail });
  112 |   });
  113 | 
  114 |   await test.step('verify new email on details page', async () => {
  115 |     await expectSingleLocatorToHaveText(newDetailsPage.generalCard.email, newEmail);
  116 |   });
  117 | 
  118 |   await test.step('verify new email on list page', async () => {
  119 |     const listPage = await newDetailsPage.returnToCustomerListPage();
  120 |     await listPage.searchTextField.fill(newEmail);
  121 |     await expect(listPage.dataTable.getRows()).toHaveCount(1);
  122 |   });
  123 | });
  124 | 
  125 | test('edits the phone number', async ({ createCustomer, customerDetailsPage }) => {
  126 |   const customer = await createCustomer(getCustomerCreateData());
  127 |   const newCountry = countries.BR;
  128 |   const newPhone = getCustomerPhone(newCountry);
  129 |   const formattedNewPhone = formatPhone(newPhone);
  130 | 
  131 |   await customerDetailsPage.goto(customer.id);
  132 | 
  133 |   const newDetailsPage = await test.step('edit customer phone number', async () => {
  134 |     const dialog = await customerDetailsPage.openCustomerEditGeneralDialog();
  135 |     return dialog.edit({ phone: newPhone, country: newCountry });
  136 |   });
  137 | 
  138 |   await test.step('verify new phone number on details page', async () => {
  139 |     await expectSingleLocatorToHaveText(newDetailsPage.generalCard.phoneNumber, formattedNewPhone);
  140 |   });
  141 | 
  142 |   await test.step('verify new phone number on list page', async () => {
  143 |     const listPage = await newDetailsPage.returnToCustomerListPage();
  144 |     await listPage.searchTextField.fill(formattedNewPhone);
  145 |     await expect(listPage.dataTable.getRows()).toHaveCount(1);
  146 |   });
  147 | });
  148 | 
  149 | test('rejects an edit with a duplicate email', async ({ createCustomer, customerDetailsPage }) => {
  150 |   const existing = await createCustomer(getCustomerCreateData());
  151 |   const editing = await createCustomer(getCustomerCreateData());
  152 | 
  153 |   await customerDetailsPage.goto(editing.id);
  154 | 
  155 |   const dialog = await test.step('submit edit with duplicate email', async () => {
  156 |     const editDialog = await customerDetailsPage.openCustomerEditGeneralDialog();
  157 |     await editDialog.fill({ email: existing.email });
  158 |     await editDialog.submit();
  159 |     return editDialog;
  160 |   });
  161 | 
  162 |   await test.step('verify errors on form', async () => {
  163 |     await expect(dialog.errors).toHaveCountGreaterThan(0);
  164 |   });
  165 | });
  166 | 
  167 | test('rejects an edit with a duplicate phone number', async ({ createCustomer, customerDetailsPage }) => {
  168 |   const existing = await createCustomer(getCustomerCreateData());
  169 |   const editing = await createCustomer(getCustomerCreateData());
  170 | 
  171 |   await customerDetailsPage.goto(editing.id);
```