describe("Alerts", function() { var io, po; beforeAll(function () { io = ST.defaultContext.driver; po = { alert: function () { return ST.element('@alert').click(); }, confirm: function () { return ST.element('@confirm').click() }, prompt: function () { return ST.element('@prompt').click() }, text: function () { return ST.element('@name'); } } }); afterAll(function () { io = null; }); describe('alert()', function () { it('should accept alert()', function () { po.alert().and(function () { io.alertAccept(); }); }); }); describe('confirm()', function () { it('should accept confirm()', function () { po.confirm().and(function () { io.alertAccept(); }); }); it('should dismiss confirm()', function () { po.confirm().and(function () { io.alertDismiss(); }); }); }); describe('prompt()', function () { it('should accept', function () { po.prompt().and(function () { io.alertAccept(); }); }); it('should dismiss', function () { po.prompt().and(function () { io.alertDismiss(); }); }); it('should enter text', function (done) { io.alertText('Voldemort'); io.alertDismiss(); po.text().expect('value').toBe('Voldemort'); }); }); });