forked from EC-CUBE/ec-cube2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
endpoints.csv に記載されたURLがすべて表示されることを確認するテストを追加
- Loading branch information
Showing
7 changed files
with
252 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# all_page_crawler.test.ts で使用するエンドポイントのCSVファイル | ||
|
||
このディレクトリのCSVファイルは all_page_crawler.test.ts で使用します。 | ||
|
||
## endpoints.csv | ||
|
||
all_page_crawler.test.ts のテスト対象のエンポイントです。 | ||
|
||
## exclude_endpoints.csv | ||
|
||
endpoints.csv のうち、テストから除外するエンドポイントです。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/abouts/index.php | ||
/admin/basis/delivery.php | ||
/admin/basis/delivery_input.php | ||
/admin/basis/holiday.php | ||
/admin/basis/index.php | ||
/admin/basis/kiyaku.php | ||
/admin/basis/mail.php | ||
/admin/basis/payment.php | ||
/admin/basis/payment_input.php | ||
/admin/basis/point.php | ||
/admin/basis/tax.php | ||
/admin/basis/tradelaw.php | ||
/admin/basis/zip_install.php | ||
/admin/contents/csv.php | ||
/admin/contents/csv_sql.php | ||
/admin/contents/file_manager.php | ||
/admin/contents/file_view.php | ||
/admin/contents/index.php | ||
/admin/contents/recommend.php | ||
/admin/contents/recommend_search.php | ||
/admin/customer/edit.php | ||
/admin/customer/index.php | ||
/admin/customer/search_customer.php | ||
/admin/design/bloc.php | ||
/admin/design/css.php | ||
/admin/design/header.php | ||
/admin/design/index.php | ||
/admin/design/main_edit.php | ||
/admin/design/template.php | ||
/admin/design/up_down.php | ||
/admin/home.php | ||
/admin/logout.php | ||
/admin/mail/history.php | ||
/admin/mail/index.php | ||
/admin/mail/preview.php | ||
/admin/mail/template.php | ||
/admin/mail/template_input.php | ||
/admin/order/disp.php | ||
/admin/order/edit.php | ||
/admin/order/index.php | ||
/admin/order/mail.php | ||
/admin/order/mail_view.php | ||
/admin/order/multiple.php | ||
/admin/order/pdf.php | ||
/admin/order/product_select.php | ||
/admin/order/status.php | ||
/admin/ownersstore/index.php | ||
/admin/ownersstore/log.php | ||
/admin/ownersstore/module.php | ||
/admin/ownersstore/plugin_hookpoint_list.php | ||
/admin/ownersstore/settings.php | ||
/admin/products/category.php | ||
/admin/products/class.php | ||
/admin/products/classcategory.php | ||
/admin/products/index.php | ||
/admin/products/maker.php | ||
/admin/products/product.php | ||
/admin/products/product_class.php | ||
/admin/products/product_rank.php | ||
/admin/products/product_select.php | ||
/admin/products/review.php | ||
/admin/products/review_edit.php | ||
/admin/products/upload_csv.php | ||
/admin/products/upload_csv_category.php | ||
/admin/system/adminarea.php | ||
/admin/system/bkup.php | ||
/admin/system/delete.php | ||
/admin/system/index.php | ||
/admin/system/input.php | ||
/admin/system/log.php | ||
/admin/system/masterdata.php | ||
/admin/system/parameter.php | ||
/admin/system/rank.php | ||
/admin/system/system.php | ||
/admin/total/index.php | ||
/cart/index.php | ||
/contact/complete.php | ||
/contact/index.php | ||
/entry/complete.php | ||
/entry/index.php | ||
/entry/kiyaku.php | ||
/forgot/index.php | ||
/guide/privacy.php | ||
/index.php | ||
/mypage/change.php | ||
/mypage/change_complete.php | ||
/mypage/delivery.php | ||
/mypage/delivery_addr.php | ||
/mypage/download.php | ||
/mypage/favorite.php | ||
/mypage/history.php | ||
/mypage/index.php | ||
/mypage/login.php | ||
/mypage/mail_view.php | ||
/mypage/order.php | ||
/mypage/refusal.php | ||
/mypage/refusal_complete.php | ||
/order/index.php | ||
/products/category_list.php | ||
/products/detail.php | ||
/products/list.php | ||
/products/review.php | ||
/products/review_complete.php | ||
/products/search.php | ||
/regist/complete.php | ||
/regist/index.php | ||
/shopping/complete.php | ||
/shopping/confirm.php | ||
/shopping/deliv.php | ||
/shopping/index.php | ||
/shopping/load_payment_module.php | ||
/shopping/multiple.php | ||
/shopping/payment.php | ||
/sitemap.php | ||
/unsupported/index.php | ||
/upgrade/index.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/define.php | ||
/admin/index.php | ||
/admin/load_module_config.php | ||
/admin/load_plugin_config.php | ||
/admin/require.php | ||
/admin/contents/file_view.php | ||
/admin/logout.php | ||
/admin/mail/preview.php | ||
/admin/products/review_edit.php | ||
/admin/system/delete.php | ||
/admin/system/rank.php | ||
/entry/email_mobile.php | ||
/frontparts/bloc/calendar.php | ||
/frontparts/bloc/cart.php | ||
/frontparts/bloc/category.php | ||
/frontparts/bloc/login.php | ||
/frontparts/bloc/login_footer.php | ||
/frontparts/bloc/login_header.php | ||
/frontparts/bloc/navi_footer.php | ||
/frontparts/bloc/navi_header.php | ||
/frontparts/bloc/news.php | ||
/frontparts/bloc/recommend.php | ||
/frontparts/bloc/search_products.php | ||
/frontparts/login_check.php | ||
/input_zip.php | ||
/preview/index.php | ||
/require.php | ||
/resize_image.php | ||
/rss/index.php | ||
/rss/product.php | ||
/rss/products.php | ||
/sitemap.php | ||
/unsupported/index.php | ||
/upgrade/index.php | ||
/mypage/login.php | ||
/mypage/download.php | ||
/mypage/history.php | ||
/mypage/mail_view.php | ||
/mypage/order.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { test } from '../../fixtures/admin_login.fixture'; | ||
import { EndpointReader } from '../../utils/EndpointReader'; | ||
import { endpointTests } from '../../utils/EndpointTests'; | ||
|
||
/** | ||
* endpoints.csv を読み込み、指定されたエンドポイントのテストを実行します。 | ||
*/ | ||
const endpointReader = new EndpointReader(); | ||
test('/admin 以下のエンポイントを確認します', async ({ adminLoginPage, page }) => { | ||
const endpoints = endpointReader.filter('/admin'); | ||
for (const endpoint of endpoints) { | ||
await endpointTests(page, endpoint); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { test, expect } from '../../fixtures/mypage_login.fixture'; | ||
import { EndpointReader } from '../../utils/EndpointReader'; | ||
import { endpointTests } from '../../utils/EndpointTests'; | ||
|
||
/** | ||
* endpoints.csv を読み込み、指定されたエンドポイントのテストを実行します。 | ||
*/ | ||
const endpointReader = new EndpointReader(); | ||
test('/mypage 以下のエンポイントを確認します', async ({ mypageLoginPage, page }) => { | ||
const endpoints = endpointReader.filter('/mypage'); | ||
for (const endpoint of endpoints) { | ||
await endpointTests(page, endpoint, null); | ||
} | ||
}); | ||
|
||
test('/abouts 以下のエンポイントを確認します', async ({ mypageLoginPage, page }) => { | ||
const endpoints = endpointReader.filter('/abouts'); | ||
for (const endpoint of endpoints) { | ||
await endpointTests(page, endpoint, null); | ||
} | ||
}); | ||
|
||
test('/guide 以下のエンポイントを確認します', async ({ mypageLoginPage, page }) => { | ||
const endpoints = endpointReader.filter('/guide'); | ||
for (const endpoint of endpoints) { | ||
await endpointTests(page, endpoint, null); | ||
} | ||
}); | ||
|
||
test('/order 以下のエンポイントを確認します', async ({ mypageLoginPage, page }) => { | ||
const endpoints = endpointReader.filter('/order'); | ||
for (const endpoint of endpoints) { | ||
await endpointTests(page, endpoint, null); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as fs from 'fs'; | ||
import * as path from "path"; | ||
|
||
export class EndpointReader { | ||
endpoints: Array<string>; | ||
|
||
constructor() { | ||
this.read(); | ||
} | ||
|
||
read() { | ||
const excludes = fs.readFileSync(path.join(__dirname, '..', 'endpoints', 'exclude_endpoints.csv'), 'utf8').split('\n'); | ||
this.endpoints = fs.readFileSync(path.join(__dirname, '..', 'endpoints', 'endpoints.csv'), 'utf8') | ||
.split('\n') | ||
.filter(line => !excludes.includes(line)) | ||
.map(line => line.replace(/index.*/, '')); | ||
|
||
return this.endpoints; | ||
} | ||
|
||
filter(prefix: string) { | ||
return this.endpoints.filter(line => line.match(new RegExp(`^${prefix}`))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
export const endpointTests = async (page:Page, endpoint:string, title:string|null = 'EC') => { | ||
await test.step(`${endpoint} を確認します`, async () => { | ||
await page.goto(endpoint); | ||
await expect(page, `toHaveURL: ${endpoint}`).toHaveURL(new RegExp(`${endpoint}`)); | ||
if (title !== null) { | ||
await expect(page).toHaveTitle(new RegExp(`${title}`)); | ||
} | ||
|
||
await expect(page.locator('body'), 'ページの表示を確認').toBeVisible(); | ||
await expect(page.locator('.error'), 'システムエラーの無いのを確認').not.toBeVisible(); | ||
}); | ||
}; |