Skip to content

Commit

Permalink
お届け先追加のテスト追加
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Jul 24, 2018
1 parent 2061933 commit ec118e7
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 40 deletions.
75 changes: 49 additions & 26 deletions codeception/_support/Page/Admin/ShippingEditPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,77 +46,77 @@ public function お届け先編集()
return $this;
}

public function 入力_姓($value)
public function 入力_姓($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_name_name01'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_name_name01'], $value);
return $this;
}

public function 入力_名($value)
public function 入力_名($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_name_name02'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_name_name02'], $value);
return $this;
}

public function 入力_セイ($value)
public function 入力_セイ($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_kana_kana01'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_kana_kana01'], $value);
return $this;
}

public function 入力_メイ($value)
public function 入力_メイ($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_kana_kana02'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_kana_kana02'], $value);
return $this;
}

public function 入力_郵便番号($value)
public function 入力_郵便番号($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_postal_code'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_postal_code'], $value);

return $this;
}

public function 入力_都道府県($value)
public function 入力_都道府県($value, $num = 0)
{
$this->tester->selectOption(['id' => 'form_shippings_0_address_pref'], $value);
$this->tester->selectOption(['id' => 'form_shippings_'.$num.'_address_pref'], $value);
return $this;
}

public function 入力_市区町村名($value)
public function 入力_市区町村名($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_address_addr01'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_address_addr01'], $value);
return $this;
}

public function 入力_番地_ビル名($value)
public function 入力_番地_ビル名($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_address_addr02'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_address_addr02'], $value);
return $this;
}

public function 入力_電話番号($value)
public function 入力_電話番号($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_phone_number'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_phone_number'], $value);

return $this;
}

public function 入力_出荷伝票番号($value)
public function 入力_出荷伝票番号($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_tracking_number'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_tracking_number'], $value);
return $this;
}

public function 入力_配送業者($value)
public function 入力_配送業者($value, $num = 0)
{
$this->tester->selectOption(['id' => 'form_shippings_0_Delivery'], $value);
$this->tester->selectOption(['id' => 'form_shippings_'.$num.'_Delivery'], $value);
return $this;
}

public function 入力_配達用メモ($value)
public function 入力_配達用メモ($value, $num = 0)
{
$this->tester->fillField(['id' => 'form_shippings_0_note'], $value);
$this->tester->fillField(['id' => 'form_shippings_'.$num.'_note'], $value);
return $this;
}

Expand All @@ -142,10 +142,33 @@ public function 出荷情報登録()
return $this;
}

public function 出荷完了にする($num = 0)
{
$this->tester->scrollTo(['id' => 'shipmentOverview_'.$num], 0, 50);
$this->tester->click('#shipmentOverview_'.$num.' > div > div:nth-child(4) > div:nth-child(2) > div:nth-child(3) > div > button');
return $this;
}

public function 変更を確定()
{
$this->tester->waitForElementVisible(['xpath' => '//*[@id="shippedNotifyModal"]/div/div/div[3]/button[2]']);
$this->tester->click(['xpath' => '//*[@id="shippedNotifyModal"]/div/div/div[3]/button[2]']);
$this->tester->waitForElementVisible(['id' => 'bulkChange']);
$this->tester->click(['id' => 'bulkChange']);
$this->tester->waitForElementVisible(['id' => 'bulkChangeComplete']);
$this->tester->click(['id' => 'bulkChangeComplete']);
return $this;
}

public function 出荷先を追加()
{
$this->tester->scrollTo(['id' => 'addShipping'], 0, 50);
$this->tester->click(['id' => 'addShipping']);
return $this;
}

