代码优化调整
This commit is contained in:
parent
07276ed14c
commit
5e869252c9
|
|
@ -3,25 +3,25 @@ const admin_top = [
|
|||
"login_url" =>"/admin",
|
||||
"root"=> "root",
|
||||
"mg_index"=>".navbar.navbar-left li:nth-child(1)",//管理首页
|
||||
"mg_order"=>".navbar.navbar-left li:nth-child(2)",//管理首页
|
||||
"mg_product"=>".navbar.navbar-left li:nth-child(3)",//管理首页
|
||||
"mg_customers"=>".navbar.navbar-left li:nth-child(4)",//管理首页
|
||||
"mg_article"=>".navbar.navbar-left li:nth-child(5)",//管理首页
|
||||
"system_set"=>".navbar.navbar-left li:nth-child(6)",//管理首页
|
||||
'go_catalog'=>'访问前台',
|
||||
"sign_out"=> "退出登录",
|
||||
// "mg_order"=> "订单管理",
|
||||
// "mg_product"=>"商品管理",
|
||||
// "mg_customers"=>"客户管理",
|
||||
"VIP"=>"VIP",
|
||||
"plugins_market"=>"插件市场",
|
||||
"sw_language"=>"简体中文",
|
||||
"en_language"=>"English",
|
||||
"mg_order"=>".navbar.navbar-left li:nth-child(2)",//管理订单
|
||||
"mg_product"=>".navbar.navbar-left li:nth-child(3)",//管理商品
|
||||
"mg_customers"=>".navbar.navbar-left li:nth-child(4)",//管理客户
|
||||
"mg_article"=>".navbar.navbar-left li:nth-child(5)",//管理文章
|
||||
"system_set"=>".navbar.navbar-left li:nth-child(6)",//系统设置
|
||||
'go_catalog'=>'.dropdown-menu.dropdown-menu-end.show li:nth-child(1)',//去往前台
|
||||
"sign_out"=> ".dropdown-menu.dropdown-menu-end.show li:nth-child(3)",//退出登录
|
||||
"Alter"=>".navbar.navbar-right li:nth-child(1)",//更新按钮
|
||||
"VIP"=>".navbar.navbar-right li:nth-child(2)",//vip图标
|
||||
"plugins_market"=>".navbar.navbar-right li:nth-child(3)",//插件市场
|
||||
"sw_language"=>".navbar.navbar-right li:nth-child(4)",//切换语言
|
||||
"en_language"=>".dropdown-menu.dropdown-menu-end.show li:nth-child(2)",//切换英语
|
||||
"ch_language"=>".dropdown-menu.dropdown-menu-end.show li:nth-child(8)",//切换中文
|
||||
];
|
||||
const admin_assert = [
|
||||
"vip_assert"=>"登录购买VIP服务",
|
||||
"plugins_assert"=>"/admin/marketing",
|
||||
"en_assert"=>"Admin Panel",
|
||||
"en_assert"=>"Admin Panel",//切换为中文断言
|
||||
"ch_assert"=>"后台管理",//切换为英文断言
|
||||
];
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ const admin_login = [
|
|||
'tltle'=>'登录到 BeikeShop 后台',
|
||||
"login_email"=> "#email-input",
|
||||
"login_pwd"=> "#password-input",
|
||||
"login_btn"=> "登录",
|
||||
"login_btn"=> ".btn.btn-lg.btn-primary",//登录按钮
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,16 @@ const order_details = [//订单详情页
|
|||
// "paid"=>".el-select-dropdown__item",//已支付
|
||||
"paid"=>".el-scrollbar__view.el-select-dropdown__list li:nth-child(1)",//已支付
|
||||
"cancel"=>".el-scrollbar__view.el-select-dropdown__list li:nth-child(2)",//已取消
|
||||
"alter_btn"=>"#app > form > div:nth-child(5) > div > button > span",
|
||||
"alter_btn"=>"#app > form > div:nth-child(5) > div > button > span",//更新状态按钮
|
||||
"Shipped"=>".el-scrollbar__view.el-select-dropdown__list li:nth-of-type(2)",//已发货
|
||||
"express_btn"=>"#app > form > div:nth-child(3) > div > div > div > span > span > i",//快递下拉按钮
|
||||
//
|
||||
"express_1"=>".el-scrollbar__view.el-select-dropdown__list:nth-of-type(2) > ul > li:nth-child(1)",//选择第一个快递
|
||||
"Completed"=>".el-scrollbar__view.el-select-dropdown__list li:nth-child(1)",//已支付//
|
||||
|
||||
"express_1"=>".el-scrollbar__view.el-select-dropdown__list",//选择第一个快递
|
||||
"order_number"=>"#app > form > div:nth-child(4) > div > div > input",//订单号
|
||||
"submit"=>"#app > form > div:nth-child(7) > div > button",//提交按钮
|
||||
"submit_btn2"=>"#app > form > div:nth-child(5) > div > button",//提交按钮
|
||||
//#app > form > div:nth-child(5) > div > button
|
||||
""=>"",
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,18 @@
|
|||
<?php
|
||||
const account = [
|
||||
"url" =>"/account",
|
||||
"go_index"=>"Home",//beikeshop图标
|
||||
"SignOut"=>"Sign Out"//sign
|
||||
"go_index"=>".logo",//beikeshop图标
|
||||
"go_account"=>".list-group-item.d-flex.justify-content-between.align-items-center:nth-child(1)",//
|
||||
"go_Edit"=>".list-group-item.d-flex.justify-content-between.align-items-center:nth-child(2)",//编辑信息
|
||||
"go_order"=>".list-group-item.d-flex.justify-content-between.align-items-center:nth-child(3)",//查看订单
|
||||
"go_address"=>".list-group-item.d-flex.justify-content-between.align-items-center:nth-child(4)",//添加地址
|
||||
"go_Wishlist"=>".list-group-item.d-flex.justify-content-between.align-items-center:nth-child(5)",//添收藏
|
||||
"go_rma"=>".list-group-item.d-flex.justify-content-between.align-items-center:nth-child(6)",//售后
|
||||
"SignOut"=>".list-group-item.d-flex.justify-content-between.align-items-center:nth-child(7)"//sign out
|
||||
];
|
||||
const address = [
|
||||
"login_url" =>"/account/addresses",
|
||||
"add_btn"=>"Add New Address",
|
||||
"go_address"=>"Addresses",//beikeshop图标
|
||||
"add_btn"=>".btn.btn-dark.mb-3",//点击添加地址
|
||||
"add_name"=>"#address-app > div:nth-child(2) > div > div > div.el-dialog__body > form > div:nth-child(1) > div > div > input",//add_name
|
||||
"add_phone"=>"#address-app > div:nth-child(2) > div > div > div.el-dialog__body > form > div:nth-child(2) > div > div > input",//add_phone
|
||||
"add_country"=>"#address-app > div:nth-child(2) > div > div > div.el-dialog__body > form > div:nth-child(3) > div > div > div:nth-child(1) > div > div > div > div.el-input.el-input--suffix > span > span",//选择国家
|
||||
|
|
@ -23,22 +28,20 @@ const address = [
|
|||
];
|
||||
const Edit = [
|
||||
"login_url" =>"/account/edit",
|
||||
"go_Edit"=>"Edit",//点击edit
|
||||
"upload_btn"=>"#address-app > div > div.col-12.col-md-9 > div > div.card-body.h-600 > form > div.bg-light.rounded-3.p-4.mb-4 > div > div > label",//上传头像图标
|
||||
"Confirm_btn"=>"Confirm",
|
||||
"user_name"=>"#address-app > div > div.col-12.col-md-9 > div > div.card-body.h-600 > form > div.row.gx-4.gy-3 > div:nth-child(1) > input",//更改用户名
|
||||
"user_email"=>"#address-app > div > div.col-12.col-md-9 > div > div.card-body.h-600 > form > div.row.gx-4.gy-3 > div:nth-child(2) > input",//更改用户email
|
||||
"Submit"=>"Submit",//add_phone
|
||||
"Submit"=>".btn.btn-primary.mt-sm-0",//add_phone
|
||||
"assert"=>"Modify Success!",
|
||||
];
|
||||
const Wishlist = [
|
||||
"login_url" =>"/account/edit",
|
||||
"go_Wishlist"=>"Wishlist",//点击Wishlist
|
||||
"Check_Details"=>"Check Details",//查看详情按钮
|
||||
"remove_Wishlist"=>".btn btn-danger btn-sm remove-wishlist",
|
||||
//body > div.container > div > div.col-12.col-md-9 > div > div.card-body > table > tbody > tr > td.text-end > div > button > i
|
||||
"Check_Details"=>".btn.btn-dark.btn-sm.add-cart",//查看详情按钮
|
||||
"remove_Wishlist"=>".btn.btn-danger.btn-sm.remove-wishlist",//移除按钮
|
||||
|
||||
"no_data"=>".text-secondary fs-4 mb-3",
|
||||
"no_data"=>".d-flex.flex-column.align-center.align-items-center.mb-4",
|
||||
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -19,19 +19,14 @@ const index_top = [
|
|||
];
|
||||
const index_cart = [
|
||||
"cart_product_text" => "#offcanvas-right-cart > div.offcanvas-body.pt-0 > div > div > div.product-info.d-flex.align-items-center > div.right.flex-grow-1 > a",
|
||||
"cart_icon"=>"",//购物车图标
|
||||
// "cart_icon"=>".navbar-nav.flex-row li:nth-child(4)",//购物车图标
|
||||
"cart_icon"=>".nav-link.position-relative",//购物车图标
|
||||
"product_text"=>"#offcanvas-right-cart > div.offcanvas-body.pt-0 > div > div > div.product-info.d-flex.align-items-center > div.right.flex-grow-1 > a",//购物车内商品名字
|
||||
"Delete_btn" => "#offcanvas-right-cart > div.offcanvas-body.pt-0 > div > div > div.product-info.d-flex.align-items-center > div.right.flex-grow-1 > div.product-bottom.d-flex.justify-content-between.align-items-center > span", //删除按钮
|
||||
"product_num"=>"#offcanvas-right-cart > div.offcanvas-footer > div.d-flex.justify-content-between.align-items-center.mb-2.p-3.bg-light.top-footer > div:nth-child(2) > strong:nth-child(2) > span",
|
||||
"cart_Checkout"=>"#offcanvas-right-cart > div.offcanvas-footer > div.p-4 > a.btn.w-100.fw-bold.btn-dark.to-checkout",
|
||||
];
|
||||
const index_login = [
|
||||
"login_icon"=>".navbar-nav.flex-row li:nth-child(3)",//购物车图标
|
||||
"product_text"=>"#offcanvas-right-cart > div.offcanvas-body.pt-0 > div > div > div.product-info.d-flex.align-items-center > div.right.flex-grow-1 > a",//购物车内商品名字
|
||||
"Delete_btn" => "#offcanvas-right-cart > div.offcanvas-body.pt-0 > div > div > div.product-info.d-flex.align-items-center > div.right.flex-grow-1 > div.product-bottom.d-flex.justify-content-between.align-items-center > span", //删除按钮
|
||||
"product_num"=>"#offcanvas-right-cart > div.offcanvas-footer > div.d-flex.justify-content-between.align-items-center.mb-2.p-3.bg-light.top-footer > div:nth-child(2) > strong:nth-child(2) > span",
|
||||
"cart_Checkout"=>"#offcanvas-right-cart > div.offcanvas-footer > div.p-4 > a.btn.w-100.fw-bold.btn-dark.to-checkout",
|
||||
"login_icon"=>".navbar-nav.flex-row li:nth-child(3)",//登录图标
|
||||
];
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ const login = [
|
|||
"login_url" =>"/login",
|
||||
"login_email"=> "#page-login > div.login-wrap > div:nth-child(1) > form > div.card-body.px-md-2 > div:nth-child(1) > div > div > input",
|
||||
"login_pwd"=> "#page-login > div.login-wrap > div:nth-child(1) > form > div.card-body.px-md-2 > div:nth-child(2) > div > div > input",
|
||||
"login_btn"=> "Login",
|
||||
"login_btn"=> ".btn.btn-dark.btn-lg.w-100.fw-bold:first-of-type",
|
||||
"login_text"=> "Home",
|
||||
];
|
||||
const register = [
|
||||
"register_email" => "#page-login > div.login-wrap > div:nth-child(3) > div.card-body.px-md-2 > form > div:nth-child(1) > div > div > input",
|
||||
"register_pwd"=> "#page-login > div.login-wrap > div:nth-child(3) > div.card-body.px-md-2 > form > div:nth-child(2) > div > div > input",
|
||||
"register_re_pwd"=> "#page-login > div.login-wrap > div:nth-child(3) > div.card-body.px-md-2 > form > div:nth-child(3) > div > div > input",
|
||||
// "register_btn"=> ".btn.btn-dark.btn-lg.w-100.fw-bold:nth-child(2)",
|
||||
"register_btn"=> "Register",
|
||||
"register_text"=> "Home",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@ const order = [
|
|||
];
|
||||
const ca_order_status = [
|
||||
"Unpaid"=>"Unpaid",//待支付
|
||||
"paid"=>"paid",//已支付
|
||||
"Paid"=>"Paid",//已支付
|
||||
"Shipped"=>"Shipped",//已发货
|
||||
"Completed"=>"Completed",
|
||||
"Completed"=>"Completed",//已完成
|
||||
];
|
||||
const get_order_status = [
|
||||
"status_text"=>".table.table-borderless.mb-0 tbody tr:first-child td:nth-child(3)",//获取当前状态
|
||||
];
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
const product = [
|
||||
"login_url" =>"/products/1",
|
||||
"product_1"=> "Buy Now",//购买商品
|
||||
"Wishlist_icon"=>"Add To Favorites",//收藏
|
||||
"add_cart"=>"Add To Cart",
|
||||
"product_1"=> ".btn.btn-dark.ms-3.fw-bold",//购买商品
|
||||
"Wishlist_icon"=>".btn.btn-link.ps-0.text-secondary",//收藏
|
||||
"add_cart"=>".btn.btn-outline-dark.ms-md-3.add-cart.fw-bold",
|
||||
"product1_name"=>"#product-top > div:nth-child(2) > div > h1",//产品名字
|
||||
|
||||
"buy_btn"=> "#product-top > div:nth-child(2) > div > div.quantity-btns > button.btn.btn-dark.ms-3.fw-bold",//购买按钮
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class AdminSignOutTest extends DuskTestCase
|
|||
//2.退出
|
||||
->clickLink(admin_top['root'])
|
||||
->pause(2000)
|
||||
->clickLink(admin_top['sign_out'])
|
||||
->pause(3000)
|
||||
->click(admin_top['sign_out'])
|
||||
->pause(10000)
|
||||
->assertSee(admin_login['tltle']);
|
||||
// ->assertSee(true_login['assert']);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class GoCatalogTest extends DuskTestCase
|
|||
//2.去往前台
|
||||
->clicklink(admin_top['root'])
|
||||
->pause(3000)
|
||||
->clickLink(admin_top['go_catalog'])
|
||||
->click(admin_top['go_catalog'])
|
||||
->pause(2000)
|
||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||
$browser->assertPathIs(index['login_url'])
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ class GoPluginsTest extends DuskTestCase
|
|||
->press(admin_login['login_btn'])
|
||||
->pause(2000)
|
||||
//2.插件市场
|
||||
->clickLink(admin_top['plugins_market'])
|
||||
->click(admin_top['plugins_market'])
|
||||
->pause(2000)
|
||||
//3.切换到第二个窗口并获取断言
|
||||
//3.根据地址获取断言
|
||||
->assertPathIs(admin_assert['plugins_assert'])
|
||||
;
|
||||
;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class GoVipTest extends DuskTestCase
|
|||
->press(admin_login['login_btn'])
|
||||
->pause(2000)
|
||||
//2.点击vip图标
|
||||
->clickLink(admin_top['VIP'])
|
||||
->click(admin_top['VIP'])
|
||||
->pause(2000)
|
||||
//3.切换到第二个窗口并获取断言
|
||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||
|
|
|
|||
|
|
@ -27,14 +27,15 @@ class LanguageSwitchTest extends DuskTestCase
|
|||
->press(admin_login['login_btn'])
|
||||
->pause(2000)
|
||||
//2.点击切换语言
|
||||
->clickLink(admin_top['sw_language'])
|
||||
->click(admin_top['sw_language'])
|
||||
//3.切换为英文
|
||||
->clickLink(admin_top['en_language'])
|
||||
->click(admin_top['en_language'])
|
||||
->pause(4000)
|
||||
->assertSee(admin_assert['en_assert'])
|
||||
//切换回中文
|
||||
->clickLink(admin_top['en_language'])
|
||||
->clickLink(admin_top['sw_language'])
|
||||
->click(admin_top['sw_language'])
|
||||
->click(admin_top['ch_language'])
|
||||
->assertSee(admin_assert['ch_assert'])
|
||||
;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,23 @@ namespace Tests\Browser;
|
|||
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\DuskTestCase;
|
||||
use Facebook\WebDriver\WebDriverBy;
|
||||
use App\Http\Controllers\By;
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/login.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/login_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/account_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/product_1.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/index_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/checkout_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/order_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/login.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/login_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/admin_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/cus_grounp.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/customer_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/systemset_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/order_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/admin_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/express.php');
|
||||
|
||||
|
||||
class Test extends DuskTestCase
|
||||
{
|
||||
/**
|
||||
|
|
@ -25,36 +32,35 @@ class Test extends DuskTestCase
|
|||
|
||||
$this->browse(function (Browser $browser)
|
||||
{
|
||||
$browser->visit(admin_login['login_url'])
|
||||
//登录后台
|
||||
->type(admin_login['login_email'], admin_true_login['email'])
|
||||
->type(admin_login['login_pwd'], admin_true_login['password'])
|
||||
->press(admin_login['login_btn'])
|
||||
->pause(2000)
|
||||
//去往前台
|
||||
->pause(3000)
|
||||
->click(admin_top['mg_order'])
|
||||
//点击查看按钮
|
||||
->press(order_right['view_btn'])
|
||||
//点击状态栏下拉按钮
|
||||
->pause(2000)
|
||||
->press(order_details['pull_btn'])
|
||||
//修改状态为已支付
|
||||
->pause(2000)
|
||||
|
||||
->click(order_details['Shipped'])
|
||||
->press(order_details['express_btn'])
|
||||
//修改状态为已支付
|
||||
$browser->visit(login['login_url'])
|
||||
->type(login['login_email'], true_login['email'])
|
||||
->type(login['login_pwd'], true_login['password'])
|
||||
->press(login['login_btn'])
|
||||
->pause(5000)
|
||||
->waitFor(order_details['express_1'])
|
||||
->click(order_details['express_1'])
|
||||
->type(order_details['order_number'], express['password'])
|
||||
->press(order_details['submit'])
|
||||
->pause(3000)
|
||||
;
|
||||
|
||||
|
||||
|
||||
->assertSee(true_login['assert'])
|
||||
->pause(5000)
|
||||
->clickLink(account['go_index'])
|
||||
//3.向下滑动页面直到找到商品
|
||||
->pause(2000)
|
||||
->scrollIntoView(index['product_img'])
|
||||
->pause(2000)
|
||||
//点击要购买的商品
|
||||
->press(index['product_img'])
|
||||
//4.点击购买按钮
|
||||
->press(product['product_1'])
|
||||
->pause(5000)
|
||||
//5.点击确认按钮
|
||||
->press(checkout['submit'])
|
||||
->pause(5000);
|
||||
$elements = $browser->elements(checkout['order_num']);
|
||||
$order_num = $elements[15]->getText();
|
||||
//打印订单号
|
||||
echo $order_num;
|
||||
$browser->clickLink(checkout['view_order'])
|
||||
->pause(4000);
|
||||
// $text = $browser->text(get_order_status['status_text']);
|
||||
$browser->assertSeeIn(get_order_status['status_text'],'Unpaid');
|
||||
// echo $text
|
||||
;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ namespace App\Http\Controllers;
|
|||
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\DuskTestCase;
|
||||
use Facebook\WebDriver\WebDriverBy;
|
||||
use App\Http\Controllers\By;
|
||||
use function PHPUnit\Framework\assertNotEquals;
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/login.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/login_page.php');
|
||||
|
|
@ -13,11 +15,12 @@ require_once(dirname(__FILE__) . '/../../data/catalog/account_page.php');
|
|||
require_once(dirname(__FILE__) . '/../../data/catalog/product_1.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/index_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/checkout_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/order_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/login.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/login_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/order_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/admin_page.php');
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../data/admin/express.php');
|
||||
|
||||
//已注册客户且有地址,直接购买商品
|
||||
class AlterOrderStationTest extends DuskTestCase
|
||||
|
|
@ -27,7 +30,7 @@ class AlterOrderStationTest extends DuskTestCase
|
|||
$this->browse(function (Browser $browser)
|
||||
{
|
||||
$browser->visit(admin_login['login_url'])
|
||||
//登录后台
|
||||
//登录后台
|
||||
->type(admin_login['login_email'], admin_true_login['email'])
|
||||
->type(admin_login['login_pwd'], admin_true_login['password'])
|
||||
->press(admin_login['login_btn'])
|
||||
|
|
@ -35,13 +38,12 @@ class AlterOrderStationTest extends DuskTestCase
|
|||
//去往前台
|
||||
->clicklink(admin_top['root'])
|
||||
->pause(3000)
|
||||
->clickLink(admin_top['go_catalog'])
|
||||
->click(admin_top['go_catalog'])
|
||||
->pause(2000)
|
||||
//切换到前台下单
|
||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||
//前台用户登录
|
||||
//前台用户登录
|
||||
//点击登录图标
|
||||
|
||||
$browser->click(index_login['login_icon'])
|
||||
->type(login['login_email'], true_login['email'])
|
||||
->type(login['login_pwd'], true_login['password'])
|
||||
|
|
@ -65,11 +67,11 @@ class AlterOrderStationTest extends DuskTestCase
|
|||
//打印订单号
|
||||
echo $order_num;
|
||||
$browser->clickLink(checkout['view_order'])
|
||||
//进入后台
|
||||
//进入后台,修改订单状态为已支付
|
||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[0]);
|
||||
//点击订单管理按钮
|
||||
$browser->clickLink(admin_top['mg_order'])
|
||||
//搜索框输入订单号
|
||||
$browser->click(admin_top['mg_order'])
|
||||
//搜索框输入刚下单的订单号
|
||||
->type(order_right['search_order'],$order_num)
|
||||
//点击搜索按钮
|
||||
->press(order_right['search_bth'])
|
||||
|
|
@ -84,15 +86,55 @@ class AlterOrderStationTest extends DuskTestCase
|
|||
->click(order_details['paid'])
|
||||
->press(order_details['alter_btn'])
|
||||
->pause(3000)
|
||||
//切换到前台
|
||||
//切换到前台
|
||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||
$browser->pause(3000)
|
||||
//刷新页面
|
||||
->refresh()
|
||||
->pause(5000);
|
||||
// 断言是否已支付
|
||||
$browser->assertSeeIn(get_order_status['status_text'],ca_order_status['Paid'])
|
||||
//切换到后台,将状态改为已发货
|
||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[0]);
|
||||
$browser->pause(2000)
|
||||
->press(order_details['pull_btn'])
|
||||
//修改状态为已支付
|
||||
->pause(2000)
|
||||
->click(order_details['Shipped'])
|
||||
->press(order_details['express_btn'])
|
||||
//选择快递并填写订单号
|
||||
->pause(2000);
|
||||
// 找到所有 class 为 el-scrollbar__view el-select-dropdown__list 的元素
|
||||
$elements = $browser->elements(order_details['express_1']);
|
||||
// 获取第二个元素
|
||||
$secondElement = $elements[1];
|
||||
// 找到第一个子元素并点击它
|
||||
$secondElement->findElement(WebDriverBy::xpath('./*[1]'))->click();
|
||||
$browser->type(order_details['order_number'], express['express_code'])
|
||||
->press(order_details['submit'])
|
||||
->pause(3000)
|
||||
//切换到前台,断言是否已发货
|
||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||
$browser->pause(3000)
|
||||
->refresh()
|
||||
->pause(5000)
|
||||
// 查看是否已支付
|
||||
->assertSee(ca_order_status['paid'])
|
||||
//
|
||||
->click(admin_top['system_set'])
|
||||
->pause(2000);
|
||||
$browser->assertSeeIn(get_order_status['status_text'],ca_order_status['Shipped'])
|
||||
// 切换到后台,将订单状态改为已完成
|
||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[0]);
|
||||
$browser->pause(2000)
|
||||
->press(order_details['pull_btn'])
|
||||
//修改状态为完成
|
||||
->pause(2000)
|
||||
->click(order_details['Completed'])
|
||||
->press(order_details['submit_btn2'])
|
||||
->pause(3000)
|
||||
//切换到前台,断言状态是否为已完成
|
||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||
$browser->pause(3000)
|
||||
->refresh()
|
||||
->pause(4000);
|
||||
$browser->assertSeeIn(get_order_status['status_text'],ca_order_status['Completed'])
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class AddCartTest extends DuskTestCase
|
|||
->press(login['login_btn'])
|
||||
->pause(5000)
|
||||
//2.点击home跳转到首页
|
||||
->clickLink(account['go_index'])
|
||||
->click(account['go_index'])
|
||||
//3.向下滑动页面直到找到元素
|
||||
->scrollIntoView(index['product_img'])
|
||||
// ->mouseover(index['product_img'])
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class AddressTest extends DuskTestCase
|
|||
->press(login['login_btn'])
|
||||
->pause(5000)
|
||||
//2.点击address
|
||||
->clickLink(address['go_address'])
|
||||
->click(account['go_address'])
|
||||
//3.点击添加地址
|
||||
->press(address['add_btn'])
|
||||
->pause(3000)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class CartCheckoutTest extends DuskTestCase
|
|||
->press(login['login_btn'])
|
||||
->pause(2000)
|
||||
//2.点击home跳转到首页
|
||||
->clickLink(account['go_index'])
|
||||
->click(account['go_index'])
|
||||
//3.向下滑动页面直到找到元素
|
||||
->scrollIntoView(index['product_img'])
|
||||
->pause(2000)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ require_once(dirname(__FILE__) . '/../../data/catalog/login.php');
|
|||
require_once(dirname(__FILE__) . '/../../data/catalog/login_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/account_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/account.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/register.php');
|
||||
|
||||
|
||||
|
||||
|
|
@ -28,7 +29,7 @@ class EditUserInfo extends DuskTestCase
|
|||
->press(login['login_btn'])
|
||||
->pause(2000)
|
||||
//2.点击编辑
|
||||
->clickLink(Edit['go_Edit'])
|
||||
->click(account['go_Edit'])
|
||||
->pause(1000)
|
||||
//3.点击上传头像按钮
|
||||
// ->press(Edit['upload_btn'])
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class OrderTest extends DuskTestCase
|
|||
// print_r($html)
|
||||
// ->driver->getCurrentURL()
|
||||
//2.点击home跳转到首页
|
||||
->clickLink(account['go_index'])
|
||||
->click(account['go_index'])
|
||||
//3.向下滑动页面直到找到元素
|
||||
->scrollIntoView(index['product_img'])
|
||||
// ->mouseover(index['product_img'])
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ require_once(dirname(__FILE__) . '/../../data/catalog/login.php');
|
|||
require_once(dirname(__FILE__) . '/../../data/catalog/login_page.php');
|
||||
require_once(dirname(__FILE__) . '/../../data/catalog/register.php');
|
||||
|
||||
|
||||
class RegisterFirst extends DuskTestCase
|
||||
{
|
||||
/**
|
||||
|
|
@ -30,6 +31,7 @@ class RegisterFirst extends DuskTestCase
|
|||
->type(register['register_email'], false_register['exist_email'])
|
||||
->type(register['register_pwd'], true_register['password'])
|
||||
->type(register['register_re_pwd'], true_register['password'])
|
||||
->pause(2000)
|
||||
->press(register['register_btn'])
|
||||
->pause(6000)
|
||||
->assertSee(true_register['assert'])
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class RemoveCartTest extends DuskTestCase
|
|||
->press(login['login_btn'])
|
||||
->pause(2000)
|
||||
//2.点击home跳转到首页
|
||||
->clickLink(account['go_index'])
|
||||
->click(account['go_index'])
|
||||
//3.向下滑动页面直到找到元素
|
||||
->scrollIntoView(index['product_img'])
|
||||
->pause(2000)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class RemoveWishlistTest extends DuskTestCase
|
|||
->press(login['login_btn'])
|
||||
->pause(3000)
|
||||
//2.点击home跳转到首页
|
||||
->clickLink(account['go_index'])
|
||||
->click(account['go_index'])
|
||||
->pause(2000)
|
||||
//3.向下滑动页面直到找到元素
|
||||
->scrollIntoView(index['product_img'])
|
||||
|
|
@ -42,13 +42,13 @@ class RemoveWishlistTest extends DuskTestCase
|
|||
->press(product['Wishlist_icon'])
|
||||
->pause(3000)
|
||||
//6.点击顶部收藏认按钮
|
||||
->clickLink(index_top['wishlist_btn'])
|
||||
->click(index_top['wishlist_btn'])
|
||||
// ->pause(1000)
|
||||
//7.点击移除按钮
|
||||
->press(Wishlist['remove_Wishlist'])
|
||||
->pause(1000)
|
||||
->pause(3000)
|
||||
//8.断言
|
||||
->assertUrlIs($ProductUrl,$browser->driver->getCurrentURL())
|
||||
->assertVisible(Wishlist['no_data'])//no_data
|
||||
;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class SignOutTest extends DuskTestCase
|
|||
->press(login['login_btn'])
|
||||
->pause(5000)
|
||||
//2.退出
|
||||
->clickLink(account['SignOut'])
|
||||
->click(account['SignOut'])
|
||||
->pause(3000)
|
||||
->assertSee(false_login['false_assert']);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class WishlistTest extends DuskTestCase
|
|||
->pause(2000)
|
||||
|
||||
//2.点击home跳转到首页
|
||||
->clickLink(account['go_index'])
|
||||
->click(account['go_index'])
|
||||
->pause(2000)
|
||||
//3.向下滑动页面直到找到元素
|
||||
->scrollIntoView(index['product_img'])
|
||||
|
|
@ -46,10 +46,10 @@ class WishlistTest extends DuskTestCase
|
|||
->click(index_top['wishlist_btn'])
|
||||
->pause(1000)
|
||||
//7.点击查看详情按钮
|
||||
->clickLink(Wishlist['Check_Details'])
|
||||
->click(Wishlist['Check_Details'])
|
||||
->pause(1000)
|
||||
//8.断言
|
||||
->assertUrlIs($ProductUrl,$browser->driver->getCurrentURL())
|
||||
->assertVisible($ProductUrl,$browser->driver->getCurrentURL())
|
||||
;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue