# 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 >> edits the email
- Location: src/manager/tests/e2e/customer/customer-edit-general.spec.ts:103:5

# 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]: Isac_Lockman44@gmail.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 "2078-6883-32 Ervin Gerhold Vienna South isac_lockman44@gmail.com +43 861 8277310 Lead None 25 May 2026" [ref=e308]:
                  - cell "2078-6883-32" [ref=e309]:
                    - link "2078-6883-32" [ref=e310] [cursor=pointer]:
                      - /url: /customers/2078688332
                      - generic [ref=e311]: 2078-6883-32
                  - cell "Ervin Gerhold" [ref=e312]:
                    - link "Ervin Gerhold" [ref=e313] [cursor=pointer]:
                      - /url: /customers/2078688332
                      - generic [ref=e314]: Ervin Gerhold
                  - cell "Vienna South" [ref=e315]:
                    - link "Vienna South" [ref=e316] [cursor=pointer]:
                      - /url: /customers/2078688332
                      - generic [ref=e320]: Vienna South
                  - cell "isac_lockman44@gmail.com" [ref=e321]:
                    - link "isac_lockman44@gmail.com" [ref=e322] [cursor=pointer]:
                      - /url: /customers/2078688332
                      - generic [ref=e325]: isac_lockman44@gmail.com
                  - cell "+43 861 8277310" [ref=e326]:
                    - link "+43 861 8277310" [ref=e327] [cursor=pointer]:
                      - /url: /customers/2078688332
                      - generic [ref=e330]: +43 861 8277310
                  - cell "Lead" [ref=e331]:
                    - link "Lead" [ref=e332] [cursor=pointer]:
                      - /url: /customers/2078688332
                      - generic [ref=e335]: Lead
                  - cell "None" [ref=e336]:
                    - link "None" [ref=e337] [cursor=pointer]:
                      - /url: /customers/2078688332
                      - generic [ref=e340]: None
                  - cell "25 May 2026" [ref=e341]:
                    - link "25 May 2026" [ref=e342] [cursor=pointer]:
                      - /url: /customers/2078688332
                      - generic [ref=e343]: 25 May 2026
                - row "3398-3092-7 Morar LLC Storeroom Innsbruck City 1030 creola.walsh@gmail.com +43 84391484284694400 Lead None 25 May 2026" [ref=e344]:
                  - cell "3398-3092-7" [ref=e345]:
                    - link "3398-3092-7" [ref=e346] [cursor=pointer]:
                      - /url: /customers/339830927
                      - generic [ref=e347]: 3398-3092-7
                  - cell "Morar LLC" [ref=e348]:
                    - link "Morar LLC" [ref=e349] [cursor=pointer]:
                      - /url: /customers/339830927
                      - generic [ref=e350]: Morar LLC
                  - cell "Storeroom Innsbruck City 1030" [ref=e351]:
                    - link "Storeroom Innsbruck City 1030" [ref=e352] [cursor=pointer]:
                      - /url: /customers/339830927
                      - generic [ref=e354]:
                        - generic [ref=e356]: Storeroom Innsbruck
                        - generic [ref=e358]: City 1030
                  - cell "creola.walsh@gmail.com" [ref=e359]:
                    - link "creola.walsh@gmail.com" [ref=e360] [cursor=pointer]:
                      - /url: /customers/339830927
                      - generic [ref=e363]: creola.walsh@gmail.com
                  - cell "+43 84391484284694400" [ref=e364]:
                    - link "+43 84391484284694400" [ref=e365] [cursor=pointer]:
                      - /url: /customers/339830927
                      - generic [ref=e368]: +43 84391484284694400
                  - cell "Lead" [ref=e369]:
                    - link "Lead" [ref=e370] [cursor=pointer]:
                      - /url: /customers/339830927
                      - generic [ref=e373]: Lead
                  - cell "None" [ref=e374]:
                    - link "None" [ref=e375] [cursor=pointer]:
                      - /url: /customers/339830927
                      - generic [ref=e378]: None
                  - cell "25 May 2026" [ref=e379]:
                    - link "25 May 2026" [ref=e380] [cursor=pointer]:
                      - /url: /customers/339830927
                      - generic [ref=e381]: 25 May 2026
                - row "1750-6912-50 Cleta Emmerich Vienna North laurie58@hotmail.com +43 30144502578147709 Lead None 25 May 2026" [ref=e382]:
                  - cell "1750-6912-50" [ref=e383]:
                    - link "1750-6912-50" [ref=e384] [cursor=pointer]:
                      - /url: /customers/1750691250
                      - generic [ref=e385]: 1750-6912-50
                  - cell "Cleta Emmerich" [ref=e386]:
                    - link "Cleta Emmerich" [ref=e387] [cursor=pointer]:
                      - /url: /customers/1750691250
                      - generic [ref=e388]: Cleta Emmerich
                  - cell "Vienna North" [ref=e389]:
                    - link "Vienna North" [ref=e390] [cursor=pointer]:
                      - /url: /customers/1750691250
                      - generic [ref=e394]: Vienna North
                  - cell "laurie58@hotmail.com" [ref=e395]:
                    - link "laurie58@hotmail.com" [ref=e396] [cursor=pointer]:
                      - /url: /customers/1750691250
                      - generic [ref=e399]: laurie58@hotmail.com
                  - cell "+43 30144502578147709" [ref=e400]:
                    - link "+43 30144502578147709" [ref=e401] [cursor=pointer]:
                      - /url: /customers/1750691250
                      - generic [ref=e404]: +43 30144502578147709
                  - cell "Lead" [ref=e405]:
                    - link "Lead" [ref=e406] [cursor=pointer]:
                      - /url: /customers/1750691250
                      - generic [ref=e409]: Lead
                  - cell "None" [ref=e410]:
                    - link "None" [ref=e411] [cursor=pointer]:
                      - /url: /customers/1750691250
                      - generic [ref=e414]: None
                  - cell "25 May 2026" [ref=e415]:
                    - link "25 May 2026" [ref=e416] [cursor=pointer]:
                      - /url: /customers/1750691250
                      - generic [ref=e417]: 25 May 2026
                - row "9020-5377-3 Littel Ltd Vienna North crussel@hotmail.com +43 65054464195060013 Lead None 25 May 2026" [ref=e418]:
                  - cell "9020-5377-3" [ref=e419]:
                    - link "9020-5377-3" [ref=e420] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e421]: 9020-5377-3
                  - cell "Littel Ltd" [ref=e422]:
                    - link "Littel Ltd" [ref=e423] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e424]: Littel Ltd
                  - cell "Vienna North" [ref=e425]:
                    - link "Vienna North" [ref=e426] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e430]: Vienna North
                  - cell "crussel@hotmail.com" [ref=e431]:
                    - link "crussel@hotmail.com" [ref=e432] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e435]: crussel@hotmail.com
                  - cell "+43 65054464195060013" [ref=e436]:
                    - link "+43 65054464195060013" [ref=e437] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e440]: +43 65054464195060013
                  - cell "Lead" [ref=e441]:
                    - link "Lead" [ref=e442] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e445]: Lead
                  - cell "None" [ref=e446]:
                    - link "None" [ref=e447] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e450]: None
                  - cell "25 May 2026" [ref=e451]:
                    - link "25 May 2026" [ref=e452] [cursor=pointer]:
                      - /url: /customers/902053773
                      - generic [ref=e453]: 25 May 2026
                - row "1020-1994-67 Alessia Ondricka Storeroom Innsbruck City 1030 marquardt.elwyn@bartoletti.com +43 70051207270244369 Lead None 25 May 2026" [ref=e454]:
                  - cell "1020-1994-67" [ref=e455]:
                    - link "1020-1994-67" [ref=e456] [cursor=pointer]:
                      - /url: /customers/1020199467
                      - generic [ref=e457]: 1020-1994-67
                  - cell "Alessia Ondricka" [ref=e458]:
                    - link "Alessia Ondricka" [ref=e459] [cursor=pointer]:
                      - /url: /customers/1020199467
                      - generic [ref=e460]: Alessia Ondricka
                  - cell "Storeroom Innsbruck City 1030" [ref=e461]:
                    - link "Storeroom Innsbruck City 1030" [ref=e462] [cursor=pointer]:
                      - /url: /customers/1020199467
                      - generic [ref=e464]:
                        - generic [ref=e466]: Storeroom Innsbruck
                        - generic [ref=e468]: City 1030
                  - cell "marquardt.elwyn@bartoletti.com" [ref=e469]:
                    - link "marquardt.elwyn@bartoletti.com" [ref=e470] [cursor=pointer]:
                      - /url: /customers/1020199467
                      - generic [ref=e473]: marquardt.elwyn@bartoletti.com
                  - cell "+43 70051207270244369" [ref=e474]:
                    - link "+43 70051207270244369" [ref=e475] [cursor=pointer]:
                      - /url: /customers/1020199467
                      - generic [ref=e478]: +43 70051207270244369
                  - cell "Lead" [ref=e479]:
                    - link "Lead" [ref=e480] [cursor=pointer]:
                      - /url: /customers/1020199467
                      - generic [ref=e483]: Lead
                  - cell "None" [ref=e484]:
                    - link "None" [ref=e485] [cursor=pointer]:
                      - /url: /customers/1020199467
                      - generic [ref=e488]: None
                  - cell "25 May 2026" [ref=e489]:
                    - link "25 May 2026" [ref=e490] [cursor=pointer]:
                      - /url: /customers/1020199467
                      - generic [ref=e491]: 25 May 2026
                - row "1689-6746-26 Kassulke-Wolf Vienna North clinton.wilkinson@hayes.com +43 46068431944696072 Lead None 25 May 2026" [ref=e492]:
                  - cell "1689-6746-26" [ref=e493]:
                    - link "1689-6746-26" [ref=e494] [cursor=pointer]:
                      - /url: /customers/1689674626
                      - generic [ref=e495]: 1689-6746-26
                  - cell "Kassulke-Wolf" [ref=e496]:
                    - link "Kassulke-Wolf" [ref=e497] [cursor=pointer]:
                      - /url: /customers/1689674626
                      - generic [ref=e498]: Kassulke-Wolf
                  - cell "Vienna North" [ref=e499]:
                    - link "Vienna North" [ref=e500] [cursor=pointer]:
                      - /url: /customers/1689674626
                      - generic [ref=e504]: Vienna North
                  - cell "clinton.wilkinson@hayes.com" [ref=e505]:
                    - link "clinton.wilkinson@hayes.com" [ref=e506] [cursor=pointer]:
                      - /url: /customers/1689674626
                      - generic [ref=e509]: clinton.wilkinson@hayes.com
                  - cell "+43 46068431944696072" [ref=e510]:
                    - link "+43 46068431944696072" [ref=e511] [cursor=pointer]:
                      - /url: /customers/1689674626
                      - generic [ref=e514]: +43 46068431944696072
                  - cell "Lead" [ref=e515]:
                    - link "Lead" [ref=e516] [cursor=pointer]:
                      - /url: /customers/1689674626
                      - generic [ref=e519]: Lead
                  - cell "None" [ref=e520]:
                    - link "None" [ref=e521] [cursor=pointer]:
                      - /url: /customers/1689674626
                      - generic [ref=e524]: None
                  - cell "25 May 2026" [ref=e525]:
                    - link "25 May 2026" [ref=e526] [cursor=pointer]:
                      - /url: /customers/1689674626
                      - generic [ref=e527]: 25 May 2026
                - row "1905-1334-26 Wisoky PLC Vienna North orpha42@bruen.org +43 22004497769179660 Lead None 25 May 2026" [ref=e528]:
                  - cell "1905-1334-26" [ref=e529]:
                    - link "1905-1334-26" [ref=e530] [cursor=pointer]:
                      - /url: /customers/1905133426
                      - generic [ref=e531]: 1905-1334-26
                  - cell "Wisoky PLC" [ref=e532]:
                    - link "Wisoky PLC" [ref=e533] [cursor=pointer]:
                      - /url: /customers/1905133426
                      - generic [ref=e534]: Wisoky PLC
                  - cell "Vienna North" [ref=e535]:
                    - link "Vienna North" [ref=e536] [cursor=pointer]:
                      - /url: /customers/1905133426
                      - generic [ref=e540]: Vienna North
                  - cell "orpha42@bruen.org" [ref=e541]:
                    - link "orpha42@bruen.org" [ref=e542] [cursor=pointer]:
                      - /url: /customers/1905133426
                      - generic [ref=e545]: orpha42@bruen.org
                  - cell "+43 22004497769179660" [ref=e546]:
                    - link "+43 22004497769179660" [ref=e547] [cursor=pointer]:
                      - /url: /customers/1905133426
                      - generic [ref=e550]: +43 22004497769179660
                  - cell "Lead" [ref=e551]:
                    - link "Lead" [ref=e552] [cursor=pointer]:
                      - /url: /customers/1905133426
                      - generic [ref=e555]: Lead
                  - cell "None" [ref=e556]:
                    - link "None" [ref=e557] [cursor=pointer]:
                      - /url: /customers/1905133426
                      - generic [ref=e560]: None
                  - cell "25 May 2026" [ref=e561]:
                    - link "25 May 2026" [ref=e562] [cursor=pointer]:
                      - /url: /customers/1905133426
                      - generic [ref=e563]: 25 May 2026
            - generic [ref=e566]:
              - generic [ref=e567]:
                - generic [ref=e568]: "Items per page:"
                - combobox [ref=e571]:
                  - generic [ref=e573] [cursor=pointer]:
                    - generic [ref=e575]: "10"
                    - combobox "Items per page:": "10"
                  - generic [ref=e577]: 󰍝
              - generic [ref=e578]: 1-7 of 7
              - generic [ref=e579]:
                - 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
  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);
  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);
      |                                                ^ Error: expect(locator).toHaveCount(expected) failed
  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);
  172 | 
  173 |   const dialog = await test.step('submit edit with duplicate phone number', async () => {
  174 |     const editDialog = await customerDetailsPage.openCustomerEditGeneralDialog();
  175 |     await editDialog.fill({ phone: existing.phone, country: existing.country });
  176 |     await editDialog.submit();
  177 |     return editDialog;
  178 |   });
  179 | 
  180 |   await test.step('verify errors on form', async () => {
  181 |     await expect(dialog.errors).toHaveCountGreaterThan(0);
  182 |   });
  183 | });
  184 | 
  185 | test('rejects an edit with a vat number that does not match the vat type', async ({
  186 |   createCustomer,
  187 |   customerDetailsPage,
  188 | }) => {
  189 |   const customer = await createCustomer(getCustomerCreateData({ type: 'business' }));
  190 | 
  191 |   await customerDetailsPage.goto(customer.id);
  192 | 
  193 |   const dialog = await test.step('submit edit with mismatched vat type and number', async () => {
  194 |     const editDialog = await customerDetailsPage.openCustomerEditGeneralDialog();
  195 |     await editDialog.fill({ vatType: vatTypes.eu_vat, vatNumber: 'INVALID-VAT-1234' });
  196 |     await editDialog.submit();
  197 |     return editDialog;
  198 |   });
  199 | 
  200 |   await test.step('verify errors on form', async () => {
  201 |     await expect(dialog.errors).toHaveCountGreaterThan(0);
  202 |   });
  203 | });
  204 | 
  205 | test('rejects an edit without all required fields', async ({ createCustomer, customerDetailsPage }) => {
  206 |   const customer = await createCustomer(getCustomerCreateData({ type: 'private' }));
  207 | 
  208 |   await customerDetailsPage.goto(customer.id);
  209 | 
  210 |   const dialog = await test.step('submit edit clearing required fields', async () => {
  211 |     const editDialog = await customerDetailsPage.openCustomerEditGeneralDialog();
  212 |     await editDialog.fill({ firstName: '', lastName: '' });
  213 |     await editDialog.submit();
  214 |     return editDialog;
  215 |   });
  216 | 
  217 |   await test.step('verify errors on form', async () => {
  218 |     await expect(dialog.errors).toHaveCountGreaterThan(0);
  219 |   });
  220 | });
  221 | 
```