UNPKG

kazana-example

Version:
46 lines (44 loc) 1.29 kB
var test = require('../utils/test') test('Data Submission', function (group, server, client) { group.test('Submit a report', function (t) { return client .init() .login() .waitForExist('[data-qa=y2014]') .click('[data-qa=y2014]') .waitForExist('[data-qa=Q4]') .click('[data-qa=Q4]') .setValue('[data-qa=report-name]', 'coffee') .setValue('[data-qa=report-text]', '+333.22 coffee') .submitForm('[data-qa=report-form]') .waitForAlert(function (error, text) { t.error(error) t.is(text, 'submitted') this.alertDismiss() }) .end() }) group.test('Update a report', function (t) { var selector = '[data-id=bookkeeping_2014-4]' return client .init() .login() .waitForExist(selector) .click(selector) .waitUntil(function () { return client.getValue('[data-qa=report-text]') .then(function (value) { return value && value.length }) }) .setValue('[data-qa=report-text]', '+444.55 coffee') .submitForm('[data-qa=report-form]') .waitForAlert(function (error, text) { t.error(error) t.is(text, 'submitted') this.alertDismiss() }) .end() }) group.end() })