Skip to content

Instantly share code, notes, and snippets.

@ngokevin
Created August 21, 2013 23:24
Show Gist options
  • Select an option

  • Save ngokevin/6301476 to your computer and use it in GitHub Desktop.

Select an option

Save ngokevin/6301476 to your computer and use it in GitHub Desktop.
var suite = require('./kasperle').suite();
suite.run('/', function(test, waitFor) {
test('Click close prompt', function(assert) {
suite.evaluate(function() {
// Set chromeless since prompt only shows on browsers.
window.require(['capabilities', 'storage'], function(capabilities, storage) {
capabilities.chromeless = false;
storage.setItem('mktapp-prompt-closed', true);
});
});
waitFor(function() {
// Wait for prompt.
// I want to "reload" the page with the above flags switched such
// that the prompt shows. Here it times out because the settings
// are not correct for the prompt to render.
return suite.exists('#mktapp-prompt .prompt-text');
}, function() {
// Click the close button and check the prompt goes away.
assert.selectorExists('#mktapp-prompt .prompt-text');
suite.press('#mktapp-prompt .prompt-close');
assert.selectorDoesNotExist('#mktapp-prompt .prompt-text');
});
});
});
@ngokevin
Copy link
Copy Markdown
Author

The waitFor times out.

The first assertion fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment