提交说明
This commit is contained in:
parent
168f65ed8e
commit
a55b1f5a63
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\CusGrounp;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
|
||||||
|
|
||||||
|
class AddCusGroupTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testAddCusGroup()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击客户管理
|
||||||
|
->click(AdminPage::TOP['mg_customers'])
|
||||||
|
->pause(3000)
|
||||||
|
//4.点击客户组
|
||||||
|
->click(CustomerPage::Left['customer_group'])
|
||||||
|
//5.点击创建客户组
|
||||||
|
->press(CustomerPage::Customer_Group['cre_cus_group'])
|
||||||
|
//4.填写客户组信息
|
||||||
|
->type(CustomerPage::Create_Group['ch_group_name'], CusGrounp::Group_Info['ch_group_name'])
|
||||||
|
->type(CustomerPage::Create_Group['en_group_name'], CusGrounp::Group_Info['en_group_name'])
|
||||||
|
->type(CustomerPage::Create_Group['ch_description'], CusGrounp::Group_Info['ch_description'])
|
||||||
|
->type(CustomerPage::Create_Group['en_description'], CusGrounp::Group_Info['en_description'])
|
||||||
|
->type(CustomerPage::Create_Group['discount'], CusGrounp::Group_Info['discount'])
|
||||||
|
|
||||||
|
//5.点击保存
|
||||||
|
->press(CustomerPage::Create_Group['save_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
->assertSee(CusGrounp::Group_Info['ch_group_name']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Beike\Models\Customer;
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CustomerData;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
class AddCustomerTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testAddCustomer()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击客户管理
|
||||||
|
->click(AdminPage::TOP['mg_customers'])
|
||||||
|
//3.点击创建客户
|
||||||
|
->press(CustomerPage::Group_list['cre_customer'])
|
||||||
|
//4.填写客户信息
|
||||||
|
->type(CustomerPage::Create['name'], CustomerData::Customer_Info['name'])
|
||||||
|
->type(CustomerPage::Create['email'], CustomerData::Customer_Info['email'])
|
||||||
|
->type(CustomerPage::Create['pwd'], CustomerData::Customer_Info['pwd'])
|
||||||
|
|
||||||
|
//5.点击保存
|
||||||
|
->press(CustomerPage::Create['save_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
->assertSee(CustomerData::Customer_Info['email']);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\Express;
|
||||||
|
use Tests\Data\Admin\SystemSetPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
|
||||||
|
class AddExpressTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testExpressTest()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
->pause(2000)
|
||||||
|
//点击系统
|
||||||
|
->click(AdminPage::TOP['system_set'])
|
||||||
|
//2.点击系统设置
|
||||||
|
->click(SystemSetPage::System_Left['system_set'])
|
||||||
|
//3.点击快递公司
|
||||||
|
->click(SystemSetPage::System_Set['express_set'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击+号
|
||||||
|
->click(SystemSetPage::System_Express['add_btn'])
|
||||||
|
//填写快递信息
|
||||||
|
->type(SystemSetPage::System_Express['express_company'], Express::Express['express_company'])
|
||||||
|
->type(SystemSetPage::System_Express['express_code'], Express::Express['express_code'])
|
||||||
|
->press(SystemSetPage::System_Express['save_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
|
||||||
|
->assertSee(SystemSetPage::Assert['assert_ful'])
|
||||||
|
->pause(3000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CreProduct;
|
||||||
|
use Tests\Data\Admin\CreProductPage;
|
||||||
|
use Tests\Data\Admin\ProductPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
class AddProductTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//场景1 email不合法
|
||||||
|
public function testAddProduct()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击商品
|
||||||
|
->click(AdminPage::TOP['mg_product'])
|
||||||
|
//2.点击商品管理
|
||||||
|
->click(ProductPage::Product_Left['product_mg'])
|
||||||
|
//3.点击创建
|
||||||
|
->press(ProductPage::Product_Top['create_product'])
|
||||||
|
//4.填写商品信息
|
||||||
|
->type(CreProductPage::Product_Top['ch_name'], CreProduct::Puoduct_Info['ch_name'])
|
||||||
|
->type(CreProductPage::Product_Top['en_name'], CreProduct::Puoduct_Info['en_name'])
|
||||||
|
->type(CreProductPage::Product_Top['sku'], CreProduct::Puoduct_Info['sku'])
|
||||||
|
->type(CreProductPage::Product_Top['price'], CreProduct::Puoduct_Info['price'])
|
||||||
|
->type(CreProductPage::Product_Top['origin_price'], CreProduct::Puoduct_Info['origin_price'])
|
||||||
|
->type(CreProductPage::Product_Top['cost_price'], CreProduct::Puoduct_Info['cost_price'])
|
||||||
|
->type(CreProductPage::Product_Top['quantity'], CreProduct::Puoduct_Info['quantity'])
|
||||||
|
//5.点击保存
|
||||||
|
->press(CreProductPage::Product_Top['save_btn'])
|
||||||
|
->assertSee(ProductPage::Assert['cre_ful_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
|
||||||
|
class AdminLoginTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//场景1 email不合法
|
||||||
|
public function testEmailIllegal()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::False_Data['illegal_email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->assertSee(LoginData::False_Data['illegal_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景2 email不存在
|
||||||
|
public function testEmailFalse()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::False_Data['false_email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->assertSee(LoginData::False_Data['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景3 密码错误
|
||||||
|
public function testPwdFalse()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::False_Data['false_password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->assertSee(LoginData::False_Data['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景4 只输入email
|
||||||
|
public function testOnlyEmail()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->assertSee(LoginData::False_Data['no_pwd']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景5 只输入密码
|
||||||
|
public function testOnlyPwd()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['email'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->assertSee(LoginData::False_Data['no_email']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景6 成功登录
|
||||||
|
public function testLoginFul()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
->assertSee(LoginData::Ture_Data['assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
|
||||||
|
|
||||||
|
class AdminSignOutTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//后台退出
|
||||||
|
public function testAdminSignOut()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.退出
|
||||||
|
->click(AdminPage::TOP['root'])
|
||||||
|
->pause(2000)
|
||||||
|
->click(AdminPage::TOP['sign_out'])
|
||||||
|
->pause(10000)
|
||||||
|
->assertSee(AdminLoginPage::Admin_Login['tltle']);
|
||||||
|
// ->assertSee(true_login['assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
|
||||||
|
class CusEmptyRecycleTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//场景1 email不合法
|
||||||
|
|
||||||
|
public function testEmptyRecycle()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击客户
|
||||||
|
->click(AdminPage::TOP['mg_customers'])
|
||||||
|
//2.点击回收站
|
||||||
|
->click(CustomerPage::Left['re_station'])
|
||||||
|
//3.点击清空回收站
|
||||||
|
->press(CustomerPage::Empty_Recycle['empty_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
->press(CustomerPage::Empty_Recycle['sure_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
->assertSee(CustomerPage::Empty_Recycle['assert_text']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
|
||||||
|
class CustomerRecycleTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testCustomerRecycle()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
->click(AdminPage::TOP['mg_customers'])
|
||||||
|
//2.点击回收站
|
||||||
|
->click(CustomerPage::Left['re_station']);
|
||||||
|
$customer_text = $browser->text(CustomerPage::Empty_Recycle['customer_text']);
|
||||||
|
echo $customer_text;
|
||||||
|
//3.点击恢复按钮
|
||||||
|
$browser->press(CustomerPage::Empty_Recycle['recycle_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//4.点击客户列表
|
||||||
|
->click(CustomerPage::Left['customer_list'])
|
||||||
|
//验证客户信息是否存在于页面
|
||||||
|
->assertSee($customer_text);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class DelCusGroupTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testDelCusGroup()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击客户管理
|
||||||
|
->click(AdminPage::TOP['mg_customers'])
|
||||||
|
->pause(3000)
|
||||||
|
//4.点击客户组
|
||||||
|
->click(CustomerPage::Left['customer_group']);
|
||||||
|
|
||||||
|
$cus_group_text = $browser->text(CustomerPage::Customer_Group['get_assert']);
|
||||||
|
echo $cus_group_text;
|
||||||
|
//5.点击删除按钮
|
||||||
|
$browser->press(CustomerPage::Customer_Group['del_cus_group'])
|
||||||
|
->pause(2000)
|
||||||
|
->assertSee($cus_group_text);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
|
||||||
|
|
||||||
|
class DelCusRecycleTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//场景1 email不合法
|
||||||
|
|
||||||
|
public function testDelCusRecycle()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
->click(AdminPage::TOP['mg_customers'])
|
||||||
|
//先删除一个客户
|
||||||
|
->press(CustomerPage::Group_list['del_customer'])
|
||||||
|
->press(CustomerPage::Group_list['sure_btn'])
|
||||||
|
->pause(1000)
|
||||||
|
//2.点击回收站
|
||||||
|
->click(CustomerPage::Left['re_station']);
|
||||||
|
$customer_text = $browser->text(CustomerPage::Empty_Recycle['customer_text']);
|
||||||
|
echo $customer_text;
|
||||||
|
//3.点击删除按钮
|
||||||
|
$browser->press(CustomerPage::Empty_Recycle['recycle_del'])
|
||||||
|
->pause(2000)
|
||||||
|
->press(CustomerPage::Empty_Recycle['sure_btn'])
|
||||||
|
//验证客户信息是否存在于页面
|
||||||
|
->assertSee($customer_text)
|
||||||
|
->pause(5000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
|
||||||
|
|
||||||
|
class DelCustomerTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//场景1 email不合法
|
||||||
|
|
||||||
|
public function testDelCustomer()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击客户管理
|
||||||
|
->click(AdminPage::TOP['mg_customers']);
|
||||||
|
$customer_text = $browser->text(CustomerPage::Group_list['get_assert']);
|
||||||
|
echo $customer_text;
|
||||||
|
$browser->press(CustomerPage::Group_list['del_customer'])
|
||||||
|
//确认
|
||||||
|
->press(CustomerPage::Group_list['sure_btn']);
|
||||||
|
$browser->pause(2000)
|
||||||
|
->assertDontSee($customer_text)
|
||||||
|
->pause(5000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\ProductPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
|
||||||
|
|
||||||
|
class DelProductTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//场景1 email不合法
|
||||||
|
|
||||||
|
public function testDelProduct()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
->click(AdminPage::TOP['mg_product']);
|
||||||
|
$product1_text = $browser->text(ProductPage::Product_Top['get_name']);
|
||||||
|
echo $product1_text;
|
||||||
|
//2.删除按钮
|
||||||
|
$browser->press(ProductPage::Product_Top['del_product'])
|
||||||
|
//确认
|
||||||
|
->press(ProductPage::Product_Top['sure_btn']);
|
||||||
|
$browser->pause(2000)
|
||||||
|
->assertDontSee($product1_text)
|
||||||
|
->pause(5000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CusGrounp;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class EditCusGroupTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testEditCusGroup()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击客户管理
|
||||||
|
->click(AdminPage::TOP['mg_customers'])
|
||||||
|
->pause(3000)
|
||||||
|
//4.点击客户组
|
||||||
|
->click(CustomerPage::Left['customer_group'])
|
||||||
|
//5.点击编辑客户组
|
||||||
|
->press(CustomerPage::Customer_Group['edit_cus_group'])
|
||||||
|
//4.填写客户组信息
|
||||||
|
->type(CustomerPage::Create_Group['ch_group_name'], CusGrounp::Group_Info['ch_group_name'])
|
||||||
|
->type(CustomerPage::Create_Group['en_group_name'], CusGrounp::Group_Info['en_group_name'])
|
||||||
|
->type(CustomerPage::Create_Group['ch_description'], CusGrounp::Group_Info['ch_description'])
|
||||||
|
->type(CustomerPage::Create_Group['en_description'], CusGrounp::Group_Info['en_description'])
|
||||||
|
->type(CustomerPage::Create_Group['discount'], CusGrounp::Group_Info['discount'])
|
||||||
|
//5.点击保存
|
||||||
|
->press(CustomerPage::Create_Group['save_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
->assertSee(CusGrounp::Group_Info['ch_group_name']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CustomerData;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class EditCustomerTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testEditCustomer()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击客户管理
|
||||||
|
->click(AdminPage::TOP['mg_customers'])
|
||||||
|
//3.点击编辑按钮
|
||||||
|
->press(CustomerPage::Group_list['edit_customer'])
|
||||||
|
//4.填写客户信息
|
||||||
|
->type(CustomerPage::Alter['name'], CustomerData::Customer_Info_Alter['name'])
|
||||||
|
->type(CustomerPage::Alter['email'], CustomerData::Customer_Info_Alter['email'])
|
||||||
|
->type(CustomerPage::Alter['pwd'], CustomerData::Customer_Info_Alter['pwd'])
|
||||||
|
//5.点击保存
|
||||||
|
->press(CustomerPage::Alter['save_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
->assertSee(CustomerData::Customer_Info_Alter['email']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CreProduct;
|
||||||
|
use Tests\Data\Admin\CreProductPage;
|
||||||
|
use Tests\Data\Admin\ProductPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
|
||||||
|
class EditProductTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//场景1 email不合法
|
||||||
|
public function testEditProduct()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击商品管理
|
||||||
|
->click(AdminPage::TOP['mg_product'])
|
||||||
|
//3.点击编辑商品
|
||||||
|
->press(ProductPage::Product_Top['edit_product'])
|
||||||
|
//4.填写商品信息
|
||||||
|
->type(CreProductPage::Product_Top['ch_name'], CreProduct::Puoduct_Info['ch_name'])
|
||||||
|
->type(CreProductPage::Product_Top['en_name'], CreProduct::Puoduct_Info['en_name'])
|
||||||
|
->type(CreProductPage::Product_Top['sku'], CreProduct::Puoduct_Info['sku'])
|
||||||
|
->type(CreProductPage::Product_Top['price'], CreProduct::Puoduct_Info['price'])
|
||||||
|
->type(CreProductPage::Product_Top['origin_price'], CreProduct::Puoduct_Info['origin_price'])
|
||||||
|
->type(CreProductPage::Product_Top['cost_price'], CreProduct::Puoduct_Info['cost_price'])
|
||||||
|
->type(CreProductPage::Product_Top['quantity'], CreProduct::Puoduct_Info['quantity'])
|
||||||
|
//5.点击保存
|
||||||
|
->press(CreProductPage::Product_Top['save_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
->assertSee(ProductPage::Assert['alter_ful_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
class GoCatalogTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//场景1 email不合法
|
||||||
|
public function testGoCatalog()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.去往前台
|
||||||
|
->click(AdminPage::TOP['root'])
|
||||||
|
->pause(3000)
|
||||||
|
->click(AdminPage::TOP['go_catalog'])
|
||||||
|
->pause(2000)
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
$browser->assertPathIs(IndexPage::Index['login_url']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class GoPluginsTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGopLugins()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.插件市场
|
||||||
|
->click(AdminPage::TOP['plugins_market'])
|
||||||
|
->pause(2000)
|
||||||
|
//3.根据地址获取断言
|
||||||
|
->assertPathIs(AdminPage::Assert['plugins_assert']);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
class GoVipTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGoVip()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击vip图标
|
||||||
|
->click(AdminPage::TOP['VIP'])
|
||||||
|
->pause(2000)
|
||||||
|
//3.切换到第二个窗口并获取断言
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
$browser->assertSee(AdminPage::Assert['vip_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class LanguageSwitchTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testLanguageSwitch()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击切换语言
|
||||||
|
->click(AdminPage::TOP['sw_language'])
|
||||||
|
//3.切换为英文
|
||||||
|
->click(AdminPage::TOP['en_language'])
|
||||||
|
->pause(4000)
|
||||||
|
->assertSee(AdminPage::Assert['en_assert'])
|
||||||
|
//切换回中文
|
||||||
|
->click(AdminPage::TOP['sw_language'])
|
||||||
|
->click(AdminPage::TOP['ch_language'])
|
||||||
|
->assertSee(AdminPage::Assert['ch_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Admin;
|
||||||
|
|
||||||
|
use Beike\Models\Language;
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\LoginPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
|
||||||
|
class Test extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testHomePage()
|
||||||
|
{
|
||||||
|
// \Tests\Data\Admin\AdminPage::TOP['login_url'];
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::ADMINLOGIN['login_url'])
|
||||||
|
->type(AdminLoginPage::ADMINLOGIN['login_email'], LoginData::TURE['email'])
|
||||||
|
->type(AdminLoginPage::ADMINLOGIN['login_pwd'], LoginData::TURE['password'])
|
||||||
|
->press(AdminLoginPage::ADMINLOGIN['login_btn'])
|
||||||
|
->pause(7000);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Combine;
|
||||||
|
|
||||||
|
use Facebook\WebDriver\WebDriverBy;
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\AdminOrderPage;
|
||||||
|
use Tests\Data\Admin\Express;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\CheckoutPage;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\OrderPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
|
||||||
|
//已注册客户且有地址,直接购买商品
|
||||||
|
class AlterOrderStationTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testAlterOrderStation()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//去往前台
|
||||||
|
->click(AdminPage::TOP['root'])
|
||||||
|
->pause(3000)
|
||||||
|
->click(AdminPage::TOP['go_catalog'])
|
||||||
|
->pause(2000)
|
||||||
|
//切换到前台下单
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
//前台用户登录
|
||||||
|
//点击登录图标
|
||||||
|
$browser->click(IndexPage::Index_Login['login_icon'])
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
//3.向下滑动页面直到找到商品
|
||||||
|
->pause(2000)
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击要购买的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
//4.点击购买按钮
|
||||||
|
->press(ProductOne::Product['product_1'])
|
||||||
|
->pause(3000)
|
||||||
|
//5.点击确认按钮
|
||||||
|
->press(CheckoutPage::Checkout['submit'])
|
||||||
|
->pause(5000);
|
||||||
|
$elements = $browser->elements(CheckoutPage::Checkout['order_num']);
|
||||||
|
$order_num = $elements[18]->getText();
|
||||||
|
//打印订单号
|
||||||
|
echo $order_num;
|
||||||
|
//点击个人中心按钮
|
||||||
|
$browser->click(IndexPage::Index_Login['login_icon'])
|
||||||
|
->click(AccountPage::Account['go_order'])
|
||||||
|
->click(AccountPage::Order['check_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
|
||||||
|
|
||||||
|
// $browser->click(CheckoutPage::Checkout['view_order'])
|
||||||
|
//进入后台,修改订单状态为已支付
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[0]);
|
||||||
|
//点击订单管理按钮
|
||||||
|
$browser->click(AdminPage::TOP['mg_order'])
|
||||||
|
->pause(3000)
|
||||||
|
//搜索框输入刚下单的订单号
|
||||||
|
->type(AdminOrderPage::Right['search_order'], $order_num)
|
||||||
|
//点击搜索按钮
|
||||||
|
->press(AdminOrderPage::Right['search_bth'])
|
||||||
|
->assertSee($order_num)
|
||||||
|
//点击查看按钮
|
||||||
|
->press(AdminOrderPage::Right['view_btn'])
|
||||||
|
//点击状态栏下拉按钮
|
||||||
|
->pause(2000)
|
||||||
|
->press(AdminOrderPage::Details['pull_btn'])
|
||||||
|
//修改状态为已支付
|
||||||
|
->pause(2000)
|
||||||
|
->click(AdminOrderPage::Details['paid'])
|
||||||
|
->press(AdminOrderPage::Details['alter_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
//切换到前台
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
$browser->pause(3000)
|
||||||
|
//刷新页面
|
||||||
|
->refresh()
|
||||||
|
->pause(1000)
|
||||||
|
// 断言是否已支付
|
||||||
|
->assertSeeIn(OrderPage::Get_Order_Status['status_text'],OrderPage::Order_Status['Paid'])
|
||||||
|
//切换到后台,将状态改为已发货
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[0]);
|
||||||
|
$browser->pause(2000)
|
||||||
|
->press(AdminOrderPage::Details['pull_btn'])
|
||||||
|
//修改状态为发货
|
||||||
|
->pause(2000)
|
||||||
|
->click(AdminOrderPage::Details['Shipped'])
|
||||||
|
->press(AdminOrderPage::Details['express_btn'])
|
||||||
|
//选择快递并填写订单号
|
||||||
|
->pause(2000);
|
||||||
|
// 找到所有 class 为 el-scrollbar__view el-select-dropdown__list 的元素
|
||||||
|
$elements = $browser->elements(AdminOrderPage::Details['express_1']);
|
||||||
|
// 获取第二个元素
|
||||||
|
$secondElement = $elements[1];
|
||||||
|
// 找到第一个子元素并点击它
|
||||||
|
$secondElement->findElement(WebDriverBy::xpath('./*[1]'))->click();
|
||||||
|
$browser->type(AdminOrderPage::Details['order_number'], Express::Express['express_code'])
|
||||||
|
->pause(2000)
|
||||||
|
//向下滑动找到更新按钮
|
||||||
|
->scrollIntoView(AdminOrderPage::Details['alter_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//按下更新按钮
|
||||||
|
->press(AdminOrderPage::Details['alter_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
//切换到前台,断言是否已发货
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
$browser->pause(3000)
|
||||||
|
->refresh()
|
||||||
|
->pause(4000)
|
||||||
|
->assertSeeIn(OrderPage::Get_Order_Status['status_text'], OrderPage::Order_Status['Shipped'])
|
||||||
|
//切换到后台,修改状态为已完成
|
||||||
|
;
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Combine;
|
||||||
|
|
||||||
|
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\CheckoutPage;
|
||||||
|
use Tests\Data\Admin\AdminOrderPage;
|
||||||
|
use Tests\Data\Catalog\OrderPage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
////前台下单,后台取消
|
||||||
|
class CancelOrderTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testCancelOrder()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//去往前台
|
||||||
|
->click(AdminPage::TOP['root'])
|
||||||
|
->pause(3000)
|
||||||
|
->click(AdminPage::TOP['go_catalog'])
|
||||||
|
->pause(2000)
|
||||||
|
//切换到前台下单
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
//前台用户登录
|
||||||
|
//点击登录图标
|
||||||
|
$browser->click(IndexPage::Index_Login['login_icon'])
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
//3.向下滑动页面直到找到商品
|
||||||
|
->pause(2000)
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击要购买的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
//4.点击购买按钮
|
||||||
|
->press(ProductOne::Product['product_1'])
|
||||||
|
->pause(5000)
|
||||||
|
//5.点击确认按钮
|
||||||
|
->press(CheckoutPage::Checkout['submit'])
|
||||||
|
->pause(5000);
|
||||||
|
$elements = $browser->elements(CheckoutPage::Checkout['order_num']);
|
||||||
|
$order_num = $elements[18]->getText();
|
||||||
|
//打印订单号
|
||||||
|
echo $order_num;
|
||||||
|
//点击个人中心按钮
|
||||||
|
$browser->click(IndexPage::Index_Login['login_icon'])
|
||||||
|
->click(AccountPage::Account['go_order'])
|
||||||
|
->click(AccountPage::Order['check_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
|
||||||
|
//进入后台,修改订单状态为已取消
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[0]);
|
||||||
|
//点击订单管理按钮
|
||||||
|
$browser->click(AdminPage::TOP['mg_order'])
|
||||||
|
//搜索框输入刚下单的订单号
|
||||||
|
->type(AdminOrderPage::Right['search_order'], $order_num)
|
||||||
|
//点击搜索按钮
|
||||||
|
->press(AdminOrderPage::Right['search_bth'])
|
||||||
|
->assertSee($order_num)
|
||||||
|
//点击查看按钮
|
||||||
|
->press(AdminOrderPage::Right['view_btn'])
|
||||||
|
//点击状态栏下拉按钮
|
||||||
|
->pause(2000)
|
||||||
|
->press(AdminOrderPage::Details['pull_btn'])
|
||||||
|
//修改状态为已取消
|
||||||
|
->pause(2000)
|
||||||
|
->click(AdminOrderPage::Details['cancel'])
|
||||||
|
->press(AdminOrderPage::Details['alter_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
//切换到前台
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
$browser->pause(3000)
|
||||||
|
//刷新页面
|
||||||
|
->refresh()
|
||||||
|
->pause(5000)
|
||||||
|
// 断言是否已取消
|
||||||
|
->assertSeeIn(OrderPage::Get_Order_Status['status_text'], OrderPage::Order_Status['Cancelled']);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Combine;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\SystemSetPage;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
|
||||||
|
|
||||||
|
//禁止游客结账
|
||||||
|
class CloseVisiterCheckoutTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testCloseVisiterCheckout()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击系统设置
|
||||||
|
->click(AdminPage::TOP['system_set'])
|
||||||
|
//点击结账设置
|
||||||
|
->click(SystemSetPage::System_Set['pay_set'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击结游客结账 禁用
|
||||||
|
->press(SystemSetPage::System_Set['close_visitor_checkout'])
|
||||||
|
//点击保存
|
||||||
|
->press(SystemSetPage::Common['save_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//去往前台验证
|
||||||
|
->click(AdminPage::TOP['root'])
|
||||||
|
->pause(3000)
|
||||||
|
->click(AdminPage::TOP['go_catalog'])
|
||||||
|
->pause(2000)
|
||||||
|
//切换到前台下单
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
//前台用户登录
|
||||||
|
$browser->pause(2000)
|
||||||
|
//向下滑动页面直到找到商品
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击要购买的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
//点击购买按钮
|
||||||
|
->press(ProductOne::Product['product_1'])
|
||||||
|
->pause(5000)
|
||||||
|
//断言:出现登录窗体则通过
|
||||||
|
->assertVisible(LoginPage::Iframe['iframe_name']);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Combine;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CreCategories;
|
||||||
|
use Tests\Data\Admin\CreCategoriesPage;
|
||||||
|
use Tests\Data\Admin\CreProduct;
|
||||||
|
use Tests\Data\Admin\CreProductPage;
|
||||||
|
use Tests\Data\Admin\ProductPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\OrderPage;
|
||||||
|
|
||||||
|
//增加商品分类
|
||||||
|
class CreateCategoriesTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testCreateCategories()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击商品管理
|
||||||
|
->click(AdminPage::TOP['mg_product'])
|
||||||
|
//点击商品分类
|
||||||
|
->click(ProductPage::Product_Left['product_cate'])
|
||||||
|
->pause(5000)
|
||||||
|
//点击创建分类按钮
|
||||||
|
->press(ProductPage::Cre_class['cre_cate_btn'])
|
||||||
|
//填写分类信息
|
||||||
|
->type(CreCategoriesPage::Cate_Page['ch_name'], CreCategories::Cate_Data['ch_name'])
|
||||||
|
->type(CreCategoriesPage::Cate_Page['en_name'], CreCategories::Cate_Data['en_name'])
|
||||||
|
->type(CreCategoriesPage::Cate_Page['ch_content'], CreCategories::Cate_Data['ch_content'])
|
||||||
|
->type(CreCategoriesPage::Cate_Page['en_content'], CreCategories::Cate_Data['en_content'])
|
||||||
|
->select(CreCategoriesPage::Cate_Page['parent_cate'], 2)
|
||||||
|
->type(CreCategoriesPage::Cate_Page['ch_title'], CreCategories::Cate_Data['ch_title'])
|
||||||
|
->type(CreCategoriesPage::Cate_Page['en_title'], CreCategories::Cate_Data['en_title'])
|
||||||
|
->type(CreCategoriesPage::Cate_Page['ch_keywords'], CreCategories::Cate_Data['ch_keywords'])
|
||||||
|
->type(CreCategoriesPage::Cate_Page['en_keywords'], CreCategories::Cate_Data['en_keywords'])
|
||||||
|
->type(CreCategoriesPage::Cate_Page['ch_description'], CreCategories::Cate_Data['ch_description'])
|
||||||
|
->type(CreCategoriesPage::Cate_Page['en_description'], CreCategories::Cate_Data['en_description'])
|
||||||
|
//点击启用
|
||||||
|
->click(CreCategoriesPage::Cate_Page['status_enable'])
|
||||||
|
//点击保存
|
||||||
|
->press(CreCategoriesPage::Cate_Page['save_btn'])
|
||||||
|
//跳转到前台并验证
|
||||||
|
->click(AdminPage::TOP['root'])
|
||||||
|
->pause(3000)
|
||||||
|
->click(AdminPage::TOP['go_catalog'])
|
||||||
|
->pause(2000)
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
$browser->click(IndexPage::Index['top_Sports'])
|
||||||
|
->pause(4000)
|
||||||
|
->assertSee(CreCategories::Cate_Data['ch_name']);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Combine;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CusGrounp;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CheckoutPage;
|
||||||
|
///客户组折扣判断
|
||||||
|
class
|
||||||
|
|
||||||
|
|
||||||
|
CustomerGroupDiscountTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testCustomerGroupDiscount()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击客户管理
|
||||||
|
->click(AdminPage::TOP['mg_customers'])
|
||||||
|
->pause(3000)
|
||||||
|
//4.点击客户组
|
||||||
|
->click(CustomerPage::Left['customer_group'])
|
||||||
|
//5.点击编辑客户组
|
||||||
|
->press(CustomerPage::Customer_Group['edit_cus_group'])
|
||||||
|
//4.填写客户组折扣为30
|
||||||
|
->type(CustomerPage::Create_Group['discount'], CusGrounp::Alter_Group_Info['discount'])
|
||||||
|
//5.点击保存
|
||||||
|
->press(CustomerPage::Create_Group['save_btn'])
|
||||||
|
->pause(5000);
|
||||||
|
//前台用户登录
|
||||||
|
//点击登录图标
|
||||||
|
$browser->click(AdminPage::TOP['root'])
|
||||||
|
->pause(3000)
|
||||||
|
->click(AdminPage::TOP['go_catalog'])
|
||||||
|
->pause(2000)
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
$browser->click(IndexPage::Index_Login['login_icon'])
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
//3.向下滑动页面直到找到商品
|
||||||
|
->pause(2000)
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击要购买的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
//4.点击购买按钮
|
||||||
|
->press(ProductOne::Product['product_1'])
|
||||||
|
->pause(5000);
|
||||||
|
//获取购买商品价格
|
||||||
|
$old_product_price = $browser->element(CheckoutPage::Checkout['product_price']);
|
||||||
|
$text = $old_product_price->getText();
|
||||||
|
$matches = [];
|
||||||
|
preg_match('/[\d\.]+/', $text, $matches);
|
||||||
|
$new_product_price = $matches[0];
|
||||||
|
|
||||||
|
// 获取购买商品的数量
|
||||||
|
$old_quantity = $browser->element(CheckoutPage::Checkout['quantity']);
|
||||||
|
$text = $old_quantity->getText();
|
||||||
|
$matches = [];
|
||||||
|
preg_match('/\d+/', $text, $matches);
|
||||||
|
$new_quantity = $matches[0];
|
||||||
|
//商品总价
|
||||||
|
// $old_product_total = $browser->element(CheckoutPage::Checkout['product_total']);
|
||||||
|
// $text = $old_product_total->getText();
|
||||||
|
// $matches = [];
|
||||||
|
// preg_match('/[\d\.]+/', $text, $matches);
|
||||||
|
// $new_product_total = $matches[0];
|
||||||
|
//运费
|
||||||
|
$old_shipping_fee = $browser->element(CheckoutPage::Checkout['shipping_fee']);
|
||||||
|
$text = $old_shipping_fee->getText();
|
||||||
|
$matches = [];
|
||||||
|
preg_match('/[\d\.]+/', $text, $matches);
|
||||||
|
$new_shipping_fee = $matches[0];
|
||||||
|
//折扣金额
|
||||||
|
// $old_customer_discount = $browser->element(CheckoutPage::Checkout['customer_discount']);
|
||||||
|
// $text = $old_customer_discount->getText();
|
||||||
|
// $matches = [];
|
||||||
|
// preg_match('/[\d\.]+/', $text, $matches);
|
||||||
|
// $new_customer_discount = $matches[0];
|
||||||
|
// //实际金额
|
||||||
|
// $old_order_total = $browser->element(CheckoutPage::Checkout['order_total']);
|
||||||
|
// $text = $old_order_total->getText();
|
||||||
|
// $matches = [];
|
||||||
|
// preg_match('/[\d\.]+/', $text, $matches);
|
||||||
|
// $new_order_total = $matches[0];
|
||||||
|
//打印订单号
|
||||||
|
// echo $new_product_price;
|
||||||
|
// echo $new_quantity;
|
||||||
|
// echo $new_product_total;
|
||||||
|
// echo $new_shipping_fee;
|
||||||
|
// echo $new_customer_discount;
|
||||||
|
// echo $new_order_total;
|
||||||
|
$discunt_price = $new_product_price * $new_quantity * (30 / 100);
|
||||||
|
// echo $discunt_price;
|
||||||
|
$true_price = $new_product_price * $new_quantity - $discunt_price + $new_shipping_fee;
|
||||||
|
$browser->assertSeeIn(CheckoutPage::Checkout['customer_discount'], $discunt_price)
|
||||||
|
->assertSeeIn(CheckoutPage::Checkout['order_total'], $true_price);
|
||||||
|
//5.点击确认按钮
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Combine;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CreProductPage;
|
||||||
|
use Tests\Data\Admin\ProductPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
|
||||||
|
class DisableProductTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//启用商品
|
||||||
|
|
||||||
|
public function testDisableProduct()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
->click(AdminPage::TOP['mg_product']);
|
||||||
|
$product1_text = $browser->text(ProductPage::Product_Top['get_name']);
|
||||||
|
echo $product1_text;
|
||||||
|
//编辑商品
|
||||||
|
$browser->press(ProductPage::Product_Top['edit_product'])
|
||||||
|
//启用商品
|
||||||
|
->click(CreProductPage::Product_Top['Disable'])
|
||||||
|
//点击保存
|
||||||
|
->press(CreProductPage::Product_Top['save_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
//点击商品,跳转前台
|
||||||
|
->clickLink($product1_text)
|
||||||
|
->pause(2000)
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
//断言是否有下架提示
|
||||||
|
$browser->assertVisible(CreProductPage::Product_Assert['Disable_text'])
|
||||||
|
->pause(3000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Combine;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CreProductPage;
|
||||||
|
use Tests\Data\Admin\ProductPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
class EnableProductTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//启用商品
|
||||||
|
|
||||||
|
public function testEnableProduct()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
->click(AdminPage::TOP['mg_product']);
|
||||||
|
$product1_text = $browser->text(ProductPage::Product_Top['get_name']);
|
||||||
|
echo $product1_text;
|
||||||
|
//编辑商品
|
||||||
|
$browser->press(ProductPage::Product_Top['edit_product'])
|
||||||
|
//启用商品
|
||||||
|
->click(CreProductPage::Product_Top['Enable'])
|
||||||
|
//点击保存
|
||||||
|
->press(CreProductPage::Product_Top['save_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
//点击商品,跳转前台
|
||||||
|
->clickLink($product1_text)
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
//断言页面是否有购买按钮
|
||||||
|
$browser->assertVisible(ProductOne::Product['product_1'])
|
||||||
|
->pause(3000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Combine;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\CheckoutPage;
|
||||||
|
use Tests\Data\Admin\SystemSetPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//禁止游客结账
|
||||||
|
class OpenVisiterCheckoutTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testCancelOrder()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击系统设置
|
||||||
|
->click(AdminPage::TOP['system_set'])
|
||||||
|
//点击结账设置
|
||||||
|
->click(SystemSetPage::System_Set['pay_set'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击结游客结账 启用
|
||||||
|
->press(SystemSetPage::System_Set['open_visitor_checkout'])
|
||||||
|
//点击保存
|
||||||
|
->press(SystemSetPage::Common['save_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//去往前台验证
|
||||||
|
->click(AdminPage::TOP['root'])
|
||||||
|
->pause(3000)
|
||||||
|
->click(AdminPage::TOP['go_catalog'])
|
||||||
|
->pause(2000)
|
||||||
|
//切换到前台下单
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
//前台用户登录
|
||||||
|
$browser->pause(2000)
|
||||||
|
//向下滑动页面直到找到商品
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击要购买的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
//点击购买按钮
|
||||||
|
->press(ProductOne::Product['product_1'])
|
||||||
|
->pause(5000)
|
||||||
|
//断言:出现登录窗体则通过
|
||||||
|
->assertPathIs(CheckoutPage::Checkout['url']);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Combine;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Admin\CreProduct;
|
||||||
|
use Tests\Data\Admin\CreProductPage;
|
||||||
|
use Tests\Data\Admin\CusGrounp;
|
||||||
|
use Tests\Data\Admin\CustomerPage;
|
||||||
|
use Tests\Data\Admin\ProductPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Admin\AdminLoginPage;
|
||||||
|
use Tests\Data\Admin\AdminPage;
|
||||||
|
use Tests\Data\Admin\LoginData;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CheckoutPage;
|
||||||
|
|
||||||
|
////库存不足时下单
|
||||||
|
class UnderstockOrderTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testUnderstockOrder()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(AdminLoginPage::Admin_Login['login_url'])
|
||||||
|
//1.登录
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_email'], LoginData::Ture_Data['email'])
|
||||||
|
->type(AdminLoginPage::Admin_Login['login_pwd'], LoginData::Ture_Data['password'])
|
||||||
|
->press(AdminLoginPage::Admin_Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//修改商品库存为5
|
||||||
|
->click(AdminPage::TOP['mg_product']);
|
||||||
|
//获取商品名
|
||||||
|
$product1_text = $browser->text(ProductPage::Product_Top['get_name']);
|
||||||
|
echo $product1_text;
|
||||||
|
//点击编辑商品
|
||||||
|
$browser->press(ProductPage::Product_Top['edit_product'])
|
||||||
|
//修改商品库存为5
|
||||||
|
->type(CreProductPage::Product_Top['quantity'], CreProduct::Alter['low_quantity'])
|
||||||
|
//5.点击保存
|
||||||
|
->press(CreProductPage::Product_Top['save_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
|
||||||
|
//去往前台下单
|
||||||
|
->clickLink($product1_text)
|
||||||
|
->pause(2000)
|
||||||
|
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
||||||
|
//输入库存
|
||||||
|
$browser->pause(2000)
|
||||||
|
->type(ProductOne::Product['quantity'], CreProduct::Alter['low_quantity'])
|
||||||
|
//在库存基础上数量+1 quantity_up
|
||||||
|
->click(ProductOne::Product['quantity_up'])
|
||||||
|
//4.点击购买按钮
|
||||||
|
->press(ProductOne::Product['product_1'])
|
||||||
|
->pause(2000)
|
||||||
|
//断言 understock_assert
|
||||||
|
->assertVisible(ProductOne::Product['understock_assert']);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
|
||||||
|
//已注册客户且有地址,直接购买商品
|
||||||
|
class AddCartTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testAddCart()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
//2.点击home跳转到首页
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
//3.向下滑动页面直到找到元素
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
// ->mouseover(index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击要加入购物车的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000);
|
||||||
|
|
||||||
|
//3.获取当前产品标题
|
||||||
|
$product_description = $browser->text(ProductOne::Product['product1_name']);
|
||||||
|
$ProductUrl = $browser->driver->getCurrentURL();
|
||||||
|
//4.点击收藏按钮
|
||||||
|
$browser->visit($ProductUrl)
|
||||||
|
//5.点击加入购物车
|
||||||
|
|
||||||
|
->press(ProductOne::Product['add_cart'])
|
||||||
|
->pause(3000)
|
||||||
|
//6.点击购物车按钮
|
||||||
|
->click(IndexPage::Index_Cart['cart_icon'])
|
||||||
|
->pause(10000);
|
||||||
|
//6.断言购物车内商品是否与先前商品相同
|
||||||
|
$browser->assertSeeIn(IndexPage::Index_Cart['product_text'], $product_description);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\AccountData;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
|
||||||
|
//已注册客户且有地址,直接购买商品
|
||||||
|
class AddressTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testAddress()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
|
||||||
|
->pause(5000)
|
||||||
|
//2.点击address
|
||||||
|
->click(AccountPage::Account['go_address'])
|
||||||
|
//3.点击添加地址
|
||||||
|
->press(AccountPage::Address['add_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
//3.1 name
|
||||||
|
->type(AccountPage::Address['add_name'], AccountData::Add_Address['add_name'])
|
||||||
|
//3.2 phone
|
||||||
|
// ->type(AccountPage::Address['add_phone'], AccountData::Add_Address['add_phone'])
|
||||||
|
//3.3 address
|
||||||
|
->type(AccountPage::Address['add_address'], AccountData::Add_Address['add_province'])
|
||||||
|
// //3.4 code
|
||||||
|
// ->type(AccountPage::Address['add_code'], AccountData::Add_Address['add_code'])
|
||||||
|
//3.5 address1
|
||||||
|
->type(AccountPage::Address['add_address1'], AccountData::Add_Address['add_address1'])
|
||||||
|
// //3.6 address2
|
||||||
|
// ->type(AccountPage::Address['add_address2'], AccountData::Add_Address['add_address2'])
|
||||||
|
//3.7 defaule
|
||||||
|
->press((AccountPage::Address['default']))
|
||||||
|
//3.8 save
|
||||||
|
->press((AccountPage::Address['save']))
|
||||||
|
->pause(3000)
|
||||||
|
->assertSee(AccountPage::Address['assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CheckoutPage;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
|
||||||
|
//已注册客户且有地址,直接购买商品
|
||||||
|
class CartCheckoutTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testCartCheckout()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击home跳转到首页
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
//3.向下滑动页面直到找到元素
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//4.点击要加入购物车的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//5.点击加入购物车
|
||||||
|
->press(ProductOne::Product['add_cart'])
|
||||||
|
->pause(3000)
|
||||||
|
//6.点击购物车按钮
|
||||||
|
->click(IndexPage::Index_Cart['cart_icon'])
|
||||||
|
->pause(3000)
|
||||||
|
//7.点击结账按钮
|
||||||
|
->press(IndexPage::Index_Cart['cart_Checkout'])
|
||||||
|
->pause(5000)
|
||||||
|
//8.点击确认按钮
|
||||||
|
->press(CheckoutPage::Checkout['submit'])
|
||||||
|
->pause(5000)
|
||||||
|
//9.断言
|
||||||
|
->assertSee(CheckoutPage::Checkout['assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CheckoutPage;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
|
||||||
|
|
||||||
|
//已注册客户且有地址,在下单时更换支付方式购买
|
||||||
|
class ChangePayMethodTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testChangePayMethod()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
//当前网址断言
|
||||||
|
->assertPathIs(AccountPage::Account['url'])
|
||||||
|
//2.点击home跳转到首页
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
//3.向下滑动页面直到找到元素
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击要购买的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
//4.点击购买按钮
|
||||||
|
->press(ProductOne::Product['product_1'])
|
||||||
|
->pause(5000)
|
||||||
|
//点击第二种支付方式
|
||||||
|
|
||||||
|
->elements(CheckoutPage::Checkout['method_pay'])[1]->click();
|
||||||
|
$browser->pause(5000)
|
||||||
|
//5.点击确认按钮
|
||||||
|
->press(CheckoutPage::Checkout['submit'])
|
||||||
|
->pause(5000)
|
||||||
|
//6.断言
|
||||||
|
->assertSee(CheckoutPage::Checkout['assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\AccountData;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\RegisterData;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
|
||||||
|
//已注册客户且有地址,直接购买商品
|
||||||
|
class EditUserInfo extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testEditInfo()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], RegisterData::True_Register['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击编辑
|
||||||
|
->click(AccountPage::Account['go_Edit'])
|
||||||
|
->pause(1000)
|
||||||
|
//3.点击上传头像按钮
|
||||||
|
// ->press(AccountPage::Edit['upload_btn'])
|
||||||
|
// ->pause(3000)
|
||||||
|
// ->waitFor('#file-input') // 等待文件上传控件出现
|
||||||
|
// ->assertVisible('#file-input') // 确保文件上传控件可见
|
||||||
|
// ->assertEnabled('#file-input') // 确保文件上传控件可用
|
||||||
|
// ->attach(AccountPage::Edit['upload_btn'],realpath('.tests/Browser/dusktest/data/Images/Headpicture/Headpicture.jpeg'))
|
||||||
|
// ->press(AccountPage::Edit['Confirm_btn'])
|
||||||
|
// ->pause(3000)
|
||||||
|
//3.1 name
|
||||||
|
->type(AccountPage::Edit['user_name'], AccountData::User_Edit['user_name'])
|
||||||
|
//3.2 phone
|
||||||
|
->type(AccountPage::Edit['user_email'], AccountData::User_Edit['user_email'])
|
||||||
|
//3.3 save
|
||||||
|
->press((AccountPage::Edit['Submit']))
|
||||||
|
->pause(3000)
|
||||||
|
->assertSee(AccountPage::Edit['assert']);
|
||||||
|
//3.向下滑动页面直到找到元素
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
|
||||||
|
class LoginTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
//场景1 email不合法
|
||||||
|
public function testEmailIllegal()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::False_Login['illegal_email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->assertSee(CataLoginData::False_Login['illegal_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景2 email不存在
|
||||||
|
public function testEmailFalse()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::False_Login['false_email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->assertSee(CataLoginData::False_Login['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景3 密码错误
|
||||||
|
public function testPwdFalse()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::False_Login['false_password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->assertSee(CataLoginData::False_Login['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景4 只输入账号
|
||||||
|
public function testOnlyEmail()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->assertSee(CataLoginData::False_Login['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景5 只输入密码
|
||||||
|
public function testOnlyPwd()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['email'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->assertSee(CataLoginData::False_Login['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景6 成功登录
|
||||||
|
public function testLoginFul()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
|
||||||
|
->pause(5000)
|
||||||
|
->assertPathIs(AccountPage::Account['url']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CheckoutPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
|
||||||
|
//已注册客户且有地址,直接购买商品
|
||||||
|
class OrderTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testOrder()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
//当前网址断言
|
||||||
|
->assertPathIs(AccountPage::Account['url'])
|
||||||
|
//打印查看当前网址
|
||||||
|
// $html = $browser->driver->getCurrentURL();
|
||||||
|
// print_r($html)
|
||||||
|
// ->driver->getCurrentURL()
|
||||||
|
//2.点击home跳转到首页
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
//3.向下滑动页面直到找到元素
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
// ->mouseover(index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//点击要购买的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
//4.点击购买按钮
|
||||||
|
->press(ProductOne::Product['product_1'])
|
||||||
|
->pause(5000)
|
||||||
|
//5.点击确认按钮
|
||||||
|
->press(CheckoutPage::Checkout['submit'])
|
||||||
|
->pause(5000)
|
||||||
|
//6.断言
|
||||||
|
->assertSee(CheckoutPage::Checkout['assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\RegisterData;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class RegisterFirst extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//1.先单独注册一个账号
|
||||||
|
public function testLoginFirst()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Register['register_email'], RegisterData::False_Register['exist_email'])
|
||||||
|
->type(LoginPage::Register['register_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->type(LoginPage::Register['register_re_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->pause(2000)
|
||||||
|
->press(LoginPage::Register['register_btn'])
|
||||||
|
->pause(6000)
|
||||||
|
->assertSee(RegisterData::True_Register['assert'])
|
||||||
|
->pause(2000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\RegisterData;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
|
||||||
|
|
||||||
|
class RegisterTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
*/
|
||||||
|
//场景1 使用已注册过的邮箱注册
|
||||||
|
public function testUsedEmail()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Register['register_email'], RegisterData::False_Register['exist_email'])
|
||||||
|
->type(LoginPage::Register['register_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->type(LoginPage::Register['register_re_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->press(LoginPage::Register['register_btn'])
|
||||||
|
->assertSee(RegisterData::False_Register['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景2 前后密码输入不一致
|
||||||
|
public function testDiffPwd()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Register['register_email'], RegisterData::True_Register['email'])
|
||||||
|
->type(LoginPage::Register['register_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->type(LoginPage::Register['register_re_pwd'], RegisterData::False_Register['false_password'])
|
||||||
|
->press(LoginPage::Register['register_btn'])
|
||||||
|
->assertSee(RegisterData::False_Register['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景3 邮箱格式不合法
|
||||||
|
public function testIllegalEmail()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Register['register_email'], RegisterData::False_Register['illegal_email'])
|
||||||
|
->type(LoginPage::Register['register_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->type(LoginPage::Register['register_re_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->press(LoginPage::Register['register_btn'])
|
||||||
|
->assertSee(RegisterData::False_Register['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景4 邮箱为空
|
||||||
|
public function testNoEmail()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Register['register_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->type(LoginPage::Register['register_re_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->press(LoginPage::Register['register_btn'])
|
||||||
|
->assertSee(RegisterData::False_Register['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景5 密码为空
|
||||||
|
public function testNoPwd()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Register['register_email'], RegisterData::True_Register['email'])
|
||||||
|
->type(LoginPage::Register['register_re_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->press(LoginPage::Register['register_btn'])
|
||||||
|
->assertSee(RegisterData::False_Register['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景6 第二次密码为空
|
||||||
|
public function testNoRepwd()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Register['register_email'], RegisterData::True_Register['email'])
|
||||||
|
->type(LoginPage::Register['register_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->press(LoginPage::Register['register_btn'])
|
||||||
|
->assertSee(RegisterData::False_Register['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//场景7 第二次密码为空
|
||||||
|
public function testRegisterFul()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
->type(LoginPage::Register['register_email'], RegisterData::True_Register['email'])
|
||||||
|
->type(LoginPage::Register['register_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->type(LoginPage::Register['register_re_pwd'], RegisterData::True_Register['password'])
|
||||||
|
->press(LoginPage::Register['register_btn'])
|
||||||
|
->pause(6000)
|
||||||
|
->assertSee(RegisterData::True_Register['assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
|
||||||
|
//已注册客户且有地址,直接购买商品
|
||||||
|
class RemoveCartTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testRemoveCart()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
//2.点击home跳转到首页
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
//3.向下滑动页面直到找到元素
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//4.点击要加入购物车的商品
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
//5.点击加入购物车
|
||||||
|
->press(ProductOne::Product['add_cart'])
|
||||||
|
->pause(3000)
|
||||||
|
//6.点击购物车按钮
|
||||||
|
->click(IndexPage::Index_Cart['cart_icon'])
|
||||||
|
->pause(3000)
|
||||||
|
//7.点击移除按钮
|
||||||
|
->click(IndexPage::Index_Cart['Delete_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
->assertSeeIn(IndexPage::Index_Cart['product_num'], '0')
|
||||||
|
->pause(3000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
|
||||||
|
//已注册客户且有地址,直接购买商品
|
||||||
|
class RemoveWishlistTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testReWishlist()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(3000)
|
||||||
|
//2.点击home跳转到首页
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
->pause(2000)
|
||||||
|
//3.向下滑动页面直到找到元素
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000);
|
||||||
|
//4.保存当前网址
|
||||||
|
$ProductUrl = $browser->driver->getCurrentURL();
|
||||||
|
//5.点击收藏按钮
|
||||||
|
$browser->visit($ProductUrl)
|
||||||
|
->press(ProductOne::Product['Wishlist_icon'])
|
||||||
|
->pause(3000)
|
||||||
|
//6.点击顶部收藏认按钮
|
||||||
|
->click(IndexPage::Index_Top['wishlist_btn'])
|
||||||
|
// ->pause(1000)
|
||||||
|
//7.点击移除按钮
|
||||||
|
->press(AccountPage::Wishlist['remove_Wishlist'])
|
||||||
|
->pause(3000)
|
||||||
|
//8.断言
|
||||||
|
->assertVisible(AccountPage::Wishlist['no_data'])//no_data
|
||||||
|
;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
|
||||||
|
class SignOutTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* A basic browser test example.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function testSignOut()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(5000)
|
||||||
|
//2.退出
|
||||||
|
->click(AccountPage::Account['SignOut'])
|
||||||
|
->pause(3000)
|
||||||
|
->assertSee(CataLoginData::False_Login['false_assert']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Browser\Pages\Front;
|
||||||
|
use Laravel\Dusk\Browser;
|
||||||
|
use Tests\Data\Catalog\AccountPage;
|
||||||
|
use Tests\Data\Catalog\CataLoginData;
|
||||||
|
use Tests\Data\Catalog\LoginPage;
|
||||||
|
use Tests\Data\Catalog\ProductOne;
|
||||||
|
use Tests\DuskTestCase;
|
||||||
|
use Tests\Data\Catalog\IndexPage;
|
||||||
|
|
||||||
|
//已注册客户且有地址,直接购买商品
|
||||||
|
class WishlistTest extends DuskTestCase
|
||||||
|
{
|
||||||
|
public function testAddWishlist()
|
||||||
|
{
|
||||||
|
$this->browse(function (Browser $browser) {
|
||||||
|
$browser->visit(LoginPage::Login['login_url'])
|
||||||
|
//1.用户登录
|
||||||
|
->type(LoginPage::Login['login_email'], CataLoginData::True_Login['email'])
|
||||||
|
->type(LoginPage::Login['login_pwd'], CataLoginData::True_Login['password'])
|
||||||
|
->press(LoginPage::Login['login_btn'])
|
||||||
|
->pause(2000)
|
||||||
|
|
||||||
|
//2.点击home跳转到首页
|
||||||
|
->click(AccountPage::Account['go_index'])
|
||||||
|
->pause(2000)
|
||||||
|
//3.向下滑动页面直到找到元素
|
||||||
|
->scrollIntoView(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000)
|
||||||
|
->press(IndexPage::Index['product_img'])
|
||||||
|
->pause(2000);
|
||||||
|
//4.保存当前网址
|
||||||
|
$ProductUrl = $browser->driver->getCurrentURL();
|
||||||
|
//5.点击收藏按钮
|
||||||
|
$browser->visit($ProductUrl)
|
||||||
|
->press(ProductOne::Product['Wishlist_icon'])
|
||||||
|
->pause(3000)
|
||||||
|
//6.点击顶部收藏认按钮
|
||||||
|
->click(IndexPage::Index_Top['wishlist_btn'])
|
||||||
|
->pause(1000)
|
||||||
|
//7.点击查看详情按钮
|
||||||
|
->click(AccountPage::Wishlist['Check_Details'])
|
||||||
|
->pause(1000)
|
||||||
|
//8.断言
|
||||||
|
->assertUrlIs($ProductUrl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,7 +7,7 @@ use Laravel\Dusk\Browser;
|
||||||
class HomePage extends Page
|
class HomePage extends Page
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the URL for the page.
|
* Get the URL for the Page.
|
||||||
*/
|
*/
|
||||||
public function url(): string
|
public function url(): string
|
||||||
{
|
{
|
||||||
|
|
@ -15,7 +15,7 @@ class HomePage extends Page
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assert that the browser is on the page.
|
* Assert that the browser is on the Page.
|
||||||
*/
|
*/
|
||||||
public function assert(Browser $browser): void
|
public function assert(Browser $browser): void
|
||||||
{
|
{
|
||||||
|
|
@ -23,7 +23,7 @@ class HomePage extends Page
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the element shortcuts for the page.
|
* Get the element shortcuts for the Page.
|
||||||
*
|
*
|
||||||
* @return array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../../../../vendor/autoload.php';
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestSuite;
|
||||||
|
use PHPUnit\TextUI\DefaultResultPrinter;
|
||||||
|
|
||||||
|
$suite = new TestSuite();
|
||||||
|
// 向测试套件中添加测试用例
|
||||||
|
//前台
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\RegisterFirst.php'); //先注册一个账户
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\RegisterTest.php'); //场景注册
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\LoginTest.php'); //前台登录场景
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\SignOutTest.php'); //前台退出
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\AddressTest.php'); //添加地址
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\AddCartTest.php'); //加入购物车
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\RemoveCartTest.php'); //移除购物车
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\RemoveWishlistTest.php'); //移除喜欢
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\WishlistTest.php'); //加入喜欢
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\EditUserInfo.php'); //修改个人信息
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\CartCheckoutTest.php'); //从购物车结账
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\ChangePayMethodTest.php'); //下单时更改支付方式
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\front\OrderTest.php'); //下单
|
||||||
|
//后台
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\AdminLoginTest.php'); //后台登录
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\AdminSignOutTest.php'); //后台退出
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\GoCatalogTest.php'); //跳转前台
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\GopLuginsTest.php'); //跳转插件市场
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\AddProductTest.php'); //添加商品
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\EditProductTest.php'); //编辑商品
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\DelProductTest.php'); //删除商品
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\GoVipTest.php'); //跳转vip界面
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\LanguageSwitchTest.php'); //切换语言
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\AddExpressTest.php'); //添加快递公司
|
||||||
|
|
||||||
|
//前后台联测
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\combine\AlterOrderStationTest.php'); //订单状态修改 已支付-已发货-一已完成
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\combine\CancelOrderTest.php'); //取消商品订单
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\combine\CloseVisiterCheckoutTest.php'); //禁用游客结账
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\combine\OpenVisiterCheckoutTest.php'); //开启游客结账
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\combine\CreateCategoriesTest.php'); //添加商品分类
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\combine\DisableProductTest.php'); //禁用商品
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\combine\EnableProductTest.php'); //启用商品
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\combine\UnderstockOrderTest.php'); //库存不足下单
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\combine\CustomerGroupDiscountTest.php'); //客户组折扣检验
|
||||||
|
|
||||||
|
//后台删除用户操作
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\AddCustomerTest.php'); //创建用户
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\EditCustomerTest.php'); //修改用户信息
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\DelCustomerTest.php'); //删除用户
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\AddCusGroupTest.php'); //添加用户组
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\EditCusGroupTest.php'); //编辑用户组
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\DelCusGroupTest.php'); //删除用户组
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\CustomerRecycleTest.php'); //恢复客户信息
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\DelCustomerTest.php'); //删除用户
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\CusEmptyRecycleTest.php'); //清空回收站
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\DelCustomerTest.php'); //删除用户
|
||||||
|
$suite->addTestFile('.\tests\Browser\Pages\admin\DelCusRecycleTest.php'); //从回收站删除客户信息
|
||||||
|
|
||||||
|
// 运行测试套件
|
||||||
|
$result = $suite->run();
|
||||||
|
// 输出测试结果
|
||||||
|
$printer = new DefaultResultPrinter();
|
||||||
|
// 输出测试结果
|
||||||
|
$printer->printResult($result);
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestSuite;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../page/front/LoginTest.php';
|
|
||||||
require_once __DIR__ . '/../page/front/RegisterTest.php';
|
|
||||||
class DuskTestSuite extends DuskTestCase
|
|
||||||
{
|
|
||||||
public static function suite()
|
|
||||||
{
|
|
||||||
$suite = new TestSuite('Dusk Tests');
|
|
||||||
|
|
||||||
$suite->addTestFile(__DIR__ . '/../page/front/LoginTest.php');
|
|
||||||
$suite->addTestFile(__DIR__ . '/../page/front/RegisterTest.php');
|
|
||||||
|
|
||||||
return $suite;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../../vendor/autoload.php';
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestSuite;
|
|
||||||
use PHPUnit\TextUI\DefaultResultPrinter;
|
|
||||||
|
|
||||||
$suite = new TestSuite();
|
|
||||||
// 向测试套件中添加测试用例
|
|
||||||
//前台
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\front\RegisterFirst.php'); //先注册一个账户
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\front\RegisterTest.php'); //场景注册
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\front\LoginTest.php'); //前台登录场景
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\front\SignOutTest.php'); //前台退出
|
|
||||||
$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\EditUserInfo.php'); //修改个人信息
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\front\CartCheckoutTest.php'); //从购物车结账
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\front\ChangePayMethodTest.php'); //下单时更改支付方式
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\front\OrderTest.php'); //下单
|
|
||||||
//后台
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\AdminLoginTest.php'); //后台登录
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\AdminSignOutTest.php'); //后台退出
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\GoCatalogTest.php'); //跳转前台
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\GopLuginsTest.php'); //跳转插件市场
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\AddProductTest.php'); //添加商品
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\EditProductTest.php'); //编辑商品
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\DelProductTest.php'); //删除商品
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\GoVipTest.php'); //跳转vip界面
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\LanguageSwitchTest.php'); //切换语言
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\AddCustomerTest.php'); //创建用户
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\EditCustomerTest.php'); //修改用户信息
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\DelCustomerTest.php'); //删除用户
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\AddCusGroupTest.php'); //添加用户组
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\EditCusGroupTest.php'); //编辑用户组
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\DelCusGroupTest.php'); //删除用户组
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\CustomerRecycleTest.php'); //恢复客户信息
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\DelCustomerTest.php'); //删除用户
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\CusEmptyRecycleTest.php'); //清空回收站
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\DelCustomerTest.php'); //删除用户
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\DelCusRecycleTest.php'); //从回收站删除客户信息
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\admin\AddExpressTest.php'); //添加快递公司
|
|
||||||
|
|
||||||
//前后台联测
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\combine\AlterOrderStationTest.php'); //订单状态修改 已支付-已发货-一已完成
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\combine\CancelOrderTest.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'); //添加商品分类
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\combine\EnableProductTest.php'); //启用商品
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\combine\DisableProductTest.php'); //禁用商品
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\combine\EnableProductTest.php'); //启用商品
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\combine\UnderstockOrderTest.php'); //库存不足下单
|
|
||||||
$suite->addTestFile('.\tests\Browser\dusktest\page\combine\CustomerGroupDiscountTest.php'); //客户组折扣检验
|
|
||||||
|
|
||||||
// 运行测试套件
|
|
||||||
$result = $suite->run();
|
|
||||||
// 输出测试结果
|
|
||||||
$printer = new DefaultResultPrinter();
|
|
||||||
// 输出测试结果
|
|
||||||
$printer->printResult($result);
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
const admin_top = [
|
|
||||||
'login_url' => '/admin',
|
|
||||||
'root' => '.text-dark.ml-2',
|
|
||||||
'mg_index' => '.list-unstyled.navbar-nav li:nth-child(1)', //管理首页 .list-unstyled.navbar-nav
|
|
||||||
'mg_order' => '.list-unstyled.navbar-nav li:nth-child(2)', //管理订单
|
|
||||||
'mg_product' => '.list-unstyled.navbar-nav li:nth-child(3)', //管理商品
|
|
||||||
'mg_customers' => '.list-unstyled.navbar-nav li:nth-child(4)', //管理客户
|
|
||||||
'mg_article' => '.list-unstyled.navbar-nav li:nth-child(5)', //管理文章
|
|
||||||
'mg_design' => '.list-unstyled.navbar-nav li:nth-child(6)', //设计
|
|
||||||
'mg_plugin' => '.list-unstyled.navbar-nav li:nth-child(7)', //插件
|
|
||||||
'system_set' => '.list-unstyled.navbar-nav li:nth-child(8)', //系统设置
|
|
||||||
'go_catalog' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(1)', //去往前台
|
|
||||||
'personal_center' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(2)', //个人中心
|
|
||||||
'sign_out' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(4)', //退出登录
|
|
||||||
'Alter' => '.navbar.navbar-right li:nth-child(1)', //更新按钮
|
|
||||||
'VIP' => '.navbar.navbar-right li:nth-child(2)', //vip图标
|
|
||||||
'buy_copyright' => '.navbar.navbar-right li:nth-child(3)', //版权购买
|
|
||||||
'plugins_market' => '.navbar.navbar-right li:nth-child(4)', //插件市场
|
|
||||||
'sw_language' => '.navbar.navbar-right li:nth-child(5)', //切换语言
|
|
||||||
'en_language' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(2)', //切换英语
|
|
||||||
'ch_language' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(9)', //切换中文
|
|
||||||
];
|
|
||||||
const admin_assert = [
|
|
||||||
'vip_assert' => '登录购买VIP服务',
|
|
||||||
'plugins_assert' => '/admin/marketing',
|
|
||||||
'en_assert' => 'Admin Panel', //切换为中文断言
|
|
||||||
'ch_assert' => '后台管理', //切换为英文断言
|
|
||||||
];
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
const add_address = [
|
|
||||||
'add_name' => 'test', //add_name
|
|
||||||
'add_phone' => 'v11012010086', //选择国家
|
|
||||||
'add_code' => '643203', //add_code
|
|
||||||
'add_address1' => 'test1', //add_address1
|
|
||||||
'add_address2' => 'test2', //add_address2
|
|
||||||
];
|
|
||||||
const user_edit = [
|
|
||||||
'upload_images' => '/../../data/images/Headpicture/Headpicture.jpeg', //上传头像
|
|
||||||
'user_name' => 'admin', //修改名字
|
|
||||||
'user_email' => 'admin@163.com', //修改emial
|
|
||||||
];
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
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' => '.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',
|
|
||||||
];
|
|
||||||
const iframe = [
|
|
||||||
'iframe_name' => '#layui-layer-iframe1',
|
|
||||||
];
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser\Pages;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
|
|
||||||
class HomePage
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The URL of the page.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $url = '/';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assert that the browser is on the page.
|
|
||||||
*
|
|
||||||
* @param Browser $browser
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function assert(Browser $browser)
|
|
||||||
{
|
|
||||||
$browser->assertPathIs($this->url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the page URL.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function url()
|
|
||||||
{
|
|
||||||
return $this->url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Click on the login link.
|
|
||||||
*
|
|
||||||
* @param Browser $browser
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function clickLoginLink(Browser $browser)
|
|
||||||
{
|
|
||||||
$browser->clickLink('Login');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill in the email field.
|
|
||||||
*
|
|
||||||
* @param Browser $browser
|
|
||||||
* @param string $email
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function fillInEmailField(Browser $browser, $email)
|
|
||||||
{
|
|
||||||
$browser->type('input[name="email"]', $email);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill in the password field.
|
|
||||||
*
|
|
||||||
* @param Browser $browser
|
|
||||||
* @param string $password
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function fillInPasswordField(Browser $browser, $password)
|
|
||||||
{
|
|
||||||
$browser->type('input[name="password"]', $password);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Submit the login form.
|
|
||||||
*
|
|
||||||
* @param Browser $browser
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function submitLoginForm(Browser $browser)
|
|
||||||
{
|
|
||||||
$browser->press('Login');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
class AddCusGroupTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testAddCusGroup()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击客户管理
|
|
||||||
->click(admin_top['mg_customers'])
|
|
||||||
->pause(3000)
|
|
||||||
//4.点击客户组
|
|
||||||
->click(customer_left['customer_group'])
|
|
||||||
//5.点击创建客户组
|
|
||||||
->press(customer_group['cre_cus_group'])
|
|
||||||
//4.填写客户组信息
|
|
||||||
->type(cre_cus_group['ch_group_name'], cus_group_info['ch_group_name'])
|
|
||||||
->type(cre_cus_group['en_group_name'], cus_group_info['en_group_name'])
|
|
||||||
->type(cre_cus_group['ch_description'], cus_group_info['ch_description'])
|
|
||||||
->type(cre_cus_group['en_description'], cus_group_info['en_description'])
|
|
||||||
->type(cre_cus_group['discount'], cus_group_info['discount'])
|
|
||||||
|
|
||||||
//5.点击保存
|
|
||||||
->press(cre_cus_group['save_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
->assertSee(cus_group_info['ch_group_name']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/customer.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/customer_page.php';
|
|
||||||
class AddCustomerTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testAddCustomer()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击客户管理
|
|
||||||
->click(admin_top['mg_customers'])
|
|
||||||
//3.点击创建客户
|
|
||||||
->press(customer_list['cre_customer'])
|
|
||||||
//4.填写客户信息
|
|
||||||
->type(cre_customer['name'], customer_info['name'])
|
|
||||||
->type(cre_customer['email'], customer_info['email'])
|
|
||||||
->type(cre_customer['pwd'], customer_info['pwd'])
|
|
||||||
|
|
||||||
//5.点击保存
|
|
||||||
->press(cre_customer['save_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
->assertSee(customer_info['email']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/systemset_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/customer_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/express.php';
|
|
||||||
class AddExpressTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testExpressTest()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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'])
|
|
||||||
//2.点击系统设置
|
|
||||||
->click(system_left['system_set'])
|
|
||||||
//3.点击邮件设置
|
|
||||||
->click(system_set['express_set'])
|
|
||||||
->pause(2000)
|
|
||||||
//点击+号
|
|
||||||
->click(express_set['add_btn'])
|
|
||||||
//填写快递信息
|
|
||||||
->type(express_set['express_company'], express['express_company'])
|
|
||||||
->type(express_set['express_code'], express['express_code'])
|
|
||||||
->press(express_set['save_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
|
|
||||||
->assertSee(express_assert['assert_ful'])
|
|
||||||
->pause(3000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/catalog/index_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product.php';
|
|
||||||
class AddProductTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
public function testAddProduct()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击商品
|
|
||||||
->click(admin_top['mg_product'])
|
|
||||||
//2.点击商品管理
|
|
||||||
->click(products_left['product_mg'])
|
|
||||||
//3.点击创建
|
|
||||||
->press(products_top['create_product'])
|
|
||||||
//4.填写商品信息
|
|
||||||
->type(product_top['ch_name'], product_info['ch_name'])
|
|
||||||
->type(product_top['en_name'], product_info['en_name'])
|
|
||||||
->type(product_top['sku'], product_info['sku'])
|
|
||||||
->type(product_top['price'], product_info['price'])
|
|
||||||
->type(product_top['origin_price'], product_info['origin_price'])
|
|
||||||
->type(product_top['cost_price'], product_info['cost_price'])
|
|
||||||
->type(product_top['quantity'], product_info['quantity'])
|
|
||||||
//5.点击保存
|
|
||||||
->press(product_top['save_btn'])
|
|
||||||
->assertSee(cre_assert['cre_ful_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/login.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/login_page.php';
|
|
||||||
|
|
||||||
class AdminLoginTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
public function testEmailIllegal()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
->type(admin_login['login_email'], admin_false_login['illegal_email'])
|
|
||||||
->type(admin_login['login_pwd'], admin_true_login['password'])
|
|
||||||
->press(admin_login['login_btn'])
|
|
||||||
->assertSee(admin_false_login['illegal_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景2 email不存在
|
|
||||||
public function testEmailFalse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
->type(admin_login['login_email'], admin_false_login['false_email'])
|
|
||||||
->type(admin_login['login_pwd'], admin_true_login['password'])
|
|
||||||
->press(admin_login['login_btn'])
|
|
||||||
->assertSee(admin_false_login['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景3 密码错误
|
|
||||||
public function testPwdFalse()
|
|
||||||
{
|
|
||||||
$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_false_login['false_password'])
|
|
||||||
->press(admin_login['login_btn'])
|
|
||||||
->assertSee(admin_false_login['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景4 只输入email
|
|
||||||
public function testOnlyEmail()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
->type(admin_login['login_email'], admin_true_login['email'])
|
|
||||||
->press(admin_login['login_btn'])
|
|
||||||
->assertSee(admin_false_login['no_pwd']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景5 只输入密码
|
|
||||||
public function testOnlyPwd()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
->type(admin_login['login_pwd'], admin_true_login['email'])
|
|
||||||
->press(admin_login['login_btn'])
|
|
||||||
->assertSee(admin_false_login['no_email']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景6 成功登录
|
|
||||||
public function testLoginFul()
|
|
||||||
{
|
|
||||||
$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)
|
|
||||||
->assertSee(admin_true_login['assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
class AdminSignOutTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
public function testAdminSignOut()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.退出
|
|
||||||
->click(admin_top['root'])
|
|
||||||
->pause(2000)
|
|
||||||
->click(admin_top['sign_out'])
|
|
||||||
->pause(10000)
|
|
||||||
->assertSee(admin_login['tltle']);
|
|
||||||
// ->assertSee(true_login['assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/customer_page.php';
|
|
||||||
class CusEmptyRecycleTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
|
|
||||||
public function testEmptyRecycle()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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_customers'])
|
|
||||||
//2.点击回收站
|
|
||||||
->click(customer_left['re_station'])
|
|
||||||
//3.点击清空回收站
|
|
||||||
->press(empty_recycle['empty_btn'])
|
|
||||||
->pause(2000)
|
|
||||||
->press(empty_recycle['sure_btn'])
|
|
||||||
->pause(2000)
|
|
||||||
->assertSee(empty_recycle['assert_text']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/customer_page.php';
|
|
||||||
class CustomerRecycleTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testCustomerRecycle()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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_customers'])
|
|
||||||
//2.点击回收站
|
|
||||||
->click(customer_left['re_station']);
|
|
||||||
$customer_text = $browser->text(empty_recycle['customer_text']);
|
|
||||||
echo $customer_text;
|
|
||||||
//3.点击恢复按钮
|
|
||||||
$browser->press(empty_recycle['recycle_btn'])
|
|
||||||
->pause(2000)
|
|
||||||
//4.点击客户列表
|
|
||||||
->click(customer_left['customer_list'])
|
|
||||||
//验证客户信息是否存在于页面
|
|
||||||
->assertSee($customer_text);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
class DelCusGroupTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testDelCusGroup()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击客户管理
|
|
||||||
->click(admin_top['mg_customers'])
|
|
||||||
->pause(3000)
|
|
||||||
//4.点击客户组
|
|
||||||
->click(customer_left['customer_group']);
|
|
||||||
|
|
||||||
$cus_group_text = $browser->text(customer_group['get_assert']);
|
|
||||||
echo $cus_group_text;
|
|
||||||
//5.点击删除按钮
|
|
||||||
$browser->press(customer_group['del_cus_group'])
|
|
||||||
->pause(2000)
|
|
||||||
->assertSee($cus_group_text);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/customer_page.php';
|
|
||||||
class DelCusRecycleTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
|
|
||||||
public function testDelCusRecycle()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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_customers'])
|
|
||||||
//先删除一个客户
|
|
||||||
->press(customer_list['del_customer'])
|
|
||||||
->press(customer_list['sure_btn'])
|
|
||||||
->pause(1000)
|
|
||||||
//2.点击回收站
|
|
||||||
->click(customer_left['re_station']);
|
|
||||||
$customer_text = $browser->text(empty_recycle['customer_text']);
|
|
||||||
echo $customer_text;
|
|
||||||
//3.点击删除按钮
|
|
||||||
$browser->press(empty_recycle['recycle_del'])
|
|
||||||
->pause(2000)
|
|
||||||
->press(empty_recycle['sure_btn'])
|
|
||||||
//验证客户信息是否存在于页面
|
|
||||||
->assertSee($customer_text)
|
|
||||||
->pause(5000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/customer.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/customer_page.php';
|
|
||||||
|
|
||||||
class DelCustomerTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
|
|
||||||
public function testDelCustomer()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击客户管理
|
|
||||||
->click(admin_top['mg_customers']);
|
|
||||||
$customer_text = $browser->text(customer_list['get_assert']);
|
|
||||||
echo $customer_text;
|
|
||||||
$browser->press(customer_list['del_customer'])
|
|
||||||
//确认
|
|
||||||
->press(customer_list['sure_btn']);
|
|
||||||
$browser->pause(2000)
|
|
||||||
->assertDontSee($customer_text)
|
|
||||||
->pause(5000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/catalog/index_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product.php';
|
|
||||||
class DelProductTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
|
|
||||||
public function testEditProduct()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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']);
|
|
||||||
$product1_text = $browser->text(products_top['get_name']);
|
|
||||||
echo $product1_text;
|
|
||||||
//2.删除按钮
|
|
||||||
$browser->press(products_top['del_product'])
|
|
||||||
//确认
|
|
||||||
->press(products_top['sure_btn']);
|
|
||||||
$browser->pause(2000)
|
|
||||||
->assertDontSee($product1_text)
|
|
||||||
->pause(5000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
class EditCusGroupTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testEditCusGroup()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击客户管理
|
|
||||||
->click(admin_top['mg_customers'])
|
|
||||||
->pause(3000)
|
|
||||||
//4.点击客户组
|
|
||||||
->click(customer_left['customer_group'])
|
|
||||||
//5.点击编辑客户组
|
|
||||||
->press(customer_group['edit_cus_group'])
|
|
||||||
//4.填写客户组信息
|
|
||||||
->type(cre_cus_group['ch_group_name'], alter_cus_group_info['ch_group_name'])
|
|
||||||
->type(cre_cus_group['en_group_name'], alter_cus_group_info['en_group_name'])
|
|
||||||
->type(cre_cus_group['ch_description'], alter_cus_group_info['ch_description'])
|
|
||||||
->type(cre_cus_group['en_description'], alter_cus_group_info['en_description'])
|
|
||||||
->type(cre_cus_group['discount'], alter_cus_group_info['discount'])
|
|
||||||
//5.点击保存
|
|
||||||
->press(cre_cus_group['save_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
->assertSee(alter_cus_group_info['ch_group_name']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/customer.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/customer_page.php';
|
|
||||||
class EditCustomerTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testEditCustomer()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击客户管理
|
|
||||||
->click(admin_top['mg_customers'])
|
|
||||||
//3.点击编辑按钮
|
|
||||||
->press(customer_list['edit_customer'])
|
|
||||||
//4.填写客户信息
|
|
||||||
->type(alter_customer['name'], customer_info_alter['name'])
|
|
||||||
->type(alter_customer['email'], customer_info_alter['email'])
|
|
||||||
->type(alter_customer['pwd'], customer_info_alter['pwd'])
|
|
||||||
//5.点击保存
|
|
||||||
->press(alter_customer['save_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
->assertSee(customer_info_alter['email']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/catalog/index_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product.php';
|
|
||||||
class EditProductTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
public function testEditProduct()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击商品管理
|
|
||||||
->click(admin_top['mg_product'])
|
|
||||||
//3.点击编辑商品
|
|
||||||
->press(products_top['edit_product'])
|
|
||||||
//4.填写商品信息
|
|
||||||
->type(product_top['ch_name'], alter_product['ch_name'])
|
|
||||||
->type(product_top['en_name'], alter_product['en_name'])
|
|
||||||
->type(product_top['sku'], alter_product['sku'])
|
|
||||||
->type(product_top['price'], alter_product['price'])
|
|
||||||
->type(product_top['origin_price'], alter_product['origin_price'])
|
|
||||||
->type(product_top['cost_price'], alter_product['cost_price'])
|
|
||||||
->type(product_top['quantity'], alter_product['quantity'])
|
|
||||||
//5.点击保存
|
|
||||||
->press(product_top['save_btn'])
|
|
||||||
->pause(3000)
|
|
||||||
->assertSee(cre_assert['alter_ful_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/catalog/index_page.php';
|
|
||||||
class GoCatalogTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
public function testGoCatalog()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.去往前台
|
|
||||||
->click(admin_top['root'])
|
|
||||||
->pause(3000)
|
|
||||||
->click(admin_top['go_catalog'])
|
|
||||||
->pause(2000)
|
|
||||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
|
||||||
$browser->assertPathIs(index['login_url']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
class GoPluginsTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testGopLugins()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.插件市场
|
|
||||||
->click(admin_top['plugins_market'])
|
|
||||||
->pause(2000)
|
|
||||||
//3.根据地址获取断言
|
|
||||||
->assertPathIs(admin_assert['plugins_assert']);
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
class GoVipTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testGoVip()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击vip图标
|
|
||||||
->click(admin_top['VIP'])
|
|
||||||
->pause(2000)
|
|
||||||
//3.切换到第二个窗口并获取断言
|
|
||||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
|
||||||
$browser->assertSee(admin_assert['vip_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
class LanguageSwitchTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testLanguageSwitch()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->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)
|
|
||||||
//2.点击切换语言
|
|
||||||
->click(admin_top['sw_language'])
|
|
||||||
//3.切换为英文
|
|
||||||
->click(admin_top['en_language'])
|
|
||||||
->pause(4000)
|
|
||||||
->assertSee(admin_assert['en_assert'])
|
|
||||||
//切换回中文
|
|
||||||
->click(admin_top['sw_language'])
|
|
||||||
->click(admin_top['ch_language'])
|
|
||||||
->assertSee(admin_assert['ch_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/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
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testAddCusGroup()
|
|
||||||
{
|
|
||||||
$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)
|
|
||||||
->click(admin_top['mg_order'])
|
|
||||||
->pause(2000)
|
|
||||||
->click(order_child['mg_order'])
|
|
||||||
->pause(2000)
|
|
||||||
->click(order_child['mg_sale_after'])
|
|
||||||
->pause(2000)
|
|
||||||
->click(order_child['ca_sale_after'])
|
|
||||||
->pause(2000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,130 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Facebook\WebDriver\WebDriverBy;
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/order_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/admin_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/express.php';
|
|
||||||
|
|
||||||
//已注册客户且有地址,直接购买商品
|
|
||||||
class AlterOrderStationTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testAlterOrderStation()
|
|
||||||
{
|
|
||||||
$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)
|
|
||||||
//去往前台
|
|
||||||
->click(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->click(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['paid'])
|
|
||||||
->press(order_details['alter_btn'])
|
|
||||||
->pause(3000)
|
|
||||||
//切换到前台
|
|
||||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
|
||||||
$browser->pause(3000)
|
|
||||||
//刷新页面
|
|
||||||
->refresh()
|
|
||||||
->pause(1000)
|
|
||||||
// 断言是否已支付
|
|
||||||
->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'])
|
|
||||||
->pause(2000)
|
|
||||||
//向下滑动找到更新按钮
|
|
||||||
->scrollIntoView(order_details['alter_btn'])
|
|
||||||
->pause(2000)
|
|
||||||
//按下更新按钮
|
|
||||||
->press(order_details['alter_btn'])
|
|
||||||
->pause(3000)
|
|
||||||
//切换到前台,断言是否已发货
|
|
||||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
|
||||||
$browser->pause(3000)
|
|
||||||
->refresh()
|
|
||||||
->pause(4000)
|
|
||||||
->assertSeeIn(get_order_status['status_text'], ca_order_status['Shipped'])
|
|
||||||
//切换到后台,修改状态为已完成
|
|
||||||
;
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/order_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/admin_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/express.php';
|
|
||||||
|
|
||||||
////前台下单,后台取消
|
|
||||||
class CancelOrderTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testCancelOrder()
|
|
||||||
{
|
|
||||||
$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)
|
|
||||||
//去往前台
|
|
||||||
->click(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->click(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']);
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/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/systemset_page.php';
|
|
||||||
|
|
||||||
//禁止游客结账
|
|
||||||
class CloseVisiterCheckoutTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testCancelOrder()
|
|
||||||
{
|
|
||||||
$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)
|
|
||||||
//点击系统设置
|
|
||||||
->click(admin_top['system_set'])
|
|
||||||
//点击结账设置
|
|
||||||
->click(system_set['pay_set'])
|
|
||||||
->pause(2000)
|
|
||||||
//点击结游客结账 禁用
|
|
||||||
->press(system_set['close_visitor_checkout'])
|
|
||||||
//点击保存
|
|
||||||
->press(system_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']);
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/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/systemset_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_categories.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_categories_page.php';
|
|
||||||
//增加商品分类
|
|
||||||
class CreateCategoriesTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testCreateCategories()
|
|
||||||
{
|
|
||||||
$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)
|
|
||||||
//点击商品管理
|
|
||||||
->click(admin_top['mg_product'])
|
|
||||||
//点击商品分类
|
|
||||||
->click(products_left['product_cate'])
|
|
||||||
->pause(5000)
|
|
||||||
//点击创建分类按钮
|
|
||||||
->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']);
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,125 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/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/cus_grounp.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/customer_page.php';
|
|
||||||
|
|
||||||
///客户组折扣判断
|
|
||||||
class CustomerGroupDiscountTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testCustomerGroupDiscount()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(admin_login['login_url'])
|
|
||||||
//1.后台登录,设置客户组折扣为30
|
|
||||||
->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)
|
|
||||||
//2.点击客户管理
|
|
||||||
->click(admin_top['mg_customers'])
|
|
||||||
->pause(3000)
|
|
||||||
//4.点击客户组
|
|
||||||
->click(customer_left['customer_group'])
|
|
||||||
//5.点击编辑客户组
|
|
||||||
->press(customer_group['edit_cus_group'])
|
|
||||||
//4.填写客户组折扣为30
|
|
||||||
->type(cre_cus_group['discount'], alter_cus_group_info['discount'])
|
|
||||||
//5.点击保存
|
|
||||||
->press(cre_cus_group['save_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
->assertSee(alter_cus_group_info['ch_group_name']);
|
|
||||||
//前台用户登录
|
|
||||||
//点击登录图标
|
|
||||||
$browser->click(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);
|
|
||||||
//获取购买商品价格
|
|
||||||
$old_product_price = $browser->element(checkout['product_price']);
|
|
||||||
$text = $old_product_price->getText();
|
|
||||||
$matches = [];
|
|
||||||
preg_match('/[\d\.]+/', $text, $matches);
|
|
||||||
$new_product_price = $matches[0];
|
|
||||||
|
|
||||||
// 获取购买商品的数量
|
|
||||||
$old_quantity = $browser->element(checkout['quantity']);
|
|
||||||
$text = $old_quantity->getText();
|
|
||||||
$matches = [];
|
|
||||||
preg_match('/\d+/', $text, $matches);
|
|
||||||
$new_quantity = $matches[0];
|
|
||||||
//商品总价
|
|
||||||
// $old_product_total = $browser->element(checkout['product_total']);
|
|
||||||
// $text = $old_product_total->getText();
|
|
||||||
// $matches = [];
|
|
||||||
// preg_match('/[\d\.]+/', $text, $matches);
|
|
||||||
// $new_product_total = $matches[0];
|
|
||||||
//运费
|
|
||||||
$old_shipping_fee = $browser->element(checkout['shipping_fee']);
|
|
||||||
$text = $old_shipping_fee->getText();
|
|
||||||
$matches = [];
|
|
||||||
preg_match('/[\d\.]+/', $text, $matches);
|
|
||||||
$new_shipping_fee = $matches[0];
|
|
||||||
//折扣金额
|
|
||||||
// $old_customer_discount = $browser->element(checkout['customer_discount']);
|
|
||||||
// $text = $old_customer_discount->getText();
|
|
||||||
// $matches = [];
|
|
||||||
// preg_match('/[\d\.]+/', $text, $matches);
|
|
||||||
// $new_customer_discount = $matches[0];
|
|
||||||
// //实际金额
|
|
||||||
// $old_order_total = $browser->element(checkout['order_total']);
|
|
||||||
// $text = $old_order_total->getText();
|
|
||||||
// $matches = [];
|
|
||||||
// preg_match('/[\d\.]+/', $text, $matches);
|
|
||||||
// $new_order_total = $matches[0];
|
|
||||||
//打印订单号
|
|
||||||
// echo $new_product_price;
|
|
||||||
// echo $new_quantity;
|
|
||||||
// echo $new_product_total;
|
|
||||||
// echo $new_shipping_fee;
|
|
||||||
// echo $new_customer_discount;
|
|
||||||
// echo $new_order_total;
|
|
||||||
$discunt_price = $new_product_price * $new_quantity * (30 / 100);
|
|
||||||
// echo $discunt_price;
|
|
||||||
$true_price = $new_product_price * $new_quantity - $discunt_price + $new_shipping_fee;
|
|
||||||
$browser->assertSeeIn(checkout['customer_discount'], $discunt_price)
|
|
||||||
->assertSeeIn(checkout['order_total'], $true_price);
|
|
||||||
//5.点击确认按钮
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/catalog/index_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product.php';
|
|
||||||
class DisableProductTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//启用商品
|
|
||||||
|
|
||||||
public function testDisableProduct()
|
|
||||||
{
|
|
||||||
|
|
||||||
$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)
|
|
||||||
->click(admin_top['mg_product']);
|
|
||||||
$product1_text = $browser->text(products_top['get_name']);
|
|
||||||
echo $product1_text;
|
|
||||||
//编辑商品
|
|
||||||
$browser->press(products_top['edit_product'])
|
|
||||||
//启用商品
|
|
||||||
->click(product_top['Disable'])
|
|
||||||
//点击保存
|
|
||||||
->press(product_top['save_btn'])
|
|
||||||
->pause(3000)
|
|
||||||
//点击商品,跳转前台
|
|
||||||
->clickLink($product1_text)
|
|
||||||
->pause(2000)
|
|
||||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
|
||||||
//断言是否有下架提示
|
|
||||||
$browser->assertVisible(product_assert['Disable_text'])
|
|
||||||
->pause(3000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/catalog/index_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/catalog/product_1.php';
|
|
||||||
class EnableProductTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//启用商品
|
|
||||||
|
|
||||||
public function testEnableProduct()
|
|
||||||
{
|
|
||||||
|
|
||||||
$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)
|
|
||||||
->click(admin_top['mg_product']);
|
|
||||||
$product1_text = $browser->text(products_top['get_name']);
|
|
||||||
echo $product1_text;
|
|
||||||
//编辑商品
|
|
||||||
$browser->press(products_top['edit_product'])
|
|
||||||
//启用商品
|
|
||||||
->click(product_top['Enable'])
|
|
||||||
//点击保存
|
|
||||||
->press(product_top['save_btn'])
|
|
||||||
->pause(3000)
|
|
||||||
//点击商品,跳转前台
|
|
||||||
->clickLink($product1_text)
|
|
||||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
|
||||||
//断言页面是否有购买按钮
|
|
||||||
$browser->assertVisible(product['product_1'])
|
|
||||||
->pause(3000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/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/systemset_page.php';
|
|
||||||
|
|
||||||
//禁止游客结账
|
|
||||||
class OpenVisiterCheckoutTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testCancelOrder()
|
|
||||||
{
|
|
||||||
$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)
|
|
||||||
//点击系统设置
|
|
||||||
->click(admin_top['system_set'])
|
|
||||||
//点击结账设置
|
|
||||||
->click(system_set['pay_set'])
|
|
||||||
->pause(2000)
|
|
||||||
//点击结游客结账 启用
|
|
||||||
->press(system_set['open_visitor_checkout'])
|
|
||||||
//点击保存
|
|
||||||
->press(system_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']);
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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/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/cre_product.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/product_page.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/admin/cre_product_page.php';
|
|
||||||
|
|
||||||
////库存不足时下单
|
|
||||||
class UnderstockOrderTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testUnderstockOrder()
|
|
||||||
{
|
|
||||||
$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)
|
|
||||||
//修改商品库存为5
|
|
||||||
->click(admin_top['mg_product']);
|
|
||||||
//获取商品名
|
|
||||||
$product1_text = $browser->text(products_top['get_name']);
|
|
||||||
echo $product1_text;
|
|
||||||
//点击编辑商品
|
|
||||||
$browser->press(products_top['edit_product'])
|
|
||||||
//修改商品库存为5
|
|
||||||
->type(product_top['quantity'], alter_product['low_quantity'])
|
|
||||||
//5.点击保存
|
|
||||||
->press(product_top['save_btn'])
|
|
||||||
->pause(3000)
|
|
||||||
|
|
||||||
//去往前台下单
|
|
||||||
->clickLink($product1_text)
|
|
||||||
->pause(2000)
|
|
||||||
->driver->switchTo()->window($browser->driver->getWindowHandles()[1]);
|
|
||||||
//输入库存
|
|
||||||
$browser->pause(2000)
|
|
||||||
->type(product['quantity'], alter_product['low_quantity'])
|
|
||||||
//在库存基础上数量+1 quantity_up
|
|
||||||
->click(product['quantity_up'])
|
|
||||||
//4.点击购买按钮
|
|
||||||
->press(product['product_1'])
|
|
||||||
->pause(2000)
|
|
||||||
//断言 understock_assert
|
|
||||||
->assertVisible(product['understock_assert']);
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
//已注册客户且有地址,直接购买商品
|
|
||||||
class AddCartTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testAddCart()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.用户登录
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
//2.点击home跳转到首页
|
|
||||||
->click(account['go_index'])
|
|
||||||
//3.向下滑动页面直到找到元素
|
|
||||||
->scrollIntoView(index['product_img'])
|
|
||||||
// ->mouseover(index['product_img'])
|
|
||||||
->pause(2000)
|
|
||||||
//2.点击要加入购物车的商品
|
|
||||||
->press(index['product_img'])
|
|
||||||
->pause(2000);
|
|
||||||
|
|
||||||
//3.获取当前产品标题
|
|
||||||
$product_description = $browser->text(product['product1_name']);
|
|
||||||
$ProductUrl = $browser->driver->getCurrentURL();
|
|
||||||
//4.点击收藏按钮
|
|
||||||
$browser->visit($ProductUrl)
|
|
||||||
//5.点击加入购物车
|
|
||||||
|
|
||||||
->press(product['add_cart'])
|
|
||||||
->pause(3000)
|
|
||||||
//6.点击购物车按钮
|
|
||||||
->click(index_cart['cart_icon'])
|
|
||||||
->pause(10000);
|
|
||||||
//6.断言购物车内商品是否与先前商品相同
|
|
||||||
$browser->assertSeeIn(index_cart['product_text'], $product_description);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
//已注册客户且有地址,直接购买商品
|
|
||||||
class AddressTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testAddress()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.用户登录
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
//2.点击address
|
|
||||||
->click(account['go_address'])
|
|
||||||
//3.点击添加地址
|
|
||||||
->press(address['add_btn'])
|
|
||||||
->pause(3000)
|
|
||||||
//3.1 name
|
|
||||||
->type(address['add_name'], add_address['add_name'])
|
|
||||||
//3.2 phone
|
|
||||||
->type(address['add_phone'], add_address['add_phone'])
|
|
||||||
//3.3 address
|
|
||||||
->type(address['add_address'], add_address['add_name'])
|
|
||||||
//3.4 code
|
|
||||||
->type(address['add_code'], add_address['add_code'])
|
|
||||||
//3.5 address1
|
|
||||||
->type(address['add_address1'], add_address['add_address2'])
|
|
||||||
//3.6 address2
|
|
||||||
->type(address['add_address2'], add_address['add_address2'])
|
|
||||||
//3.7 defaule
|
|
||||||
->press((address['default']))
|
|
||||||
//3.8 save
|
|
||||||
->press((address['save']))
|
|
||||||
->pause(3000)
|
|
||||||
->assertSee(address['assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
//已注册客户且有地址,直接购买商品
|
|
||||||
class CartCheckoutTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testCartCheckout()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.用户登录
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(2000)
|
|
||||||
//2.点击home跳转到首页
|
|
||||||
->click(account['go_index'])
|
|
||||||
//3.向下滑动页面直到找到元素
|
|
||||||
->scrollIntoView(index['product_img'])
|
|
||||||
->pause(2000)
|
|
||||||
//4.点击要加入购物车的商品
|
|
||||||
->press(index['product_img'])
|
|
||||||
->pause(2000)
|
|
||||||
//5.点击加入购物车
|
|
||||||
->press(product['add_cart'])
|
|
||||||
->pause(3000)
|
|
||||||
//6.点击购物车按钮
|
|
||||||
->click(index_cart['cart_icon'])
|
|
||||||
->pause(3000)
|
|
||||||
//7.点击结账按钮
|
|
||||||
->press(index_cart['cart_Checkout'])
|
|
||||||
->pause(5000)
|
|
||||||
//8.点击确认按钮
|
|
||||||
->press(checkout['submit'])
|
|
||||||
->pause(5000)
|
|
||||||
//9.断言
|
|
||||||
->assertSee(checkout['assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
//已注册客户且有地址,在下单时更换支付方式购买
|
|
||||||
class ChangePayMethodTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testChangePayMethod()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.用户登录
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
//当前网址断言
|
|
||||||
->assertPathIs(account['url'])
|
|
||||||
//2.点击home跳转到首页
|
|
||||||
->click(account['go_index'])
|
|
||||||
//3.向下滑动页面直到找到元素
|
|
||||||
->scrollIntoView(index['product_img'])
|
|
||||||
->pause(2000)
|
|
||||||
//点击要购买的商品
|
|
||||||
->press(index['product_img'])
|
|
||||||
//4.点击购买按钮
|
|
||||||
->press(product['product_1'])
|
|
||||||
->pause(5000)
|
|
||||||
//点击第二种支付方式
|
|
||||||
|
|
||||||
->elements(checkout['method_pay'])[1]->click();
|
|
||||||
$browser->pause(5000)
|
|
||||||
//5.点击确认按钮
|
|
||||||
->press(checkout['submit'])
|
|
||||||
->pause(5000)
|
|
||||||
//6.断言
|
|
||||||
->assertSee(checkout['assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
//已注册客户且有地址,直接购买商品
|
|
||||||
class EditUserInfo extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testEditInfo()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.用户登录
|
|
||||||
->type(login['login_email'], true_register['email'])
|
|
||||||
->type(login['login_pwd'], true_register['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(2000)
|
|
||||||
//2.点击编辑
|
|
||||||
->click(account['go_Edit'])
|
|
||||||
->pause(1000)
|
|
||||||
//3.点击上传头像按钮
|
|
||||||
// ->press(Edit['upload_btn'])
|
|
||||||
// ->pause(3000)
|
|
||||||
// ->waitFor('#file-input') // 等待文件上传控件出现
|
|
||||||
// ->assertVisible('#file-input') // 确保文件上传控件可见
|
|
||||||
// ->assertEnabled('#file-input') // 确保文件上传控件可用
|
|
||||||
// ->attach(Edit['upload_btn'],realpath('E:/phpstudy_pro/WWW/autotest.test/beikeshop/tests/Browser/dusktest/data/images/Headpicture/Headpicture.jpeg'))
|
|
||||||
// ->press(Edit['Confirm_btn'])
|
|
||||||
// ->pause(3000)
|
|
||||||
//3.1 name
|
|
||||||
->type(Edit['user_name'], user_edit['user_name'])
|
|
||||||
//3.2 phone
|
|
||||||
->type(Edit['user_email'], user_edit['user_email'])
|
|
||||||
//3.3 save
|
|
||||||
->press((Edit['Submit']))
|
|
||||||
->pause(3000)
|
|
||||||
->assertSee(Edit['assert']);
|
|
||||||
//3.向下滑动页面直到找到元素
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
class LoginTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
public function testEmailIllegal()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(login['login_email'], false_login['illegal_email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->assertSee(false_login['illegal_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景2 email不存在
|
|
||||||
public function testEmailFalse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(login['login_email'], false_login['false_email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->assertSee(false_login['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景3 密码错误
|
|
||||||
public function testPwdFalse()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], false_login['false_password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->assertSee(false_login['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景4 只输入账号
|
|
||||||
public function testOnlyEmail()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->assertSee(false_login['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景5 只输入密码
|
|
||||||
public function testOnlyPwd()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(login['login_pwd'], true_login['email'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->assertSee(false_login['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景6 成功登录
|
|
||||||
public function testLoginFul()
|
|
||||||
{
|
|
||||||
$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)
|
|
||||||
->assertPathIs(account['url']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
//已注册客户且有地址,直接购买商品
|
|
||||||
class OrderTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testOrder()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.用户登录
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
//当前网址断言
|
|
||||||
->assertPathIs(account['url'])
|
|
||||||
//打印查看当前网址
|
|
||||||
// $html = $browser->driver->getCurrentURL();
|
|
||||||
// print_r($html)
|
|
||||||
// ->driver->getCurrentURL()
|
|
||||||
//2.点击home跳转到首页
|
|
||||||
->click(account['go_index'])
|
|
||||||
//3.向下滑动页面直到找到元素
|
|
||||||
->scrollIntoView(index['product_img'])
|
|
||||||
// ->mouseover(index['product_img'])
|
|
||||||
->pause(2000)
|
|
||||||
//点击要购买的商品
|
|
||||||
->press(index['product_img'])
|
|
||||||
//4.点击购买按钮
|
|
||||||
->press(product['product_1'])
|
|
||||||
->pause(5000)
|
|
||||||
//5.点击确认按钮
|
|
||||||
->press(checkout['submit'])
|
|
||||||
->pause(5000)
|
|
||||||
//6.断言
|
|
||||||
->assertSee(checkout['assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//1.先单独注册一个账号
|
|
||||||
public function testLoginFirst()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->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'])
|
|
||||||
->pause(2000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,106 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
require_once dirname(__FILE__) . '/../../data/catalog/register.php';
|
|
||||||
require_once dirname(__FILE__) . '/../../data/catalog/login_page.php';
|
|
||||||
|
|
||||||
class RegisterTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
*/
|
|
||||||
//场景1 使用已注册过的邮箱注册
|
|
||||||
public function testUsedEmail()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(register['register_email'], false_register['exist_email'])
|
|
||||||
->type(register['register_pwd'], true_register['password'])
|
|
||||||
->type(register['register_re_pwd'], true_register['password'])
|
|
||||||
->press(register['register_btn'])
|
|
||||||
->assertSee(false_register['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景2 前后密码输入不一致
|
|
||||||
public function testDiffPwd()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(register['register_email'], true_register['email'])
|
|
||||||
->type(register['register_pwd'], true_register['password'])
|
|
||||||
->type(register['register_re_pwd'], false_register['false_password'])
|
|
||||||
->press(register['register_btn'])
|
|
||||||
->assertSee(false_register['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景3 邮箱格式不合法
|
|
||||||
public function testIllegalEmail()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(register['register_email'], false_register['illegal_email'])
|
|
||||||
->type(register['register_pwd'], true_register['password'])
|
|
||||||
->type(register['register_re_pwd'], true_register['password'])
|
|
||||||
->press(register['register_btn'])
|
|
||||||
->assertSee(false_register['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景4 邮箱为空
|
|
||||||
public function testNoEmail()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(register['register_pwd'], true_register['password'])
|
|
||||||
->type(register['register_re_pwd'], true_register['password'])
|
|
||||||
->press(register['register_btn'])
|
|
||||||
->assertSee(false_register['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景5 密码为空
|
|
||||||
public function testNoPwd()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(register['register_email'], true_register['email'])
|
|
||||||
->type(register['register_re_pwd'], true_register['password'])
|
|
||||||
->press(register['register_btn'])
|
|
||||||
->assertSee(false_register['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景6 第二次密码为空
|
|
||||||
public function testNoRepwd()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(register['register_email'], true_register['email'])
|
|
||||||
->type(register['register_pwd'], true_register['password'])
|
|
||||||
->press(register['register_btn'])
|
|
||||||
->assertSee(false_register['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景7 第二次密码为空
|
|
||||||
public function testRegisterFul()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
->type(register['register_email'], true_register['email'])
|
|
||||||
->type(register['register_pwd'], true_register['password'])
|
|
||||||
->type(register['register_re_pwd'], true_register['password'])
|
|
||||||
->press(register['register_btn'])
|
|
||||||
->pause(6000)
|
|
||||||
->assertSee(true_register['assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
//已注册客户且有地址,直接购买商品
|
|
||||||
class RemoveCartTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testRemoveCart()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.用户登录
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(2000)
|
|
||||||
//2.点击home跳转到首页
|
|
||||||
->click(account['go_index'])
|
|
||||||
//3.向下滑动页面直到找到元素
|
|
||||||
->scrollIntoView(index['product_img'])
|
|
||||||
->pause(2000)
|
|
||||||
//4.点击要加入购物车的商品
|
|
||||||
->press(index['product_img'])
|
|
||||||
->pause(2000)
|
|
||||||
//5.点击加入购物车
|
|
||||||
->press(product['add_cart'])
|
|
||||||
->pause(3000)
|
|
||||||
//6.点击购物车按钮
|
|
||||||
->click(index_cart['cart_icon'])
|
|
||||||
->pause(3000)
|
|
||||||
//7.点击移除按钮
|
|
||||||
->press(index_cart['Delete_btn'])
|
|
||||||
->pause(3000)
|
|
||||||
->assertSeeIn(index_cart['product_num'], '0')
|
|
||||||
->pause(3000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
//已注册客户且有地址,直接购买商品
|
|
||||||
class RemoveWishlistTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testReWishlist()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.用户登录
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(3000)
|
|
||||||
//2.点击home跳转到首页
|
|
||||||
->click(account['go_index'])
|
|
||||||
->pause(2000)
|
|
||||||
//3.向下滑动页面直到找到元素
|
|
||||||
->scrollIntoView(index['product_img'])
|
|
||||||
->pause(2000)
|
|
||||||
->press(index['product_img'])
|
|
||||||
->pause(2000);
|
|
||||||
//4.保存当前网址
|
|
||||||
$ProductUrl = $browser->driver->getCurrentURL();
|
|
||||||
//5.点击收藏按钮
|
|
||||||
$browser->visit($ProductUrl)
|
|
||||||
->press(product['Wishlist_icon'])
|
|
||||||
->pause(3000)
|
|
||||||
//6.点击顶部收藏认按钮
|
|
||||||
->click(index_top['wishlist_btn'])
|
|
||||||
// ->pause(1000)
|
|
||||||
//7.点击移除按钮
|
|
||||||
->press(Wishlist['remove_Wishlist'])
|
|
||||||
->pause(3000)
|
|
||||||
//8.断言
|
|
||||||
->assertVisible(Wishlist['no_data'])//no_data
|
|
||||||
;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
class SignOutTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic browser test example.
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
//场景1 email不合法
|
|
||||||
public function testSignOut()
|
|
||||||
{
|
|
||||||
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.登录
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(5000)
|
|
||||||
//2.退出
|
|
||||||
->click(account['SignOut'])
|
|
||||||
->pause(3000)
|
|
||||||
->assertSee(false_login['false_assert']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace Tests\Browser;
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Dusk\Browser;
|
|
||||||
use Tests\DuskTestCase;
|
|
||||||
|
|
||||||
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';
|
|
||||||
|
|
||||||
//已注册客户且有地址,直接购买商品
|
|
||||||
class WishlistTest extends DuskTestCase
|
|
||||||
{
|
|
||||||
public function testAddWishlist()
|
|
||||||
{
|
|
||||||
$this->browse(function (Browser $browser) {
|
|
||||||
$browser->visit(login['login_url'])
|
|
||||||
//1.用户登录
|
|
||||||
->type(login['login_email'], true_login['email'])
|
|
||||||
->type(login['login_pwd'], true_login['password'])
|
|
||||||
->press(login['login_btn'])
|
|
||||||
->pause(2000)
|
|
||||||
|
|
||||||
//2.点击home跳转到首页
|
|
||||||
->click(account['go_index'])
|
|
||||||
->pause(2000)
|
|
||||||
//3.向下滑动页面直到找到元素
|
|
||||||
->scrollIntoView(index['product_img'])
|
|
||||||
->pause(2000)
|
|
||||||
->press(index['product_img'])
|
|
||||||
->pause(2000);
|
|
||||||
//4.保存当前网址
|
|
||||||
$ProductUrl = $browser->driver->getCurrentURL();
|
|
||||||
//5.点击收藏按钮
|
|
||||||
$browser->visit($ProductUrl)
|
|
||||||
->press(product['Wishlist_icon'])
|
|
||||||
->pause(3000)
|
|
||||||
//6.点击顶部收藏认按钮
|
|
||||||
->click(index_top['wishlist_btn'])
|
|
||||||
->pause(1000)
|
|
||||||
//7.点击查看详情按钮
|
|
||||||
->click(Wishlist['Check_Details'])
|
|
||||||
->pause(1000)
|
|
||||||
//8.断言
|
|
||||||
->assertUrlIs($ProductUrl, $browser->driver->getCurrentURL());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Tests\Data\Admin;
|
||||||
const admin_login = [
|
class AdminLoginPage{
|
||||||
|
const Admin_Login = [
|
||||||
'login_url' => '/admin/login',
|
'login_url' => '/admin/login',
|
||||||
'tltle' => '登录到 BeikeShop 后台',
|
'tltle' => '登录到 BeikeShop 后台',
|
||||||
'login_email' => '#email-input',
|
'login_email' => "#email-input",
|
||||||
'login_pwd' => '#password-input',
|
'login_pwd' => '#password-input',
|
||||||
'login_btn' => '.btn.btn-lg.btn-primary', //登录按钮
|
'login_btn' => '.btn.btn-lg.btn-primary', //登录按钮
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Tests\Data\Admin;
|
||||||
|
|
||||||
const order_right = [
|
class AdminOrderPage{
|
||||||
'url' => '/admin/orders',
|
const Right = [
|
||||||
|
'url' => '/Admin/orders',
|
||||||
'search_order' => '#app > form > div:nth-child(1) > div:nth-child(1) > div > div > input', //搜索栏--订单号
|
'search_order' => '#app > form > div:nth-child(1) > div:nth-child(1) > div > div > input', //搜索栏--订单号
|
||||||
'search_bth' => '#app > div > div > button:nth-child(1)', //搜索按钮
|
'search_bth' => '#app > div > div > button:nth-child(1)', //搜索按钮
|
||||||
'view_btn' => '#customer-app > div > div.table-push > table > tbody > tr > td:nth-child(9) > a', //查看按钮
|
'view_btn' => '#customer-app > div > div.table-push > table > tbody > tr > td:nth-child(9) > a', //查看按钮
|
||||||
];
|
];
|
||||||
const order_child = [
|
const Child= [
|
||||||
'mg_order' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(1)', //订单列表
|
'mg_order' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(1)', //订单列表
|
||||||
'mg_sale_after' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(2)', //售后管理
|
'mg_sale_after' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(2)', //售后管理
|
||||||
'ca_sale_after' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(3)', //售后原因
|
'ca_sale_after' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(3)', //售后原因
|
||||||
];
|
];
|
||||||
const order_details = [//订单详情页
|
const Details = [//订单详情页
|
||||||
'pull_btn' => '#app > form > div.el-form-item.is-required > div > div > div > span > span > i', //状态栏下拉按钮
|
'pull_btn' => '#app > form > div.el-form-item.is-required > div > div > div > span > span > i', //状态栏下拉按钮
|
||||||
// "paid"=>".el-select-dropdown__item",//已支付
|
// "paid"=>".el-select-dropdown__item",//已支付
|
||||||
'paid' => '.el-scrollbar__view.el-select-dropdown__list li:nth-child(1)', //已支付
|
'paid' => '.el-scrollbar__view.el-select-dropdown__list li:nth-child(1)', //已支付
|
||||||
|
|
@ -26,5 +28,6 @@ const order_details = [//订单详情页
|
||||||
'submit' => '#app > form > div:nth-child(7) > div > button', //提交按钮
|
'submit' => '#app > form > div:nth-child(7) > div > button', //提交按钮
|
||||||
'submit_btn2' => '#app > form > div:nth-child(5) > div > button', //提交按钮
|
'submit_btn2' => '#app > form > div:nth-child(5) > div > button', //提交按钮
|
||||||
//#app > form > div:nth-child(5) > div > button
|
//#app > form > div:nth-child(5) > div > button
|
||||||
'' => '',
|
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
namespace Tests\Data\Admin;
|
||||||
|
|
||||||
|
class AdminPage {
|
||||||
|
|
||||||
|
const TOP = [
|
||||||
|
'login_url' => '/admin',
|
||||||
|
'root' => '.ml-2',
|
||||||
|
'mg_index' => '.list-unstyled.navbar-nav li:nth-child(1)', //管理首页 .list-unstyled.navbar-nav
|
||||||
|
'mg_order' => '.list-unstyled.navbar-nav li:nth-child(2)', //管理订单
|
||||||
|
'mg_product' => '.list-unstyled.navbar-nav li:nth-child(3)', //管理商品
|
||||||
|
'mg_customers' => '.list-unstyled.navbar-nav li:nth-child(4)', //管理客户
|
||||||
|
'mg_article' => '.list-unstyled.navbar-nav li:nth-child(5)', //管理文章
|
||||||
|
'mg_design' => '.list-unstyled.navbar-nav li:nth-child(6)', //设计
|
||||||
|
'mg_plugin' => '.list-unstyled.navbar-nav li:nth-child(7)', //插件
|
||||||
|
'system_set' => '.list-unstyled.navbar-nav li:nth-child(8)', //系统设置
|
||||||
|
'go_catalog' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(1)', //去往前台
|
||||||
|
'personal_center' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(2)', //个人中心
|
||||||
|
'sign_out' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(4)', //退出登录
|
||||||
|
'Alter' => '.navbar.navbar-right li:nth-child(1)', //更新按钮
|
||||||
|
'VIP' => '.navbar.navbar-right li:nth-child(2)', //vip图标
|
||||||
|
'buy_copyright' => '.navbar.navbar-right li:nth-child(3)', //版权购买
|
||||||
|
'plugins_market' => '.navbar.navbar-right li:nth-child(4)', //插件市场
|
||||||
|
'sw_language' => '.navbar.navbar-right li:nth-child(5)', //切换语言
|
||||||
|
'en_language' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(2)', //切换英语
|
||||||
|
'ch_language' => '.dropdown-menu.dropdown-menu-end.show li:nth-child(10)', //切换中文
|
||||||
|
];
|
||||||
|
|
||||||
|
const Assert = [
|
||||||
|
'vip_assert' => '登录购买VIP服务',
|
||||||
|
'plugins_assert' => '/admin/marketing',
|
||||||
|
'en_assert' => 'Admin Panel', //切换为中文断言
|
||||||
|
'ch_assert' => '后台管理', //切换为英文断言
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Tests\Data\Admin;
|
||||||
const article_left = [
|
class ArticlePage{
|
||||||
'url' => '/admin/pages',
|
const Left= [
|
||||||
|
'url' => '/Admin/pages',
|
||||||
'mg_article' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(1)', //文章管理
|
'mg_article' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(1)', //文章管理
|
||||||
'catalog_article' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(2)', //文章分类
|
'catalog_article' => '.list-unstyled.navbar-nav:nth-child(2) li:nth-child(2)', //文章分类
|
||||||
];
|
];
|
||||||
const article_common = [
|
const Common = [
|
||||||
'add_btn' => '#content > div.container-fluid.p-0 > div > div > div.d-flex.justify-content-between.mb-4 > a', //添加按钮
|
'add_btn' => '#content > div.container-fluid.p-0 > div > div > div.d-flex.justify-content-between.mb-4 > a', //添加按钮
|
||||||
'edit_btn' => '#content > div.container-fluid.p-0 > div > div > div.table-push > table > tbody > tr:nth-child(1) > td.text-end > a', //编辑按钮
|
'edit_btn' => '#content > div.container-fluid.p-0 > div > div > div.table-push > table > tbody > tr:nth-child(1) > td.text-end > a', //编辑按钮
|
||||||
'del_btn' => '#content > div.container-fluid.p-0 > div > div > div.table-push > table > tbody > tr:nth-child(1) > td.text-end > button', //删除按钮
|
'del_btn' => '#content > div.container-fluid.p-0 > div > div > div.table-push > table > tbody > tr:nth-child(1) > td.text-end > button', //删除按钮
|
||||||
|
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Tests\Data\Admin;
|
||||||
const categories_data = [
|
class CreCategories{
|
||||||
|
const Cate_Data= [
|
||||||
'ch_name' => 'categories_test',
|
'ch_name' => 'categories_test',
|
||||||
'en_name' => 'categories_test',
|
'en_name' => 'categories_test',
|
||||||
'ch_content' => 'categories_content_test',
|
'ch_content' => 'categories_content_test',
|
||||||
|
|
@ -13,3 +14,4 @@ const categories_data = [
|
||||||
'en_description' => 'categories_description_test',
|
'en_description' => 'categories_description_test',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Tests\Data\Admin;
|
||||||
const categories_info = [
|
class CreCategoriesPage{
|
||||||
|
const Cate_Page = [
|
||||||
'ch_name' => 'descriptions[zh_cn][name]',
|
'ch_name' => 'descriptions[zh_cn][name]',
|
||||||
'en_name' => 'descriptions[en][name]',
|
'en_name' => 'descriptions[en][name]',
|
||||||
'ch_content' => 'descriptions[zh_cn][content]',
|
'ch_content' => 'descriptions[zh_cn][content]',
|
||||||
|
|
@ -17,3 +18,4 @@ const categories_info = [
|
||||||
'save_btn' => '.btn.btn-primary.mt-3',
|
'save_btn' => '.btn.btn-primary.mt-3',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Tests\Data\Admin;
|
||||||
const product_info = [
|
class CreProduct{
|
||||||
|
const Puoduct_Info = [
|
||||||
'ch_name' => 'test', //中文名称
|
'ch_name' => 'test', //中文名称
|
||||||
'en_name' => 'test', //英文名称
|
'en_name' => 'test', //英文名称
|
||||||
'sku' => '123', //sku
|
'sku' => '123', //sku
|
||||||
|
|
@ -9,7 +10,7 @@ const product_info = [
|
||||||
'cost_price' => '5', //成本价
|
'cost_price' => '5', //成本价
|
||||||
'quantity' => '3', //数量
|
'quantity' => '3', //数量
|
||||||
];
|
];
|
||||||
const alter_product = [
|
const Alter = [
|
||||||
'ch_name' => 'alter_test', //中文名称
|
'ch_name' => 'alter_test', //中文名称
|
||||||
'en_name' => 'alter_test', //英文名称
|
'en_name' => 'alter_test', //英文名称
|
||||||
'sku' => '456', //sku
|
'sku' => '456', //sku
|
||||||
|
|
@ -19,3 +20,4 @@ const alter_product = [
|
||||||
'quantity' => '30', //数量
|
'quantity' => '30', //数量
|
||||||
'low_quantity' => '5', //少量商品 ,测试库存不足
|
'low_quantity' => '5', //少量商品 ,测试库存不足
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
namespace Tests\Data\Admin;
|
||||||
|
|
||||||
const product_top = [
|
class CreProductPage{
|
||||||
'login_url' => '/admin/products/create', //
|
const Product_Top = [
|
||||||
|
'login_url' => '/Admin/products/create', //
|
||||||
'ch_name' => 'descriptions[zh_cn][name]', //中文名称
|
'ch_name' => 'descriptions[zh_cn][name]', //中文名称
|
||||||
'en_name' => 'descriptions[en][name]', //英文名称
|
'en_name' => 'descriptions[en][name]', //英文名称
|
||||||
'sku' => 'skus[0][sku]', //sku
|
'sku' => 'skus[0][sku]', //sku
|
||||||
|
|
@ -11,8 +13,9 @@ const product_top = [
|
||||||
'quantity' => 'skus[0][quantity]', //数量
|
'quantity' => 'skus[0][quantity]', //数量
|
||||||
'Enable' => '#active-1',
|
'Enable' => '#active-1',
|
||||||
'Disable' => '#active-0',
|
'Disable' => '#active-0',
|
||||||
'save_btn' => '#content > div.page-title-box.py-1.d-flex.align-items-center.justify-content-between > div > button', //保存
|
'save_btn' => '.btn.btn-lg.btn-primary.submit-form', //保存
|
||||||
];
|
];
|
||||||
const product_assert = [
|
const Product_Assert = [
|
||||||
'Disable_text' => '.text-danger', //商品禁用后显示的文本class
|
'Disable_text' => '.text-danger', //商品禁用后显示的文本class
|
||||||
];
|
];
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue