()
| 502 | } |
| 503 | |
| 504 | function validateNestedListFields() { |
| 505 | cy.get('a[href^="#/collections/settings"]').click(); |
| 506 | cy.get('a[href^="#/collections/settings/entries/hotel_locations"]').click(); |
| 507 | |
| 508 | // add first city list item |
| 509 | cy.contains('button', 'hotel locations').click(); |
| 510 | cy.contains('button', 'cities').click(); |
| 511 | cy.contains('label', 'City').parents().next().first().type('Washington DC'); |
| 512 | cy.contains('label', 'Number of Hotels in City').parents().next().first().type('5'); |
| 513 | cy.contains('button', 'city locations').click(); |
| 514 | |
| 515 | // add second city list item |
| 516 | cy.contains('button', 'cities').click(); |
| 517 | cy.contains('label', 'Cities') |
| 518 | .parents() |
| 519 | .next() |
| 520 | .first() |
| 521 | .find('div[class*=SortableListItem]') |
| 522 | .eq(2) |
| 523 | .as('secondCitiesListControl'); |
| 524 | cy.get('@secondCitiesListControl') |
| 525 | .contains('label', 'City') |
| 526 | .parents() |
| 527 | .next() |
| 528 | .first() |
| 529 | .type('Boston'); |
| 530 | cy.get('@secondCitiesListControl').contains('button', 'city locations').click(); |
| 531 | |
| 532 | cy.contains('button', 'Save').click(); |
| 533 | assertNotification(notifications.error.missingField); |
| 534 | |
| 535 | // assert on fields |
| 536 | assertFieldErrorStatus('Hotel Locations', colorError); |
| 537 | assertFieldErrorStatus('Cities', colorError); |
| 538 | assertFieldErrorStatus('City', colorNormal); |
| 539 | assertFieldErrorStatus('City', colorNormal, { scope: cy.get('@secondCitiesListControl') }); |
| 540 | assertFieldErrorStatus('Number of Hotels in City', colorNormal); |
| 541 | assertFieldErrorStatus('Number of Hotels in City', colorError, { |
| 542 | scope: cy.get('@secondCitiesListControl'), |
| 543 | }); |
| 544 | assertFieldErrorStatus('City Locations', colorError); |
| 545 | assertFieldErrorStatus('City Locations', colorError, { |
| 546 | scope: cy.get('@secondCitiesListControl'), |
| 547 | }); |
| 548 | assertFieldErrorStatus('Hotel Name', colorError); |
| 549 | assertFieldErrorStatus('Hotel Name', colorError, { scope: cy.get('@secondCitiesListControl') }); |
| 550 | |
| 551 | // list control aliases |
| 552 | cy.contains('label', 'Hotel Locations') |
| 553 | .parents() |
| 554 | .next() |
| 555 | .find('div[class*=SortableListItem]') |
| 556 | .first() |
| 557 | .as('hotelLocationsListControl'); |
| 558 | cy.contains('label', 'Cities') |
| 559 | .parents() |
| 560 | .next() |
| 561 | .find('div[class*=SortableListItem]') |
no test coverage detected