Completed
Push — 4.0 ( 51ae79...7b064c )
by Kiyotaka
01:07 queued 19s
created

ProductCsvUploadPage::CSVアップロード実行()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.ec-cube.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Page\Admin;
15
16
class ProductCsvUploadPage extends AbstractAdminPageStyleGuide
17
{
18
    public static $完了メッセージ = '#importCsvModal > div > div > div.modal-body.text-left > p';
19
20
    /**
21
     * ProductCsvUploadPage constructor.
22
     */
23
    public function __construct(\AcceptanceTester $I)
24
    {
25
        parent::__construct($I);
26
    }
27
28
    public static function go($I)
29
    {
30
        $page = new ProductCsvUploadPage($I);
31
32
        return $page->goPage('/product/product_csv_upload', '商品CSV登録商品管理');
33
    }
34
35
    public static function at($I)
36
    {
37
        $page = new self($I);
38
39
        return $page->atPage('商品CSV登録商品管理');
40
    }
41
42
    public function 入力_CSVファイル($fileName)
43
    {
44
        $this->tester->attachFile(['id' => 'admin_csv_import_import_file'], $fileName);
45
46
        return $this;
47
    }
48
49
    public function CSVアップロード()
50
    {
51
        $this->tester->click(['id' => 'upload-button']);
52
53
        return $this;
54
    }
55
56
    public function アップロードボタン有効化()
57
    {
58
        // $this->tester->attachFileでイベントが効かずボタンが有効化されないので、テストコードで有効化する.
59
        $this->tester->waitForJS('return $("#upload-button").prop("disabled", false);', 1);
60
61
        return $this;
62
    }
63
64
    public function モーダルを表示()
65
    {
66
        $this->tester->click(['id' => 'upload-button']);
67
68
        return $this;
69
    }
70
71
    public function CSVアップロード実行()
72
    {
73
        $this->tester->wait(1);
74
        $this->tester->click(['id' => 'importCsv']);
75
76
        return $this;
77
    }
78
79
    public function CSVアップロード確認()
80
    {
81
        $this->tester->wait(1);
82
        $this->tester->see('CSVファイルをアップロードしました', ProductCsvUploadPage::$完了メッセージ);
83
84
        return $this;
85
    }
86
87
    public function モーダルを閉じる()
88
    {
89
        $this->tester->click(['id' => 'importCsvDone']);
90
91
        return $this;
92
    }
93
94
    public function 雛形ダウンロード()
95
    {
96
        $this->tester->click('#download-button');
97
98
        return $this;
99
    }
100
}
101