Commit ba1e28e9 authored by Joshua Yu's avatar Joshua Yu

Merge branch 'main' into 'master'

update Screenshot See merge request !17
parents b8e1d319 2607dbbc
...@@ -14,7 +14,7 @@ class UserTransactionPage { ...@@ -14,7 +14,7 @@ class UserTransactionPage {
let rows = await table.findElements({ tagName: 'tr' }) let rows = await table.findElements({ tagName: 'tr' })
console.log("rows.length: ",rows.length) 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 //*[@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!== ""){ if (totalAmount!== ""){
let amount= await cells[2].getText() 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")) // 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"))
......
...@@ -141,6 +141,36 @@ describe('case01: Invoice with Paid=> Success', function () { ...@@ -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) => { it('case 05 - invoice with paid => Success ', (done) => {
(async () => { (async () => {
...@@ -177,13 +207,13 @@ describe('case01: Invoice with Paid=> Success', function () { ...@@ -177,13 +207,13 @@ describe('case01: Invoice with Paid=> Success', function () {
await baseStep.wait(Driver, 3000); await baseStep.wait(Driver, 3000);
await baseStep.click(Driver, userInvoicePage.menu_Invoice); await baseStep.click(Driver, userInvoicePage.menu_Invoice);
await baseStep.screenShot(Driver, savaPath + "/03_PaidInvoiceList"); 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_id)).not.null;
expect(await baseStep.getText(Driver, userInvoicePage.invoice_name)).to.equal("SubscriptionCreate"); 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.status)).to.equal("Paid");
expect(await baseStep.getText(Driver, userInvoicePage.subscription_id)).not.null; expect(await baseStep.getText(Driver, userInvoicePage.subscription_id)).not.null;
expect(await baseStep.getText(Driver, userInvoicePage.payment_gateway)).to.equal("stripe"); expect(await baseStep.getText(Driver, userInvoicePage.payment_gateway)).to.equal("Stripe");
await baseStep.screenShot(Driver, savaPath + "/04_PaidInvoiceDetail"); await baseStep.screenShot(Driver, savaPath + "/04_PaidInvoiceDetail");
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
...@@ -345,10 +375,10 @@ describe('case02: Invoice with Processing=> Success', function () { ...@@ -345,10 +375,10 @@ describe('case02: Invoice with Processing=> Success', function () {
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
await baseStep.click(Driver, userInvoicePage.menu_Invoice); await baseStep.click(Driver, userInvoicePage.menu_Invoice);
await baseStep.screenShot(Driver, savaPath + "/05_ProcessingInvoiceList"); 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_id)).not.null;
expect(await baseStep.getText(Driver, userInvoicePage.invoice_name)).to.equal("SubscriptionCreate"); 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.status)).to.equal("Processing");
expect(await baseStep.getText(Driver, userInvoicePage.subscription_id)).not.null; expect(await baseStep.getText(Driver, userInvoicePage.subscription_id)).not.null;
expect(await baseStep.getText(Driver, userInvoicePage.payment_gateway)).to.equal("Wire Transfer"); expect(await baseStep.getText(Driver, userInvoicePage.payment_gateway)).to.equal("Wire Transfer");
...@@ -515,10 +545,10 @@ describe('case03: Invoice with cancelled=> Success', function () { ...@@ -515,10 +545,10 @@ describe('case03: Invoice with cancelled=> Success', function () {
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
await baseStep.click(Driver, userInvoicePage.menu_Invoice); await baseStep.click(Driver, userInvoicePage.menu_Invoice);
await baseStep.screenShot(Driver, savaPath + "/07_CancelInvoiceList"); 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_id)).not.null;
expect(await baseStep.getText(Driver, userInvoicePage.invoice_name)).to.equal("SubscriptionCreate"); 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.status)).to.equal("Cancelled");
expect(await baseStep.getText(Driver, userInvoicePage.subscription_id)).not.null; expect(await baseStep.getText(Driver, userInvoicePage.subscription_id)).not.null;
expect(await baseStep.getText(Driver, userInvoicePage.payment_gateway)).to.equal("Wire Transfer"); expect(await baseStep.getText(Driver, userInvoicePage.payment_gateway)).to.equal("Wire Transfer");
......
...@@ -142,6 +142,35 @@ describe('case01: Transaction with Succeeded=> Success', function () { ...@@ -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) => { it('case 05 -Transaction with Succeeded => Success ', (done) => {
(async () => { (async () => {
...@@ -177,7 +206,7 @@ describe('case01: Transaction with Succeeded=> Success', function () { ...@@ -177,7 +206,7 @@ describe('case01: Transaction with Succeeded=> Success', function () {
await baseStep.click(Driver, userTransactionPage.menu_transaction); await baseStep.click(Driver, userTransactionPage.menu_transaction);
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
await baseStep.screenShot(Driver, savaPath + "/01_SuccessTransaction"); 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(); done();
...@@ -339,7 +368,7 @@ describe('case02: Transaction with Pending=> Success', function () { ...@@ -339,7 +368,7 @@ describe('case02: Transaction with Pending=> Success', function () {
await baseStep.click(Driver, userTransactionPage.menu_transaction); await baseStep.click(Driver, userTransactionPage.menu_transaction);
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
await baseStep.screenShot(Driver, savaPath + "/02_PendingTransaction"); 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(); done();
...@@ -504,7 +533,7 @@ describe('case03: Transaction with Failed=> Success', function () { ...@@ -504,7 +533,7 @@ describe('case03: Transaction with Failed=> Success', function () {
await baseStep.click(Driver, userTransactionPage.menu_transaction); await baseStep.click(Driver, userTransactionPage.menu_transaction);
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
await baseStep.screenShot(Driver, savaPath + "/03_FailedTransaction"); 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(); done();
......
...@@ -64,4 +64,25 @@ proto.cancelSubscription = function (header, body, cb) { ...@@ -64,4 +64,25 @@ proto.cancelSubscription = function (header, body, cb) {
cb(err ? err : res, url, header, bodyObject) 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; module.exports = API_Object;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment