diff --git a/test/integration/blocks.test.js b/test/integration/blocks.test.js index 4963c5e44a8617ca7b0f7c68ea1985ef84262775..8b2acdc730b3e03492925a58c546d52c47d02284 100644 --- a/test/integration/blocks.test.js +++ b/test/integration/blocks.test.js @@ -90,6 +90,40 @@ describe('Working with the blocks', () => { await expect(logs).toEqual([]); }); + test('Creating a list', async () => { + await loadUri(uri); + await clickXpath('//button[@title="tryit"]'); + await clickText('Code'); + await clickText('Variables', scope.blocksTab); + await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for scroll animation + + await clickText('Make a List'); + let el = await findByXpath("//input[@placeholder='']"); + await el.sendKeys('list1'); + await clickButton('OK'); + + // Click the "add <thing> to list" block 3 times + await clickText('add', scope.blocksTab); + await clickText('add', scope.blocksTab); + await clickText('add', scope.blocksTab); + await clickText('list1', scope.blocksTab); + await findByText('thing thing thing', scope.reportedValue); // Tooltip with result + + // Interact with the monitor, adding an item + await findByText('list1', scope.monitors); // Just to be sure it is there + await clickText('+', scope.monitors); + el = await findByXpath(`//body//${scope.monitors}//input`); + await el.sendKeys('thing2'); + await clickText('list1', scope.monitors); // Blur the input to submit + + // Check that the list value has been propagated. + await clickText('list1', scope.blocksTab); + await findByText('thing thing thing thing2', scope.reportedValue); // Tooltip with result + + const logs = await getLogs(); + await expect(logs).toEqual([]); + }); + test('Custom procedures', async () => { await loadUri(uri); await clickXpath('//button[@title="tryit"]');