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
3b2caaeb
Commit
3b2caaeb
authored
Sep 30, 2024
by
Joshua Yu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' into 'master'
add cases See merge request
!23
parents
cc8c50a0
6a87fa95
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
536 additions
and
14 deletions
+536
-14
MerchantBillableMetricPage.js
01_Web/PageObject/MerchantBillableMetricPage.js
+9
-0
MerchantDiscountCodePage.js
01_Web/PageObject/MerchantDiscountCodePage.js
+33
-12
MerchantInvoicePage.js
01_Web/PageObject/MerchantInvoicePage.js
+10
-0
MerchantPlanPage.js
01_Web/PageObject/MerchantPlanPage.js
+35
-0
MerchantTransactionPage.js
01_Web/PageObject/MerchantTransactionPage.js
+10
-0
MerchantUserListPage.js
01_Web/PageObject/MerchantUserListPage.js
+26
-1
02_new_plan.js
01_Web/TestCases/MerchantPortal/02_new_plan.js
+0
-0
03_billable_metric_merchant.js
...b/TestCases/MerchantPortal/03_billable_metric_merchant.js
+149
-0
04_discount_code_merchant.js
01_Web/TestCases/MerchantPortal/04_discount_code_merchant.js
+0
-0
05_invoice.js
01_Web/TestCases/MerchantPortal/05_invoice.js
+75
-0
06_transaction.js
01_Web/TestCases/MerchantPortal/06_transaction.js
+188
-1
08_subscription.js
01_Web/TestCases/MerchantPortal/08_subscription.js
+1
-0
09_user_list.js
01_Web/TestCases/MerchantPortal/09_user_list.js
+0
-0
No files found.
01_Web/PageObject/MerchantBillableMetricPage.js
View file @
3b2caaeb
...
...
@@ -10,7 +10,9 @@ class MerchantBillableMetricPage {
metric_code
=
'//*[@id="code"]'
metric_description
=
'//*[@id="metricDescription"]'
aggregation_type
=
'//*[@id="aggregationType"]'
aggregation_type_errpr
=
'//*[@id="aggregationType_help"]'
aggregation_property
=
'//*[@id="aggregationProperty"]'
aggregation_property_error
=
'//*[@id="aggregationProperty_help"]'
save_btn
=
'//*[text()="Save"]'
selectAggregationType
=
async
function
(
driver
,
type
){
...
...
@@ -63,6 +65,13 @@ class MerchantBillableMetricPage {
}
editBillableMetric
=
async
function
(
driver
,
metricName
){
console
.
log
(
"Edit Billable Metric: "
,
metricName
);
let
editPath
=
'//*[text()="'
+
metricName
+
'"]/following-sibling::td//*[text()="Edit"]'
;
await
baseStep
.
click
(
driver
,
editPath
);
await
baseStep
.
wait
(
driver
,
1000
);
}
}
...
...
01_Web/PageObject/MerchantDiscountCodePage.js
View file @
3b2caaeb
...
...
@@ -7,15 +7,19 @@ class MerchantDiscountCodePage {
menu_discount_code
=
'//*[@class="ant-menu-title-content" and text()="Discount Code"]'
new_discount_code
=
'//*[@class="ant-btn-icon"]/span[@aria-label="plus"]'
name
=
'//*[@id="name"]'
name_error
=
'//*[@id="name_help"]'
code
=
'//*[@id="code"]'
code_error
=
'//*[@id="code_help"]'
billingType
=
'//*[@id="billingType"]'
discountType
=
'//*[@id="discountType"]'
currency
=
'//*[@id="currency"]'
discountAmount
=
'//*[@id="discountAmount"]'
discountPercentage
=
'//*[@id="discountPercentage"]'
discountPercentage_error
=
'//*[@id="discountPercentage_help"]'
cycleLimit
=
'//*[@id="cycleLimit"]'
validityRangeStart
=
'//*[@id="validityRange"]'
validityRangeEnd
=
'//*[@placeholder="End date"]'
validity_error
=
'//*[@id="validityRange_help"]'
validityRangeOK
=
"//span[contains(.,'OK')]"
save_btn
=
'//*[text()="Save"]'
...
...
@@ -85,8 +89,7 @@ class MerchantDiscountCodePage {
await
baseStep
.
wait
(
driver
,
1000
)
}
checkRecordDiscountCode
=
async
function
(
driver
,
code
=
""
,
name
=
""
,
description
=
""
,
type
=
""
,
aggregationType
=
""
,
aggregationProperty
=
""
,
record
=
1
){
await
baseStep
.
waitUntilElement
(
driver
,
"//*[@class='ant-table-cell' and text()='Aggregation Type']"
,
20000
);
checkRecordDiscountCode
=
async
function
(
driver
,
code
=
""
,
name
=
""
,
status
=
""
,
billingType
=
""
,
discount_type
=
""
,
percentage
=
""
,
record
=
1
){
await
baseStep
.
wait
(
driver
,
10000
);
let
table
=
await
driver
.
findElement
(
By
.
xpath
(
"//*[@class='ant-table-tbody']"
));
...
...
@@ -95,30 +98,48 @@ class MerchantDiscountCodePage {
let
cells
=
await
rows
[
record
-
1
].
findElements
({
tagName
:
'td'
});
if
(
code
!==
""
){
expect
(
await
cells
[
0
].
getText
()).
to
.
equal
(
nam
e
);
expect
(
await
cells
[
0
].
getText
()).
to
.
equal
(
cod
e
);
}
if
(
name
!==
""
){
expect
(
await
cells
[
1
].
getText
()).
to
.
equal
(
cod
e
);
expect
(
await
cells
[
1
].
getText
()).
to
.
equal
(
nam
e
);
}
if
(
description
!==
""
){
if
(
status
!==
""
){
expect
(
await
cells
[
2
].
getText
()).
to
.
equal
(
description
);
expect
(
await
cells
[
2
].
getText
()).
to
.
equal
(
status
);
}
if
(
t
ype
!==
""
){
if
(
billingT
ype
!==
""
){
expect
(
await
cells
[
3
].
getText
()).
to
.
equal
(
t
ype
);
expect
(
await
cells
[
3
].
getText
()).
to
.
equal
(
billingT
ype
);
}
if
(
aggregationT
ype
!==
""
){
if
(
discount_t
ype
!==
""
){
expect
(
await
cells
[
4
].
getText
()).
to
.
equal
(
aggregationT
ype
);
expect
(
await
cells
[
4
].
getText
()).
to
.
equal
(
discount_t
ype
);
}
if
(
aggregationProperty
!==
""
){
if
(
percentage
!==
""
){
expect
(
await
cells
[
5
].
getText
()).
to
.
equal
(
aggregationProperty
);
expect
(
await
cells
[
6
].
getText
()).
to
.
equal
(
percentage
);
}
}
editDiscountCode
=
async
function
(
driver
,
discount
){
console
.
log
(
"Edit Discount Code: "
,
discount
);
let
editPath
=
'//*[text()="'
+
discount
+
'"]/following-sibling::td[10]//*[@aria-label="edit"]'
;
await
baseStep
.
click
(
driver
,
editPath
);
await
baseStep
.
wait
(
driver
,
1000
);
}
filterStatus
=
async
function
(
driver
,
status
){
await
baseStep
.
click
(
driver
,
"//*[text()=
\"
Status
\"
]/following-sibling::span/span"
);
for
(
let
i
of
status
){
await
baseStep
.
click
(
driver
,
'//*[text()="'
+
i
+
'"]/../label/span/input'
)
}
await
baseStep
.
wait
(
driver
,
1000
);
await
baseStep
.
click
(
driver
,
"//*[@class=
\"
ant-table-filter-dropdown
\"
]//*[text()=
\"
OK
\"
]"
);
await
baseStep
.
wait
(
driver
,
1000
);
}
}
...
...
01_Web/PageObject/MerchantInvoicePage.js
View file @
3b2caaeb
...
...
@@ -67,6 +67,16 @@ class MerchantInvoicePage {
}
filterStatus
=
async
function
(
driver
,
status
){
await
baseStep
.
click
(
driver
,
"//*[text()=
\"
Status
\"
]/following-sibling::span/span"
);
for
(
let
i
of
status
){
await
baseStep
.
click
(
driver
,
'//*[text()="'
+
i
+
'"]/../label/span/input'
)
}
await
baseStep
.
wait
(
driver
,
1000
);
await
baseStep
.
click
(
driver
,
"//*[@class=
\"
ant-table-filter-dropdown
\"
]//*[text()=
\"
OK
\"
]"
);
await
baseStep
.
wait
(
driver
,
1000
);
}
}
module
.
exports
=
new
MerchantInvoicePage
();
01_Web/PageObject/MerchantPlanPage.js
View file @
3b2caaeb
...
...
@@ -6,10 +6,14 @@ class MerchantPlanPage {
menu_plan
=
'//*[@class="ant-menu-title-content" and text()="Product and Plan"]'
// new_plan_btn= '//*[@class="anticon anticon-plus"]/../following-sibling::span[text()="New plan"]'
new_plan_btn
=
'//*[@class="ant-btn-icon"]/span[@aria-label="plus"]'
edit_plan
=
'//*[@aria-label="edit"]'
copy_plan
=
'//*[@aria-label="copy"]'
plan_name_label
=
'//*[@for="planName"]'
plan_name
=
'//*[@id="planName"]'
plan_name_error
=
'//*[@id="planName_help"]'
plan_description_label
=
'//*[@for="description"]'
plan_description
=
'//*[@id="description"]'
plan_description_error
=
'//*[@id="description_help"]'
status_label
=
'//*[@for="status"]'
status
=
'//*[@id="status"]'
is_published_label
=
'//*[@for="publishStatus"]'
...
...
@@ -18,6 +22,7 @@ class MerchantPlanPage {
currency
=
'//*[@id="currency"]'
price_label
=
'//*[@for="amount"]'
price
=
'//*[@id="amount"]'
price_error
=
'//*[@id="amount_help"]'
intervalUnit_label
=
'//*[@for="intervalUnit"]'
intervalUnit
=
'//*[@id="intervalUnit"]'
intervalCount_label
=
'//*[@for="intervalCount"]'
...
...
@@ -39,11 +44,17 @@ class MerchantPlanPage {
auto_renew_after_trial_end_label
=
'//*[@for="cancelAtTrialEnd"]'
auto_renew_after_trial_end
=
'//*[@id="cancelAtTrialEnd"]'
billable_metrics_label
=
'//*[@title="Billable Metrics"]'
billable_metrics_name
=
'(//*[@title="Billable Metrics"]/../following-sibling::div//input)[1]'
billable_metrics_limit_value
=
'(//*[@title="Billable Metrics"]/../following-sibling::div//input)[2]'
Custom_data_label
=
'//*[@for="metadata"]'
custom_data
=
'//*[@id="metadata"]'
back_btn
=
'//*[text()="Go Back"]'
save_btn
=
'//*[text()="Save"]'
activate_btn
=
'//*[text()="Activate"]'
publish_btn
=
'//*[text()="Publish"]'
unpublish_btn
=
'//*[text()="Unpublish"]'
delete_btn
=
'//*[text()="Delete"]'
confirm_delete_btn
=
'//*[@class="ant-popconfirm-buttons"]/button'
plan_list_table
=
'//*[@class="ant-table-tbody"]'
...
...
@@ -174,6 +185,30 @@ class MerchantPlanPage {
}
}
}
selectBillableMetrics
=
async
function
(
driver
,
name
){
console
.
log
(
"select addon name: "
,
name
);
await
baseStep
.
scrollIntoView
(
driver
,
this
.
billable_metrics_name
);
await
baseStep
.
click
(
driver
,
this
.
billable_metrics_name
);
await
baseStep
.
click
(
driver
,
"//*[contains(text(),'"
+
name
+
"')]"
);
await
baseStep
.
wait
(
driver
,
1000
);
await
baseStep
.
click
(
driver
,
this
.
billable_metrics_limit_value
);
await
baseStep
.
wait
(
driver
,
1000
);
}
editPlan
=
async
function
(
driver
,
planName
){
console
.
log
(
"Edit plan: "
,
planName
);
let
editPath
=
'//*[text()="'
+
planName
+
'"]//following-sibling::td[9]//*[@aria-label="edit"]'
;
await
baseStep
.
click
(
driver
,
editPath
);
await
baseStep
.
wait
(
driver
,
1000
);
}
copyPlan
=
async
function
(
driver
,
planName
){
console
.
log
(
"Copy plan: "
,
planName
);
let
editPath
=
'//*[text()="'
+
planName
+
'"]//following-sibling::td[9]//*[@aria-label="copy"]'
;
await
baseStep
.
click
(
driver
,
editPath
);
await
baseStep
.
wait
(
driver
,
1000
);
}
}
module
.
exports
=
new
MerchantPlanPage
();
01_Web/PageObject/MerchantTransactionPage.js
View file @
3b2caaeb
...
...
@@ -35,6 +35,16 @@ class MerchantTransactionPage {
}
}
filterStatus
=
async
function
(
driver
,
status
){
await
baseStep
.
click
(
driver
,
"//*[text()=
\"
Status
\"
]/following-sibling::span/span"
);
for
(
let
i
of
status
){
await
baseStep
.
click
(
driver
,
'//*[text()="'
+
i
+
'"]/../label/span/input'
)
}
await
baseStep
.
wait
(
driver
,
1000
);
await
baseStep
.
click
(
driver
,
"//*[@class=
\"
ant-table-filter-dropdown
\"
]//*[text()=
\"
OK
\"
]"
);
await
baseStep
.
wait
(
driver
,
1000
);
}
}
...
...
01_Web/PageObject/MerchantUserListPage.js
View file @
3b2caaeb
...
...
@@ -11,6 +11,7 @@ class MerchantUserListPage {
clear_btn
=
'//*[text()="Clear"]'
search_btn
=
'//*[text()="Search"]'
add_new_btn
=
'//*[@aria-label="user-add"]'
sub_id_link
=
'//*[@id="root"]/div/div/main/div/div/div[3]/div/div/div/div/div/table/tbody/tr/td[4]/div'
info_first_name
=
'//*[text()="First Name"]/../following-sibling::div[1]'
info_last_name
=
'//*[text()="Last Name"]/../following-sibling::div[1]'
info_email
=
'//*[text()="Email"]/../following-sibling::div[1]/a'
...
...
@@ -42,6 +43,15 @@ class MerchantUserListPage {
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"]/..'
account_billing_address
=
'//*[@id="address"]'
account_payment_stripe
=
'//*[@for="payment-stripe"]'
account_payment_changelly
=
'//*[@for="payment-changelly"]'
account_payment_wire_transfer
=
'//*[@for="payment-wire_transfer"]'
account_vat_number
=
'//*[@id="vATNumber"]'
account_country
=
'//*[@id="countryCode"]'
vat_error_message
=
'//*[contains(text(), "AT number validation failed. ")]'
country_error_message
=
'//*[contains(text(), "Your country from vat number is")]'
save_btn
=
'//*[text()="Save"]'
...
...
@@ -68,7 +78,7 @@ class MerchantUserListPage {
expect
(
await
cells
[
6
].
getText
()).
to
.
equal
(
status
);
}
await
baseStep
.
click
(
driver
,
'//*[@id="root"]/div/div/main/div/div/div[3]/div/div/div/div/div/table/tbody/tr[1]/td[1]'
);
await
baseStep
.
wait
(
driver
,
1
000
);
await
baseStep
.
wait
(
driver
,
3
000
);
}
...
...
@@ -125,6 +135,21 @@ class MerchantUserListPage {
}
}
setCountry
=
async
function
(
driver
,
countryName
){
console
.
log
(
"set country: "
,
countryName
);
// await driver.executeScript(`document.getElementsByClassName("ant-select-selection-item").title = '${countryName}';`)
// await driver.executeScript(`document.getElementsByClassName("ant-select-selection-item").textContent = '${countryName}';`)
// let element = driver.findElement(By.className('ant-select-selection-item'));
//
// let js = `arguments[0].setAttribute("title", "${countryName}");`;
// await driver.executeScript(js, element);
// await driver.executeScript(`arguments[0].innerText = "${countryName}";`, element);
let
xpath
=
'//div[3]/div/div/div[2]/div/div/div/div/div'
;
await
baseStep
.
input
(
driver
,
this
.
account_country
,
countryName
);
await
baseStep
.
input
(
driver
,
this
.
account_country
,
'
\
uE007'
);
await
baseStep
.
wait
(
driver
,
1000
);
}
}
module
.
exports
=
new
MerchantUserListPage
();
01_Web/TestCases/MerchantPortal/02_new_plan.js
View file @
3b2caaeb
This diff is collapsed.
Click to expand it.
01_Web/TestCases/MerchantPortal/03_billable_metric_merchant.js
View file @
3b2caaeb
...
...
@@ -422,6 +422,155 @@ describe('case05: Add billable metric in Merchant Portal, Aggregation Type = sum
});
describe
(
'case06: Add billable metric without param=> Success'
,
function
()
{
this
.
timeout
(
100000
);
beforeEach
(
function
()
{
response
=
null
;
addContext
(
this
,
{
title
:
'StartTime'
,
value
:
{
StartTime
:
timeStamp
=
new
Date
()
}
});
});
afterEach
(
function
()
{
if
(
response
)
{
addContext
(
this
,
{
title
:
'Request'
,
value
:
{
Request
:
request
}
});
addContext
(
this
,
{
title
:
'Response'
,
value
:
{
Response
:
response
}
});
}
addContext
(
this
,
{
title
:
'EndTime'
,
value
:
{
EndTime
:
timeStamp
=
new
Date
()
}
});
});
it
(
'TC001 - add billable metric ,Aggregation Type = sum => Success '
,
(
done
)
=>
{
(
async
()
=>
{
try
{
// login
Driver
=
driver
.
getDriver
(
webdriver
,
'chrome'
);
// Check Url
await
loginPage
.
openMerchantUrl
(
Driver
);
const
currentUrl
=
await
Driver
.
getCurrentUrl
();
console
.
log
(
'当前网址:'
,
currentUrl
);
await
baseStep
.
waitUntilElement
(
Driver
,
loginPage
.
email
,
20000
);
await
loginPage
.
loginMerchant
(
Driver
)
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
click
(
Driver
,
billableMetricPage
.
menu_billable_metric
);
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
click
(
Driver
,
billableMetricPage
.
new_billable_metric
);
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
click
(
Driver
,
billableMetricPage
.
save_btn
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
'/11_error.jpeg'
);
expect
(
"Please select your aggregation type"
).
to
.
equal
(
await
baseStep
.
getText
(
Driver
,
billableMetricPage
.
aggregation_type_errpr
));
expect
(
"Please input your property to aggregate !"
).
to
.
equal
(
await
baseStep
.
getText
(
Driver
,
billableMetricPage
.
aggregation_property_error
));
await
baseStep
.
wait
(
Driver
,
1000
);
done
();
}
catch
(
e
)
{
done
(
e
);
}
finally
{
await
Driver
.
quit
();
}
})();
});
it
(
'Delay 5 seconds '
,
(
done
)
=>
{
setTimeout
(()
=>
{
// TODO Need wait about syncTimeAPI second after last operation
done
();
},
5000
);
});
});
describe
(
'case07: Edit billable metric in Merchant Portal=> Success'
,
function
()
{
this
.
timeout
(
100000
);
beforeEach
(
function
()
{
response
=
null
;
addContext
(
this
,
{
title
:
'StartTime'
,
value
:
{
StartTime
:
timeStamp
=
new
Date
()
}
});
});
afterEach
(
function
()
{
if
(
response
)
{
addContext
(
this
,
{
title
:
'Request'
,
value
:
{
Request
:
request
}
});
addContext
(
this
,
{
title
:
'Response'
,
value
:
{
Response
:
response
}
});
}
addContext
(
this
,
{
title
:
'EndTime'
,
value
:
{
EndTime
:
timeStamp
=
new
Date
()
}
});
});
it
(
'TC001 - Edit billable metric => Success '
,
(
done
)
=>
{
(
async
()
=>
{
try
{
// login
Driver
=
driver
.
getDriver
(
webdriver
,
'chrome'
);
// Check Url
await
loginPage
.
openMerchantUrl
(
Driver
);
const
currentUrl
=
await
Driver
.
getCurrentUrl
();
console
.
log
(
'当前网址:'
,
currentUrl
);
await
baseStep
.
waitUntilElement
(
Driver
,
loginPage
.
email
,
20000
);
await
loginPage
.
loginMerchant
(
Driver
)
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
click
(
Driver
,
billableMetricPage
.
menu_billable_metric
);
await
baseStep
.
wait
(
Driver
,
1000
);
await
billableMetricPage
.
editBillableMetric
(
Driver
,
"Editable metric"
);
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
inputWithClear
(
Driver
,
billableMetricPage
.
metric_description
,
"description"
+
new
Date
().
getTime
());
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
'/12_edit.jpeg'
);
await
baseStep
.
click
(
Driver
,
billableMetricPage
.
save_btn
);
await
baseStep
.
wait
(
Driver
,
3000
);
done
();
}
catch
(
e
)
{
done
(
e
);
}
finally
{
await
Driver
.
quit
();
}
})();
});
it
(
'Delay 5 seconds '
,
(
done
)
=>
{
setTimeout
(()
=>
{
// TODO Need wait about syncTimeAPI second after last operation
done
();
},
5000
);
});
});
01_Web/TestCases/MerchantPortal/04_discount_code_merchant.js
View file @
3b2caaeb
This diff is collapsed.
Click to expand it.
01_Web/TestCases/MerchantPortal/05_invoice.js
View file @
3b2caaeb
...
...
@@ -1078,6 +1078,81 @@ describe('case05: refund with wire transfer=> Success', function () {
});
describe
(
'case06: Filter => Success'
,
function
()
{
this
.
timeout
(
9000000
);
beforeEach
(
function
()
{
response
=
null
;
addContext
(
this
,
{
title
:
'StartTime'
,
value
:
{
StartTime
:
timeStamp
=
new
Date
()
}
});
});
afterEach
(
function
()
{
if
(
response
)
{
addContext
(
this
,
{
title
:
'Request'
,
value
:
{
Request
:
request
}
});
addContext
(
this
,
{
title
:
'Response'
,
value
:
{
Response
:
response
}
});
}
addContext
(
this
,
{
title
:
'EndTime'
,
value
:
{
EndTime
:
timeStamp
=
new
Date
()
}
});
});
it
(
'case 01 - filter status in invoice list=> Success '
,
(
done
)
=>
{
(
async
()
=>
{
try
{
// login
Driver
=
driver
.
getDriver
(
webdriver
,
'chrome'
);
// Check Url
await
loginPage
.
openMerchantUrl
(
Driver
);
const
currentUrl
=
await
Driver
.
getCurrentUrl
();
console
.
log
(
'当前网址:'
,
currentUrl
);
await
baseStep
.
waitUntilElement
(
Driver
,
loginPage
.
email
,
20000
);
await
loginPage
.
loginMerchant
(
Driver
)
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
click
(
Driver
,
merchantInvoicePage
.
menu_Invoice
);
await
merchantInvoicePage
.
filterStatus
(
Driver
,
[
"Cancelled"
]);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
'/09_filterStatus.jpeg'
);
await
merchantInvoicePage
.
checkRecordInvoiceList
(
Driver
,
""
,
"Invoice"
,
"Cancelled"
,
"Stripe"
,
testUser
);
done
();
}
catch
(
e
)
{
done
(
e
);
}
finally
{
await
Driver
.
quit
();
}
})();
});
it
(
'Delay 5 seconds '
,
(
done
)
=>
{
setTimeout
(()
=>
{
// TODO Need wait about syncTimeAPI second after last operation
done
();
},
5000
);
});
});
...
...
01_Web/TestCases/MerchantPortal/06_transaction.js
View file @
3b2caaeb
...
...
@@ -12,7 +12,7 @@ const baseStep = require('../../../CommonStep/Web/Web_Common_Step');
const
API_Object
=
require
(
"../../../CommonStep/API/API_Object"
);
const
API_Env
=
require
(
"../../../CommonStep/API/API_Env"
);
const
ApiReq
=
new
API_Object
(
"
https://api.unibee.top
"
);
const
ApiReq
=
new
API_Object
(
"
"
);
const
addContext
=
require
(
'mochawesome/addContext'
);
const
{
expect
}
=
require
(
"chai"
);
...
...
@@ -853,6 +853,193 @@ describe('case04: Transaction with refund => Success', function () {
});
describe
(
'case05: Transaction filter => Success'
,
function
()
{
this
.
timeout
(
9000000
);
beforeEach
(
function
()
{
response
=
null
;
addContext
(
this
,
{
title
:
'StartTime'
,
value
:
{
StartTime
:
timeStamp
=
new
Date
()
}
});
});
afterEach
(
function
()
{
if
(
response
)
{
addContext
(
this
,
{
title
:
'Request'
,
value
:
{
Request
:
request
}
});
addContext
(
this
,
{
title
:
'Response'
,
value
:
{
Response
:
response
}
});
}
addContext
(
this
,
{
title
:
'EndTime'
,
value
:
{
EndTime
:
timeStamp
=
new
Date
()
}
});
});
it
(
'case 01 - check filter => Success '
,
(
done
)
=>
{
(
async
()
=>
{
try
{
// login
Driver
=
driver
.
getDriver
(
webdriver
,
'chrome'
);
// Check Url
await
loginPage
.
openMerchantUrl
(
Driver
);
const
currentUrl
=
await
Driver
.
getCurrentUrl
();
console
.
log
(
'当前网址:'
,
currentUrl
);
await
baseStep
.
waitUntilElement
(
Driver
,
loginPage
.
email
,
20000
);
await
loginPage
.
loginMerchant
(
Driver
)
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
click
(
Driver
,
merchantTransactionPage
.
menu_transaction
);
await
merchantTransactionPage
.
filterStatus
(
Driver
,
[
"Failed"
])
await
baseStep
.
wait
(
Driver
,
2000
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
'/05_RefundTransaction.jpeg'
);
await
merchantTransactionPage
.
checkRecordTransactionList
(
Driver
,
""
,
"Failed"
,
"Payment"
,
"Stripe"
);
done
();
}
catch
(
e
)
{
done
(
e
);
}
finally
{
await
Driver
.
quit
();
}
})();
});
it
(
'Delay 5 seconds '
,
(
done
)
=>
{
setTimeout
(()
=>
{
// TODO Need wait about syncTimeAPI second after last operation
done
();
},
5000
);
});
});
describe
(
'case06: One time payment => Success'
,
function
()
{
this
.
timeout
(
9000000
);
beforeEach
(
function
()
{
response
=
null
;
addContext
(
this
,
{
title
:
'StartTime'
,
value
:
{
StartTime
:
timeStamp
=
new
Date
()
}
});
});
afterEach
(
function
()
{
if
(
response
)
{
addContext
(
this
,
{
title
:
'Request'
,
value
:
{
Request
:
request
}
});
addContext
(
this
,
{
title
:
'Response'
,
value
:
{
Response
:
response
}
});
}
addContext
(
this
,
{
title
:
'EndTime'
,
value
:
{
EndTime
:
timeStamp
=
new
Date
()
}
});
});
it
(
'TC001 - user purchase a plan => Success '
,
(
done
)
=>
{
(
async
()
=>
{
try
{
// login
Driver
=
driver
.
getDriver
(
webdriver
,
'chrome'
);
// Check Url
await
loginPage
.
openUserUrl
(
Driver
,);
const
currentUrl
=
await
Driver
.
getCurrentUrl
();
console
.
log
(
'当前网址:'
,
currentUrl
);
await
baseStep
.
waitUntilElement
(
Driver
,
loginPage
.
user_email
,
20000
);
await
loginPage
.
loginUserPortal
(
Driver
,
testUser
)
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
click
(
Driver
,
userPlanPage
.
menu_plan
);
await
baseStep
.
waitUntilElement
(
Driver
,
userPlanPage
.
plan_page_sign
,
20000
);
await
baseStep
.
click
(
Driver
,
userPlanPage
.
one_time_addons_tab
)
// no content
await
userPlanPage
.
selectPlan
(
Driver
,
'one time payment'
);
await
baseStep
.
click
(
Driver
,
userPlanPage
.
one_time_OK_btn
);
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
switchWindow
(
Driver
);
await
baseStep
.
waitUntilElement
(
Driver
,
userPlanPage
.
change_card_btn
,
20000
);
await
baseStep
.
click
(
Driver
,
userPlanPage
.
change_card_btn
);
await
baseStep
.
input
(
Driver
,
userPlanPage
.
card_number
,
'4242424242424242'
);
await
baseStep
.
input
(
Driver
,
userPlanPage
.
card_expiry
,
'1234'
);
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
input
(
Driver
,
userPlanPage
.
card_cvc
,
'567'
);
await
baseStep
.
wait
(
Driver
,
3000
);
await
baseStep
.
click
(
Driver
,
userPlanPage
.
pay_btn
);
await
baseStep
.
waitUntilElement
(
Driver
,
userPlanPage
.
payment_success_sign
,
20000
);
let
actual_success_text
=
await
baseStep
.
getText
(
Driver
,
userPlanPage
.
payment_success_sign
)
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
"/06_Buy_an_oneTimePayment"
);
await
expect
(
"Payment succeeded!"
).
to
.
equal
(
actual_success_text
)
await
baseStep
.
wait
(
Driver
,
30000
);
done
();
}
catch
(
e
)
{
done
(
e
);
}
finally
{
await
Driver
.
quit
();
}
})();
});
it
(
'case 02 - check transaction in merchant portal => Success '
,
(
done
)
=>
{
(
async
()
=>
{
try
{
// login
Driver
=
driver
.
getDriver
(
webdriver
,
'chrome'
);
// Check Url
await
loginPage
.
openMerchantUrl
(
Driver
);
const
currentUrl
=
await
Driver
.
getCurrentUrl
();
console
.
log
(
'当前网址:'
,
currentUrl
);
await
baseStep
.
waitUntilElement
(
Driver
,
loginPage
.
email
,
20000
);
await
loginPage
.
loginMerchant
(
Driver
)
await
baseStep
.
wait
(
Driver
,
1000
);
await
baseStep
.
click
(
Driver
,
merchantTransactionPage
.
menu_transaction
);
await
baseStep
.
wait
(
Driver
,
2000
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
'/07_SuccessTransaction.jpeg'
);
await
merchantTransactionPage
.
checkRecordTransactionList
(
Driver
,
"€15"
,
"Succeeded"
,
"Payment"
,
"Stripe"
);
done
();
}
catch
(
e
)
{
done
(
e
);
}
finally
{
await
Driver
.
quit
();
}
})();
});
it
(
'Delay 5 seconds '
,
(
done
)
=>
{
setTimeout
(()
=>
{
// TODO Need wait about syncTimeAPI second after last operation
done
();
},
5000
);
});
});
...
...
01_Web/TestCases/MerchantPortal/08_subscription.js
View file @
3b2caaeb
...
...
@@ -644,3 +644,4 @@ describe('case03: change Due date=> Success', function () {
01_Web/TestCases/MerchantPortal/09_user_list.js
View file @
3b2caaeb
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