public function 出荷日を確認($num = 0)
{
$this->tester->scrollTo(['id' => 'shipmentOverview_'.$num], 0, 50);
$this->tester->see((new \DateTime())->format('Y/m/d'),
'#shipmentOverview_'.$num.' > div > div:nth-child(4) > div:nth-child(2) > div:nth-child(3) > div > span');
}
}
82 changes: 68 additions & 14 deletions codeception/acceptance/EA09ShippingCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ public function shipping出荷編集(\AcceptanceTester $I)
{
$I->wantTo('EA0901-UC03-T01(& UC03-T02) 出荷編集');

// $I->getScenario()->skip('お届け日を編集時にJSが走らない問題がありskip');

$I->resetEmails();

// 新規受付ステータスの受注を作る
// 対応中ステータスの受注を作る
$createCustomer = Fixtures::get('createCustomer');
$createOrders = Fixtures::get('createOrders');
$newOrders = $createOrders($createCustomer(), 1, array());
$newOrders = $createOrders($createCustomer(), 1, array(), OrderStatus::IN_PROGRESS);

$OrderListPage = OrderManagePage::go($I)->検索($newOrders[0]->getOrderNo());

Expand All @@ -57,7 +55,6 @@ public function shipping出荷編集(\AcceptanceTester $I)
$Shippings = $TargetShippings();

$ShippingRegisterPage = ShippingEditPage::at($I)
// ->お届け先編集()
->入力_姓('')
->出荷情報登録();

Expand All @@ -81,18 +78,75 @@ public function shipping出荷編集(\AcceptanceTester $I)

$I->see('出荷情報を登録しました。', ShippingEditPage::$登録完了メッセージ);

/* 出荷済みに変更 */
// $ShippingRegisterPage
// // ->入力_出荷日('2018-09-04')
// ->出荷情報登録()
// ->変更を確定();
// $I->wait(1);
// $I->see('出荷情報を登録しました。', ShippingEditPage::$登録完了メッセージ);
$I->wait(10);

// $I->wait(3);
// $I->seeEmailCount(2);
// 出荷済みに変更
$ShippingRegisterPage
->出荷完了にする()
->変更を確定()
->出荷日を確認();
}

public function shippingお届け先追加(\AcceptanceTester $I)
{
$I->wantTo('EA0901-UC03-T03 お届け先追加');

$I->resetEmails();

// 対応中ステータスの受注を作る
$createCustomer = Fixtures::get('createCustomer');
$createOrders = Fixtures::get('createOrders');
$newOrders = $createOrders($createCustomer(), 1, array(), OrderStatus::IN_PROGRESS);

$OrderListPage = OrderManagePage::go($I)->検索($newOrders[0]->getOrderNo());

$I->see('検索結果:1件が該当しました', OrderManagePage::$検索結果_メッセージ);

/* 編集 */
$OrderListPage->一覧_編集(1);

$OrderRegisterPage = OrderEditPage::at($I)
->お届け先の追加();


$TargetShippings = Fixtures::get('findShippings'); // Closure
$Shippings = $TargetShippings();

$ShippingRegisterPage = ShippingEditPage::at($I);
$ShippingRegisterPage
->出荷先を追加();

/* 正常系 */
$ShippingRegisterPage
// ->お届け先編集()
->入力_姓('aaa', 1)
->入力_名('bbb', 1)
->入力_セイ('アアア', 1)
->入力_メイ('アアア', 1)
->入力_郵便番号('060-0000', 1)
->入力_都道府県(['1' => '北海道'], 1)
->入力_市区町村名('bbb', 1)
->入力_番地_ビル名('bbb', 1)
->入力_電話番号('111-111-111', 1)
->入力_番地_ビル名('address 2', 1)
->出荷情報登録();

$I->see('出荷情報を登録しました。', ShippingEditPage::$登録完了メッセージ);

$I->wait(10);
// 出荷済みに変更
$ShippingRegisterPage
->出荷完了にする()
->変更を確定()
->出荷日を確認();

// 出荷済みに変更
$ShippingRegisterPage
->出荷完了にする(1)
->変更を確定(1);
// TODO ステータス変更スキップしました

}

public function shipping_出荷CSV登録(\AcceptanceTester $I)
{
Expand Down

0 comments on commit ec118e7

Please sign in to comment.