Skip to content

Commit

Permalink
Apply yarn lint:typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Apr 18, 2024
1 parent e79ca01 commit 0f6656d
Show file tree
Hide file tree
Showing 31 changed files with 195 additions and 174 deletions.
6 changes: 3 additions & 3 deletions e2e-tests/fixtures/admin_login.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const test = base.extend<LoginFixtures>({
loginPage: async ({ page }, use) => {
const loginPage = new AdminLoginPage(page);
if (PlaywrightConfig.use?.proxy === undefined) {
await page.goto(`/${ADMIN_DIR}`);
await page.goto(`/${ ADMIN_DIR }`);
await loginPage.login(ECCUBE_ADMIN_USER, ECCUBE_ADMIN_PASS);
} else {
const zapClient = loginPage.getZapClient();
Expand All @@ -24,10 +24,10 @@ export const test = base.extend<LoginFixtures>({
await zapClient.setForcedUserModeEnabled();
expect(await zapClient.isForcedUserModeEnabled()).toBeTruthy();
}
await page.goto(`/${ADMIN_DIR}home.php`);
await page.goto(`/${ ADMIN_DIR }home.php`);
}
await use(loginPage);
},
}
});

export { expect } from "@playwright/test";
2 changes: 1 addition & 1 deletion e2e-tests/fixtures/mypage_login.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const test = base.extend({
await page.goto(`/mypage/index.php`);
}
use(page);
},
}
});

