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
ba1e28e9
Commit
ba1e28e9
authored
Aug 12, 2024
by
Joshua Yu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' into 'master'
update Screenshot See merge request
!17
parents
b8e1d319
2607dbbc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
11 deletions
+92
-11
UserTransactionPage.js
01_Web/PageObject/UserTransactionPage.js
+1
-1
04_invoice.js
01_Web/TestCases/UserPortal/04_invoice.js
+37
-7
05_transaction.js
01_Web/TestCases/UserPortal/05_transaction.js
+32
-3
API_Object.js
CommonStep/API/API_Object.js
+22
-0
No files found.
01_Web/PageObject/UserTransactionPage.js
View file @
ba1e28e9
...
...
@@ -14,7 +14,7 @@ class UserTransactionPage {
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
-
1
].
findElements
({
tagName
:
'td'
});
let
cells
=
await
rows
[
record
].
findElements
({
tagName
:
'td'
});
if
(
totalAmount
!==
""
){
let
amount
=
await
cells
[
2
].
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"))
...
...
01_Web/TestCases/UserPortal/04_invoice.js
View file @
ba1e28e9
...
...
@@ -141,6 +141,36 @@ describe('case01: Invoice with Paid=> Success', function () {
}
});
it
(
'Case 04: update user country => Success'
,
(
done
)
=>
{
try
{
setTimeout
(()
=>
{
//Wait syncTimeAPI*1000 seconds
ApiReq
.
updateUserCountry
(
API_Env
.
get
().
headerSet
,
{
"countryCode"
:
"GB"
,
"countryName"
:
"United Kingdom"
,
"userId"
:
testData
[
'id'
]
},
(
res
,
url
,
header
,
bodyObject
)
=>
{
request
=
JSON
.
stringify
(
bodyObject
);
request
=
{
URL
:
url
,
Headers
:
header
,
Body
:
JSON
.
parse
(
request
)
};
// response = res.body;
// Expect response headers:x-app,Content-Type
expect
(
res
.
statusCode
).
to
.
equal
(
200
);
const
resBody
=
JSON
.
parse
(
res
.
body
);
response
=
resBody
;
console
.
log
(
resBody
)
// // token check
expect
(
resBody
.
code
).
to
.
equal
(
0
);
done
();
});
},
1000
);
}
catch
(
e
)
{
done
(
e
);
}
});
it
(
'case 05 - invoice with paid => Success '
,
(
done
)
=>
{
(
async
()
=>
{
...
...
@@ -177,13 +207,13 @@ describe('case01: Invoice with Paid=> Success', function () {
await
baseStep
.
wait
(
Driver
,
3000
);
await
baseStep
.
click
(
Driver
,
userInvoicePage
.
menu_Invoice
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
"/03_PaidInvoiceList"
);
await
userInvoicePage
.
checkRecordInvoiceList
(
Driver
,
""
,
"€24
.4 (tax: €4.
4)"
,
"Paid"
);
await
userInvoicePage
.
checkRecordInvoiceList
(
Driver
,
""
,
"€24
(tax: €
4)"
,
"Paid"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_id
)).
not
.
null
;
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_name
)).
to
.
equal
(
"SubscriptionCreate"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_amount
)).
to
.
equal
(
"€24
.4 (22
% tax incl)"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_amount
)).
to
.
equal
(
"€24
(20
% tax incl)"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
status
)).
to
.
equal
(
"Paid"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
subscription_id
)).
not
.
null
;
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
payment_gateway
)).
to
.
equal
(
"
s
tripe"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
payment_gateway
)).
to
.
equal
(
"
S
tripe"
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
"/04_PaidInvoiceDetail"
);
await
baseStep
.
wait
(
Driver
,
2000
);
...
...
@@ -345,10 +375,10 @@ describe('case02: Invoice with Processing=> Success', function () {
await
baseStep
.
wait
(
Driver
,
2000
);
await
baseStep
.
click
(
Driver
,
userInvoicePage
.
menu_Invoice
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
"/05_ProcessingInvoiceList"
);
await
userInvoicePage
.
checkRecordInvoiceList
(
Driver
,
""
,
"€24
.4 (tax: €4.
4)"
,
"Processing"
);
await
userInvoicePage
.
checkRecordInvoiceList
(
Driver
,
""
,
"€24
(tax: €
4)"
,
"Processing"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_id
)).
not
.
null
;
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_name
)).
to
.
equal
(
"SubscriptionCreate"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_amount
)).
to
.
equal
(
"€24
.4 (22
% tax incl)"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_amount
)).
to
.
equal
(
"€24
(20
% tax incl)"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
status
)).
to
.
equal
(
"Processing"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
subscription_id
)).
not
.
null
;
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
payment_gateway
)).
to
.
equal
(
"Wire Transfer"
);
...
...
@@ -515,10 +545,10 @@ describe('case03: Invoice with cancelled=> Success', function () {
await
baseStep
.
wait
(
Driver
,
2000
);
await
baseStep
.
click
(
Driver
,
userInvoicePage
.
menu_Invoice
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
"/07_CancelInvoiceList"
);
await
userInvoicePage
.
checkRecordInvoiceList
(
Driver
,
""
,
"€24
.4 (tax: €4.
4)"
,
"Cancelled"
);
await
userInvoicePage
.
checkRecordInvoiceList
(
Driver
,
""
,
"€24
(tax: €
4)"
,
"Cancelled"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_id
)).
not
.
null
;
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_name
)).
to
.
equal
(
"SubscriptionCreate"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_amount
)).
to
.
equal
(
"€24
.4 (22
% tax incl)"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
invoice_amount
)).
to
.
equal
(
"€24
(20
% tax incl)"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
status
)).
to
.
equal
(
"Cancelled"
);
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
subscription_id
)).
not
.
null
;
expect
(
await
baseStep
.
getText
(
Driver
,
userInvoicePage
.
payment_gateway
)).
to
.
equal
(
"Wire Transfer"
);
...
...
01_Web/TestCases/UserPortal/05_transaction.js
View file @
ba1e28e9
...
...
@@ -142,6 +142,35 @@ describe('case01: Transaction with Succeeded=> Success', function () {
}
});
it
(
'Case 04: update user country => Success'
,
(
done
)
=>
{
try
{
setTimeout
(()
=>
{
//Wait syncTimeAPI*1000 seconds
ApiReq
.
updateUserCountry
(
API_Env
.
get
().
headerSet
,
{
"countryCode"
:
"GB"
,
"countryName"
:
"United Kingdom"
,
"userId"
:
testData
[
'id'
]
},
(
res
,
url
,
header
,
bodyObject
)
=>
{
request
=
JSON
.
stringify
(
bodyObject
);
request
=
{
URL
:
url
,
Headers
:
header
,
Body
:
JSON
.
parse
(
request
)
};
// response = res.body;
// Expect response headers:x-app,Content-Type
expect
(
res
.
statusCode
).
to
.
equal
(
200
);
const
resBody
=
JSON
.
parse
(
res
.
body
);
response
=
resBody
;
console
.
log
(
resBody
)
// // token check
expect
(
resBody
.
code
).
to
.
equal
(
0
);
done
();
});
},
1000
);
}
catch
(
e
)
{
done
(
e
);
}
});
it
(
'case 05 -Transaction with Succeeded => Success '
,
(
done
)
=>
{
(
async
()
=>
{
...
...
@@ -177,7 +206,7 @@ describe('case01: Transaction with Succeeded=> Success', function () {
await
baseStep
.
click
(
Driver
,
userTransactionPage
.
menu_transaction
);
await
baseStep
.
wait
(
Driver
,
2000
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
"/01_SuccessTransaction"
);
await
userTransactionPage
.
checkRecordTransactionList
(
Driver
,
"€24
.4
"
,
"Succeeded"
,
"Payment"
,
"stripe"
);
await
userTransactionPage
.
checkRecordTransactionList
(
Driver
,
"€24"
,
"Succeeded"
,
"Payment"
,
"stripe"
);
done
();
...
...
@@ -339,7 +368,7 @@ describe('case02: Transaction with Pending=> Success', function () {
await
baseStep
.
click
(
Driver
,
userTransactionPage
.
menu_transaction
);
await
baseStep
.
wait
(
Driver
,
2000
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
"/02_PendingTransaction"
);
await
userTransactionPage
.
checkRecordTransactionList
(
Driver
,
"€24
.4
"
,
"Pending"
,
"Payment"
,
"wire_transfer"
);
await
userTransactionPage
.
checkRecordTransactionList
(
Driver
,
"€24"
,
"Pending"
,
"Payment"
,
"wire_transfer"
);
done
();
...
...
@@ -504,7 +533,7 @@ describe('case03: Transaction with Failed=> Success', function () {
await
baseStep
.
click
(
Driver
,
userTransactionPage
.
menu_transaction
);
await
baseStep
.
wait
(
Driver
,
2000
);
await
baseStep
.
screenShot
(
Driver
,
savaPath
+
"/03_FailedTransaction"
);
await
userTransactionPage
.
checkRecordTransactionList
(
Driver
,
"€24
.4
"
,
"Failed"
,
"Payment"
,
"wire_transfer"
);
await
userTransactionPage
.
checkRecordTransactionList
(
Driver
,
"€24"
,
"Failed"
,
"Payment"
,
"wire_transfer"
);
done
();
...
...
CommonStep/API/API_Object.js
View file @
ba1e28e9
...
...
@@ -64,4 +64,25 @@ proto.cancelSubscription = function (header, body, cb) {
cb
(
err
?
err
:
res
,
url
,
header
,
bodyObject
)
})
}
proto
.
updateUserCountry
=
function
(
header
,
body
,
cb
)
{
let
url
=
`
${
this
.
baseUrl
}
/merchant/user/update`
;
let
bodyObject
=
{
"countryCode"
:
"GB"
,
"countryName"
:
"United Kingdom"
,
"userId"
:
"2235429245"
}
for
(
let
k
in
bodyObject
)
{
if
(
k
in
body
)
{
bodyObject
[
k
]
=
body
[
k
];
}
}
HttpRequest
.
post
(
url
,
header
,
JSON
.
stringify
(
bodyObject
),
(
err
,
res
)
=>
{
cb
(
err
?
err
:
res
,
url
,
header
,
bodyObject
)
})
}
module
.
exports
=
API_Object
;
\ No newline at end of file
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