Skip to content

Commit

Permalink
Merge pull request #900 from nanasess/fix-deprecate-faker-js
Browse files Browse the repository at this point in the history
faker-js の非推奨メソッドを修正
  • Loading branch information
nanasess authored Apr 22, 2024
2 parents 30683bc + 131f0a3 commit b1dde49
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 51 deletions.
4 changes: 2 additions & 2 deletions e2e-tests/test/admin/system/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ test.describe.serial('システム設定>メンバー管理画面を確認を
await expect(popup.locator('h2')).toContainText('メンバー登録/編集');
});

const name = faker.name.lastName();
const name = faker.person.lastName();
const department = faker.company.name();
const user = fakerEn.internet.password();
const password = fakerEn.helpers.fake('{{internet.password}}{{datatype.number}}');
const password = fakerEn.helpers.fake('{{internet.password}}{{number.int}}');

let edit: Page;
test('メンバー登録を確認します', async ( { loginPage, page } ) => {
Expand Down
38 changes: 19 additions & 19 deletions e2e-tests/test/front_guest/entry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,40 @@ test.describe.serial('会員登録のテストをします', () => {

let email: string;
test('会員登録内容を入力します', async () => {
await page.fill('input[name=name01]', faker.name.lastName());
await page.fill('input[name=name02]', faker.name.firstName());
await page.fill('input[name=name01]', faker.person.lastName());
await page.fill('input[name=name02]', faker.person.firstName());
await page.fill('input[name=kana01]', 'イシ');
await page.fill('input[name=kana02]', 'キュウブ');
await page.fill('input[name=company_name]', faker.company.name());
await page.fill('input[name=zip01]', faker.address.zipCode('###'));
await page.fill('input[name=zip02]', faker.address.zipCode('####'));
await page.selectOption('select[name=pref]', { label: faker.address.state() });
await page.fill('input[name=addr01]', faker.address.city());
await page.fill('input[name=addr02]', faker.address.streetName());
await page.fill('input[name=tel01]', faker.phone.number('###'));
await page.fill('input[name=tel02]', faker.phone.number('###'));
await page.fill('input[name=tel03]', faker.phone.number('###'));
await page.fill('input[name=fax01]', faker.phone.number('###'));
await page.fill('input[name=fax02]', faker.phone.number('###'));
await page.fill('input[name=fax03]', faker.phone.number('###'));
await page.fill('input[name=zip01]', faker.location.zipCode('###'));
await page.fill('input[name=zip02]', faker.location.zipCode('####'));
await page.selectOption('select[name=pref]', { label: faker.location.state() });
await page.fill('input[name=addr01]', faker.location.city());
await page.fill('input[name=addr02]', faker.location.street());
await page.fill('input[name=tel01]', faker.string.numeric(3));
await page.fill('input[name=tel02]', faker.string.numeric(3));
await page.fill('input[name=tel03]', faker.string.numeric(3));
await page.fill('input[name=fax01]', faker.string.numeric(3));
await page.fill('input[name=fax02]', faker.string.numeric(3));
await page.fill('input[name=fax03]', faker.string.numeric(3));
email = fakerEN.helpers.fake(String(Date.now()) + '.{{internet.exampleEmail}}').toLowerCase();
await page.fill('input[name=email]', email);
await page.fill('input[name=email02]', email);
const password = faker.datatype.uuid();
const password = faker.string.uuid();
await page.fill('input[name=password]', password);
await page.fill('input[name=password02]', password);
const sex = faker.datatype.number({ min: 1, max: 2 });
const sex = faker.number.int({ min: 1, max: 2 });
await page.check(`input[name=sex][value="${ sex }"]`);
const job = faker.datatype.number({ min: 1, max: 18 });
const job = faker.number.int({ min: 1, max: 18 });
await page.selectOption('select[name=job]', { value: String(job) });
const birth = faker.date.past(20, addYears(new Date(), -20).toISOString());
const birth = faker.date.past({ years:20, refDate: addYears(new Date(), -20).toISOString() });
await page.selectOption('select[name=year]', String(birth.getFullYear()));
await page.selectOption('select[name=month]', String(birth.getMonth() + 1));
await page.selectOption('select[name=day]', String(birth.getDate()));
const reminder = faker.datatype.number({ min: 1, max: 7 });
const reminder = faker.number.int({ min: 1, max: 7 });
await page.selectOption('select[name=reminder]', String(reminder));
await page.fill('input[name=reminder_answer]', faker.lorem.word());
const mailmaga_flg = faker.datatype.number({ min: 1, max: 3 });
const mailmaga_flg = faker.number.int({ min: 1, max: 3 });
await page.check(`input[name=mailmaga_flg][value="${ mailmaga_flg }"]`);
await page.click('[alt=確認ページへ]');
});
Expand Down
58 changes: 29 additions & 29 deletions e2e-tests/test/front_guest/shopping.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,51 +45,51 @@ test.describe.serial('購入フロー(ゲスト)のテストをします', () =>

let email: string;
test('お客様情報を入力します', async () => {
await page.fill('input[name=order_name01]', faker.name.lastName());
await page.fill('input[name=order_name02]', faker.name.firstName());
await page.fill('input[name=order_name01]', faker.person.lastName());
await page.fill('input[name=order_name02]', faker.person.firstName());
await page.fill('input[name=order_kana01]', 'イシ');
await page.fill('input[name=order_kana02]', 'キュウブ');
await page.fill('input[name=order_company_name]', faker.company.name());
await page.fill('input[name=order_zip01]', faker.address.zipCode('###'));
await page.fill('input[name=order_zip02]', faker.address.zipCode('####'));
await page.selectOption('select[name=order_pref]', { label: faker.address.state() });
await page.fill('input[name=order_addr01]', faker.address.city());
await page.fill('input[name=order_addr02]', faker.address.streetName());
await page.fill('input[name=order_tel01]', faker.phone.number('###'));
await page.fill('input[name=order_tel02]', faker.phone.number('###'));
await page.fill('input[name=order_tel03]', faker.phone.number('###'));
await page.fill('input[name=order_fax01]', faker.phone.number('###'));
await page.fill('input[name=order_fax02]', faker.phone.number('###'));
await page.fill('input[name=order_fax03]', faker.phone.number('###'));
await page.fill('input[name=order_zip01]', faker.location.zipCode('###'));
await page.fill('input[name=order_zip02]', faker.location.zipCode('####'));
await page.selectOption('select[name=order_pref]', { label: faker.location.state() });
await page.fill('input[name=order_addr01]', faker.location.city());
await page.fill('input[name=order_addr02]', faker.location.street());
await page.fill('input[name=order_tel01]', faker.string.numeric(3));
await page.fill('input[name=order_tel02]', faker.string.numeric(3));
await page.fill('input[name=order_tel03]', faker.string.numeric(3));
await page.fill('input[name=order_fax01]', faker.string.numeric(3));
await page.fill('input[name=order_fax02]', faker.string.numeric(3));
await page.fill('input[name=order_fax03]', faker.string.numeric(3));
email = fakerEN.helpers.fake(String(Date.now()) + '.{{internet.exampleEmail}}').toLowerCase();
await page.fill('input[name=order_email]', email);
await page.fill('input[name=order_email02]', email);
const sex = faker.datatype.number({ min: 1, max: 2 });
const sex = faker.number.int({ min: 1, max: 2 });
await page.check(`input[name=order_sex][value="${ sex }"]`);
const job = faker.datatype.number({ min: 1, max: 18 });
const job = faker.number.int({ min: 1, max: 18 });
await page.selectOption('select[name=order_job]', { value: String(job) });
const birth = faker.date.past(20, addYears(new Date(), -20).toISOString());
const birth = faker.date.past({ years:20, refDate:addYears(new Date(), -20).toISOString() });
await page.selectOption('select[name=order_year]', String(birth.getFullYear()));
await page.selectOption('select[name=order_month]', String(birth.getMonth() + 1));
await page.selectOption('select[name=order_day]', String(birth.getDate()));

await page.click('text=お届け先を指定');
await page.fill('input[name=shipping_name01]', faker.name.lastName());
await page.fill('input[name=shipping_name02]', faker.name.firstName());
await page.fill('input[name=shipping_name01]', faker.person.lastName());
await page.fill('input[name=shipping_name02]', faker.person.firstName());
await page.fill('input[name=shipping_kana01]', 'イシ');
await page.fill('input[name=shipping_kana02]', 'キュウブ');
await page.fill('input[name=shipping_company_name]', faker.company.name());
await page.fill('input[name=shipping_zip01]', faker.address.zipCode('###'));
await page.fill('input[name=shipping_zip02]', faker.address.zipCode('####'));
await page.selectOption('select[name=shipping_pref]', { label: faker.address.state() });
await page.fill('input[name=shipping_addr01]', faker.address.city());
await page.fill('input[name=shipping_addr02]', faker.address.streetName());
await page.fill('input[name=shipping_tel01]', faker.phone.number('###'));
await page.fill('input[name=shipping_tel02]', faker.phone.number('###'));
await page.fill('input[name=shipping_tel03]', faker.phone.number('###'));
await page.fill('input[name=shipping_fax01]', faker.phone.number('###'));
await page.fill('input[name=shipping_fax02]', faker.phone.number('###'));
await page.fill('input[name=shipping_fax03]', faker.phone.number('###'));
await page.fill('input[name=shipping_zip01]', faker.location.zipCode('###'));
await page.fill('input[name=shipping_zip02]', faker.location.zipCode('####'));
await page.selectOption('select[name=shipping_pref]', { label: faker.location.state() });
await page.fill('input[name=shipping_addr01]', faker.location.city());
await page.fill('input[name=shipping_addr02]', faker.location.street());
await page.fill('input[name=shipping_tel01]', faker.string.numeric(3));
await page.fill('input[name=shipping_tel02]', faker.string.numeric(3));
await page.fill('input[name=shipping_tel03]', faker.string.numeric(3));
await page.fill('input[name=shipping_fax01]', faker.string.numeric(3));
await page.fill('input[name=shipping_fax02]', faker.string.numeric(3));
await page.fill('input[name=shipping_fax03]', faker.string.numeric(3));

await page.click('[alt=上記のお届け先のみに送る]');
});
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/test/installer/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test.describe.serial('インストーラのテストをします', () => {
let password: string;
test('step1 - ECサイトの設定をします', async () => {
await expect(page.locator('h2').first()).toHaveText('ECサイトの設定');
adminDirectory = faker.datatype.uuid().substring(0, 8);
adminDirectory = faker.string.uuid().substring(0, 8);
user = faker.internet.userName();
password = faker.helpers.fake('{{internet.password}}{{datatype.number}}');
await page.fill('input[name=shop_name]', faker.company.name());
Expand Down

0 comments on commit b1dde49

Please sign in to comment.