Commit b191c14c authored by Joshua Yu's avatar Joshua Yu

Merge branch 'main' into 'master'

Main See merge request !1
parents dea5a40b d567329c
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
class Login_Page {
email= '//input[@id="login-password_email"]'
password= '//input[@id="login-password_password"]'
submitBtn= '//*[text()="Submit"]'
email_empty_error = '//*[@id="login-password_email_help"]/div[1]'
email_invalid_error = '//*[@id="login-password_email_help"]/div[2]'
password_empty_error = '//*[@id="login-password_password_help"]/div[1]'
user_email= '//input[@id="login-with-password_email"]'
user_password= '//input[@id="login-with-password_password"]'
user_email_empty_error = '//*[@id="login-with-password_email_help"]/div[1]'
user_email_invalid_error = '//*[@id="login-with-password_email_help"]/div[2]'
user_password_empty_error = '//*[@id="login-with-password_password_help"]/div[1]'
error_message = '//input[@id="login-password_password"]/../../../../../../following-sibling::div[2]'
user_error_message = '//input[@id="login-with-password_password"]/../../../../../../following-sibling::div[2]'
// http://unibee:[email protected]/
openMerchantUrl = async function (driver, url = 'http://localhost/'){
console.log("Open URL: " + url);
await baseStep.access_url(driver,url);
await baseStep.wait(driver, 3000);
let currentUrl = await driver.getCurrentUrl();
console.log("currentUrl: " + currentUrl);
}
// http://unibee:[email protected]/
openUserUrl = async function (driver, url = 'http://localhost:8086/plans'){
console.log("Open URL: " + url);
await baseStep.access_url(driver,url);
await baseStep.wait(driver, 3000);
let currentUrl = await driver.getCurrentUrl();
console.log("currentUrl: " + currentUrl);
}
loginMerchant = async function (driver, email='[email protected]', password ='changeme' ){
console.log("Login with email: " + email);
await baseStep.waitUntilElement(driver, this.email,20000);
await baseStep.input(driver, this.email, email);
await baseStep.wait(driver, 1000);
await baseStep.input(driver, this.password, password);
await baseStep.wait(driver, 1000);
await baseStep.click(driver, this.submitBtn);
await baseStep.wait(driver, 1000);
}
loginUserPortal = async function (driver, email='[email protected]', password ='Aa@666666' ){
console.log("Login with email: " + email);
await baseStep.waitUntilElement(driver, this.user_email,20000);
await baseStep.input(driver, this.user_email, email);
await baseStep.wait(driver, 2000);
await baseStep.input(driver, this.user_password, password);
await baseStep.wait(driver, 1000);
await baseStep.click(driver, this.submitBtn);
}
}
module.exports = new Login_Page();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const {expect} = require("chai");
const By = webdriver.By;
class MerchantBillableMetricPage {
menu_billable_metric= '//*[@class="ant-menu-title-content" and text()="Billable Metric"]'
new_billable_metric = '//*[@class="ant-btn-icon"]/span[@aria-label="plus"]'
metric_name = '//*[@id="metricName"]'
metric_code = '//*[@id="code"]'
metric_description = '//*[@id="metricDescription"]'
aggregation_type = '//*[@id="aggregationType"]'
aggregation_property = '//*[@id="aggregationProperty"]'
save_btn = '//*[text()="Save"]'
selectAggregationType = async function (driver, type){
console.log("selectAggregationType: " , type);
let type_list = {
"count": "//div/div/div[2]/div/div/div/div/div",
"count unique": "//div[2]/div/div/div/div[2]/div",
"latest": "//div/div[3]/div",
"max":"//div/div/div[4]/div",
"sum": "//div[2]/div/div/div/div[5]/div"
}
await baseStep.input(driver,this.aggregation_type, type);
await baseStep.wait(driver, 1000)
await baseStep.click(driver, type_list[type]);
await baseStep.wait(driver, 1000)
}
checkRecordBillableMetric = async function(driver, name="", code="", description="", type="",aggregationType = "",aggregationProperty = "",record =1){
await baseStep.waitUntilElement(driver, "//*[@class='ant-table-cell' and text()='Aggregation Type']", 20000);
await baseStep.wait(driver,10000);
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-1].findElements({ tagName: 'td' });
if (name !== ""){
expect(await cells[0].getText()).to.equal(name);
}
if (code!== ""){
expect(await cells[1].getText()).to.equal(code);
}
if (description !== ""){
expect(await cells[2].getText()).to.equal(description);
}
if (type !== ""){
expect(await cells[3].getText()).to.equal(type);
}
if (aggregationType !== ""){
expect(await cells[4].getText()).to.equal(aggregationType);
}
if (aggregationProperty !== ""){
expect(await cells[5].getText()).to.equal(aggregationProperty);
}
}
}
module.exports = new MerchantBillableMetricPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const {expect} = require("chai");
const By = webdriver.By;
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"]'
code = '//*[@id="code"]'
billingType = '//*[@id="billingType"]'
discountType = '//*[@id="discountType"]'
currency = '//*[@id="currency"]'
discountAmount = '//*[@id="discountAmount"]'
discountPercentage = '//*[@id="discountPercentage"]'
cycleLimit = '//*[@id="cycleLimit"]'
validityRangeStart = '//*[@id="validityRange"]'
validityRangeEnd = '//*[@placeholder="End date"]'
validityRangeOK= "//span[contains(.,'OK')]"
save_btn = '//*[text()="Save"]'
selectBillingType = async function (driver, type = "One time use"){
console.log("selectBillingType: " , type);
let type_list = {
"One time use": "//div[3]/div/div/div[2]/div/div/div/div/div",
"Recurring": "//div[2]/div/div/div/div[2]/div",
}
if(type !== "One time use"){
await baseStep.input(driver,this.billingType, type);
await baseStep.wait(driver, 1000)
await baseStep.click(driver, type_list[type]);
await baseStep.wait(driver, 1000)
}
}
selectDiscountType = async function (driver, type = "Percentage"){
console.log("selectDiscountType: " , type);
let type_list = {
"Percentage": "//div[3]/div/div/div[2]/div/div/div/div/div",
"Fixed amount": "//div[2]/div/div/div/div[2]/div",
}
let type_list_rec = {
"Percentage": "(//div[3]/div/div/div[2]/div/div/div/div/div)[2]",
"Fixed amount": "(//div[2]/div/div/div/div[2]/div)[2]",
}
if(type !== "Percentage") {
try {
await baseStep.input(driver, this.discountType, type);
await baseStep.wait(driver, 1000)
await baseStep.click(driver, type_list[type]);
await baseStep.wait(driver, 1000)
} catch {
await baseStep.click(driver, type_list_rec[type]);
await baseStep.wait(driver, 1000)
}
}
}
selectCurrency = async function (driver, currency = "EUR"){
console.log("selectCurrency: " , currency);
let currency_list = {
"EUR": "//div[3]/div/div/div[2]/div/div/div/div/div",
"USD": "//div[2]/div/div/div/div[2]/div",
"JPY": "//div/div[3]/div"
}
if (currency !== "EUR"){
await baseStep.input(driver,this.currency, currency);
await baseStep.wait(driver, 1000)
await baseStep.click(driver, currency_list[currency]);
await baseStep.wait(driver, 1000)
}
}
inputPercentage= async function (driver, percentage = 0){
console.log("inputPercentage: " , percentage);
let ele = await driver.findElement(By.xpath(this.discountPercentage));
await driver.executeScript("arguments[0].value = '"+percentage+"';", ele);
// await baseStep.input(driver,this.intervalCount, intervalCount);
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);
await baseStep.wait(driver,10000);
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-1].findElements({ tagName: 'td' });
if (code !== ""){
expect(await cells[0].getText()).to.equal(name);
}
if (name!== ""){
expect(await cells[1].getText()).to.equal(code);
}
if (description !== ""){
expect(await cells[2].getText()).to.equal(description);
}
if (type !== ""){
expect(await cells[3].getText()).to.equal(type);
}
if (aggregationType !== ""){
expect(await cells[4].getText()).to.equal(aggregationType);
}
if (aggregationProperty !== ""){
expect(await cells[5].getText()).to.equal(aggregationProperty);
}
}
}
module.exports = new MerchantDiscountCodePage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const {expect} = require("chai");
const By = webdriver.By;
class MerchantInvoicePage {
menu_Invoice= '//*[@class="ant-menu-title-content" and text()="Invoice"]'
invoice_id = '//*[text()="Invoice Id"]/following-sibling::div[1]'
invoice_name = '//*[text()="Invoice Name"]/following-sibling::div[1]'
invoice_amount = '//*[text()="Invoice Amount"]/following-sibling::div[1]'
status = '(//*[text()="Status"]/following-sibling::div[1])[2]/span'
mark_as_paid_button = '(//*[text()="Status"]/following-sibling::div[1])[2]/button'
transfer_number = '//*[@id="TransferNumber"]'
reason = '//*[@id="reason"]'
mark_as_paid_confirm = '//*[@class="ant-modal-content"]//button[2]'
invoice_items = '//*[text()="Invoice Items"]/following-sibling::div[1]/button'
refund = '//*[text()="Refund"]/following-sibling::div[1]'
payment_type = '//*[text()="Payment type"]/following-sibling::div[1]'
discount_amount = '//*[text()="Discount Amount"]/following-sibling::div[1]'
subscription_id = '//*[text()="Subscription Id"]/following-sibling::div[1]'
payment_gateway = '//*[text()="Payment Gateway"]/following-sibling::div[1]'
user_name = '//*[text()="User Name"]/following-sibling::div[1]'
refund_btn = '//*[@aria-label="dollar"][1]'
refund_reason = '//*[text()="Refund Reason:"]/following-sibling::input'
refund_amount = '//*[text()="Refund Amt:"]/following-sibling::span/input'
refund_confirm = '//*[text()="Refund"]'
refund_wire_transfer_confirm = '//*[@aria-label="check-circle"]';
refund_comment = '//*[@id="reason"]'
mark_as_refunded_confirm = '//*[text()="Mark as Refunded"]'
checkRecordInvoiceList = async function(driver, totalAmount="", type = "", status="", Gateway = "", email = "",record = 1){
await baseStep.waitUntilElement(driver, "//*[@class='ant-table-tbody']", 20000);
await baseStep.wait(driver,3000);
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 (totalAmount!== ""){
expect(await cells[1].getText()).to.equal(totalAmount);
}
if (type !== ""){
expect(await cells[2].getText()).to.equal(type);
}
if (status !== ""){
expect(await cells[3].getText()).to.equal(status);
}
if (Gateway !== ""){
expect(await cells[5].getText()).to.equal(Gateway);
}
if (email !== ""){
expect(await cells[8].getText()).to.equal(email);
}
await baseStep.click(driver, "//*[@id=\"root\"]/div/div/main/div/div/div/div[2]/div/div/div/div/div/div[2]/table/tbody/tr[2]/td[1]/button/span");
await baseStep.wait(driver,1000);
}
}
module.exports = new MerchantInvoicePage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const By = webdriver.By;
class MerchantPlanPage {
menu_plan= '//*[@class="ant-menu-title-content" and text()="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"]'
plan_name_label= '//*[@for="planName"]'
plan_name= '//*[@id="planName"]'
plan_description_label= '//*[@for="description"]'
plan_description= '//*[@id="description"]'
status_label= '//*[@for="status"]'
status= '//*[@id="status"]'
is_published_label= '//*[@for="publishStatus"]'
is_published= '//*[text()="Publish"]'
currency_label= '//*[@for="currency"]'
currency = '//*[@id="currency"]'
price_label= '//*[@for="amount"]'
price= '//*[@id="amount"]'
intervalUnit_label = '//*[@for="intervalUnit"]'
intervalUnit = '//*[@id="intervalUnit"]'
intervalCount_label= '//*[@for="intervalCount"]'
intervalCount= '//*[@id="intervalCount"]'
plan_type_label = '//*[@for="type"]'
plan_type= '//*[@id="type"]'
add_ons_label = '//*[@for="addonIds"]'
add_ons = '//*[@id="addonIds"]'
onetimeAddonIds_label = '//*[@for="onetimeAddonIds"]'
onetimeAddonIds = '//*[@id="onetimeAddonIds"]'
allow_trial_label = '//*[@for="enableTrial"]'
allow_trial = '//*[@id="enableTrial"]'
trial_price_label = '//*[@for="trialAmount"]'
trial_price = '//*[@id="trialAmount"]'
trial_length_label = '//*[@for="trialDurationTime"]'
trial_length = '//*[@id="trialDurationTime"]'
trial_requires_bank_card_info_label = '//*[@for="trialDemand"]'
trial_requires_bank_card_info = '//*[@id="trialDemand"]'
auto_renew_after_trial_end_label = '//*[@for="cancelAtTrialEnd"]'
auto_renew_after_trial_end = '//*[@id="cancelAtTrialEnd"]'
billable_metrics_label = '//*[@title="Billable Metrics"]'
Custom_data_label = '//*[@for="metadata"]'
back_btn = '//*[text()="Go Back"]'
save_btn = '//*[text()="Save"]'
activate_btn = '//*[text()="Activate"]'
publish_btn = '//*[text()="Publish"]'
delete_btn = '//*[text()="Delete"]'
confirm_delete_btn = '//*[@class="ant-popconfirm-buttons"]/button'
plan_list_table = '//*[@class="ant-table-tbody"]'
selectCurrency = async function (driver, currency = "EUR"){
console.log("selectCurrency: " , currency);
let currency_list = {
"EUR": "//div[3]/div/div/div[2]/div/div/div/div/div",
"USD": "//div[2]/div/div/div/div[2]/div",
"JPY": "//div/div[3]/div"
}
if (currency !== "EUR"){
await baseStep.input(driver,this.currency, currency);
await baseStep.wait(driver, 1000)
await baseStep.click(driver, currency_list[currency]);
await baseStep.wait(driver, 1000)
}
}
inputIntervalCount = async function (driver, intervalCount = 1){
console.log("inputIntervalCount: " , intervalCount);
let ele = await driver.findElement(By.xpath(this.intervalCount));
await driver.executeScript("arguments[0].value = '"+intervalCount+"';", ele);
// await baseStep.input(driver,this.intervalCount, intervalCount);
await baseStep.wait(driver, 1000)
}
inputTrialPrice = async function (driver, price = 1){
console.log("inputTrialPrice: " , price);
let ele = await driver.findElement(By.xpath(this.trial_price));
await driver.executeScript("arguments[0].value = '"+price+"';", ele);
// await baseStep.input(driver,this.intervalCount, intervalCount);
await baseStep.wait(driver, 1000)
}
selectIntervalUnit = async function (driver, IntervalUnit = "month"){
console.log("selectIntervalUnit: " , IntervalUnit);
let IntervalUnit_list = {
"day": "//div[3]/div/div/div[2]/div/div/div/div/div",
"week": "//div[2]/div/div/div/div[2]/div",
"month": "//div/div[3]/div",
"year": "//div/div/div[4]/div"
}
if (IntervalUnit !== "month"){
await baseStep.input(driver,this.intervalUnit, IntervalUnit);
await baseStep.wait(driver, 1000)
await baseStep.click(driver, IntervalUnit_list[IntervalUnit]);
await baseStep.wait(driver, 1000)
}
}
selectPlanType = async function (driver, type = "Main type"){
console.log("selectPlanType: " , type);
let type_list = {
"Main type": "//div[3]/div/div/div[2]/div/div/div/div/div",
"Addon": "//div[2]/div/div/div/div[2]/div",
"One time payment": "//div/div[3]/div"
}
if (type !== "Main type"){
await baseStep.input(driver,this.plan_type, type);
await baseStep.wait(driver, 2000)
await baseStep.click(driver, type_list[type]);
await baseStep.wait(driver, 1000)
}
}
selectPlan= async function (driver, planName){
console.log("selectPlan: " , planName);
await baseStep.scrollIntoView(driver, "//*[text()='"+planName+"']");
await baseStep.click(driver, "//*[text()='"+planName+"']");
await baseStep.wait(driver,1000);
}
}
module.exports = new MerchantPlanPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const By = webdriver.By;
const {expect} = require("chai");
class MerchantSubscriptionPage {
menu_subscription= '//*[@class="ant-menu-title-content" and text()="Subscription"]'
first_name = '//span[text()="First Name"]/..//following-sibling::div[1]'
last_name = '//span[text()="Last Name"]/..//following-sibling::div[1]'
email = '//span[text()="Email"]/..//following-sibling::div[1]'
phone = '//span[text()="Phone"]/..//following-sibling::div[1]'
country = '//span[text()="Country"]/..//following-sibling::div[1]'
billing_address = '//span[text()="Billing Address"]/..//following-sibling::div[1]'
payment_method = '//span[text()="Payment Method"]/..//following-sibling::div[1]'
Vat_number = '//span[text()="VAT Number"]/..//following-sibling::div[1]'
subscription_tab = '//*[@data-node-key="Subscription"]'
account_tab = '//*[@data-node-key="Account"]'
Invoices_tab = '//*[@data-node-key="Invoices"]'
Payment_tab = '//*[@data-node-key="Payment"]'
sub_plan = '//*[text()="Plan"]/following-sibling::div[1]'
sub_plan_description = '//*[text()="Plan Description"]/following-sibling::div[1]'
sub_status = '//*[text()="Status"]/following-sibling::div[1]/span'
sub_subscription_id = '//*[text()="Subscription Id"]/following-sibling::div[1]'
sub_plan_price = '//*[text()="Plan Price"]/following-sibling::div[1]'
sub_addons_price = '//*[text()="Addons Price"]/following-sibling::div[1]'
sub_discount_amount = '//*[text()="Discount Amount"]/following-sibling::div[1]'
sub_total_amount = '//*[text()="Total Amount"]/following-sibling::div[1]'
sub_bill_period = '//*[text()="Bill Period"]/following-sibling::div[1]'
sub_next_due_date = '//*[text()="Next due date"]/following-sibling::div[1]//input'
sub_first_pay = '//*[text()="First Pay"]/following-sibling::div[1]'
sub_payment_gateway = '//*[text()="Payment Gateway"]/following-sibling::div[1]'
end_subscription = '//*[text()="End Subscription"]'
end_immediately = '//*[text()="immediately"]'
end_OK_btn = '(//*[@type = "button"]/span[text()="OK"])[2]'
checkRecordSubList = async function(driver, planName="", description="", amount="", status="", user= "", record = 1){
await baseStep.waitUntilElement(driver, "//*[@class='ant-table-cell' and text()='Plan Name']", 20000);
await baseStep.wait(driver,10000);
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-1].findElements({ tagName: 'td' });
if (planName !== ""){
expect(await cells[0].getText()).to.equal(planName);
}
if (description!== ""){
expect(await cells[1].getText()).to.equal(description);
}
if (amount !== ""){
expect(await cells[2].getText()).to.equal(amount);
}
if (status !== ""){
expect(await cells[3].getText()).to.equal(status);
}
if (user !== ""){
expect(await cells[6].getText()).to.equal(user);
}
}
selectSubByPlanName = async function(driver, planName){
console.log("select sub by plan name: ", planName);
await baseStep.click(driver, "(//span[text()="+planName+"])[1]");
await baseStep.wait(driver, 1000);
}
}
module.exports = new MerchantSubscriptionPage();
\ No newline at end of file
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const {expect} = require("chai");
const By = webdriver.By;
class MerchantTransactionPage {
menu_transaction= '//*[@class="ant-menu-title-content" and text()="Transaction"]'
checkRecordTransactionList = async function(driver, totalAmount="", status="", type= "",Gateway = "",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 (totalAmount!== ""){
// let amount = await cells[2].findElement({ tagName: 'div' })
// 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 cells[2].getText()).to.equal(totalAmount);
}
if (status !== ""){
expect(await cells[3].getText()).to.equal(status);
}
if (type !== ""){
expect(await cells[4].getText()).to.equal(type);
}
if (Gateway !== ""){
expect(await cells[5].getText()).to.equal(Gateway);
}
}
}
module.exports = new MerchantTransactionPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const {expect} = require("chai");
const By = webdriver.By;
class MerchantUserAccountPage {
menu_user_list= '//*[@class="ant-menu-title-content" and text()="User List"]'
account_type_Individual = '//*[text()="Individual"]'
account_type_Business = '//*[text()="Business"]'
first_name = '//*[@id="firstName"]'
last_name = '//*[@id="lastName"]'
email = '//*[@id="email"]'
country = '//*[@id="countryCode"]'
city = '//*[@id="city"]'
zipCode = '//*[@id="zipCode"]'
billing_address = '//*[@id="address"]'
company_name = '//*[@id="companyName"]'
VATNumber = '//*[@id="vATNumber"]'
phone_number = '//*[@id="phone"]'
Save_btn = '//*[text()="Save"]'
}
module.exports = new MerchantUserAccountPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const {expect} = require("chai");
const By = webdriver.By;
class MerchantUserListPage {
menu_user_list= '//*[@class="ant-menu-title-content" and text()="User List"]'
filter_first_name = '//*[@id="firstName"]'
filter_last_name = '//*[@id="lastName"]'
filter_email = '//*[@id="email"]'
clear_btn = '//*[text()="Clear"]'
search_btn = '//*[text()="Search"]'
add_new_btn = '//*[text()="Add New"]'
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'
info_phone = '//*[text()="Phone"]/../following-sibling::div[1]'
info_country = '//*[text()="Country"]/../following-sibling::div[1]'
info_billing_address= '//*[text()="Billing Address"]/../following-sibling::div[1]'
info_payment_method = '//*[text()="Payment Method"]/../following-sibling::div[1]'
info_vat_number = '//*[text()="VAT Number"]/../following-sibling::div[1]'
account_tab = '//*[@data-node-key="AccountInfo"]'
subscription_tab = '//*[@data-node-key="Subscription"]'
invoice_tab = '//*[@data-node-key="Invoice"]'
transaction_tab = '//*[@data-node-key="Transaction"]'
checkRecordUserList = async function(driver, firstName="", lastName="", email="", status="",record = 1){
await baseStep.waitUntilElement(driver, "//*[@class='ant-table-cell' and text()='First Name']", 20000);
await baseStep.wait(driver,10000);
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-1].findElements({ tagName: 'td' });
if (firstName !== ""){
expect(await cells[0].getText()).to.equal(firstName);
}
if (lastName!== ""){
expect(await cells[1].getText()).to.equal(lastName);
}
if (email !== ""){
expect(await cells[2].getText()).to.equal(email);
}
if (status !== ""){
expect(await cells[7].getText()).to.equal(status);
}
}
}
module.exports = new MerchantUserListPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const {expect} = require("chai");
const By = webdriver.By;
class UserInvoicePage {
menu_Invoice= '//*[@class="ant-menu-title-content" and text()="Invoice"]'
invoice_id = '//*[text()="Invoice Id"]/following-sibling::div[1]'
invoice_name = '//*[text()="Invoice Name"]/following-sibling::div[1]'
invoice_amount = '//*[text()="Invoice Amount"]/following-sibling::div[1]'
status = '//*[text()="Status"]/following-sibling::div[1]'
invoice_items = '//*[text()="Invoice Items"]/following-sibling::div[1]/button'
refund = '//*[text()="Refund"]/following-sibling::div[1]'
payment_type = '//*[text()="Payment type"]/following-sibling::div[1]'
discount_amount = '//*[text()="Discount Amount"]/following-sibling::div[1]'
subscription_id = '//*[text()="Subscription Id"]/following-sibling::div[1]'
payment_gateway = '//*[text()="Payment Gateway"]/following-sibling::div[1]'
user_name = '//*[text()="User Name"]/following-sibling::div[1]'
checkRecordInvoiceList = async function(driver, invoiceId = "", totalAmount="", 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-1].findElements({ tagName: 'td' });
if (invoiceId !== ""){
expect(await cells[0].getText()).to.equal(invoiceId);
}
if (totalAmount!== ""){
expect(await cells[1].getText()).to.equal(totalAmount);
}
if (status !== ""){
expect(await cells[2].getText()).to.equal(status);
}
await baseStep.click(driver, "//*[@class='ant-table-tbody']/tr[1]");
await baseStep.wait(driver,1000);
}
}
module.exports = new UserInvoicePage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const {expect} = require("chai");
const By = webdriver.By;
class UserMyAccountPage {
menu_my_account= '//*[@class="ant-menu-title-content" and text()="My Account"]'
account_type_Individual = '//*[text()="Individual"]'
account_type_Business = '//*[text()="Business"]'
first_name = '//*[@id="firstName"]'
last_name = '//*[@id="lastName"]'
email = '//*[@id="email"]'
country = '//*[@id="countryCode"]'
city = '//*[@id="city"]'
zipCode = '//*[@id="zipCode"]'
billing_address = '//*[@id="address"]'
company_name = '//*[@id="companyName"]'
VATNumber = '//*[@id="vATNumber"]'
phone_number = '//*[@id="phone"]'
Save_btn = '//*[text()="Save"]'
}
module.exports = new UserMyAccountPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const By = webdriver.By;
class UserMySubPage {
menu_my_subscription= '//*[@class="ant-menu-title-content" and text()="My Subscription"]'
sub_status = '//*[text()="Status"]/following-sibling::div[1]/span'
cancel_sub_button = '//span[text()="CANCEL"]'
cancel_confirm_button = '//span[text()="Yes, Cancel it"]'
}
module.exports = new UserMySubPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const By = webdriver.By;
class UserOrderPreviewPage {
title_description= '//*[@class="ant-modal-body"]/div/div/div[1]/div[1]'
title_price= '//*[@class="ant-modal-body"]/div/div/div[1]/div[2]'
title_quantity= '//*[@class="ant-modal-body"]/div/div/div[1]/div[3]'
title_amount= '//*[@class="ant-modal-body"]/div/div/div[1]/div[4]'
content_description = '//*[@class="ant-modal-body"]/div/div/div[2]/div/div[1]'
content_price = '//*[@class="ant-modal-body"]/div/div/div[2]/div/div[2]'
content_quantity = '//*[@class="ant-modal-body"]/div/div/div[2]/div/div[3]'
content_amount = '//*[@class="ant-modal-body"]/div/div/div[2]/div/div[4]'
vat_number = '//*[@placeholder="Your VAT number"]'
vat_company_address = '//*[text()="Company Address"]/../following-sibling::div/span'
vat_company_name = '//*[text()="Company Name"]/../following-sibling::div/span'
vat_company_code = '//*[text()="Company Code"]/../following-sibling::div/span'
country = '//*[@type="search"]'
discount_code = '//*[text()="Discount code"]/../following-sibling::div/div/span/input'
discount_code_apply = '//*[text()="Discount code"]/../following-sibling::div/div/span[2]/button'
saved = '//*[text()="Saved"]/following-sibling::div'
tax = '//*[text()="Tax"]/following-sibling::div'
order_total = '//*[text()="Order Total"]/following-sibling::div'
bank_card = '//*[@for="payment-stripe"]'
wire_transfer = '//*[@for="payment-wire_transfer"]'
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.country, countryName);
await baseStep.wait(driver, 1000);
await baseStep.click(driver, xpath);
}
}
module.exports = new UserOrderPreviewPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const By = webdriver.By;
class UserPlanPage {
menu_plan= '//*[@class="ant-menu-title-content" and text()="Plans"]'
plan_card = '//*[text()="Month Plan"]'
plan_page_sign = '//*[text()="One-time Addons"]'
one_time_addons_tab= '//*[text()="One-time Addons"]'
confirm_btn = '//*[text()="Buy"]'
one_time_confirm_btn = '(//*[text()="Buy"])[2]'
order_preview_title = '//*[text()="Order Preview"]'
bank_card = '//*[@for="payment-stripe"]'
wire_transfer = '//*[@for="payment-wire_transfer"]'
crypto_currency = '//*[@for="crypto-payment"]'
OK_btn = '//*[@class="confirm-btn-wrapper"]//span[text()="OK"]'
one_time_OK_btn = '//*[@class="modal-content-wrapper"]//span[text()="OK"]'
change_card_btn = '//*[@id="root"]/div/div/div[2]/main/div/div[2]/form/div[1]/div/div/div[2]/div/div/div[1]/div[2]/div[2]/div/div/div[2]/div/div[2]/button/div'
pay_btn = '//button/div[3]'
card_number = '//*[@id="cardNumber"]'
card_expiry = '//*[@id="cardExpiry"]'
card_cvc = '//*[@id="cardCvc"]'
billing_name = '//*[@id="billingName"]'
payment_success_sign = '//*[text()="Payment succeeded!"]'
wire_transfer_no_finish = '//button[contains(@class, "cancel")]'
wire_transfer_Yes_finish = '//button[contains(@class, "confirm")]'
selectPlan= async function (driver, planName){
console.log("selectPlan: " , planName);
await baseStep.scrollIntoView(driver, "//*[text()='"+planName+"']");
await baseStep.click(driver, "//*[text()='"+planName+"']");
await baseStep.wait(driver,1000);
try{
await baseStep.click(driver, this.confirm_btn);
}
catch(e){
await baseStep.click(driver, this.one_time_confirm_btn);
}
await baseStep.wait(driver,1000);
}
}
module.exports = new UserPlanPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver');
const {expect} = require("chai");
const By = webdriver.By;
class UserTransactionPage {
menu_transaction= '//*[@class="ant-menu-title-content" and text()="Transaction"]'
checkRecordTransactionList = async function(driver, totalAmount="", status="", type= "", gateway="" ,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-1].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"))
expect(await amount).to.equal(totalAmount);
}
if (status !== ""){
let actualStatus = await cells[3].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 actualStatus).to.equal(status);
}
if (type !== ""){
expect(await cells[4].getText()).to.equal(type);
}
if (gateway !== ""){
expect(await cells[6].getText()).to.equal(gateway);
}
}
}
module.exports = new UserTransactionPage();
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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