export { expect } from "@playwright/test";
6 changes: 3 additions & 3 deletions e2e-tests/pages/admin/login.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export class AdminLoginPage {

constructor(page: Page) {
this.page = page;
this.url = `/${ADMIN_DIR}index.php`;
this.url = `/${ ADMIN_DIR }index.php`;

this.loginId = page.locator('input[name=login_id]');
this.password = page.locator('input[name=password]');
this.loginButton = page.getByRole('link', { name: 'LOGIN' })
this.loginButton = page.getByRole('link', { name: 'LOGIN' });
this.zapClient = new ZapClient();
}

Expand All @@ -32,7 +32,7 @@ export class AdminLoginPage {
}

async logout() {
await this.page.goto(`/${ADMIN_DIR}/logout.php`);
await this.page.goto(`/${ ADMIN_DIR }/logout.php`);
}

getZapClient() {
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/pages/cart.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class CartPage {

constructor(page: Page) {
this.page = page;
this.url = `${PlaywrightConfig.use?.baseURL ?? ""}/cart/index.php`;
this.url = `${ PlaywrightConfig.use?.baseURL ?? "" }/cart/index.php`;
this.nextButton = page.locator('input[name=confirm][alt=購入手続きへ]');
this.zapClient = new ZapClient();
}
Expand All @@ -25,15 +25,15 @@ export class CartPage {
}

getAdditionButton(row?: number) {
return this.page.locator(`table[summary=商品情報] >> tr >> nth=${row ?? 1} >> td >> nth=4 >> [alt="+"]`);
return this.page.locator(`table[summary=商品情報] >> tr >> nth=${ row ?? 1 } >> td >> nth=4 >> [alt="+"]`);
}

getSubtructionButton(row?: number) {
return this.page.locator(`table[summary=商品情報] >> tr >> nth=${row ?? 1} >> td >> nth=4 >> [alt="-"]`);
return this.page.locator(`table[summary=商品情報] >> tr >> nth=${ row ?? 1 } >> td >> nth=4 >> [alt="-"]`);
}

getQuantity(row?: number) {
return this.page.locator(`table[summary=商品情報] >> tr >> nth=${row ?? 1} >> td >> nth=4`);
return this.page.locator(`table[summary=商品情報] >> tr >> nth=${ row ?? 1 } >> td >> nth=4`);
}

async addition(row?: number) {
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/pages/contact.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ContactPage {
// 'name01', 'name02', 'kana01', 'kana02', 'zip01', 'zip02', 'addr01', 'addr02', 'tel01', 'tel02', 'tel03'
constructor(page: Page) {
this.page = page;
this.url = `${PlaywrightConfig.use?.baseURL ?? ""}/contact/index.php`;
this.url = `${ PlaywrightConfig.use?.baseURL ?? "" }/contact/index.php`;
this.confirmButton = page.locator('input[name=confirm][alt=確認ページへ]');
this.submitButton = page.locator('input[name=send][alt=送信]');
this.name01 = page.locator('input[name=name01]');
Expand Down Expand Up @@ -81,7 +81,7 @@ export class ContactPage {
this.tel02,
this.tel03,
this.email,
this.emailConfirm,
this.emailConfirm
];
}
getZapClient() {
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/pages/mypage/login.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class MypageLoginPage {
this.url = '/mypage/login.php';

this.loginEmail = page.getByRole('textbox', { name: 'メールアドレスを入力して下さい' });
this.loginPass = page.getByRole('textbox', { name: 'パスワードを入力して下さい' })
this.loginPass = page.getByRole('textbox', { name: 'パスワードを入力して下さい' });
this.loginButton = page.locator('id=header_login_form').getByRole('button');
this.logoutButton = page.getByRole('button', { name: 'ログアウト' }).first();
this.zapClient = new ZapClient();
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/pages/products/detail.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class ProductsDetailPage {
}

async goto(productId: number) {
await this.page.goto(`${PlaywrightConfig.use.baseURL}/products/detail.php?product_id=${productId}`);
await this.page.goto(`${ PlaywrightConfig.use.baseURL }/products/detail.php?product_id=${ productId }`);
}

async cartIn(quantity?: number, classCategory1?: string, classCategory2?: string) {
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/pages/shopping/deliv.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class ShoppingDelivPage {
}

async goto() {
await this.page.goto(`${PlaywrightConfig.use.baseURL}/shopping/deliv.php`);
await this.page.goto(`${ PlaywrightConfig.use.baseURL }/shopping/deliv.php`);
}

async gotoNext() {
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/pages/shopping/payment.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export class ShoppingPaymentPage {
}

async goto() {
await this.page.goto(`${PlaywrightConfig.use?.baseURL}/shopping/payment.php`);
await this.page.goto(`${ PlaywrightConfig.use?.baseURL }/shopping/payment.php`);
}

async gotoNext() {
await this.nextButton.click();
}

async selectPaymentMethod(label: string) {
await this.paymentMethod.locator(`text=${label}`).click();
await this.paymentMethod.locator(`text=${ label }`).click();
}

async selectDeliveryDate(index: number) {
Expand Down
18 changes: 9 additions & 9 deletions e2e-tests/test/admin/contents/recommendsearch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '../../../fixtures/admin_login.fixture';
import { Page } from '@playwright/test';
import { ADMIN_DIR } from '../../../config/default.config';

const url = `/${ADMIN_DIR}contents/recommend.php`;
const url = `/${ ADMIN_DIR }contents/recommend.php`;

test.describe('おすすめ商品管理を確認します', () => {
let page: Page;
Expand All @@ -20,7 +20,7 @@ test.describe('おすすめ商品管理を確認します', () => {
page.on('dialog', dialog => dialog.accept());
[ popup ] = await Promise.all([
page.waitForEvent('popup'),
page.click(`.recommend-product >> nth=${nth} >> a >> text=編集`)
page.click(`.recommend-product >> nth=${ nth } >> a >> text=編集`)
]);
});

Expand All @@ -29,7 +29,7 @@ test.describe('おすすめ商品管理を確認します', () => {
page.on('dialog', dialog => dialog.accept());
[ popup ] = await Promise.all([
page.waitForEvent('popup'),
page.click(`.recommend-product >> nth=${nth} >> a >> text=編集`)
page.click(`.recommend-product >> nth=${ nth } >> a >> text=編集`)
]);
await popup.waitForLoadState('load');
await expect(popup.locator('#popup-container')).toContainText('カテゴリ');
Expand All @@ -38,8 +38,8 @@ test.describe('おすすめ商品管理を確認します', () => {
await expect(popup.locator('#recommend-search-results >> tr >> nth=1')).toContainText('アイスクリーム');

await popup.click('#recommend-search-results >> tr >> nth=1 >> text=決定');
await expect(page.locator(`.recommend-product >> nth=${nth}`)).toContainText('アイスクリーム');
await page.click(`.recommend-product >> nth=${nth} >> text=この内容で登録する`);
await expect(page.locator(`.recommend-product >> nth=${ nth }`)).toContainText('アイスクリーム');
await page.click(`.recommend-product >> nth=${ nth } >> text=この内容で登録する`);
});
});

Expand All @@ -51,7 +51,7 @@ test.describe('おすすめ商品管理を確認します', () => {
page.on('dialog', dialog => dialog.accept());
[ popup ] = await Promise.all([
page.waitForEvent('popup'),
page.click(`.recommend-product >> nth=${nth} >> a >> text=編集`)
page.click(`.recommend-product >> nth=${ nth } >> a >> text=編集`)
]);
});

Expand All @@ -60,7 +60,7 @@ test.describe('おすすめ商品管理を確認します', () => {
page.on('dialog', dialog => dialog.accept());
[ popup ] = await Promise.all([
page.waitForEvent('popup'),
page.click(`.recommend-product >> nth=${nth} >> a >> text=編集`)
page.click(`.recommend-product >> nth=${ nth } >> a >> text=編集`)
]);
await popup.waitForLoadState('load');
await expect(popup.locator('#popup-container')).toContainText('商品コード');
Expand All @@ -69,8 +69,8 @@ test.describe('おすすめ商品管理を確認します', () => {
await expect(popup.locator('#recommend-search-results >> tr >> nth=1')).toContainText('おなべレシピ');

await popup.click('#recommend-search-results >> tr >> nth=1 >> text=決定');
await expect(page.locator(`.recommend-product >> nth=${nth}`)).toContainText('おなべレシピ');
await page.click(`.recommend-product >> nth=${nth} >> text=この内容で登録する`);
await expect(page.locator(`.recommend-product >> nth=${ nth }`)).toContainText('おなべレシピ');
await page.click(`.recommend-product >> nth=${ nth } >> text=この内容で登録する`);
});
});
});
2 changes: 1 addition & 1 deletion e2e-tests/test/admin/customer/edit.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '../../../fixtures/admin_login.fixture';
import { ADMIN_DIR } from '../../../config/default.config';

const url = `/${ADMIN_DIR}/customer/edit.php`;
const url = `/${ ADMIN_DIR }/customer/edit.php`;
test.describe('会員登録画面のテストをします', () => {

test('会員登録画面のテストをします', async ( { loginPage, page }) => {
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/test/admin/home.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '../../fixtures/admin_login.fixture';
import { Page } from '@playwright/test';
import { ADMIN_DIR } from '../../config/default.config';

const url = `/${ADMIN_DIR}/home.php`;
const url = `/${ ADMIN_DIR }/home.php`;

test.describe('管理画面Homeの確認をします', () => {
let page: Page;
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/test/admin/ownersstore/plugin_install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fs from 'fs';

import { ADMIN_DIR } from '../../../config/default.config';

const url = `/${ADMIN_DIR}ownersstore/index.php`;
const url = `/${ ADMIN_DIR }ownersstore/index.php`;

const pluginPath = path.join(__dirname, '..', '..', '..', '..', 'tests', 'class',
'fixtures', 'plugin', 'PrefilterTransformPlugin');
Expand Down
18 changes: 9 additions & 9 deletions e2e-tests/test/admin/system/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import { faker as fakerEn } from '@faker-js/faker/locale/en';

import { ADMIN_DIR } from '../../../config/default.config';

const url = `/${ADMIN_DIR}system/index.php`;
const url = `/${ ADMIN_DIR }system/index.php`;

test.describe.serial('システム設定>メンバー管理画面を確認をします', () => {
let page: Page;

test('メンバー管理画面を開きます', async( { loginPage, page } ) => {
test('メンバー管理画面を開きます', async ( { loginPage, page } ) => {
await page.goto(url);
await expect(page.locator('h1')).toContainText('システム設定>メンバー管理');
});

let popup: Page;
test('メンバー登録画面を開きます', async( { loginPage, page } ) => {
test('メンバー登録画面を開きます', async ( { loginPage, page } ) => {
await page.goto(url);
[ popup ] = await Promise.all([
page.waitForEvent('popup'),
Expand All @@ -32,7 +32,7 @@ test.describe.serial('システム設定>メンバー管理画面を確認を
const password = fakerEn.helpers.fake('{{internet.password}}{{datatype.number}}');

let edit: Page;
test('メンバー登録を確認します', async( { loginPage, page } ) => {
test('メンバー登録を確認します', async ( { loginPage, page } ) => {
await page.goto(url);
[ popup ] = await Promise.all([
page.waitForEvent('popup'),
Expand All @@ -57,28 +57,28 @@ test.describe.serial('システム設定>メンバー管理画面を確認を
]);
edit.on('dialog', dialog => dialog.accept());
expect(await edit.inputValue('input[name=name]')).toBe(name);
await edit.fill('input[name=department]', `${department} 変更`);
await edit.fill('input[name=department]', `${ department } 変更`);
expect(await edit.inputValue('input[name=login_id]')).toBe(user);
await edit.fill('input[name=password]', password);
await edit.fill('input[name=password02]', password);
await edit.click('text=この内容で登録する');

await expect(page.locator('table.list >> tr >> nth=1')).toContainText(`${department} 変更`);
await expect(page.locator('table.list >> tr >> nth=1')).toContainText(`${ department } 変更`);
});

test('下へ移動を確認します', async( { loginPage, page } ) => {
test('下へ移動を確認します', async ( { loginPage, page } ) => {
await page.goto(url);
await page.click('table.list >> tr >> nth=1 >> text=下へ');
await expect(page.locator('table.list >> tr >> nth=2')).toContainText(name);
});

test('上へ移動を確認します', async( { loginPage, page } ) => {
test('上へ移動を確認します', async ( { loginPage, page } ) => {
await page.goto(url);
await page.click('table.list >> tr >> nth=2 >> text=上へ');
await expect(page.locator('table.list >> tr >> nth=1')).toContainText(name);
});

test('メンバー削除を確認します', async( { loginPage, page } ) => {
test('メンバー削除を確認します', async ( { loginPage, page } ) => {
await page.goto(url);
page.on('dialog', dialog => dialog.accept());
await page.click('table.list >> tr >> nth=1 >> text=削除');
Expand Down
Loading

0 comments on commit 0f6656d

Please sign in to comment.