public function createExpense(AcceptanceTester $I) { $I->wantTo('Create an expense'); $vendorName = $this->faker->name; $clientEmail = $this->faker->safeEmail; $amount = $this->faker->numberBetween(10, 20); // create vendor $I->amOnPage('/vendors/create'); $I->fillField(['name' => 'name'], $vendorName); $I->click('Save'); $I->see($vendorName); $vendorId = $I->grabFromDatabase('vendors', 'id', ['name' => $vendorName]); // create client $I->amOnPage('/clients/create'); $I->fillField(['name' => 'contacts[0][email]'], $clientEmail); $I->click('Save'); $I->see($clientEmail); // create expense $I->amOnPage('/expenses/create'); $I->fillField(['name' => 'amount'], $amount); $I->selectDropdown($I, $vendorName, '.vendor-select .dropdown-toggle'); $I->selectDropdown($I, $clientEmail, '.client-select .dropdown-toggle'); $I->click('Save'); $I->seeInDatabase('expenses', ['vendor_id' => $vendorId]); // invoice expense $I->executeJS('submitAction(\'invoice\')'); $I->click('Save'); $I->wait(1); $I->see($clientEmail); $I->see($amount); }
public function create(AcceptanceTester $I) { $clientEmail = $this->faker->safeEmail; $productKey = $this->faker->text(10); $amount = rand(1, 10); $I->wantTo('enter a payment'); // create client $I->amOnPage('/clients/create'); $I->fillField(['name' => 'contacts[0][email]'], $clientEmail); $I->click('Save'); $I->see($clientEmail); // create product $I->amOnPage('/products/create'); $I->fillField(['name' => 'product_key'], $productKey); $I->fillField(['name' => 'notes'], $this->faker->text(80)); $I->fillField(['name' => 'cost'], $this->faker->numberBetween(11, 20)); $I->click('Save'); $I->see($productKey); // create invoice $I->amOnPage('/invoices/create'); $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle'); $I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey); $I->click('Save'); $I->see($clientEmail); $I->amOnPage('/payments/create'); $I->selectDropdown($I, $clientEmail, '.client-select .dropdown-toggle'); $I->selectDropdownRow($I, 1, '.invoice-select .combobox-container'); $I->fillField(['name' => 'amount'], $amount); $I->selectDropdown($I, 'Cash', '.payment-type-select .dropdown-toggle'); $I->selectDataPicker($I, '#payment_date', 'now + 1 day'); $I->fillField(['name' => 'transaction_reference'], $this->faker->text(12)); $I->click('Save'); $I->see('Successfully created payment'); $I->seeInDatabase('payments', ['amount' => number_format($amount, 2)]); }
public function taxRates(AcceptanceTester $I) { $I->wantTo('test tax rates'); $clientEmail = $this->faker->safeEmail; $productKey = $this->faker->text(10); $itemTaxRate = $this->faker->randomFloat(2, 5, 15); $itemTaxName = $this->faker->word(); $invoiceTaxRate = $this->faker->randomFloat(2, 5, 15); $invoiceTaxName = $this->faker->word(); $itemCost = $this->faker->numberBetween(1, 20); $total = $itemCost; $total += round($itemCost * $itemTaxRate / 100, 2); $total += round($itemCost * $invoiceTaxRate / 100, 2); // create tax rates $I->amOnPage('/tax_rates/create'); $I->fillField(['name' => 'name'], $itemTaxName); $I->fillField(['name' => 'rate'], $itemTaxRate); $I->click('Save'); $I->see($itemTaxName); $I->amOnPage('/tax_rates/create'); $I->fillField(['name' => 'name'], $invoiceTaxName); $I->fillField(['name' => 'rate'], $invoiceTaxRate); $I->click('Save'); $I->see($invoiceTaxName); // enable line item taxes $I->amOnPage('/settings/tax_rates'); $I->checkOption('#invoice_item_taxes'); $I->click('Save'); // create product $I->amOnPage('/products/create'); $I->fillField(['name' => 'product_key'], $productKey); $I->fillField(['name' => 'notes'], $this->faker->text(80)); $I->fillField(['name' => 'cost'], $itemCost); $I->selectOption('select[name=default_tax_rate_id]', $itemTaxName . ' ' . $itemTaxRate . '%'); $I->click('Save'); $I->wait(1); $I->see($productKey); // create client $I->amOnPage('/clients/create'); $I->fillField(['name' => 'contacts[0][email]'], $clientEmail); $I->click('Save'); $I->see($clientEmail); // create invoice $I->amOnPage('/invoices/create'); $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle'); $I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey); $I->selectOption('#taxRateSelect', $invoiceTaxName . ' ' . $invoiceTaxRate . '%'); $I->wait(2); // check total is right before saving $I->see("\${$total}"); $I->click('Save'); $I->wait(1); $I->see($clientEmail); // check total is right after saving $I->see("\${$total}"); $I->amOnPage('/invoices'); // check total is right in list view $I->see("\${$total}"); }
public function create(AcceptanceTester $I) { $note = $this->faker->catchPhrase; $clientEmail = $this->faker->safeEmail; $I->wantTo('Create a credit'); $I->amOnPage('/clients/create'); $I->fillField(['name' => 'contacts[0][email]'], $clientEmail); $I->click('Save'); $I->see($clientEmail); $I->amOnPage('/credits/create'); $I->selectDropdown($I, $clientEmail, '.client-select .dropdown-toggle'); $I->fillField(['name' => 'amount'], rand(50, 200)); $I->fillField(['name' => 'private_notes'], $note); $I->selectDataPicker($I, '#credit_date', 'now + 1 day'); $I->click('Save'); $I->see('Successfully created credit'); $I->seeInDatabase('credits', array('private_notes' => $note)); $I->amOnPage('/credits'); $I->seeCurrentUrlEquals('/credits'); $I->see($clientEmail); }
public function signUpAndGoPro(AcceptanceTester $I) { $userEmail = $this->faker->safeEmail; $userPassword = $this->faker->password; $I->wantTo('test purchasing a pro plan'); $I->amOnPage('/invoice_now'); $I->click('Sign Up'); $I->wait(1); $I->checkOption('#terms_checkbox'); $I->fillField(['name' => 'new_first_name'], $this->faker->firstName); $I->fillField(['name' => 'new_last_name'], $this->faker->lastName); $I->fillField(['name' => 'new_email'], $userEmail); $I->fillField(['name' => 'new_password'], $userPassword); $I->click('Save'); $I->wait(1); $I->amOnPage('/dashboard'); $I->click('Upgrade'); $I->wait(1); $I->click('#changePlanButton'); $I->wait(1); $I->click('Pay Now'); $I->wait(1); $I->fillField(['name' => 'address1'], $this->faker->streetAddress); $I->fillField(['name' => 'address2'], $this->faker->streetAddress); $I->fillField(['name' => 'city'], $this->faker->city); $I->fillField(['name' => 'state'], $this->faker->state); $I->fillField(['name' => 'postal_code'], $this->faker->postcode); $I->selectDropdown($I, 'United States', '.country-select .dropdown-toggle'); $I->fillField(['name' => 'card_number'], '4242424242424242'); $I->fillField(['name' => 'cvv'], '1234'); $I->selectOption('#expiration_month', 12); $I->selectOption('#expiration_year', date('Y')); $I->click('.btn-success'); $I->wait(1); $I->see('Successfully applied payment'); $I->amOnPage('/dashboard'); $I->dontSee('Go Pro'); }
public function createRecurringInvoice(AcceptanceTester $I) { $clientEmail = $this->faker->safeEmail; $I->wantTo('create a recurring invoice'); $I->amOnPage('/clients/create'); $I->fillField(['name' => 'contacts[0][email]'], $clientEmail); $I->click('Save'); $I->see($clientEmail); $I->amOnPage('/recurring_invoices/create'); $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle'); $I->selectDataPicker($I, '#end_date', '+ 1 week'); $I->fillField('#po_number', rand(100, 200)); $I->fillField('#discount', rand(0, 20)); $this->fillItems($I); $I->executeJS("submitAction('email')"); $I->wait(2); $I->see($clientEmail); $invoiceNumber = $I->grabAttributeFrom('#invoice_number', 'value'); $I->click('Recurring Invoice'); $I->see($clientEmail); $I->click('#lastSent'); $I->see($invoiceNumber); }
public function createQuote(AcceptanceTester $I) { $clientEmail = $this->faker->safeEmail; $productKey = $this->faker->text(10); $I->wantTo('create a quote'); // create client $I->amOnPage('/clients/create'); $I->fillField(['name' => 'contacts[0][email]'], $clientEmail); $I->click('Save'); $I->see($clientEmail); // create product $I->amOnPage('/products/create'); $I->fillField(['name' => 'product_key'], $productKey); $I->fillField(['name' => 'notes'], $this->faker->text(80)); $I->fillField(['name' => 'cost'], $this->faker->numberBetween(1, 20)); $I->click('Save'); $I->wait(1); //$I->see($productKey); // create quote $I->amOnPage('/quotes/create'); $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle'); $I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey); $I->click('table.invoice-table tbody tr:nth-child(1) .tt-selectable'); $I->click('Save'); $I->see($clientEmail); // enter payment $clientId = $I->grabFromDatabase('contacts', 'client_id', ['email' => $clientEmail]); $invoiceId = $I->grabFromDatabase('invoices', 'id', ['client_id' => $clientId]); $invitationKey = $I->grabFromDatabase('invitations', 'invitation_key', ['invoice_id' => $invoiceId]); $clientSession = $I->haveFriend('client'); $clientSession->does(function (AcceptanceTester $I) use($invitationKey) { $I->amOnPage('/view/' . $invitationKey); $I->click('Approve'); $I->see('This quote is approved'); }); }
public function onlinePayment(AcceptanceTester $I) { $I->wantTo('test an online payment'); $clientEmail = $this->faker->safeEmail; $productKey = $this->faker->text(10); // set gateway info $I->wantTo('create a gateway'); $I->amOnPage('/settings/online_payments'); if (strpos($I->grabFromCurrentUrl(), 'create') !== false) { $I->fillField(['name' => '23_apiKey'], env('stripe_secret_key') ?: Fixtures::get('stripe_secret_key')); // Fails to load StripeJS causing "ReferenceError: Can't find variable: Stripe" //$I->fillField(['name' =>'stripe_publishable_key'], env('stripe_secret_key') ?: Fixtures::get('stripe_publishable_key')); $I->selectOption('#token_billing_type_id', 4); $I->click('Save'); $I->see('Successfully created gateway'); } // create client $I->amOnPage('/clients/create'); $I->fillField(['name' => 'contacts[0][email]'], $clientEmail); $I->click('Save'); $I->see($clientEmail); // create product $I->amOnPage('/products/create'); $I->fillField(['name' => 'product_key'], $productKey); $I->fillField(['name' => 'notes'], $this->faker->text(80)); $I->fillField(['name' => 'cost'], $this->faker->numberBetween(1, 20)); $I->click('Save'); $I->wait(1); $I->see($productKey); // create invoice $I->amOnPage('/invoices/create'); $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle'); $I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey); $I->click('table.invoice-table tbody tr:nth-child(1) .tt-selectable'); $I->click('Save'); $I->see($clientEmail); // enter payment $clientId = $I->grabFromDatabase('contacts', 'client_id', ['email' => $clientEmail]); $invoiceId = $I->grabFromDatabase('invoices', 'id', ['client_id' => $clientId]); $invitationKey = $I->grabFromDatabase('invitations', 'invitation_key', ['invoice_id' => $invoiceId]); $clientSession = $I->haveFriend('client'); $clientSession->does(function (AcceptanceTester $I) use($invitationKey) { $I->amOnPage('/view/' . $invitationKey); $I->click('Pay Now'); /* $I->fillField(['name' => 'first_name'], $this->faker->firstName); $I->fillField(['name' => 'last_name'], $this->faker->lastName); $I->fillField(['name' => 'address1'], $this->faker->streetAddress); $I->fillField(['name' => 'address2'], $this->faker->streetAddress); $I->fillField(['name' => 'city'], $this->faker->city); $I->fillField(['name' => 'state'], $this->faker->state); $I->fillField(['name' => 'postal_code'], $this->faker->postcode); $I->selectDropdown($I, 'United States', '.country-select .dropdown-toggle'); */ $I->fillField('#card_number', '4242424242424242'); $I->fillField('#cvv', '1234'); $I->selectOption('#expiration_month', 12); $I->selectOption('#expiration_year', date('Y')); $I->click('.btn-success'); $I->wait(3); $I->see('Successfully applied payment'); }); $I->wait(1); // create recurring invoice and auto-bill $I->amOnPage('/recurring_invoices/create'); $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle'); $I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey); $I->click('table.invoice-table tbody tr:nth-child(1) .tt-selectable'); $I->checkOption('#auto_bill'); $I->executeJS('preparePdfData(\'email\')'); $I->wait(3); $I->see("\$0.00"); }
public function checkBalance(AcceptanceTester $I) { $I->wantTo('ensure the balance is correct'); $clientEmail = $this->faker->safeEmail; $productKey = $this->faker->text(10); $productPrice = $this->faker->numberBetween(1, 20); // create client $I->amOnPage('/clients/create'); $I->fillField(['name' => 'contacts[0][email]'], $clientEmail); $I->click('Save'); $I->wait(1); $I->see($clientEmail); $clientId = $I->grabFromCurrentUrl('~clients/(\\d+)~'); // create product $I->amOnPage('/products/create'); $I->fillField(['name' => 'product_key'], $productKey); $I->fillField(['name' => 'notes'], $this->faker->text(80)); $I->fillField(['name' => 'cost'], $productPrice); $I->click('Save'); $I->wait(1); $I->see($productKey); // create invoice $I->amOnPage('/invoices/create'); $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle'); $I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey); $I->click('Save'); $I->wait(1); $I->see($clientEmail); $invoiceId = $I->grabFromCurrentUrl('~invoices/(\\d+)~'); $I->amOnPage("/clients/{$clientId}"); $I->see('Balance $' . $productPrice); // update the invoice $I->amOnPage('/invoices/' . $invoiceId); $I->fillField(['name' => 'invoice_items[0][qty]'], 2); $I->click('Save'); $I->wait(1); $I->amOnPage("/clients/{$clientId}"); $I->see('Balance $' . $productPrice * 2); // enter payment $I->amOnPage("/payments/create/{$clientId}/{$invoiceId}"); $I->click('Save'); $I->wait(1); $I->see('Balance $0.00'); $I->see('Paid to Date $' . $productPrice * 2); // archive the invoice $I->amOnPage('/invoices/' . $invoiceId); $I->executeJS('submitBulkAction("archive")'); $I->wait(1); $I->amOnPage("/clients/{$clientId}"); $I->see('Balance $0.00'); $I->see('Paid to Date $' . $productPrice * 2); // delete the invoice $I->amOnPage('/invoices/' . $invoiceId); $I->executeJS('submitBulkAction("delete")'); $I->wait(1); $I->amOnPage("/clients/{$clientId}"); $I->see('Balance $0.00'); $I->see('Paid to Date $0.00'); // restore the invoice $I->amOnPage('/invoices/' . $invoiceId); $I->executeJS('submitBulkAction("restore")'); $I->wait(1); $I->amOnPage("/clients/{$clientId}"); $I->see('Balance $0.00'); $I->see('Paid to Date $' . $productPrice * 2); }