Test all invoice designs

This commit is contained in:
Hillel Coren 2017-08-10 19:05:21 +03:00
parent 49da93f318
commit 24997c9382
3 changed files with 30 additions and 11 deletions

View File

@ -166,7 +166,7 @@ class CheckData extends Command
//$this->logMessage('Result: ' . $result); //$this->logMessage('Result: ' . $result);
if ($result && $result != $invoice->balance) { if ($result && $result != $invoice->balance) {
$this->logMessage("PHP/JS amounts do not match {$link} - PHP: {$invoice->balance}, JS: {$result}"); $this->logMessage("PHP/JS amounts do not match {$link}?silent=true | PHP: {$invoice->balance}, JS: {$result}");
$this->isValid = $isValid = false; $this->isValid = $isValid = false;
} }
} }

View File

@ -110,16 +110,25 @@
try { try {
return getPDFString(refreshPDFCB, force); return getPDFString(refreshPDFCB, force);
} catch (exception) { } catch (exception) {
console.warn('Failed to generate PDF: %s', exception.message); @if (Utils::isTravis())
var href = location.href; var message = exception.message || '';
if (href.indexOf('/view/') > 0 && href.indexOf('phantomjs') == -1) { if (message.indexOf('Attempting to change value of a readonly property') >= 0) {
var url = href.replace('/view/', '/download/') + '?base64=true'; // do nothing
$.get(url, function(result) { } else {
if (result && result.indexOf('data:application/pdf') == 0) { throw exception;
refreshPDFCB(result); }
} @else
}) console.warn('Failed to generate PDF: %s', exception.message);
} var href = location.href;
if (href.indexOf('/view/') > 0 && href.indexOf('phantomjs') == -1) {
var url = href.replace('/view/', '/download/') + '?base64=true';
$.get(url, function(result) {
if (result && result.indexOf('data:application/pdf') == 0) {
refreshPDFCB(result);
}
})
}
@endif
} }
} }

View File

@ -54,10 +54,20 @@ class InvoiceCest
$I->see($invoiceNumber); $I->see($invoiceNumber);
$I->see('199.01'); $I->see('199.01');
for ($i=1; $i<=10; $i++) {
$this->updateDesign($I, $i);
}
$I->amOnPage("/clients/{$clientId}#invoices"); $I->amOnPage("/clients/{$clientId}#invoices");
$I->see('199.01'); $I->see('199.01');
} }
private function updateDesign($I, $designId)
{
$I->selectOption('#invoice_design_id', $designId);
$I->click('#saveButton');
}
/* /*
public function editInvoice(AcceptanceTester $I) public function editInvoice(AcceptanceTester $I)
{ {