Build Mocha test dynamically after getting data from webdriver.io
问题 I'm looking for a solution to define Mocha tests after getting data asynchronously. For now, I use gulp-webdriver to getting HTML content with Selenium. And I want tests certain HTML tags structure. For example, I want to get all buttons structure from an HTML page. 1° In Mocha Before(), I get buttons : var buttons = browser.url("url").getHTML("button"); 2° And after that, I want tests each button in a separate it : buttons.forEach(function(button) { it() }); The only solution found is