casper: Avoid nesting wait statements to avoid flakes.

This test had flaked before. Nesting waitUntilVisible
statements is generally discouraged in casper tests.
This commit is contained in:
Steve Howell
2018-03-01 16:57:11 -05:00
committed by Tim Abbott
parent bd0a5d5d69
commit 1338b99356

View File

@@ -124,19 +124,20 @@ casper.then(function create_bot() {
});
var bot_email = '1-bot@zulip.zulipdev.com';
var button_sel = '.download_bot_zuliprc[data-email="' + bot_email + '"]';
casper.then(function () {
var button_sel = '.download_bot_zuliprc[data-email="' + bot_email + '"]';
casper.waitUntilVisible(button_sel, function () {
casper.click(button_sel);
});
});
casper.waitUntilVisible(button_sel + '[href^="data:application"]', function () {
casper.test.assertMatch(
decodeURIComponent(casper.getElementsAttribute(button_sel, 'href')),
regex_zuliprc,
'Looks like a bot ~/.zuliprc file');
});
casper.then(function () {
casper.waitUntilVisible(button_sel + '[href^="data:application"]', function () {
casper.test.assertMatch(
decodeURIComponent(casper.getElementsAttribute(button_sel, 'href')),
regex_zuliprc,
'Looks like a bot ~/.zuliprc file');
});
});