123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730 |
- var assert = require('assert');
- var i;
- Feature('array');
- Scenario('should have correct initial value', async (I) => {
- I.amOnPage('array.html');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[]');
- });
- Scenario('should work well with string editors', async (I) => {
- I.amOnPage('array-strings.html');
- I.click('Add String');
- I.click('Add String');
- I.click('Add String');
- I.click('Add String');
- I.click('Add String');
- I.seeElement('[name="root[0]"]');
- I.seeElement('[name="root[1]"]');
- I.seeElement('[name="root[2]"]');
- I.seeElement('[name="root[3]"]');
- I.seeElement('[name="root[4]"]');
- I.fillField('[name="root[0]"]', "1");
- I.fillField('[name="root[1]"]', "2");
- I.fillField('[name="root[2]"]', "3");
- I.fillField('[name="root[3]"]', "4");
- I.fillField('[name="root[4]"]', "5");
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '["1","2","3","4","5"]');
- // shuffle
- I.click('.moveup[data-i="4"]');
- I.click('.moveup[data-i="2"]');
- I.click('.moveup[data-i="1"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '["3","1","2","5","4"]');
- // delete single
- I.see('String 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('String 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('String 5');
- // delete last
- I.see('String 4');
- I.click('Delete Last String');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('String 4');
- I.click('Delete Last String');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('String 4');
- // delete all
- I.see('String 1');
- I.see('String 2');
- I.see('String 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('String 1');
- I.see('String 2');
- I.see('String 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('String 1');
- I.dontSee('String 2');
- I.dontSee('String 3');
- });
- Scenario('should work well with number editors', async (I) => {
- I.amOnPage('array-numbers.html');
- I.click('Add Number');
- I.click('Add Number');
- I.click('Add Number');
- I.click('Add Number');
- I.click('Add Number');
- I.seeElement('[name="root[0]"]');
- I.seeElement('[name="root[1]"]');
- I.seeElement('[name="root[2]"]');
- I.seeElement('[name="root[3]"]');
- I.seeElement('[name="root[4]"]');
- I.fillField('[name="root[0]"]', "1");
- I.fillField('[name="root[1]"]', "2");
- I.fillField('[name="root[2]"]', "3");
- I.fillField('[name="root[3]"]', "4");
- I.fillField('[name="root[4]"]', "5");
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[1,2,3,4,5]');
- // shuffle
- I.click('.moveup[data-i="4"]');
- I.click('.moveup[data-i="2"]');
- I.click('.moveup[data-i="1"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[3,1,2,5,4]');
- // delete single
- I.see('Number 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Number 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Number 5');
- // delete last
- I.see('Number 4');
- I.click('Delete Last Number');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Number 4');
- I.click('Delete Last Number');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Number 4');
- // delete all
- I.see('Number 1');
- I.see('Number 2');
- I.see('Number 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Number 1');
- I.see('Number 2');
- I.see('Number 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Number 1');
- I.dontSee('Number 2');
- I.dontSee('Number 3');
- });
- Scenario('should work well with integer editors', async (I) => {
- I.amOnPage('array-integers.html');
- I.click('Add Integer');
- I.click('Add Integer');
- I.click('Add Integer');
- I.click('Add Integer');
- I.click('Add Integer');
- I.seeElement('[name="root[0]"]');
- I.seeElement('[name="root[1]"]');
- I.seeElement('[name="root[2]"]');
- I.seeElement('[name="root[3]"]');
- I.seeElement('[name="root[4]"]');
- I.fillField('[name="root[0]"]', "1");
- I.fillField('[name="root[1]"]', "2");
- I.fillField('[name="root[2]"]', "3");
- I.fillField('[name="root[3]"]', "4");
- I.fillField('[name="root[4]"]', "5");
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[1,2,3,4,5]');
- // shuffle
- I.click('.moveup[data-i="4"]');
- I.click('.moveup[data-i="2"]');
- I.click('.moveup[data-i="1"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[3,1,2,5,4]');
- // delete single
- I.see('Integer 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Integer 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Integer 5');
- // delete last
- I.see('Integer 4');
- I.click('Delete Last Integer');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Integer 4');
- I.click('Delete Last Integer');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Integer 4');
- // delete all
- I.see('Integer 1');
- I.see('Integer 2');
- I.see('Integer 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Integer 1');
- I.see('Integer 2');
- I.see('Integer 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Integer 1');
- I.dontSee('Integer 2');
- I.dontSee('Integer 3');
- });
- Scenario('should work well with select editors', async (I) => {
- I.amOnPage('array-selects.html');
- I.click('Add Select');
- I.click('Add Select');
- I.seeElement('[name="root[0]"]');
- I.seeElement('[name="root[1]"]');
- I.selectOption('[name="root[0]"]', "true");
- I.selectOption('[name="root[1]"]', "false");
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[true,false]');
- // shuffle
- I.click('.moveup[data-i="1"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[false,true]');
- // delete single
- I.click('Add Select');
- I.click('Add Select');
- I.click('Add Select');
- I.see('Select 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Select 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Select 5');
- // delete last
- I.see('Select 4');
- I.click('Delete Last Select');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Select 4');
- I.click('Delete Last Select');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Select 4');
- // delete all
- I.see('Select 1');
- I.see('Select 2');
- I.see('Select 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Select 1');
- I.see('Select 2');
- I.see('Select 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Select 1');
- I.dontSee('Select 2');
- I.dontSee('Select 3');
- });
- Scenario('should work well with checkbox editors', async (I) => {
- I.amOnPage('array-checkboxes.html');
- I.click('Add Checkbox');
- I.click('Add Checkbox');
- I.click('Add Checkbox');
- I.click('Add Checkbox');
- I.click('Add Checkbox');
- I.seeElement('[data-schemapath="root.0"]');
- I.seeElement('[data-schemapath="root.1"]');
- I.seeElement('[data-schemapath="root.2"]');
- I.seeElement('[data-schemapath="root.3"]');
- I.seeElement('[data-schemapath="root.4"]');
- I.checkOption('1', '[data-schemapath="root.0"]');
- I.checkOption('2', '[data-schemapath="root.1"]');
- I.checkOption('3', '[data-schemapath="root.2"]');
- I.checkOption('4', '[data-schemapath="root.3"]');
- I.checkOption('5', '[data-schemapath="root.4"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["1"],["2"],["3"],["4"],["5"]]');
- // shuffle
- I.click('.moveup[data-i="4"]');
- I.click('.moveup[data-i="2"]');
- I.click('.moveup[data-i="1"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["3"],["1"],["2"],["5"],["4"]]');
- // delete single
- I.see('Checkbox 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Checkbox 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Checkbox 5');
- // delete last
- I.see('Checkbox 4');
- I.click('Delete Last Checkbox');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Checkbox 4');
- I.click('Delete Last Checkbox');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Checkbox 4');
- // delete all
- I.see('Checkbox 1');
- I.see('Checkbox 2');
- I.see('Checkbox 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Checkbox 1');
- I.see('Checkbox 2');
- I.see('Checkbox 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Checkbox 1');
- I.dontSee('Checkbox 2');
- I.dontSee('Checkbox 3');
- });
- Scenario('should work well with rating editors', async (I) => {
- I.amOnPage('array-ratings.html');
- I.seeElement('[data-schemapath="root.0"]');
- I.seeElement('[data-schemapath="root.1"]');
- I.seeElement('[data-schemapath="root.2"]');
- I.seeElement('[data-schemapath="root.3"]');
- I.seeElement('[data-schemapath="root.4"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[1,2,3,4,5]');
- // shuffle
- I.click('.moveup[data-i="4"]');
- I.click('.moveup[data-i="2"]');
- I.click('.moveup[data-i="1"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[3,1,2,5,4]');
- // delete single
- I.see('Rating 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Rating 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Rating 5');
- // delete last
- I.see('Rating 4');
- I.click('Delete Last Rating');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Rating 4');
- I.click('Delete Last Rating');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Rating 4');
- // delete all
- I.see('Rating 1');
- I.see('Rating 2');
- I.see('Rating 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Rating 1');
- I.see('Rating 2');
- I.see('Rating 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Rating 1');
- I.dontSee('Rating 2');
- I.dontSee('Rating 3');
- });
- Scenario('should work well with multiselect editors', async (I) => {
- I.amOnPage('array-multiselects.html');
- I.click('Add Multiselect');
- I.click('Add Multiselect');
- I.click('Add Multiselect');
- I.click('Add Multiselect');
- I.click('Add Multiselect');
- I.seeElement('[data-schemapath="root.0"]');
- I.seeElement('[data-schemapath="root.1"]');
- I.seeElement('[data-schemapath="root.2"]');
- I.seeElement('[data-schemapath="root.3"]');
- I.seeElement('[data-schemapath="root.4"]');
- I.selectOption('[name="root[0]"]', "1");
- I.selectOption('[name="root[1]"]', "2");
- I.selectOption('[name="root[2]"]', "3");
- I.selectOption('[name="root[3]"]', "4");
- I.selectOption('[name="root[4]"]', "5");
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["1"],["2"],["3"],["4"],["5"]]');
- // shuffle
- I.click('.moveup[data-i="4"]');
- I.click('.moveup[data-i="2"]');
- I.click('.moveup[data-i="1"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["3"],["1"],["2"],["5"],["4"]]');
- // delete single
- I.see('Multiselect 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Multiselect 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Multiselect 5');
- // delete last
- I.see('Multiselect 4');
- I.click('Delete Last Multiselect');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Multiselect 4');
- I.click('Delete Last Multiselect');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Multiselect 4');
- // delete all
- I.see('Multiselect 1');
- I.see('Multiselect 2');
- I.see('Multiselect 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Multiselect 1');
- I.see('Multiselect 2');
- I.see('Multiselect 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Multiselect 1');
- I.dontSee('Multiselect 2');
- I.dontSee('Multiselect 3');
- });
- Scenario('should work well with object editors', async (I) => {
- I.amOnPage('array-objects.html');
- I.click('Add Object');
- I.click('Add Object');
- I.click('Add Object');
- I.click('Add Object');
- I.click('Add Object');
- I.seeElement('[name="root[0][property]"]');
- I.seeElement('[name="root[1][property]"]');
- I.seeElement('[name="root[2][property]"]');
- I.seeElement('[name="root[3][property]"]');
- I.seeElement('[name="root[4][property]"]');
- I.fillField('[name="root[0][property]"]', "1");
- I.fillField('[name="root[1][property]"]', "2");
- I.fillField('[name="root[2][property]"]', "3");
- I.fillField('[name="root[3][property]"]', "4");
- I.fillField('[name="root[4][property]"]', "5");
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[{"property":"1"},{"property":"2"},{"property":"3"},{"property":"4"},{"property":"5"}]');
- // shuffle
- I.click('.moveup[data-i="4"]');
- I.click('.moveup[data-i="2"]');
- I.click('.moveup[data-i="1"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[{"property":"3"},{"property":"1"},{"property":"2"},{"property":"5"},{"property":"4"}]');
- // delete single
- I.see('Object 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Object 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Object 5');
- // delete last
- I.see('Object 4');
- I.click('Delete Last Object');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Object 4');
- I.click('Delete Last Object');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Object 4');
- // delete all
- I.see('Object 1');
- I.see('Object 2');
- I.see('Object 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Object 1');
- I.see('Object 2');
- I.see('Object 3');
- I.click('Delete All');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Object 1');
- I.dontSee('Object 2');
- I.dontSee('Object 3');
- });
- Scenario('should work well with nested array editors', async (I) => {
- I.amOnPage('array-nested-arrays.html');
- I.click('Add Array');
- I.click('Add Array');
- I.click('Add Array');
- I.click('Add Array');
- I.click('Add Array');
- I.seeElement('[data-schemapath="root.0"]');
- I.seeElement('[data-schemapath="root.1"]');
- I.seeElement('[data-schemapath="root.2"]');
- I.seeElement('[data-schemapath="root.3"]');
- I.seeElement('[data-schemapath="root.4"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[[],[],[],[],[]]');
- // adds one string editor in each first level array
- for (i = 0; i < 5; i++) {
- I.click('Add String', '[data-schemapath="root.' + i + '"]');
- I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][0]"]', String(i + 1));
- }
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["1"],["2"],["3"],["4"],["5"]]');
- // shuffle
- I.click('.moveup[data-i="4"]');
- I.click('.moveup[data-i="2"]');
- I.click('.moveup[data-i="1"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["3"],["1"],["2"],["5"],["4"]]');
- // delete single
- I.see('Array 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Array 5');
- I.click('[data-schemapath="root.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Array 5');
- // delete last
- I.see('Array 4');
- I.click('Delete Last Array');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Array 4');
- I.click('Delete Last Array');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Array 4');
- // delete all
- I.see('Array 1');
- I.see('Array 2');
- I.see('Array 3');
- // there are hidden "Delete All" buttons right now and "I.click(Delete All)"
- // will attempt to click the first match. It fails because is hidden.
- // this is why i use this script. is more flexible.
- I.executeScript(function() {
- var e = document.querySelectorAll('.json-editor-btn-delete');
- e[e.length - 1].click();
- });
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('Array 1');
- I.see('Array 2');
- I.see('Array 3');
- I.executeScript(function() {
- var e = document.querySelectorAll('.json-editor-btn-delete');
- e[e.length - 1].click();
- });
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('Array 1');
- I.dontSee('Array 2');
- I.dontSee('Array 3');
- // manipulate nested items
- I.amOnPage('array-nested-arrays.html');
- I.click('Add Array');
- I.click('Add Array');
- I.click('Add Array');
- I.click('Add Array');
- I.click('Add Array');
- I.seeElement('[data-schemapath="root.0"]');
- I.seeElement('[data-schemapath="root.1"]');
- I.seeElement('[data-schemapath="root.2"]');
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[[],[],[],[],[]]');
- // adds one string editor in each first level array
- for (i = 0; i < 5; i++) {
- I.click('Add String', '[data-schemapath="root.' + i + '"]');
- I.click('Add String', '[data-schemapath="root.' + i + '"]');
- I.click('Add String', '[data-schemapath="root.' + i + '"]');
- I.click('Add String', '[data-schemapath="root.' + i + '"]');
- I.click('Add String', '[data-schemapath="root.' + i + '"]');
- I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][0]"]', "1");
- I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][1]"]', "2");
- I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][2]"]', "3");
- I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][3]"]', "4");
- I.fillField('[data-schemapath="root.' + i + '"] [name="root[' + i + '][4]"]', "5");
- }
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["1","2","3","4","5"],["1","2","3","4","5"],["1","2","3","4","5"],["1","2","3","4","5"],["1","2","3","4","5"]]');
- // shuffle every strings array
- for (i = 0; i < 5; i++) {
- I.click('[data-schemapath="root.' + i + '.4"] .moveup');
- I.click('[data-schemapath="root.' + i + '.2"] .moveup');
- I.click('[data-schemapath="root.' + i + '.1"] .moveup');
- }
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["3","1","2","5","4"],["3","1","2","5","4"],["3","1","2","5","4"],["3","1","2","5","4"],["3","1","2","5","4"]]');
- // delete single (fifth) element from every string array
- for (i = 0; i < 5; i++) {
- I.see('String 5', '[data-schemapath="root.' + i + '"]');
- I.click('[data-schemapath="root.' + i + '.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('String 5', '[data-schemapath="root.' + i + '"]');
- I.click('[data-schemapath="root.' + i + '.4"] .delete');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('String 5', '[data-schemapath="root.' + i + '"]');
- }
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["3","1","2","5"],["3","1","2","5"],["3","1","2","5"],["3","1","2","5"],["3","1","2","5"]]');
- // delete last (fourth) element from every string array
- for (i = 0; i < 5; i++) {
- I.see('String 4', '[data-schemapath="root.' + i + '"]');
- I.click('Delete Last String', '[data-schemapath="root.' + i + '"]');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('String 4', '[data-schemapath="root.' + i + '"]');
- I.click('Delete Last String', '[data-schemapath="root.' + i + '"]');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('String 4', '[data-schemapath="root.' + i + '"]');
- }
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[["3","1","2"],["3","1","2"],["3","1","2"],["3","1","2"],["3","1","2"]]');
- // delete last (fourth) element from every string array
- for (i = 0; i < 5; i++) {
- I.see('String 1', '[data-schemapath="root.' + i + '"]');
- I.see('String 2', '[data-schemapath="root.' + i + '"]');
- I.see('String 3', '[data-schemapath="root.' + i + '"]');
- I.click('Delete All', '[data-schemapath="root.' + i + '"]');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.cancelPopup();
- I.see('String 1', '[data-schemapath="root.' + i + '"]');
- I.see('String 2', '[data-schemapath="root.' + i + '"]');
- I.see('String 3', '[data-schemapath="root.' + i + '"]');
- I.click('Delete All', '[data-schemapath="root.' + i + '"]');
- I.seeInPopup('Are you sure you want to remove this node?');
- I.acceptPopup();
- I.dontSee('String 1', '[data-schemapath="root.' + i + '"]');
- I.dontSee('String 2', '[data-schemapath="root.' + i + '"]');
- I.dontSee('String 3', '[data-schemapath="root.' + i + '"]');
- }
- I.click('.get-value');
- value = await I.grabValueFrom('.debug');
- assert.equal(value, '[[],[],[],[],[]]');
- });
|