|
1 | 1 | import { test as base, expect } from "@playwright/test"; |
2 | 2 | import { MypageLoginPage } from "../../pages/mypage/login.page"; |
3 | | -import { EntryPage } from "../../pages/entry/entry.page"; |
4 | | -import { AdminLoginPage } from "../../pages/admin/login.page"; |
5 | 3 | import { Mode, ContextType } from '../../utils/ZapClient'; |
6 | 4 | import PlaywrightConfig from '../../../playwright.config'; |
7 | | -import { ECCUBE_ADMIN_USER, ECCUBE_ADMIN_PASS, ADMIN_DIR } from "../../config/default.config"; |
8 | | -import { faker } from '@faker-js/faker/locale/ja'; |
9 | | -import { FakerUtils } from "../../utils/FakerUtils"; |
| 5 | +import { ECCUBE_DEFAULT_USER, ECCUBE_DEFAULT_PASS } from "../../config/default.config"; |
10 | 6 |
|
11 | 7 | type MypageLoginFixtures = { |
12 | 8 | mypageLoginPage: MypageLoginPage; |
13 | 9 | }; |
14 | 10 |
|
15 | 11 | export const test = base.extend<MypageLoginFixtures>({ |
16 | 12 | mypageLoginPage: async ({ page }, use) => { |
17 | | - const email = FakerUtils.createEmail(); |
18 | | - const password = FakerUtils.createPassword(); |
| 13 | + // 既存のzap_user@example.comユーザーを使用 |
| 14 | + const email = ECCUBE_DEFAULT_USER; |
| 15 | + const password = ECCUBE_DEFAULT_PASS; |
19 | 16 | const loginPage = new MypageLoginPage(page, email, password); |
20 | 17 | if (PlaywrightConfig.use?.proxy === undefined) { |
21 | | - const entryPage = new EntryPage(page, email, password); |
22 | | - await entryPage.goto(); |
23 | | - await entryPage.agree(); |
24 | | - await entryPage.fill(); |
25 | | - await entryPage.confirm(); |
26 | | - await entryPage.register(); |
| 18 | + // マイページログインページに移動してログイン |
27 | 19 | await loginPage.goto(); |
28 | | - await loginPage.logout(); |
29 | | - |
30 | | - // 購入フローのテストでポイント利用するため、ポイントを加算する |
31 | | - const adminLoginPage = new AdminLoginPage(page); |
32 | | - await page.goto(`/${ADMIN_DIR}`); |
33 | | - await adminLoginPage.login(ECCUBE_ADMIN_USER, ECCUBE_ADMIN_PASS); |
34 | | - await page.goto(`/${ADMIN_DIR}/customer/index.php`); |
35 | | - await page.locator('input[name=search_email]').fill(email); |
36 | | - await page.getByRole('link', { name: 'この条件で検索する' }).click(); |
37 | | - await page.getByRole('link', { name: '編集' }).click(); |
38 | | - await page.getByRole('row', { name: '所持ポイント' }).getByRole('textbox').fill(String(faker.number.int({ min: 0, max: 999999 }))); |
39 | | - await page.getByRole('link', { name: '確認ページへ' }).click(); |
40 | | - await page.getByRole('link', { name: 'この内容で登録する' }).click(); |
41 | | - |
42 | | - await page.goto(`/`); |
43 | 20 | await loginPage.login(); |
44 | 21 | } else { |
45 | 22 | const zapClient = loginPage.getZapClient(); |
|
0 commit comments