Commit 3b2caaeb authored by Joshua Yu's avatar Joshua Yu

Merge branch 'main' into 'master'

add cases See merge request !23
parents cc8c50a0 6a87fa95
...@@ -10,7 +10,9 @@ class MerchantBillableMetricPage { ...@@ -10,7 +10,9 @@ class MerchantBillableMetricPage {
metric_code = '//*[@id="code"]' metric_code = '//*[@id="code"]'
metric_description = '//*[@id="metricDescription"]' metric_description = '//*[@id="metricDescription"]'
aggregation_type = '//*[@id="aggregationType"]' aggregation_type = '//*[@id="aggregationType"]'
aggregation_type_errpr = '//*[@id="aggregationType_help"]'
aggregation_property = '//*[@id="aggregationProperty"]' aggregation_property = '//*[@id="aggregationProperty"]'
aggregation_property_error = '//*[@id="aggregationProperty_help"]'
save_btn = '//*[text()="Save"]' save_btn = '//*[text()="Save"]'
selectAggregationType = async function (driver, type){ selectAggregationType = async function (driver, type){
...@@ -63,6 +65,13 @@ class MerchantBillableMetricPage { ...@@ -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);
}
} }
......
...@@ -7,15 +7,19 @@ class MerchantDiscountCodePage { ...@@ -7,15 +7,19 @@ class MerchantDiscountCodePage {
menu_discount_code= '//*[@class="ant-menu-title-content" and text()="Discount Code"]' menu_discount_code= '//*[@class="ant-menu-title-content" and text()="Discount Code"]'
new_discount_code = '//*[@class="ant-btn-icon"]/span[@aria-label="plus"]' new_discount_code = '//*[@class="ant-btn-icon"]/span[@aria-label="plus"]'
name = '//*[@id="name"]' name = '//*[@id="name"]'
name_error = '//*[@id="name_help"]'
code = '//*[@id="code"]' code = '//*[@id="code"]'
code_error = '//*[@id="code_help"]'
billingType = '//*[@id="billingType"]' billingType = '//*[@id="billingType"]'
discountType = '//*[@id="discountType"]' discountType = '//*[@id="discountType"]'
currency = '//*[@id="currency"]' currency = '//*[@id="currency"]'
discountAmount = '//*[@id="discountAmount"]' discountAmount = '//*[@id="discountAmount"]'
discountPercentage = '//*[@id="discountPercentage"]' discountPercentage = '//*[@id="discountPercentage"]'
discountPercentage_error = '//*[@id="discountPercentage_help"]'
cycleLimit = '//*[@id="cycleLimit"]' cycleLimit = '//*[@id="cycleLimit"]'
validityRangeStart = '//*[@id="validityRange"]' validityRangeStart = '//*[@id="validityRange"]'
validityRangeEnd = '//*[@placeholder="End date"]' validityRangeEnd = '//*[@placeholder="End date"]'
validity_error = '//*[@id="validityRange_help"]'
validityRangeOK= "//span[contains(.,'OK')]" validityRangeOK= "//span[contains(.,'OK')]"
save_btn = '//*[text()="Save"]' save_btn = '//*[text()="Save"]'
...@@ -85,8 +89,7 @@ class MerchantDiscountCodePage { ...@@ -85,8 +89,7 @@ class MerchantDiscountCodePage {
await baseStep.wait(driver, 1000) await baseStep.wait(driver, 1000)
} }
checkRecordDiscountCode= async function(driver, code="", name="", description="", type="",aggregationType = "",aggregationProperty = "",record =1){ checkRecordDiscountCode= async function(driver, code="", name="", status ="", billingType = "", discount_type = "", percentage = "",record =1){
await baseStep.waitUntilElement(driver, "//*[@class='ant-table-cell' and text()='Aggregation Type']", 20000);
await baseStep.wait(driver,10000); await baseStep.wait(driver,10000);
let table = await driver.findElement(By.xpath("//*[@class='ant-table-tbody']")); let table = await driver.findElement(By.xpath("//*[@class='ant-table-tbody']"));
...@@ -95,30 +98,48 @@ class MerchantDiscountCodePage { ...@@ -95,30 +98,48 @@ class MerchantDiscountCodePage {
let cells = await rows[record-1].findElements({ tagName: 'td' }); let cells = await rows[record-1].findElements({ tagName: 'td' });
if (code !== ""){ if (code !== ""){
expect(await cells[0].getText()).to.equal(name); expect(await cells[0].getText()).to.equal(code);
} }
if (name!== ""){ if (name!== ""){
expect(await cells[1].getText()).to.equal(code); expect(await cells[1].getText()).to.equal(name);
} }
if (description !== ""){ if (status !== ""){
expect(await cells[2].getText()).to.equal(description); expect(await cells[2].getText()).to.equal(status);
} }
if (type !== ""){ if (billingType !== ""){
expect(await cells[3].getText()).to.equal(type); expect(await cells[3].getText()).to.equal(billingType);
} }
if (aggregationType !== ""){ if (discount_type !== ""){
expect(await cells[4].getText()).to.equal(aggregationType); expect(await cells[4].getText()).to.equal(discount_type);
} }
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);
}
} }
......
...@@ -67,6 +67,16 @@ class MerchantInvoicePage { ...@@ -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(); module.exports = new MerchantInvoicePage();
...@@ -6,10 +6,14 @@ class MerchantPlanPage { ...@@ -6,10 +6,14 @@ class MerchantPlanPage {
menu_plan= '//*[@class="ant-menu-title-content" and text()="Product and Plan"]' 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="anticon anticon-plus"]/../following-sibling::span[text()="New plan"]'
new_plan_btn = '//*[@class="ant-btn-icon"]/span[@aria-label="plus"]' 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_label= '//*[@for="planName"]'
plan_name= '//*[@id="planName"]' plan_name= '//*[@id="planName"]'
plan_name_error = '//*[@id="planName_help"]'
plan_description_label= '//*[@for="description"]' plan_description_label= '//*[@for="description"]'
plan_description= '//*[@id="description"]' plan_description= '//*[@id="description"]'
plan_description_error = '//*[@id="description_help"]'
status_label= '//*[@for="status"]' status_label= '//*[@for="status"]'
status= '//*[@id="status"]' status= '//*[@id="status"]'
is_published_label= '//*[@for="publishStatus"]' is_published_label= '//*[@for="publishStatus"]'
...@@ -18,6 +22,7 @@ class MerchantPlanPage { ...@@ -18,6 +22,7 @@ class MerchantPlanPage {
currency = '//*[@id="currency"]' currency = '//*[@id="currency"]'
price_label= '//*[@for="amount"]' price_label= '//*[@for="amount"]'
price= '//*[@id="amount"]' price= '//*[@id="amount"]'
price_error = '//*[@id="amount_help"]'
intervalUnit_label = '//*[@for="intervalUnit"]' intervalUnit_label = '//*[@for="intervalUnit"]'
intervalUnit = '//*[@id="intervalUnit"]' intervalUnit = '//*[@id="intervalUnit"]'
intervalCount_label= '//*[@for="intervalCount"]' intervalCount_label= '//*[@for="intervalCount"]'
...@@ -39,11 +44,17 @@ class MerchantPlanPage { ...@@ -39,11 +44,17 @@ class MerchantPlanPage {
auto_renew_after_trial_end_label = '//*[@for="cancelAtTrialEnd"]' auto_renew_after_trial_end_label = '//*[@for="cancelAtTrialEnd"]'
auto_renew_after_trial_end = '//*[@id="cancelAtTrialEnd"]' auto_renew_after_trial_end = '//*[@id="cancelAtTrialEnd"]'
billable_metrics_label = '//*[@title="Billable Metrics"]' 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_label = '//*[@for="metadata"]'
custom_data = '//*[@id="metadata"]'
back_btn = '//*[text()="Go Back"]' back_btn = '//*[text()="Go Back"]'
save_btn = '//*[text()="Save"]' save_btn = '//*[text()="Save"]'
activate_btn = '//*[text()="Activate"]' activate_btn = '//*[text()="Activate"]'
publish_btn = '//*[text()="Publish"]' publish_btn = '//*[text()="Publish"]'
unpublish_btn = '//*[text()="Unpublish"]'
delete_btn = '//*[text()="Delete"]' delete_btn = '//*[text()="Delete"]'
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"]'
...@@ -174,6 +185,30 @@ class MerchantPlanPage { ...@@ -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(); module.exports = new MerchantPlanPage();
...@@ -35,6 +35,16 @@ class MerchantTransactionPage { ...@@ -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);
}
} }
......
...@@ -11,6 +11,7 @@ class MerchantUserListPage { ...@@ -11,6 +11,7 @@ class MerchantUserListPage {
clear_btn = '//*[text()="Clear"]' clear_btn = '//*[text()="Clear"]'
search_btn = '//*[text()="Search"]' search_btn = '//*[text()="Search"]'
add_new_btn = '//*[@aria-label="user-add"]' 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_first_name = '//*[text()="First Name"]/../following-sibling::div[1]'
info_last_name = '//*[text()="Last Name"]/../following-sibling::div[1]' info_last_name = '//*[text()="Last Name"]/../following-sibling::div[1]'
info_email = '//*[text()="Email"]/../following-sibling::div[1]/a' info_email = '//*[text()="Email"]/../following-sibling::div[1]/a'
...@@ -42,6 +43,15 @@ class MerchantUserListPage { ...@@ -42,6 +43,15 @@ class MerchantUserListPage {
plan_name = '(//*[text()="Plan"]/following-sibling::div[1])' plan_name = '(//*[text()="Plan"]/following-sibling::div[1])'
sub_status = '(//*[text()="Status"]/following-sibling::div[1]/span[1])' sub_status = '(//*[text()="Status"]/following-sibling::div[1]/span[1])'
plan_search_list = '//*[text()="Assign subscription"]/../following-sibling::div//input[@type="search"]/..' 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 { ...@@ -68,7 +78,7 @@ class MerchantUserListPage {
expect(await cells[6].getText()).to.equal(status); 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.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,1000); await baseStep.wait(driver,3000);
} }
...@@ -125,6 +135,21 @@ class MerchantUserListPage { ...@@ -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(); module.exports = new MerchantUserListPage();
...@@ -422,6 +422,155 @@ describe('case05: Add billable metric in Merchant Portal, Aggregation Type = sum ...@@ -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);
});
});
...@@ -1078,6 +1078,81 @@ describe('case05: refund with wire transfer=> Success', function () { ...@@ -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);
});
});
......
...@@ -12,7 +12,7 @@ const baseStep = require('../../../CommonStep/Web/Web_Common_Step'); ...@@ -12,7 +12,7 @@ const baseStep = require('../../../CommonStep/Web/Web_Common_Step');
const API_Object = require("../../../CommonStep/API/API_Object"); const API_Object = require("../../../CommonStep/API/API_Object");
const API_Env = require("../../../CommonStep/API/API_Env"); 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 addContext = require('mochawesome/addContext');
const {expect} = require("chai"); const {expect} = require("chai");
...@@ -853,6 +853,193 @@ describe('case04: Transaction with refund => Success', function () { ...@@ -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);
});
});
......
...@@ -644,3 +644,4 @@ describe('case03: change Due date=> Success', function () { ...@@ -644,3 +644,4 @@ describe('case03: change Due date=> Success', function () {
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