1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 07:33:04 +01:00
invoiceninja/tests/functional/SettingsCest.php

236 lines
6.7 KiB
PHP
Raw Normal View History

2015-08-30 14:08:15 +02:00
<?php
use \FunctionalTester;
use Faker\Factory;
class SettingsCest
{
private $faker;
public function _before(FunctionalTester $I)
{
$I->checkIfLogin($I);
$this->faker = Factory::create();
}
2015-10-14 16:15:39 +02:00
/*
2015-08-30 14:08:15 +02:00
public function companyDetails(FunctionalTester $I)
{
$I->wantTo('update the company details');
2015-10-14 16:15:39 +02:00
$I->amOnPage('/settings/company_details');
2015-08-30 14:08:15 +02:00
$name = $this->faker->company;
$I->fillField(['name' => 'name'], $name);
$I->fillField(['name' => 'work_email'], $this->faker->safeEmail);
$I->fillField(['name' => 'work_phone'], $this->faker->phoneNumber);
$I->fillField(['name' => 'address1'], $this->faker->buildingNumber . ' ' . $this->faker->streetName);
$I->fillField(['name' => 'address2'], $this->faker->secondaryAddress);
$I->fillField(['name' => 'city'], $this->faker->city);
$I->fillField(['name' => 'state'], $this->faker->state);
$I->fillField(['name' => 'postal_code'], $this->faker->postcode);
2015-10-14 16:15:39 +02:00
$I->click('Save');
2015-08-30 14:08:15 +02:00
2015-10-14 16:15:39 +02:00
$I->seeResponseCodeIs(200);
$I->seeRecord('accounts', array('name' => $name));
}
*/
2016-09-11 19:05:59 +02:00
2015-10-14 16:15:39 +02:00
public function userDetails(FunctionalTester $I)
{
$I->wantTo('update the user details');
$I->amOnPage('/settings/user_details');
$firstName = $this->faker->firstName;
$I->fillField(['name' => 'first_name'], $firstName);
2015-08-30 14:08:15 +02:00
$I->fillField(['name' => 'last_name'], $this->faker->lastName);
$I->fillField(['name' => 'phone'], $this->faker->phoneNumber);
$I->click('Save');
2015-10-14 16:15:39 +02:00
$I->seeResponseCodeIs(200);
$I->seeRecord('users', array('first_name' => $firstName));
}
/*
public function localization(FunctionalTester $I)
{
$I->wantTo('update the localization');
$I->amOnPage('/settings/localization');
$name = $this->faker->company;
$I->fillField(['name' => 'name'], $name);
$I->click('Save');
2015-08-30 14:08:15 +02:00
$I->seeResponseCodeIs(200);
$I->seeRecord('accounts', array('name' => $name));
}
2015-10-14 16:15:39 +02:00
*/
2015-08-30 14:08:15 +02:00
public function productSettings(FunctionalTester $I)
{
$I->wantTo('update the product settings');
2015-10-14 16:15:39 +02:00
$I->amOnPage('/settings/products');
2015-08-30 14:08:15 +02:00
$I->click('Save');
$I->seeResponseCodeIs(200);
}
public function createProduct(FunctionalTester $I)
{
$I->wantTo('create a product');
$I->amOnPage('/products/create');
$productKey = $this->faker->text(10);
$I->fillField(['name' => 'product_key'], $productKey);
$I->fillField(['name' => 'notes'], $this->faker->text(80));
2015-09-01 20:40:30 +02:00
$I->fillField(['name' => 'cost'], $this->faker->numberBetween(1, 20));
2015-08-30 14:08:15 +02:00
$I->click('Save');
$I->seeResponseCodeIs(200);
$I->seeRecord('products', array('product_key' => $productKey));
}
2016-09-11 19:05:59 +02:00
public function updateProduct(FunctionalTester $I)
2015-08-30 14:08:15 +02:00
{
return;
$I->wantTo('update a product');
$I->amOnPage('/products/1/edit');
$productKey = $this->faker->text(10);
$I->fillField(['name' => 'product_key'], $productKey);
$I->click('Save');
$I->seeResponseCodeIs(200);
$I->seeRecord('products', array('product_key' => $productKey));
}
2015-11-01 19:21:11 +01:00
/*
2015-08-30 14:08:15 +02:00
public function updateNotifications(FunctionalTester $I)
{
$I->wantTo('update notification settings');
2015-10-14 16:15:39 +02:00
$I->amOnPage('/settings/notifications');
2015-08-30 14:08:15 +02:00
$terms = $this->faker->text(80);
$I->fillField(['name' => 'invoice_terms'], $terms);
$I->fillField(['name' => 'invoice_footer'], $this->faker->text(60));
$I->click('Save');
$I->seeResponseCodeIs(200);
$I->seeRecord('accounts', array('invoice_terms' => $terms));
}
2015-11-01 19:21:11 +01:00
*/
2016-09-11 19:05:59 +02:00
2015-08-30 14:08:15 +02:00
public function updateInvoiceSettings(FunctionalTester $I)
{
$I->wantTo('update invoice settings');
2015-10-14 16:15:39 +02:00
$I->amOnPage('/settings/invoice_settings');
2015-08-30 14:08:15 +02:00
$label = $this->faker->text(10);
$I->fillField(['name' => 'custom_client_label1'], $label);
$I->click('Save');
$I->seeResponseCodeIs(200);
$I->seeRecord('accounts', array('custom_client_label1' => $label));
2015-10-13 09:11:44 +02:00
//$I->amOnPage('/clients/create');
//$I->see($label);
2015-08-30 14:08:15 +02:00
}
public function updateEmailTemplates(FunctionalTester $I)
{
$I->wantTo('update email templates');
2015-10-14 16:15:39 +02:00
$I->amOnPage('/settings/templates_and_reminders');
2015-08-30 14:08:15 +02:00
$string = $this->faker->text(100);
2015-09-17 21:01:06 +02:00
$I->fillField(['name' => 'email_template_invoice'], $string);
2015-08-30 14:08:15 +02:00
$I->click('Save');
$I->seeResponseCodeIs(200);
2015-09-17 21:01:06 +02:00
$I->seeRecord('accounts', array('email_template_invoice' => $string));
2015-08-30 14:08:15 +02:00
}
public function runReport(FunctionalTester $I)
{
$I->wantTo('run the report');
2016-09-11 19:05:59 +02:00
$I->amOnPage('/settings/reports');
2015-08-30 14:08:15 +02:00
$I->click('Run');
$I->seeResponseCodeIs(200);
}
2016-09-11 19:05:59 +02:00
2015-09-01 20:40:30 +02:00
public function createUser(FunctionalTester $I)
{
$I->wantTo('create a user');
$I->amOnPage('/users/create');
$email = $this->faker->safeEmail;
$I->fillField(['name' => 'first_name'], $this->faker->firstName);
$I->fillField(['name' => 'last_name'], $this->faker->lastName);
$I->fillField(['name' => 'email'], $email);
$I->click('Send invitation');
$I->seeResponseCodeIs(200);
$I->seeRecord('users', array('email' => $email));
}
public function createToken(FunctionalTester $I)
{
$I->wantTo('create a token');
$I->amOnPage('/tokens/create');
$name = $this->faker->firstName;
$I->fillField(['name' => 'name'], $name);
$I->click('Save');
$I->seeResponseCodeIs(200);
$I->seeRecord('account_tokens', array('name' => $name));
}
2015-10-13 09:11:44 +02:00
/*
public function onlinePayments(FunctionalTester $I)
{
$gateway = $I->grabRecord('account_gateways', array('gateway_id' => 23));
if (!$gateway) {
$apiKey = $this->faker->swiftBicNumber;
$I->wantTo('create a gateway');
$I->amOnPage('/gateways/create');
$I->seeCurrentUrlEquals('/gateways/create');
$I->fillField(['name' => '23_apiKey'], $apiKey);
$I->click('Save');
2016-09-11 19:05:59 +02:00
2015-10-13 09:11:44 +02:00
$I->seeResponseCodeIs(200);
$I->see('Successfully created gateway');
$I->seeRecord('account_gateways', array('gateway_id' => 23));
} else {
2015-11-01 19:21:11 +01:00
$config = $gateway->getConfig();
2015-10-13 09:11:44 +02:00
$apiKey = $config->apiKey;
}
// $I->amOnPage('/gateways/1/edit');
// $I->click('Save');
2016-09-11 19:05:59 +02:00
2015-10-13 09:11:44 +02:00
// $I->seeResponseCodeIs(200);
// $I->see('Successfully updated gateway');
// $I->seeRecord('account_gateways', array('config' => '{"apiKey":"ASHHOWAH"}'));
}
*/
2016-09-11 19:05:59 +02:00
2015-09-01 20:40:30 +02:00
2015-08-30 14:08:15 +02:00
}