Skip to content

Commit

Permalink
fix: add changes to the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olegfedak committed Aug 15, 2024
1 parent b45dc66 commit 0a31216
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cypress/e2e/markdown_widget_code_block_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ function codeBlock(content) {
<div>
<div></div>
<div>
<div><label>Code Block</label>
<div>
<div><label>Code Block</label></div>
<div><button><span><svg>
<path></path>
</svg></span></button>
Expand Down
23 changes: 23 additions & 0 deletions cypress/utils/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function assertColorOn(cssProperty, color, opts) {
} else {
(opts.scope ? opts.scope : cy)
.contains('label', opts.label)
.parents()
.next()
.should(assertion);
}
Expand Down Expand Up @@ -518,23 +519,31 @@ function validateNestedListFields() {
cy.contains('button', 'hotel locations').click();
cy.contains('button', 'cities').click();
cy.contains('label', 'City')
.parents()
.next()
.first() // Вибрати перший елемент після parents()
.type('Washington DC');
cy.contains('label', 'Number of Hotels in City')
.parents()
.next()
.first() // Вибрати перший елемент після parents()
.type('5');
cy.contains('button', 'city locations').click();

// add second city list item
cy.contains('button', 'cities').click();
cy.contains('label', 'Cities')
.parents()
.next()
.first() // Вибрати перший елемент після parents()
.find('div[class*=SortableListItem]')
.eq(2)
.as('secondCitiesListControl');
cy.get('@secondCitiesListControl')
.contains('label', 'City')
.parents()
.next()
.first() // Вибрати перший елемент після parents()
.type('Boston');
cy.get('@secondCitiesListControl')
.contains('button', 'city locations')
Expand All @@ -561,21 +570,25 @@ function validateNestedListFields() {

// list control aliases
cy.contains('label', 'Hotel Locations')
.parents()
.next()
.find('div[class*=SortableListItem]')
.first()
.as('hotelLocationsListControl');
cy.contains('label', 'Cities')
.parents()
.next()
.find('div[class*=SortableListItem]')
.eq(0)
.as('firstCitiesListControl');
cy.contains('label', 'City Locations')
.parents()
.next()
.find('div[class*=SortableListItem]')
.eq(0)
.as('firstCityLocationsListControl');
cy.contains('label', 'Cities')
.parents()
.next()
.find('div[class*=SortableListItem]')
.eq(3)
Expand All @@ -589,7 +602,9 @@ function validateNestedListFields() {
assertListControlErrorStatus([colorError, colorError], '@secondCityLocationsListControl');

cy.contains('label', 'Hotel Name')
.parents()
.next()
.first()
.type('The Ritz Carlton');
cy.contains('button', 'Save').click();
assertNotification(notifications.error.missingField);
Expand All @@ -598,12 +613,20 @@ function validateNestedListFields() {
// fill out rest of form and save
cy.get('@secondCitiesListControl')
.contains('label', 'Number of Hotels in City')
.parents()
.next()
.first()
.type(3);
cy.get('@secondCitiesListControl')
.contains('label', 'Hotel Name')
.parents()
.next()
.first()
.type('Grand Hyatt');
cy.contains('label', 'Country')
.parents()
.next()
.first()
.type('United States');
flushClockAndSave();
assertNotification(notifications.saved);
Expand Down

0 comments on commit 0a31216

Please sign in to comment.