Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AutomationTestForUnibee
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua Yu
AutomationTestForUnibee
Commits
b9927b88
Commit
b9927b88
authored
Sep 06, 2024
by
YuShijiaCode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cases for product
parent
bb05bc2e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
120 additions
and
3 deletions
+120
-3
MerchantPlanPage.js
01_Web/PageObject/MerchantPlanPage.js
+33
-0
MerchantUserListPage.js
01_Web/PageObject/MerchantUserListPage.js
+43
-1
UserMySubPage.js
01_Web/PageObject/UserMySubPage.js
+39
-1
UserPlanPage.js
01_Web/PageObject/UserPlanPage.js
+5
-0
10_product.js
01_Web/TestCases/MerchantPortal/10_product.js
+0
-0
02_purchanse_plan.js
01_Web/TestCases/UserPortal/02_purchanse_plan.js
+0
-1
08_product.js
01_Web/TestCases/UserPortal/08_product.js
+0
-0
No files found.
01_Web/PageObject/MerchantPlanPage.js
View file @
b9927b88
...
@@ -48,6 +48,16 @@ class MerchantPlanPage {
...
@@ -48,6 +48,16 @@ class MerchantPlanPage {
confirm_delete_btn
=
'//*[@class="ant-popconfirm-buttons"]/button'
confirm_delete_btn
=
'//*[@class="ant-popconfirm-buttons"]/button'
plan_list_table
=
'//*[@class="ant-table-tbody"]'
plan_list_table
=
'//*[@class="ant-table-tbody"]'
new_product_btn
=
'(//*[@class="ant-tabs-nav-add"]/span[@aria-label="plus"])[1]'
product_name
=
'//*[@id="productName"]'
product_description
=
'//*[@id="description"]'
product_detail_OK
=
'//*[text()="OK"]'
product_delete_OK
=
'//*[text()="OK"]'
product_edit_OK
=
'//*[text()="OK"]'
product_edit_btn
=
'(//*[@aria-label=
\'
edit
\'
])[1]'
selectCurrency
=
async
function
(
driver
,
currency
=
"EUR"
){
selectCurrency
=
async
function
(
driver
,
currency
=
"EUR"
){
console
.
log
(
"selectCurrency: "
,
currency
);
console
.
log
(
"selectCurrency: "
,
currency
);
let
currency_list
=
{
let
currency_list
=
{
...
@@ -141,6 +151,29 @@ class MerchantPlanPage {
...
@@ -141,6 +151,29 @@ class MerchantPlanPage {
await
baseStep
.
wait
(
driver
,
1000
);
await
baseStep
.
wait
(
driver
,
1000
);
}
}
selectProduct
=
async
function
(
driver
,
name
){
console
.
log
(
"select product: "
+
name
);
await
baseStep
.
click
(
driver
,
"//*[text()='"
+
name
+
"']"
);
await
baseStep
.
wait
(
driver
,
1000
);
}
deleteProduct
=
async
function
(
driver
,
name
){
console
.
log
(
"delete product: "
+
name
);
await
baseStep
.
click
(
driver
,
"//*[text()='"
+
name
+
"']/following-sibling::button"
);
await
baseStep
.
wait
(
driver
,
1000
);
}
clickNewPlanBtn
=
async
function
(
driver
){
let
btns
=
await
driver
.
findElements
(
By
.
xpath
(
this
.
new_plan_btn
));
for
(
let
btn
of
btns
){
console
.
log
(
"-------"
,
btn
);
if
(
await
btn
.
isDisplayed
()){
await
btn
.
click
();
break
;
}
}
}
}
}
module
.
exports
=
new
MerchantPlanPage
();
module
.
exports
=
new
MerchantPlanPage
();
01_Web/PageObject/MerchantUserListPage.js
View file @
b9927b88
...
@@ -39,7 +39,9 @@ class MerchantUserListPage {
...
@@ -39,7 +39,9 @@ class MerchantUserListPage {
current_plan
=
"//*[text()='Plan']/following-sibling::div[1]"
current_plan
=
"//*[text()='Plan']/following-sibling::div[1]"
current_plan_des
=
"(//*[text()='Plan Description'])[1]/following-sibling::div[1]"
current_plan_des
=
"(//*[text()='Plan Description'])[1]/following-sibling::div[1]"
current_status
=
"(//*[text()='Status'])[3]//following-sibling::div[1]/span"
current_status
=
"(//*[text()='Status'])[3]//following-sibling::div[1]/span"
plan_name
=
'(//*[text()="Plan"]/following-sibling::div[1])'
sub_status
=
'(//*[text()="Status"]/following-sibling::div[1]/span[1])'
plan_search_list
=
'//*[text()="Assign subscription"]/../following-sibling::div//input[@type="search"]/..'
...
@@ -82,6 +84,46 @@ class MerchantUserListPage {
...
@@ -82,6 +84,46 @@ class MerchantUserListPage {
await
baseStep
.
wait
(
driver
,
1000
);
await
baseStep
.
wait
(
driver
,
1000
);
}
}
selectProduct
=
async
function
(
driver
,
name
){
console
.
log
(
"select product: "
+
name
);
await
baseStep
.
click
(
driver
,
"//*[text()='"
+
name
+
"']"
);
await
baseStep
.
wait
(
driver
,
1000
);
}
checkRecordHistoryList
=
async
function
(
driver
,
product
=
""
,
plan
=
""
,
status
=
""
,
record
=
1
){
await
baseStep
.
waitUntilElement
(
driver
,
"//*[@class='ant-table-tbody']"
,
20000
);
await
baseStep
.
wait
(
driver
,
5000
);
let
table
=
await
driver
.
findElement
(
By
.
xpath
(
"//*[@class='ant-table-tbody']"
));
let
rows
=
await
table
.
findElements
({
tagName
:
'tr'
})
console
.
log
(
"rows.length: "
,
rows
.
length
)
let
cells
=
await
rows
[
record
].
findElements
({
tagName
:
'td'
});
if
(
product
!==
""
){
let
actual_product
=
await
cells
[
0
].
getText
()
expect
(
await
actual_product
).
to
.
equal
(
product
);
}
if
(
plan
!==
""
){
let
actual_plan
=
await
cells
[
1
].
getText
()
expect
(
await
actual_plan
).
to
.
equal
(
plan
);
}
if
(
status
!==
""
){
let
actual_status
=
await
cells
[
4
].
getText
()
expect
(
actual_status
).
to
.
equal
(
status
);
}
}
clickAssignBtn
=
async
function
(
driver
){
let
btns
=
await
driver
.
findElements
(
By
.
xpath
(
this
.
assign_sub_btn
));
for
(
let
btn
of
btns
){
console
.
log
(
"-------"
,
btn
);
if
(
await
btn
.
isDisplayed
()){
await
btn
.
click
();
break
;
}
}
}
}
}
...
...
01_Web/PageObject/UserMySubPage.js
View file @
b9927b88
const
baseStep
=
require
(
"../../CommonStep/Web/Web_Common_Step"
);
const
baseStep
=
require
(
"../../CommonStep/Web/Web_Common_Step"
);
const
webdriver
=
require
(
'selenium-webdriver'
);
const
webdriver
=
require
(
'selenium-webdriver'
);
const
{
expect
}
=
require
(
"chai"
);
const
By
=
webdriver
.
By
;
const
By
=
webdriver
.
By
;
class
UserMySubPage
{
class
UserMySubPage
{
menu_my_subscription
=
'//*[@class="ant-menu-title-content" and text()="My Subscription"]'
menu_my_subscription
=
'//*[@class="ant-menu-title-content" and text()="My Subscription"]'
sub_status
=
'//*[text()="Status"]/following-sibling::div[1]/span'
plan_name
=
'(//*[text()="Plan"]/following-sibling::div[1])'
sub_status
=
'(//*[text()="Status"]/following-sibling::div[1]/span[1])'
cancel_sub_button
=
'//span[text()="CANCEL"]'
cancel_sub_button
=
'//span[text()="CANCEL"]'
cancel_confirm_button
=
'//span[text()="Yes, Cancel it"]'
cancel_confirm_button
=
'//span[text()="Yes, Cancel it"]'
go_to_choose_one
=
'//*[text()="Go to choose one"]'
selectProduct
=
async
function
(
driver
,
name
){
console
.
log
(
"select product: "
+
name
);
await
baseStep
.
click
(
driver
,
"//*[text()='"
+
name
+
"']"
);
await
baseStep
.
wait
(
driver
,
1000
);
}
checkRecordHistoryList
=
async
function
(
driver
,
product
=
""
,
plan
=
""
,
status
=
""
,
record
=
1
){
await
baseStep
.
waitUntilElement
(
driver
,
"//*[@class='ant-table-tbody']"
,
20000
);
await
baseStep
.
wait
(
driver
,
5000
);
let
table
=
await
driver
.
findElement
(
By
.
xpath
(
"//*[@class='ant-table-tbody']"
));
let
rows
=
await
table
.
findElements
({
tagName
:
'tr'
})
console
.
log
(
"rows.length: "
,
rows
.
length
)
//*[@id="root"]/div/div/main/div/div/div[1]/div/div/div/div/div[2]/table/tbody/tr[2]/td[3]/div/span
let
cells
=
await
rows
[
record
].
findElements
({
tagName
:
'td'
});
if
(
product
!==
""
){
let
actual_product
=
await
cells
[
0
].
getText
()
// let amount = await driver.findElement(By.xpath("//*[@id=\"root\"]/div/div/main/div/div/div[1]/div/div/div/div/div[2]/table/tbody/tr["+(record+1)+"]/td[3]/div/span"))
expect
(
await
actual_product
).
to
.
equal
(
product
);
}
if
(
plan
!==
""
){
let
actual_plan
=
await
cells
[
1
].
getText
()
// let actualStatus = await driver.findElement(By.xpath("//*[@id=\"root\"]/div/div/main/div/div/div[1]/div/div/div/div/div[2]/table/tbody/tr["+(record+1)+"]/td[4]/span"))
expect
(
await
actual_plan
).
to
.
equal
(
plan
);
}
if
(
status
!==
""
){
let
actual_status
=
await
cells
[
4
].
getText
()
expect
(
actual_status
).
to
.
equal
(
status
);
}
}
isProductSelected
=
async
function
(
driver
,
productName
){
let
element
=
await
driver
.
findElement
(
By
.
xpath
(
"//*[text()='"
+
productName
+
"']"
));
return
await
element
.
getAttribute
(
'aria-selected'
);
}
}
}
module
.
exports
=
new
UserMySubPage
();
module
.
exports
=
new
UserMySubPage
();
01_Web/PageObject/UserPlanPage.js
View file @
b9927b88
...
@@ -43,6 +43,11 @@ class UserPlanPage {
...
@@ -43,6 +43,11 @@ class UserPlanPage {
}
}
selectProduct
=
async
function
(
driver
,
name
){
console
.
log
(
"select product: "
+
name
);
await
baseStep
.
click
(
driver
,
"//*[text()='"
+
name
+
"']"
);
await
baseStep
.
wait
(
driver
,
1000
);
}
...
...
01_Web/TestCases/MerchantPortal/10_product.js
0 → 100644
View file @
b9927b88
This diff is collapsed.
Click to expand it.
01_Web/TestCases/UserPortal/02_purchanse_plan.js
View file @
b9927b88
...
@@ -14,7 +14,6 @@ const ApiReq = new API_Object("https://api.unibee.top");
...
@@ -14,7 +14,6 @@ const ApiReq = new API_Object("https://api.unibee.top");
const
addContext
=
require
(
'mochawesome/addContext'
);
const
addContext
=
require
(
'mochawesome/addContext'
);
const
{
expect
}
=
require
(
"chai"
);
const
{
expect
}
=
require
(
"chai"
);
const
{
wait
}
=
require
(
"../../../CommonStep/Web/Web_Common_Step"
);
let
request
;
let
request
;
let
response
;
let
response
;
let
timeStamp
=
new
Date
();
let
timeStamp
=
new
Date
();
...
...
01_Web/TestCases/UserPortal/08_product.js
0 → 100644
View file @
b9927b88
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment