Событие обмена триггером не работает должным образом в транспортире - PullRequest
0 голосов
/ 31 октября 2019

Попытка отправить значения в поле ввода и нажать кнопку Добавить. Но событие Dispatch отличается от ручного щелчка и передачи значений.

//Passing value in an inputbox
browser.executeScript(`document.querySelector("body > moo-shell > auto-app").shadowRoot.querySelector("section > auto-config").shadowRoot.querySelector("section:nth-child(2) > div > div:nth-child(2) > section:nth-child(1) > auto-schedules-field").shadowRoot.querySelector("div > vaadin-ext-time-picker:nth-child(1)").shadowRoot.querySelector("vaadin-combo-box-light > vaadin-time-picker-text-field").shadowRoot.querySelector("div > div:nth-child(2) > slot:nth-child(2) > input").value = "abcd";`);
//Dispatching change event
browser.executeScript(`document.querySelector("body > moo-shell > auto-app").shadowRoot.querySelector("section > auto-config").shadowRoot.querySelector("section:nth-child(2) > div > div:nth-child(2) > section:nth-child(1) > auto-schedules-field").shadowRoot.querySelector("div > vaadin-ext-time-picker:nth-child(1)").shadowRoot.querySelector("vaadin-combo-box-light > vaadin-time-picker-text-field").shadowRoot.querySelector("div > div:nth-child(2) > slot:nth-child(2) > input").dispatchEvent(new Event('change', { 'bubbles': true }));`);

var clickAddButton = `document.querySelector("body > moo-shell > auto-app").shadowRoot.querySelector("section > auto-config").shadowRoot.querySelector("section:nth-child(2) > div > div:nth-child(2) > section:nth-child(1) > auto-schedules-field").shadowRoot.querySelector("div > vaadin-button").shadowRoot.querySelector("#button").dispatchEvent(new Event('change', { 'bubbles': true }));`;
browser.executeScript(clickAddButton);
//Dispatching change event after clicking the add button
browser.executeScript(`document.querySelector("body > moo-shell > auto-app").shadowRoot.querySelector("section > auto-config").shadowRoot.querySelector("section:nth-child(2) > div > div:nth-child(2) > section:nth-child(1) > auto-schedules-field").shadowRoot.querySelector("div > vaadin-button").shadowRoot.querySelector("#button").click();`)

//Expected Result: Input box should turn red
//Actual Result: Value passes in the input box & clicked Add button but inputbox doesnot 
//turns red...same execution doing manually input box turns red.
...