wirecard / shopsystem-ui-testsuite
Shop System UI 测试套件
该软件包的官方仓库似乎已不存在,因此该软件包已被冻结。
Requires
- php: >=7.2
- ext-json: *
- hoa/console: ^3.17
Requires (Dev)
- dev-master
- dev-parallel_test_concept_2
- dev-parallel_test_concept_1
- dev-wd-77-create-test-case
- dev-wd-76-create-feature-file-and-enable-payment-method
- dev-wd-67-create-feature-file-and-enable-payment-method
- dev-wd-64-automate-steps-outside-the-shop
- dev-wd-63-create-feature-file
- dev-WD-58-check-if-wirecard-credit-card-is-enabled-and-all-data-that-was-entered-is-shown
- dev-wd-47-activate-the-wirecard-credit-card-method-and-fill-fields
- dev-wd-46-implement-preconditions
- dev-wd-42-Implement-admin-user-registration
- dev-wd-41-update-magento2-and-prestashop-classes-according-to-change-in-feature-files
- dev-wd-36-creating-test-case
- dev-WD-19
- dev-TPWDCEE-6288-try2-configuration
- dev-TWDCEE-6288-configuration
This package is auto-updated.
Last update: 2022-12-25 14:23:39 UTC
README
本项目包含 Wirecard Shop Systems 扩展的验收测试。
支持的 Shop 系统
Shop 系统 | 支持 | 本项目用于 CI |
---|---|---|
Prestashop | ✅ | ✅ |
Woocommerce | ✅ | ✅ |
Magento2 | ✅ | ✅ |
本地运行测试
-
启动已安装 wirecard-ee 扩展的 Shop 系统
- 注意:对于 Magento2
- 确保数据库和配置的缓存已禁用,可以通过运行
magento cache:disable db_ddl collections config
实现 - 确保 Magento2 中的 cron 作业配置为每分钟或更短的时间间隔(检查文件 vendor/wirecard/magento2-ee/etc/crontab.xml)
- 确保数据库和配置的缓存已禁用,可以通过运行
- 注意:对于 Magento2
-
在端口 4444 上启动 chrome driver 和 selenium driver
-
克隆
git clone https://github.com/wirecard/shopsystems-ui-testsuite.git cd shopsystems-ui-testsuite
-
安装 codeception 及其依赖项
composer require codeception/codeception --dev composer require codeception/module-webdriver --dev composer require codeception/module-asserts --dev composer require codeception/module-db --dev
-
导出环境变量
SHOP_SYSTEM = prestashop #(或 woocommerce 或 magento2)
DB_HOST
DB_PORT
DB_NAME
DB_USER
DB_PASSWORD
SHOP_URL
-
启动 codeception
vendor/bin/codecept run acceptance -g ${SHOP_SYSTEM} --debug --html
如何在持续集成中包含项目和运行测试
-
将 wirecard/shopsystem-ui-testsuite 包含到您的 composer 配置中
composer require wirecard/shopsystem-ui-testsuite
-
将 codeception 服务添加到 docker-compose(示例 docker-compose.yml)
version: '3'
services:
# Reference: https://hub.docker.com/_/mysql
db:
image: mysql
networks:
- shop-net
web:
build:
context: .
networks:
- shop-net
depends_on:
- db
codecept:
image: codeception/codeception
build:
context: .
dockerfile: Dockerfile_codeception
volumes:
- "${PWD}/<location-to-vendor/wirecard/shopsystem-ui-testsuite>:/project"
networks:
- shop-net
networks:
shop-net:
- 传递所有必需变量运行测试
docker-compose run \
-e SHOP_SYSTEM="${SHOP_SYSTEM}" \
-e SHOP_URL="${SHOP_URL}" \
-e SHOP_VERSION="${SHOP_VERSION}" \
-e EXTENSION_VERSION="${EXTENSION_VERSION}" \
-e DB_HOST="${DB_SERVER}" \
-e DB_NAME="${DB_NAME}" \
-e DB_USER="${DB_USER}" \
-e DB_PASSWORD="${DB_PASSWORD}" \
-e BROWSERSTACK_USER="${BROWSERSTACK_USER}" \
-e BROWSERSTACK_ACCESS_KEY="${BROWSERSTACK_ACCESS_KEY}" \
codecept run acceptance \
-g "${TEST_GROUP}" -g "${SHOP_SYSTEM}" \
--env ci --html --xml
*注意:对于 PayPal 测试 - 确保每次订单号不重复
配置测试数据
除了指定的测试数据(客户信息、支付方式凭据(如信用卡号码、PayPal 凭据等))外,还可以使用自定义数据。为此,请使用 config.json
文件。在那里可以更改使用的货币、默认商店系统国家以及数据文件的路径。
config.json
文件内容
{
"gateway" : "API-TEST",
"guest_customer_data": "GuestCustomerData.json",
"registered_customer_data": "RegisteredCustomerData.json",
"currency": "EUR",
"default_country": "AT",
"creditcard_data": "CreditCardData.json",
"creditcardoneclick_data": "CreditCardOneClickData.json",
"paypal_data": "PayPalData.json"
}
注意:如果您想使用自定义 *_data.json
路径,请放置完整的文件路径。否则,该文件应位于 _data
文件夹内的相应文件夹中。
结构
.
├── tests # All files
| ├── _data
| | ├── Customer # Customer (shop user) data
| | | ├──...
| | ├── Locator # Locators
| | | ├──...
| | ├── PaymentMethodConfig # Payment method configuration data (maid, user, password, etc...)
| | | ├──...
| | | ├──MappedPaymentActions # Payment action mapped names depending on shop system
| | | | ├──...
| | | ├──...
| | ├── PaymentMethodData # Payment method data (crecit card numbers, user, password, ...)
| | | ├──...
| ├── _support # All helper classes
| | ├── Helper
| | | ├── Config # Classes responsible for handling data
| | | | ├── Customer # Classes handling customer data
| | | | | ├──...
| | | | ├── PaymentMethod # Classes handling payment method data
| | | | | ├──...
| | | | ├── FileSystem.php # Path constants
| | | | ├──...
| | | ├── Acceptance.php # All helper functions that AcceptanceTester.php and it's child classes can use
| | | ├── DbHelper.php # All Db related helper funcitons
| | ├── Step # Here we keep all the AcceptanceTester.php child classes that group different steps by their functionality
| | | ├── Acceptance
| | | | ├── PaymentMethod # Steps specific for payment method
| | | | | ├── ...
| | | | ├── ShopSystem # Steps specific for shop system
| | | | | ├── ...
| | | | ├── ... # Generic classes and interfaces
| | ├── AcceptanceTester.php # Main orchestrator class, that calls specific steps
| ├── acceptance
| | ├── CreditCard # Actual test cases for credit card
| | ├── PayPal
| | ├── ...
| ├── acceptance.yml # Acceptance test configuration
├── codeception.yml # Codeception configuration files
├── config.json # Basic configuration of test data
└── README.md
流程
Woocommerce 上信用卡测试的示例
入口点:CreditCard/CreditCard3DSAuthorizationHappyPath.feature
每行都链接到
orchestrator:_support/AcceptanceTester.php
。它负责初始化并从子实例调用步骤
商店实例 _support/Step/Acceptane/ShopSystem/WoocommerceStep.php
用于特定于商店系统的步骤(如填写购物车、转到结账)
或
支付方式实例 _support/Step/Acceptane/PaymentMethod/CreditCardStep.php
用于特定于支付方式的步骤(如填写信用卡表单并转到 ACS 页面)
商店实例和支付方式实例都使用
_data/Locator
中的定位器
_data/Customer
中的数据用于客户信息(姓名、地址、电话等)
_data/PaymentMethodData
用于支付方式信息(信用卡号码、CVV 等)