Skip to content

Commit

Permalink
商品一覧ページのソート E2Eテスト
Browse files Browse the repository at this point in the history
  • Loading branch information
h.matsuo committed Feb 8, 2022
1 parent 1256f5b commit e899bbb
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
14 changes: 14 additions & 0 deletions codeception/_support/Page/Admin/ProductManagePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,18 @@ public function 一括削除完了()

return $this;
}

public function assertSortedList($index, $order)
{
$values = $this->tester->grabMultiple('.c-contentsArea__primaryCol tr > td:nth-child('.$index.')');

$expect = $values;
if ($order === 'asc') {
sort($expect);
} else {
rsort($expect);
}

$this->tester->assertEquals($expect, $values);
}
}
26 changes: 26 additions & 0 deletions codeception/acceptance/EA03ProductCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,32 @@ public function product_CSV出力項目設定(AcceptanceTester $I)
$I->assertNotContains('フリーエリア', $csvHeader);
}

public function product_一覧でのソート(AcceptanceTester $I)
{
$I->wantTo('EA0301-UC03-T01 一覧でのソート');
$page = ProductManagePage::go($I);

// 商品一覧・ID横の上矢印をクリック
$I->click('[data-sortkey="product_id"]');
$I->seeElement('.listSort-current[data-sortkey="product_id"] .fa-arrow-up');
$page->assertSortedList(2, 'asc');

// ID横の下矢印をクリック
$I->click('[data-sortkey="product_id"]');
$I->seeElement('.listSort-current[data-sortkey="product_id"] .fa-arrow-down');
$page->assertSortedList(2, 'desc');

// 更新日横の上矢印をクリック
$I->click('[data-sortkey="update_date"]');
$I->seeElement('.listSort-current[data-sortkey="update_date"] .fa-arrow-up');
$page->assertSortedList(10, 'asc');

// 更新日横の下矢印をクリック
$I->click('[data-sortkey="update_date"]');
$I->seeElement('.listSort-current[data-sortkey="update_date"] .fa-arrow-down');
$page->assertSortedList(10, 'desc');
}

public function product_一覧からの規格編集規格なし失敗(AcceptanceTester $I)
{
$I->wantTo('EA0310-UC01-T02 一覧からの規格編集 規格なし 失敗');
Expand Down

0 comments on commit e899bbb

Please sign in to comment.