I have method which I use for testing in my web app. When I call it once everything works just fine. but if call it several times it not fulfills data.
method:
function createEmailAlert(alertName) {
casper.waitForSelector('a[data-id="create-alert-button"]',
function success() {
casper.click('a[data-id="create-alert-button"]');
});
casper.wait(2000, function () {
casper.click('div[data-id="field-alert-meta"] input[role="combobox"]');
casper.then(function () {
casper.clickLabel('Email', 'li');
});
});
casper.then(function () {
casper.sendKeys('div[data-id="field-alert-name"] input[type="text"]', alertName, {
reset: true
});
casper.sendKeys('div[data-id="field-parameter-to"] input[role="textbox"]', 'autotest@asset-control.com');
casper.sendKeys('div[data-id="field-parameter-cc"] input[role="textbox"]', 'autotest.cc@asset-control.com');
casper.sendKeys('div[data-id="field-parameter-bcc"] input[role="textbox"]', 'autotest.bcc@asset-control.com');
casper.sendKeys('div[data-id="field-parameter-subject"] input[role="textbox"]', 'Email Alert Text');
casper.sendKeys('div[data-id="field-parameter-text"] textarea[role="textbox"]', 'Email alert comments....');
});
};
call:
casper.test.begin('Test double click activity assigned alert', function suite(test) {
createEmailAlert('BLUE ALERT');
casper.run(function () {
test.done();
});
works well, but if write:
casper.test.begin('Test double click activity assigned alert', function suite(test) {
createEmailAlert('BLUE ALERT1');
createEmailAlert('BLUE ALERT2');
casper.run(function () {
test.done();
});
creates two objects, but data is filled randomly, and not all. Why?
Aucun commentaire:
Enregistrer un commentaire