diff --git a/tests/Browser/dusktest/RunnerTestCase/Run_Case.php b/tests/Browser/dusktest/RunnerTestCase/Run_Case.php index 3086ddbc..c045e4f4 100644 --- a/tests/Browser/dusktest/RunnerTestCase/Run_Case.php +++ b/tests/Browser/dusktest/RunnerTestCase/Run_Case.php @@ -18,8 +18,8 @@ use PHPUnit\TextUI\DefaultResultPrinter; $suite->addTestFile('.\tests\Browser\dusktest\page\front\AddressTest.php');//添加地址 $suite->addTestFile('.\tests\Browser\dusktest\page\front\AddCartTest.php');//加入购物车 $suite->addTestFile('.\tests\Browser\dusktest\page\front\RemoveCartTest.php');//移除购物车 + $suite->addTestFile('.\tests\Browser\dusktest\page\front\RemoveWishlistTest.php');//移除喜欢 $suite->addTestFile('.\tests\Browser\dusktest\page\front\WishlistTest.php');//加入喜欢 -// $suite->addTestFile('.\tests\Browser\dusktest\page\front\RemoveWishlistTest.php');//移除喜欢 $suite->addTestFile('.\tests\Browser\dusktest\page\front\EditUserInfo.php');//修改个人信息 //后台 $suite->addTestFile('.\tests\Browser\dusktest\page\admin\AdminLoginTest.php'); //后台登录 @@ -44,9 +44,10 @@ use PHPUnit\TextUI\DefaultResultPrinter; //前后台联测 -//场景1 前台下单,后台取消订单 - $suite->addTestFile('.\tests\Browser\dusktest\page\front\OrderTest.php');//商品页下单 - $suite->addTestFile('.\tests\Browser\dusktest\page\front\CartCheckoutTest.php');//购物车下单 + $suite->addTestFile('.\tests\Browser\dusktest\page\combine\AlterOrderStationTest.php');//商订单状态修改 + $suite->addTestFile('.\tests\Browser\dusktest\page\combine\CloseVisiterCheckoutTest.php');//禁用游客结账 + $suite->addTestFile('.\tests\Browser\dusktest\page\combine\OpenVisiterCheckoutTest.php');//开启游客结账 + $suite->addTestFile('.\tests\Browser\dusktest\page\combine\CreateCategoriesTest.php');//添加商品分类 // 运行测试套件 $result = $suite->run(); // 输出测试结果 diff --git a/tests/Browser/dusktest/data/admin/admin_page.php b/tests/Browser/dusktest/data/admin/admin_page.php index 6ba77f7f..ab4c379e 100644 --- a/tests/Browser/dusktest/data/admin/admin_page.php +++ b/tests/Browser/dusktest/data/admin/admin_page.php @@ -1,7 +1,7 @@ "/admin", - "root"=> "root", + "root"=> ".text-dark.ml-2", "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)",//管理商品 diff --git a/tests/Browser/dusktest/data/admin/cre_categories.php b/tests/Browser/dusktest/data/admin/cre_categories.php new file mode 100644 index 00000000..755c7dd7 --- /dev/null +++ b/tests/Browser/dusktest/data/admin/cre_categories.php @@ -0,0 +1,17 @@ +"categories_test", + "en_name"=>"categories_test", + "ch_content"=>"categories_content_test", + "en_content"=>"categories_content_test", + "ch_title"=>"categories_title_test", + "en_title"=>"categories_title_test", + "ch_keywords"=>"categories_keywords_test", + "en_keywords"=>"categories_keywords_test", + "ch_description"=>"categories_description_test", + "en_description"=>"categories_description_test", + + +]; + + diff --git a/tests/Browser/dusktest/data/admin/cre_categories_page.php b/tests/Browser/dusktest/data/admin/cre_categories_page.php new file mode 100644 index 00000000..c074349a --- /dev/null +++ b/tests/Browser/dusktest/data/admin/cre_categories_page.php @@ -0,0 +1,20 @@ +"descriptions[zh_cn][name]", + "en_name"=>"descriptions[en][name]", + "ch_content"=>"descriptions[zh_cn][content]", + "en_content"=>"descriptions[en][content]", + "parent_cate"=>"parent_id", + "ch_title"=>"descriptions[zh_cn][meta_title]", + "en_title"=>"descriptions[en][meta_title]", + "ch_keywords"=>"descriptions[zh_cn][meta_keywords]", + "en_keywords"=>"descriptions[en][meta_keywords]", + "ch_description"=>"descriptions[zh_cn][meta_description]", + "en_description"=>"descriptions[en][meta_description]", + "status_enable"=>"#active-1", + "status_disable"=>"#active-0", + "save_btn"=>".btn.btn-primary.mt-3", + +]; + + diff --git a/tests/Browser/dusktest/data/admin/express.php b/tests/Browser/dusktest/data/admin/express.php index 273e90f5..87c39409 100644 --- a/tests/Browser/dusktest/data/admin/express.php +++ b/tests/Browser/dusktest/data/admin/express.php @@ -4,6 +4,6 @@ const express = [ "express_company"=>"顺风快递", "express_code"=>"11011", - + "order_number"=>"110120188", ]; diff --git a/tests/Browser/dusktest/data/admin/product_page.php b/tests/Browser/dusktest/data/admin/product_page.php index 8b8f49ec..2f953661 100644 --- a/tests/Browser/dusktest/data/admin/product_page.php +++ b/tests/Browser/dusktest/data/admin/product_page.php @@ -1,6 +1,7 @@ "/admin/products", + ""=>"", "create_product"=>"#product-app > div > div > div.d-flex.justify-content-between.my-4 > a > button",//创建商品按钮 //编辑商品按钮 "edit_product" =>"#product-app > div > div > div.table-push > table > tbody > tr:nth-child(1) > td.text-end > a.btn.btn-outline-secondary.btn-sm", @@ -9,6 +10,18 @@ const products_top = [ "sure_btn"=>"确定", "get_name"=>"#product-app > div > div > div.table-push > table > tbody > tr:nth-child(1) > td:nth-child(4) > a", ]; +const products_left = [ + "product_cate"=>".list-unstyled.navbar-nav li:nth-child(1)",//商品分类 + "product_mg"=>".list-unstyled.navbar-nav li:nth-child(2)",//商品管理 + "product_brand"=>".list-unstyled.navbar-nav li:nth-child(3)",//商品品牌 + "attribute_group"=>".list-unstyled.navbar-nav li:nth-child(4)",//属性组 + "attribute"=>".list-unstyled.navbar-nav li:nth-child(5)",//属性 + "Recy_station"=>".list-unstyled.navbar-nav li:nth-child(6)",//回收站 +]; +const product_cla = [ + "cre_cate_btn"=>"#category-app > div > a",//创建分类按钮 + +]; const cre_assert = [ "cre_ful_assert"=>"创建成功!", "alter_ful_assert" =>"更新成功!", diff --git a/tests/Browser/dusktest/data/admin/systemset_page.php b/tests/Browser/dusktest/data/admin/systemset_page.php index ad30adf8..4face7ab 100644 --- a/tests/Browser/dusktest/data/admin/systemset_page.php +++ b/tests/Browser/dusktest/data/admin/systemset_page.php @@ -1,5 +1,7 @@ ".btn.btn-lg.btn-primary.submit-form" +]; const system_set = [ "basic_set"=>".nav.nav-tabs.nav-bordered.mb-5 li:nth-child(1)",//基础设置 @@ -9,6 +11,8 @@ const system_set = [ "express_set"=>".nav.nav-tabs.nav-bordered.mb-5 li:nth-child(5)",//快递公司 "advanced_filter"=>".nav.nav-tabs.nav-bordered.mb-5 li:nth-child(6)",//高级筛选 "email_set"=>".nav.nav-tabs.nav-bordered.mb-5 li:nth-child(7)",//邮件设置 + "close_visitor_checkout"=>"#tab-checkout > div:nth-child(1) > div > div > div:nth-child(2) > label",//游客结账 禁用 + "open_visitor_checkout"=>"#guest_checkout-1",//游客结账 启用 ]; const express_set = [ //快递公司 "add_btn"=>".bi.bi-plus-circle.cursor-pointer.fs-4",//加号 diff --git a/tests/Browser/dusktest/data/catalog/checkout_page.php b/tests/Browser/dusktest/data/catalog/checkout_page.php index 58138702..80202696 100644 --- a/tests/Browser/dusktest/data/catalog/checkout_page.php +++ b/tests/Browser/dusktest/data/catalog/checkout_page.php @@ -2,6 +2,7 @@ const checkout = [ + 'url' => '/checkout',//提交按钮 'submit' => 'Submit Order',//提交按钮 //订单成功验证信息 'assert' => 'Congratulations, the order was successfully generated!', diff --git a/tests/Browser/dusktest/data/catalog/index_page.php b/tests/Browser/dusktest/data/catalog/index_page.php index 838e8b65..70265ca1 100644 --- a/tests/Browser/dusktest/data/catalog/index_page.php +++ b/tests/Browser/dusktest/data/catalog/index_page.php @@ -6,11 +6,17 @@ const index = [ "address_btn" => "#checkout-address-app > div.checkout-black > div.addresses-wrap > div > div > div > button", //添加地址 "login_text" => "Home", "right_icon"=>".navbar-nav flex-row", + "top_Sports"=>".navbar-nav.mx-auto li:nth-child(1)", + "top_Fashion"=>".navbar-nav.mx-auto li:nth-child(2)", + "top_Digital"=>".navbar-nav.mx-auto li:nth-child(3)", + "top_Hot"=>".navbar-nav.mx-auto li:nth-child(4)", + "top_Brand"=>".navbar-nav.mx-auto li:nth-child(5)", + "top_Latest_Products"=>".navbar-nav.mx-auto li:nth-child(6)", ]; const index_top = [ // "wishlist_btn" => "",//收藏商品图标 "wishlist_btn" => ".navbar-nav.flex-row li:nth-child(2)",//收藏商品图标 - "top_Sports"=>"Sports", + "buy_btn" => "#product-top > div:nth-child(2) > div > div.quantity-btns > button.btn.btn-dark.ms-3.fw-bold",//购买按钮 "address_btn" => "#checkout-address-app > div.checkout-black > div.addresses-wrap > div > div > div > button", //添加地址 "login_text" => "Home", diff --git a/tests/Browser/dusktest/data/catalog/login_page.php b/tests/Browser/dusktest/data/catalog/login_page.php index e6cbf25a..9af696bc 100644 --- a/tests/Browser/dusktest/data/catalog/login_page.php +++ b/tests/Browser/dusktest/data/catalog/login_page.php @@ -16,3 +16,7 @@ const register = [ "register_btn"=> "Register", "register_text"=> "Home", ]; +const iframe = [ + "iframe_name"=>"#layui-layer-iframe1", +]; + diff --git a/tests/Browser/dusktest/data/catalog/order_page.php b/tests/Browser/dusktest/data/catalog/order_page.php index fb938ed5..e363cbe9 100644 --- a/tests/Browser/dusktest/data/catalog/order_page.php +++ b/tests/Browser/dusktest/data/catalog/order_page.php @@ -12,7 +12,8 @@ const ca_order_status = [ "Unpaid"=>"Unpaid",//待支付 "Paid"=>"Paid",//已支付 "Shipped"=>"Shipped",//已发货 - "Completed"=>"Completed",//已完成 + "Completed"=>"Completed",//已完成 Cancelled + "Cancelled"=>"Cancelled",//已完成 Cancelled ]; const get_order_status = [ "status_text"=>".table.table-borderless.mb-0 tbody tr:first-child td:nth-child(3)",//获取当前状态 diff --git a/tests/Browser/dusktest/page/admin/CusEmptyRecycleTest.php b/tests/Browser/dusktest/page/admin/CusEmptyRecycleTest.php index a49ca303..78aa1154 100644 --- a/tests/Browser/dusktest/page/admin/CusEmptyRecycleTest.php +++ b/tests/Browser/dusktest/page/admin/CusEmptyRecycleTest.php @@ -31,7 +31,7 @@ class CusEmptyRecycleTest extends DuskTestCase ->type(admin_login['login_pwd'], admin_true_login['password']) ->press(admin_login['login_btn']) ->pause(2000) - ->clickLink(admin_top['mg_customers']) + ->click(admin_top['mg_customers']) //2.点击回收站 ->clickLink(customer_left['re_station']) //3.点击清空回收站 diff --git a/tests/Browser/dusktest/page/admin/CustomerRecycleTest.php b/tests/Browser/dusktest/page/admin/CustomerRecycleTest.php index 92a716b0..41cbae42 100644 --- a/tests/Browser/dusktest/page/admin/CustomerRecycleTest.php +++ b/tests/Browser/dusktest/page/admin/CustomerRecycleTest.php @@ -18,7 +18,6 @@ class CustomerRecycleTest extends DuskTestCase -//场景1 email不合法 public function testEmptyRecycle() { @@ -31,7 +30,7 @@ class CustomerRecycleTest extends DuskTestCase ->type(admin_login['login_pwd'], admin_true_login['password']) ->press(admin_login['login_btn']) ->pause(2000) - ->clickLink(admin_top['mg_customers']) + ->click(admin_top['mg_customers']) //2.点击回收站 ->clickLink(customer_left['re_station']); $customer_text=$browser->text(empty_recycle['customer_text']); diff --git a/tests/Browser/dusktest/page/admin/DelCusGroupTest.php b/tests/Browser/dusktest/page/admin/DelCusGroupTest.php index 3bd49704..bdd05930 100644 --- a/tests/Browser/dusktest/page/admin/DelCusGroupTest.php +++ b/tests/Browser/dusktest/page/admin/DelCusGroupTest.php @@ -28,7 +28,7 @@ class DelCusGroupTest extends DuskTestCase ->press(admin_login['login_btn']) ->pause(2000) //2.点击客户管理 - ->clickLink(admin_top['mg_customers']) + ->click(admin_top['mg_customers']) ->pause(3000) //4.点击客户组 ->clickLink(customer_left['customer_group']); diff --git a/tests/Browser/dusktest/page/admin/DelCusRecycleTest.php b/tests/Browser/dusktest/page/admin/DelCusRecycleTest.php index 23f9f6df..898bdf7a 100644 --- a/tests/Browser/dusktest/page/admin/DelCusRecycleTest.php +++ b/tests/Browser/dusktest/page/admin/DelCusRecycleTest.php @@ -31,7 +31,7 @@ class DelCusRecycleTest extends DuskTestCase ->type(admin_login['login_pwd'], admin_true_login['password']) ->press(admin_login['login_btn']) ->pause(2000) - ->clickLink(admin_top['mg_customers']) + ->click(admin_top['mg_customers']) //先删除一个客户 ->press(customer_list['del_customer']) ->press(customer_list['sure_btn']) diff --git a/tests/Browser/dusktest/page/admin/DelCustomerTest.php b/tests/Browser/dusktest/page/admin/DelCustomerTest.php index f7ebd6c6..062f81e7 100644 --- a/tests/Browser/dusktest/page/admin/DelCustomerTest.php +++ b/tests/Browser/dusktest/page/admin/DelCustomerTest.php @@ -37,7 +37,6 @@ class DelCustomerTest extends DuskTestCase ->clickLink(admin_top['mg_customers']); $customer_text=$browser->text(customer_list['get_assert']); echo $customer_text; - //2.删除按钮 $browser->press(customer_list['del_customer']) //确认 ->press(customer_list['sure_btn']); diff --git a/tests/Browser/dusktest/page/admin/Test.php b/tests/Browser/dusktest/page/admin/Test.php index b5e2edd1..3d3150a6 100644 --- a/tests/Browser/dusktest/page/admin/Test.php +++ b/tests/Browser/dusktest/page/admin/Test.php @@ -19,6 +19,7 @@ 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'); +require_once(dirname(__FILE__) . '/../../data/admin/product_page.php'); class Test extends DuskTestCase @@ -29,39 +30,28 @@ class Test extends DuskTestCase */ public function testAddCusGroup() { - $this->browse(function (Browser $browser) { - $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) - ->assertSee(true_login['assert']) - ->pause(5000) - ->clickLink(account['go_index']) - //3.向下滑动页面直到找到商品 + $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) - ->scrollIntoView(index['product_img']) + ->click(admin_top['mg_product']) ->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 - ; + ->click(products_left['product_cla']) + ->pause(2000) + ->click(products_left['product_mg']) + ->pause(2000) + ->click(products_left['product_brand']) + ->pause(2000) + ->click(products_left['attribute_group']) + ->pause(2000) + ->click(products_left['attribute']) + ->pause(2000) + ->click(products_left['Recy_station']) + ->pause(2000) + ; }); } } diff --git a/tests/Browser/dusktest/page/combine/AlterOrderStationTest.php b/tests/Browser/dusktest/page/combine/AlterOrderStationTest.php index 1bb251d2..cc8f7f27 100644 --- a/tests/Browser/dusktest/page/combine/AlterOrderStationTest.php +++ b/tests/Browser/dusktest/page/combine/AlterOrderStationTest.php @@ -38,7 +38,7 @@ class AlterOrderStationTest extends DuskTestCase //去往前台 ->clicklink(admin_top['root']) ->pause(3000) - ->click(admin_top['go_catalog']) + ->clickLink(admin_top['go_catalog']) ->pause(2000) //切换到前台下单 ->driver->switchTo()->window($browser->driver->getWindowHandles()[1]); @@ -93,14 +93,15 @@ class AlterOrderStationTest extends DuskTestCase ->refresh() ->pause(5000); // 断言是否已支付 - $browser->assertSeeIn(get_order_status['status_text'],ca_order_status['Paid']) + $text = $browser->text(get_order_status['status_text']); + $browser->assertSeeIn($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']) + ->click(order_details['paid']) ->press(order_details['express_btn']) //选择快递并填写订单号 ->pause(2000); @@ -114,27 +115,12 @@ class AlterOrderStationTest extends DuskTestCase ->press(order_details['submit']) ->pause(3000) //切换到前台,断言是否已发货 - ->driver->switchTo()->window($browser->driver->getWindowHandles()[1]); - $browser->pause(3000) - ->refresh() - ->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']) - + $text = $browser->text(get_order_status['status_text']); + $browser->assertSeeIn($text,ca_order_status['Shipped']) ; diff --git a/tests/Browser/dusktest/page/combine/CancelOrderTest.php b/tests/Browser/dusktest/page/combine/CancelOrderTest.php new file mode 100644 index 00000000..5179c25d --- /dev/null +++ b/tests/Browser/dusktest/page/combine/CancelOrderTest.php @@ -0,0 +1,104 @@ +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) + //去往前台 + ->clicklink(admin_top['root']) + ->pause(3000) + ->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']) + ->press(login['login_btn']) + ->pause(5000) + ->click(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']) + //进入后台,修改订单状态为已支付 + ->driver->switchTo()->window($browser->driver->getWindowHandles()[0]); + //点击订单管理按钮 + $browser->click(admin_top['mg_order']) + //搜索框输入刚下单的订单号 + ->type(order_right['search_order'],$order_num) + //点击搜索按钮 + ->press(order_right['search_bth']) + ->assertSee($order_num) + //点击查看按钮 + ->press(order_right['view_btn']) + //点击状态栏下拉按钮 + ->pause(2000) + ->press(order_details['pull_btn']) + //修改状态为已支付 + ->pause(2000) + ->click(order_details['cancel']) + ->press(order_details['alter_btn']) + ->pause(3000) + //切换到前台 + ->driver->switchTo()->window($browser->driver->getWindowHandles()[1]); + $browser->pause(3000) + //刷新页面 + ->refresh() + ->pause(5000) + // 断言是否已取消 + ->assertSeeIn(get_order_status['status_text'],ca_order_status['Cancelled']) + + ; + + + + }); + } +} diff --git a/tests/Browser/dusktest/page/combine/CloseVisiterCheckoutTest.php b/tests/Browser/dusktest/page/combine/CloseVisiterCheckoutTest.php new file mode 100644 index 00000000..c3f515c6 --- /dev/null +++ b/tests/Browser/dusktest/page/combine/CloseVisiterCheckoutTest.php @@ -0,0 +1,76 @@ +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) + //点击系统设置 + ->click(admin_top['system_set']) + //点击结账设置 + ->click(system_set['pay_set']) + ->pause(2000) + //点击结游客结账 禁用 + ->press(system_set['close_visitor_checkout']) + //点击保存 + ->press(common['save_btn']) + ->pause(2000) + //去往前台验证 + ->click(admin_top['root']) + ->pause(3000) + ->click(admin_top['go_catalog']) + ->pause(2000) + //切换到前台下单 + ->driver->switchTo()->window($browser->driver->getWindowHandles()[1]); + //前台用户登录 + $browser->pause(2000) + //向下滑动页面直到找到商品 + ->scrollIntoView(index['product_img']) + ->pause(2000) + //点击要购买的商品 + ->press(index['product_img']) + //点击购买按钮 + ->press(product['product_1']) + ->pause(5000) + //断言:出现登录窗体则通过 + ->assertVisible(iframe['iframe_name']) + + + ; + + + + }); + } +} diff --git a/tests/Browser/dusktest/page/combine/CreateCategoriesTest.php b/tests/Browser/dusktest/page/combine/CreateCategoriesTest.php new file mode 100644 index 00000000..a7cc4f56 --- /dev/null +++ b/tests/Browser/dusktest/page/combine/CreateCategoriesTest.php @@ -0,0 +1,82 @@ +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) + //点击商品管理 + ->click(admin_top['mg_product']) + //点击商品分类 + ->click(products_left['product_cate']) + ->pause(2000) + //点击创建分类按钮 + ->press(product_cla['cre_cate_btn']) + //填写分类信息 + ->type(categories_info['ch_name'], categories_data['ch_name']) + ->type(categories_info['en_name'], categories_data['en_name']) + ->type(categories_info['ch_content'], categories_data['ch_content']) + ->type(categories_info['en_content'], categories_data['en_content']) + ->select(categories_info['parent_cate'], 2) + ->type(categories_info['ch_title'], categories_data['ch_title']) + ->type(categories_info['en_title'], categories_data['en_title']) + ->type(categories_info['ch_keywords'], categories_data['ch_keywords']) + ->type(categories_info['en_keywords'], categories_data['en_keywords']) + ->type(categories_info['ch_description'], categories_data['ch_description']) + ->type(categories_info['en_description'], categories_data['en_description']) + //点击启用 + ->click(categories_info['status_enable']) + //点击保存 + ->press(categories_info['save_btn']) + //跳转到前台并验证 + ->click(admin_top['root']) + ->pause(3000) + ->click(admin_top['go_catalog']) + ->pause(2000) + ->driver->switchTo()->window($browser->driver->getWindowHandles()[1]); + $browser->click(index['top_Sports']) + ->pause(4000) + ->assertSee(categories_data['ch_name']) + + + + ; + + + + }); + } +} diff --git a/tests/Browser/dusktest/page/combine/OpenVisiterCheckoutTest.php b/tests/Browser/dusktest/page/combine/OpenVisiterCheckoutTest.php new file mode 100644 index 00000000..e03ee52b --- /dev/null +++ b/tests/Browser/dusktest/page/combine/OpenVisiterCheckoutTest.php @@ -0,0 +1,76 @@ +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) + //点击系统设置 + ->click(admin_top['system_set']) + //点击结账设置 + ->click(system_set['pay_set']) + ->pause(2000) + //点击结游客结账 启用 + ->press(system_set['open_visitor_checkout']) + //点击保存 + ->press(common['save_btn']) + ->pause(2000) + //去往前台验证 + ->click(admin_top['root']) + ->pause(3000) + ->click(admin_top['go_catalog']) + ->pause(2000) + //切换到前台下单 + ->driver->switchTo()->window($browser->driver->getWindowHandles()[1]); + //前台用户登录 + $browser->pause(2000) + //向下滑动页面直到找到商品 + ->scrollIntoView(index['product_img']) + ->pause(2000) + //点击要购买的商品 + ->press(index['product_img']) + //点击购买按钮 + ->press(product['product_1']) + ->pause(5000) + //断言:出现登录窗体则通过 + ->assertPathIs(checkout['url']) + + + ; + + + + }); + } +} diff --git a/tests/Browser/dusktest/page/front/LoginTest.php b/tests/Browser/dusktest/page/front/LoginTest.php index 5d8c1598..b00fafb6 100644 --- a/tests/Browser/dusktest/page/front/LoginTest.php +++ b/tests/Browser/dusktest/page/front/LoginTest.php @@ -87,7 +87,7 @@ class LoginTest extends DuskTestCase ->type(login['login_pwd'], true_login['password']) ->press(login['login_btn']) ->pause(5000) - ->assertSee(true_login['assert']); + ->assertUrlIs(account['url']); }); } } diff --git a/tests/Browser/dusktest/page/front/RemoveCartTest.php b/tests/Browser/dusktest/page/front/RemoveCartTest.php index 04991003..11547192 100644 --- a/tests/Browser/dusktest/page/front/RemoveCartTest.php +++ b/tests/Browser/dusktest/page/front/RemoveCartTest.php @@ -39,7 +39,7 @@ class RemoveCartTest extends DuskTestCase ->press(product['add_cart']) ->pause(3000) //6.点击购物车按钮 - ->clickLink(index_cart['cart_icon']) + ->click(index_cart['cart_icon']) ->pause(3000) //7.点击移除按钮 ->press(index_cart['Delete_btn']) diff --git a/tests/Browser/dusktest/page/front/WishlistTest.php b/tests/Browser/dusktest/page/front/WishlistTest.php index ebaedda4..08f210a7 100644 --- a/tests/Browser/dusktest/page/front/WishlistTest.php +++ b/tests/Browser/dusktest/page/front/WishlistTest.php @@ -49,7 +49,7 @@ class WishlistTest extends DuskTestCase ->click(Wishlist['Check_Details']) ->pause(1000) //8.断言 - ->assertVisible($ProductUrl,$browser->driver->getCurrentURL()) + ->assertUrlIs($ProductUrl,$browser->driver->getCurrentURL()) ; }); } diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index 26b75cc0..c4cf5310 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -48,7 +48,7 @@ abstract class DuskTestCase extends BaseTestCase } protected function baseUrl() { - return 'http://beikeshop.test'; + return 'http://beiketu.test'; } /** diff --git a/! b/! new file mode 100644 index 00000000..efcad8e3 --- /dev/null +++ b/! @@ -0,0 +1,35 @@ + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# On branch feature-auto-test +# Your branch is up to date with 'origin/feature-auto-test'. +# +# Changes to be committed: +# modified: tests/Browser/dusktest/RunnerTestCase/Run_Case.php +# modified: tests/Browser/dusktest/data/admin/admin_page.php +# new file: tests/Browser/dusktest/data/admin/cre_categories.php +# new file: tests/Browser/dusktest/data/admin/cre_categories_page.php +# modified: tests/Browser/dusktest/data/admin/express.php +# modified: tests/Browser/dusktest/data/admin/product_page.php +# modified: tests/Browser/dusktest/data/admin/systemset_page.php +# modified: tests/Browser/dusktest/data/catalog/checkout_page.php +# modified: tests/Browser/dusktest/data/catalog/index_page.php +# modified: tests/Browser/dusktest/data/catalog/login_page.php +# modified: tests/Browser/dusktest/data/catalog/order_page.php +# modified: tests/Browser/dusktest/page/admin/CusEmptyRecycleTest.php +# modified: tests/Browser/dusktest/page/admin/CustomerRecycleTest.php +# modified: tests/Browser/dusktest/page/admin/DelCusGroupTest.php +# modified: tests/Browser/dusktest/page/admin/DelCusRecycleTest.php +# modified: tests/Browser/dusktest/page/admin/DelCustomerTest.php +# modified: tests/Browser/dusktest/page/admin/Test.php +# modified: tests/Browser/dusktest/page/combine/AlterOrderStationTest.php +# new file: tests/Browser/dusktest/page/combine/CancelOrderTest.php +# new file: tests/Browser/dusktest/page/combine/CloseVisiterCheckoutTest.php +# new file: tests/Browser/dusktest/page/combine/CreateCategoriesTest.php +# new file: tests/Browser/dusktest/page/combine/OpenVisiterCheckoutTest.php +# modified: tests/Browser/dusktest/page/front/LoginTest.php +# modified: tests/Browser/dusktest/page/front/RemoveCartTest.php +# modified: tests/Browser/dusktest/page/front/WishlistTest.php +# modified: tests/DuskTestCase.php +#