Commit 704fd2df authored by YuShijiaCode's avatar YuShijiaCode

update login user

parent 9e2128c3
...@@ -121,6 +121,26 @@ class MerchantPlanPage { ...@@ -121,6 +121,26 @@ class MerchantPlanPage {
} }
selectAddOn = async function (driver, name){
console.log("select addon name: " , name);
await baseStep.scrollIntoView(driver, this.add_ons);
await baseStep.click(driver, this.add_ons);
await baseStep.click(driver, "//*[contains(text(),'"+name+"')]");
await baseStep.wait(driver, 1000);
await baseStep.click(driver, this.Custom_data_label);
await baseStep.wait(driver, 1000);
}
selectOneTimePayment = async function (driver, name){
console.log("select addon name: " , name);
await baseStep.scrollIntoView(driver, this.onetimeAddonIds);
await baseStep.click(driver, this.onetimeAddonIds);
await baseStep.click(driver, "//*[contains(text(),'"+name+"')]");
await baseStep.wait(driver, 1000);
await baseStep.click(driver, this.Custom_data_label);
await baseStep.wait(driver, 1000);
}
} }
module.exports = new MerchantPlanPage(); module.exports = new MerchantPlanPage();
const baseStep = require("../../CommonStep/Web/Web_Common_Step"); const baseStep = require("../../CommonStep/Web/Web_Common_Step");
const webdriver = require('selenium-webdriver'); const webdriver = require('selenium-webdriver');
const By = webdriver.By; const By = webdriver.By;
const Key = webdriver.Key;
const {expect} = require("chai"); const {expect} = require("chai");
class MerchantSubscriptionPage { class MerchantSubscriptionPage {
...@@ -13,10 +14,10 @@ class MerchantSubscriptionPage { ...@@ -13,10 +14,10 @@ class MerchantSubscriptionPage {
billing_address = '//span[text()="Billing Address"]/..//following-sibling::div[1]' billing_address = '//span[text()="Billing Address"]/..//following-sibling::div[1]'
payment_method = '//span[text()="Payment Method"]/..//following-sibling::div[1]' payment_method = '//span[text()="Payment Method"]/..//following-sibling::div[1]'
Vat_number = '//span[text()="VAT Number"]/..//following-sibling::div[1]' Vat_number = '//span[text()="VAT Number"]/..//following-sibling::div[1]'
subscription_tab = '//*[@data-node-key="Subscription"]' subscription_tab = '//*[@data-node-key="Subscription"]'
account_tab = '//*[@data-node-key="Account"]' account_tab = '//*[@data-node-key="Account"]'
Invoices_tab = '//*[@data-node-key="Invoices"]' Invoices_tab = '//*[@data-node-key="Invoices"]'
Payment_tab = '//*[@data-node-key="Payment"]' Payment_tab = '//*[@data-node-key="Payment"]'
sub_plan = '//*[text()="Plan"]/following-sibling::div[1]' sub_plan = '//*[text()="Plan"]/following-sibling::div[1]'
sub_plan_description = '//*[text()="Plan Description"]/following-sibling::div[1]' sub_plan_description = '//*[text()="Plan Description"]/following-sibling::div[1]'
sub_status = '//*[text()="Status"]/following-sibling::div[1]/span' sub_status = '//*[text()="Status"]/following-sibling::div[1]/span'
...@@ -31,7 +32,16 @@ class MerchantSubscriptionPage { ...@@ -31,7 +32,16 @@ class MerchantSubscriptionPage {
sub_payment_gateway = '//*[text()="Payment Gateway"]/following-sibling::div[1]' sub_payment_gateway = '//*[text()="Payment Gateway"]/following-sibling::div[1]'
end_subscription = '//*[text()="End Subscription"]' end_subscription = '//*[text()="End Subscription"]'
end_immediately = '//*[text()="immediately"]' end_immediately = '//*[text()="immediately"]'
end_OK_btn = '(//*[@type = "button"]/span[text()="OK"])[2]' end_OK_btn = '//*[@type = "button"]/span[text()="OK"]'
change_sub_btn = '//*[text()="Change Plan"]'
plan_selector = '//input[@type="search"]/../..'
change_OK_btn = '//*[@type = "button"]/span[text()="OK"]'
change_confirm = '//span[text()="Confirm"]'
due_date = '(//*[@placeholder="Select date"])[2]'
due_date_OK_btn = '//*[@type = "button"]/span[text()="OK"]'
change_due_date_info = '//*[@class="ant-picker-input"]/../following-sibling::span'
checkRecordSubList = async function(driver, planName="", description="", amount="", status="", user= "", record = 1){ checkRecordSubList = async function(driver, planName="", description="", amount="", status="", user= "", record = 1){
...@@ -66,10 +76,25 @@ class MerchantSubscriptionPage { ...@@ -66,10 +76,25 @@ class MerchantSubscriptionPage {
selectSubByPlanName = async function(driver, planName){ selectSubByPlanName = async function(driver, planName){
console.log("select sub by plan name: ", planName); console.log("select sub by plan name: ", planName);
await baseStep.click(driver, "(//span[text()="+planName+"])[1]"); await baseStep.click(driver, "(//span[text()='"+planName+"'])[1]");
await baseStep.wait(driver, 1000); await baseStep.wait(driver, 1000);
} }
selectTargetPlan = async function (driver, Plan){
console.log("select Plan name: " , Plan);
await baseStep.click(driver, this.plan_selector);
await baseStep.click(driver, "//*[contains(text(),'"+Plan+"')]");
await baseStep.wait(driver, 1000);
}
setDueDate = async function (driver, days){
console.log("set " + days + " days later");
let current = new Date(new Date().setMonth(new Date().getMonth()+1));
let expect = baseStep.getDateFormat(new Date(new Date(current).setDate(new Date(current).getDate()+days)), "YYYY-MMM-DD");
await baseStep.inputWithClear(driver, this.due_date, expect);
await driver.findElement(By.xpath(this.due_date)).sendKeys(Key.ENTER);
}
} }
module.exports = new MerchantSubscriptionPage(); module.exports = new MerchantSubscriptionPage();
\ No newline at end of file
...@@ -10,7 +10,7 @@ class MerchantUserListPage { ...@@ -10,7 +10,7 @@ class MerchantUserListPage {
filter_email = '//*[@id="email"]' filter_email = '//*[@id="email"]'
clear_btn = '//*[text()="Clear"]' clear_btn = '//*[text()="Clear"]'
search_btn = '//*[text()="Search"]' search_btn = '//*[text()="Search"]'
add_new_btn = '//*[text()="Add New"]' add_new_btn = '//*[@aria-label="user-add"]'
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'
...@@ -20,35 +20,61 @@ class MerchantUserListPage { ...@@ -20,35 +20,61 @@ class MerchantUserListPage {
info_payment_method = '//*[text()="Payment Method"]/../following-sibling::div[1]' info_payment_method = '//*[text()="Payment Method"]/../following-sibling::div[1]'
info_vat_number = '//*[text()="VAT Number"]/../following-sibling::div[1]' info_vat_number = '//*[text()="VAT Number"]/../following-sibling::div[1]'
account_tab = '//*[@data-node-key="AccountInfo"]' account_tab = '//*[@data-node-key="AccountInfo"]'
subscription_tab = '//*[@data-node-key="Subscription"]' subscription_tab = '//*[@id="rc-tabs-0-tab-subscription"]'
invoice_tab = '//*[@data-node-key="Invoice"]' invoice_tab = '//*[@data-node-key="Invoice"]'
transaction_tab = '//*[@data-node-key="Transaction"]' transaction_tab = '//*[@data-node-key="Transaction"]'
new_email = '(//*[@id="email"])[2]'
new_ex_user_id = '//*[@id="externalUserId"]'
new_first_name = '(//*[@id="firstName"])[2]'
new_last_name = '(//*[@id="lastName"])[2]'
new_phone = '//*[@id="phone"]'
new_address = '//*[@id = "address"]'
new_OK_btn = '//*[text()="OK"]'
suspend_btn = '//*[text()="Suspend"]'
suspend_confirm_btn = '(//*[text()=\'Suspend\'])[2]'
assign_sub_btn = '//*[text()="Assign Subscription"]'
plan_selector = '(//input[@type="search"]/../..)[2]'
assign_OK_btn = '//*[text()="OK"]'
current_text = '(//*[@class="ant-divider-inner-text"])[6]'
current_plan = "(//*[text()='Plan'])[2]/following-sibling::div[1]"
current_plan_des = "(//*[text()='Plan Description'])[1]/following-sibling::div[1]"
current_status= "(//*[text()='Status'])[3]//following-sibling::div[1]/span"
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);
checkRecordUserList = async function(driver, name = "", email="", status="",record = 1){
await baseStep.waitUntilElement(driver, "//*[@class='ant-table-cell' and text()='Email']", 20000);
await baseStep.wait(driver,5000);
let table = await driver.findElement(By.xpath("//*[@class='ant-table-tbody']")); let table = await driver.findElement(By.xpath("//*[@class='ant-table-tbody']"));
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)
let cells = await rows[record-1].findElements({ tagName: 'td' }); let cells = await rows[record-1].findElements({ tagName: 'td' });
if (firstName !== ""){ if (name !== ""){
expect(await cells[0].getText()).to.equal(firstName); expect(await cells[0].getText()).to.equal(name);
}
if (lastName!== ""){
expect(await cells[1].getText()).to.equal(lastName);
} }
if (email !== ""){ if (email !== ""){
expect(await cells[2].getText()).to.equal(email); expect(await cells[1].getText()).to.equal(email);
} }
if (status !== ""){ if (status !== ""){
expect(await cells[7].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.wait(driver,1000);
}
selectTargetPlan = async function (driver, Plan){
console.log("select Plan name: " , Plan);
await baseStep.click(driver, this.plan_selector);
await baseStep.click(driver, "//*[contains(text(),'"+Plan+"')]");
await baseStep.wait(driver, 1000);
} }
......
...@@ -94,7 +94,7 @@ describe('Cancel the subscription', function() { ...@@ -94,7 +94,7 @@ describe('Cancel the subscription', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -119,7 +119,7 @@ describe('Cancel the subscription', function() { ...@@ -119,7 +119,7 @@ describe('Cancel the subscription', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
......
...@@ -137,6 +137,7 @@ describe('Login failed with wrong password in Merchant Portal=> Success', functi ...@@ -137,6 +137,7 @@ describe('Login failed with wrong password in Merchant Portal=> Success', functi
await baseStep.input(Driver,loginPage.password, '123123'); await baseStep.input(Driver,loginPage.password, '123123');
await baseStep.click(Driver, loginPage.submitBtn); await baseStep.click(Driver, loginPage.submitBtn);
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
await baseStep.screenShot(Driver,savaPath + '/03_Wrong_password.jpeg');
expect("Login Failed, Password Not Match").to.equal(await baseStep.getText(Driver,loginPage.error_message)); expect("Login Failed, Password Not Match").to.equal(await baseStep.getText(Driver,loginPage.error_message));
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
done(); done();
...@@ -206,6 +207,7 @@ describe('Login failed with wrong email in Merchant Portal=> Success', function( ...@@ -206,6 +207,7 @@ describe('Login failed with wrong email in Merchant Portal=> Success', function(
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
await baseStep.input(Driver,loginPage.password, '123123'); await baseStep.input(Driver,loginPage.password, '123123');
await baseStep.click(Driver, loginPage.submitBtn); await baseStep.click(Driver, loginPage.submitBtn);
await baseStep.screenShot(Driver,savaPath + '/04_Wrong_Email.jpeg');
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
expect("Email Not Found").to.equal(await baseStep.getText(Driver,loginPage.error_message)); expect("Email Not Found").to.equal(await baseStep.getText(Driver,loginPage.error_message));
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
...@@ -277,6 +279,7 @@ describe('Login failed with empty email and password in Merchant Portal=> Succes ...@@ -277,6 +279,7 @@ describe('Login failed with empty email and password in Merchant Portal=> Succes
await baseStep.input(Driver,loginPage.password, ''); await baseStep.input(Driver,loginPage.password, '');
await baseStep.click(Driver, loginPage.submitBtn); await baseStep.click(Driver, loginPage.submitBtn);
await baseStep.wait(Driver, 2000); await baseStep.wait(Driver, 2000);
await baseStep.screenShot(Driver,savaPath + '/05_empty_Email.jpeg');
expect("Please input your Email!").to.equal(await baseStep.getText(Driver,loginPage.email_empty_error)); expect("Please input your Email!").to.equal(await baseStep.getText(Driver,loginPage.email_empty_error));
expect("Please input valid email address.").to.equal(await baseStep.getText(Driver,loginPage.email_invalid_error)); expect("Please input valid email address.").to.equal(await baseStep.getText(Driver,loginPage.email_invalid_error));
expect("Please input your password!").to.equal(await baseStep.getText(Driver,loginPage.password_empty_error)); expect("Please input your password!").to.equal(await baseStep.getText(Driver,loginPage.password_empty_error));
......
...@@ -477,7 +477,7 @@ describe('case05: create a new plan in Merchant Portal, Allow Trial = True bill ...@@ -477,7 +477,7 @@ describe('case05: create a new plan in Merchant Portal, Allow Trial = True bill
}); });
describe('case05: create a add on in Merchant Portal, => Success', function() { describe('case06: create a add on in Merchant Portal, => Success', function() {
this.timeout(100000); this.timeout(100000);
beforeEach(function () { beforeEach(function () {
...@@ -563,7 +563,7 @@ describe('case05: create a add on in Merchant Portal, => Success', function() { ...@@ -563,7 +563,7 @@ describe('case05: create a add on in Merchant Portal, => Success', function() {
}); });
describe('case06: create a one time payment on in Merchant Portal, => Success', function() { describe('case07: create a one time payment on in Merchant Portal, => Success', function() {
this.timeout(100000); this.timeout(100000);
beforeEach(function () { beforeEach(function () {
...@@ -650,6 +650,99 @@ describe('case06: create a one time payment on in Merchant Portal, => Success', ...@@ -650,6 +650,99 @@ describe('case06: create a one time payment on in Merchant Portal, => Success',
}); });
describe('case08: create a new plan in Merchant Portal, associated with add-on and one time payment=> 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 - create a new plan, associated with add-on and one time payment => 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 loginPage.loginMerchant(Driver)
await baseStep.wait(Driver, 1000);
await baseStep.screenShot(Driver,savaPath + '/01_Menu.jpeg');
await baseStep.waitUntilElement(Driver, planPage.menu_plan);
await baseStep.click(Driver, planPage.menu_plan);
await baseStep.wait(Driver, 1000);
await baseStep.click(Driver, planPage.new_plan_btn);
await baseStep.input(Driver, planPage.plan_name, "AutomationTest" + new Date().getTime() );
await baseStep.input(Driver, planPage.plan_description, "AutomationTest description");
await planPage.selectCurrency(Driver,"EUR")
await baseStep.wait(Driver, 1000); // aria-activedescendant
await baseStep.input(Driver, planPage.price, "20");
await planPage.inputIntervalCount(Driver, 2);
await baseStep.scrollIntoView(Driver, planPage.add_ons);
await baseStep.wait(Driver, 1000);
await planPage.selectAddOn(Driver, "addonforAuto");
await planPage.selectOneTimePayment(Driver, "oneTimeForAuto");
await baseStep.scrollIntoView(Driver, planPage.save_btn);
await baseStep.click(Driver, planPage.save_btn);
await baseStep.screenShot(Driver,savaPath + '/02_save.jpeg');
await baseStep.wait(Driver, 2000);
await baseStep.click(Driver, planPage.delete_btn);
await baseStep.screenShot(Driver,savaPath + '/03_delete.jpeg');
await baseStep.wait(Driver, 1000);
await baseStep.click(Driver, planPage.confirm_delete_btn);
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);
});
});
......
...@@ -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("http://localhost:8088"); const ApiReq = new API_Object("http://api.unibee.top");
const addContext = require('mochawesome/addContext'); const addContext = require('mochawesome/addContext');
const {expect} = require("chai"); const {expect} = require("chai");
...@@ -94,7 +94,7 @@ describe('TS001: Invoice with Paid=> Success', function() { ...@@ -94,7 +94,7 @@ describe('TS001: Invoice with Paid=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -119,7 +119,7 @@ describe('TS001: Invoice with Paid=> Success', function() { ...@@ -119,7 +119,7 @@ describe('TS001: Invoice with Paid=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -325,7 +325,7 @@ describe('TS002: Invoice with Processing and paid (wire transfer)=> Success', fu ...@@ -325,7 +325,7 @@ describe('TS002: Invoice with Processing and paid (wire transfer)=> Success', fu
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -350,7 +350,7 @@ describe('TS002: Invoice with Processing and paid (wire transfer)=> Success', fu ...@@ -350,7 +350,7 @@ describe('TS002: Invoice with Processing and paid (wire transfer)=> Success', fu
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -559,7 +559,7 @@ describe('TS003: Invoice with cancelled=> Success', function() { ...@@ -559,7 +559,7 @@ describe('TS003: Invoice with cancelled=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -584,7 +584,7 @@ describe('TS003: Invoice with cancelled=> Success', function() { ...@@ -584,7 +584,7 @@ describe('TS003: Invoice with cancelled=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -782,7 +782,7 @@ describe('TS004: refund with stripe=> Success', function() { ...@@ -782,7 +782,7 @@ describe('TS004: refund with stripe=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -807,7 +807,7 @@ describe('TS004: refund with stripe=> Success', function() { ...@@ -807,7 +807,7 @@ describe('TS004: refund with stripe=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -1015,7 +1015,7 @@ describe('TS005: refund with wire transfer=> Success', function() { ...@@ -1015,7 +1015,7 @@ describe('TS005: refund with wire transfer=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -1040,7 +1040,7 @@ describe('TS005: refund with wire transfer=> Success', function() { ...@@ -1040,7 +1040,7 @@ describe('TS005: refund with wire transfer=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
......
...@@ -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("http://localhost:8088"); const ApiReq = new API_Object("http://api.unibee.top");
const addContext = require('mochawesome/addContext'); const addContext = require('mochawesome/addContext');
const {expect} = require("chai"); const {expect} = require("chai");
...@@ -95,7 +95,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() { ...@@ -95,7 +95,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -120,7 +120,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() { ...@@ -120,7 +120,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -190,7 +190,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() { ...@@ -190,7 +190,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() {
await baseStep.click(Driver, userPlanPage.OK_btn); await baseStep.click(Driver, userPlanPage.OK_btn);
await baseStep.wait(Driver,5000); await baseStep.wait(Driver,5000);
await baseStep.switchWindow(Driver); await baseStep.switchWindow(Driver);
await baseStep.waitUntilElement(Driver, userPlanPage.change_card_btn,200000); await baseStep.waitUntilElement(Driver, userPlanPage.change_card_btn,2000);
await baseStep.click(Driver, userPlanPage.change_card_btn); await baseStep.click(Driver, userPlanPage.change_card_btn);
await baseStep.input(Driver,userPlanPage.card_number, '4242424242424242'); await baseStep.input(Driver,userPlanPage.card_number, '4242424242424242');
await baseStep.input(Driver,userPlanPage.card_expiry, '1234'); await baseStep.input(Driver,userPlanPage.card_expiry, '1234');
...@@ -317,7 +317,7 @@ describe('TS002: Transaction with Pending=> Success', function() { ...@@ -317,7 +317,7 @@ describe('TS002: Transaction with Pending=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -342,7 +342,7 @@ describe('TS002: Transaction with Pending=> Success', function() { ...@@ -342,7 +342,7 @@ describe('TS002: Transaction with Pending=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -534,7 +534,7 @@ describe('TS003: Transaction with Failed=> Success', function() { ...@@ -534,7 +534,7 @@ describe('TS003: Transaction with Failed=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -559,7 +559,7 @@ describe('TS003: Transaction with Failed=> Success', function() { ...@@ -559,7 +559,7 @@ describe('TS003: Transaction with Failed=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -753,7 +753,7 @@ describe('TS004: Transaction with refund => Success', function() { ...@@ -753,7 +753,7 @@ describe('TS004: Transaction with refund => Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -778,7 +778,7 @@ describe('TS004: Transaction with refund => Success', function() { ...@@ -778,7 +778,7 @@ describe('TS004: Transaction with refund => Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
......
This diff is collapsed.
let loginPage = require("../../PageObject/LoginPage");
let userPlanPage = require("../../PageObject/UserPlanPage");
let userListPage = require("../../PageObject/MerchantUserListPage")
const urlencoded = require('urlencode');
const webdriver = require('selenium-webdriver');
const By = webdriver.By;
const driver = require('../../../CommonStep/Web/seleniumWebDriver');
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("http://localhost:8088");
const addContext = require('mochawesome/addContext');
const {expect} = require("chai");
const {wait} = require("../../../CommonStep/Web/Web_Common_Step");
const merchantInvoicePage = require("../../PageObject/MerchantInvoicePage");
const discountCodePage = require("../../PageObject/MerchantDiscountCodePage");
let request;
let response;
let timeStamp = new Date();
let Driver;
let savaPath = __dirname + "/../../Report/Web/ScreenShot/09_user_list/" + baseStep.getDateFormat(new Date(),"YYYY-MM-DD_HH:mm:ss");
let testData = [];
let testUser = "[email protected]";
describe('TS001: add user in user list=> 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 - add a new user => Success ', (done) => {
(async () => {
try {
// login
Driver = driver.getDriver(webdriver, 'chrome');
// Check Url
await loginPage.openMerchantUrl(Driver, "http://unibee:123456@localhost/plan/list/");
const currentUrl = await Driver.getCurrentUrl();
console.log('当前网址:', currentUrl);
await baseStep.waitUntilElement(Driver, loginPage.email,20000);
await loginPage.loginMerchant(Driver, "[email protected]", "changeme")
await baseStep.wait(Driver, 1000);
await baseStep.waitUntilElement(Driver, userListPage.menu_user_list);
await baseStep.click(Driver, userListPage.menu_user_list);
await baseStep.wait(Driver,2000);
await baseStep.click(Driver, userListPage.add_new_btn);
await baseStep.wait(Driver,2000);
let time = new Date().getTime();
await baseStep.input(Driver, userListPage.new_email, "Auto"+ time + "@test.com");
await baseStep.input(Driver, userListPage.new_ex_user_id, time);
await baseStep.input(Driver, userListPage.new_first_name, "Testing");
await baseStep.input(Driver, userListPage.new_last_name, "QA" + time);
await baseStep.input(Driver, userListPage.new_phone, "15642543250");
await baseStep.input(Driver, userListPage.new_address, "Test Address");
await baseStep.screenShot(Driver, savaPath + "/01_add_user");
await baseStep.click(Driver, userListPage.new_OK_btn);
await baseStep.wait(Driver,1000);
await baseStep.screenShot(Driver, savaPath + "/02_user_list");
await userListPage.checkRecordUserList(Driver, "Testing QA"+time, "Auto"+ time + "@test.com","Active");
await baseStep.scrollIntoView(Driver,userListPage.suspend_btn);
await baseStep.click(Driver, userListPage.suspend_btn);
await baseStep.screenShot(Driver, savaPath + "/03_suspend_user");
await baseStep.click(Driver, userListPage.suspend_confirm_btn);
await baseStep.click(Driver, userListPage.menu_user_list);
await baseStep.wait(Driver,2000);
await baseStep.screenShot(Driver, savaPath + "/04_suspend_result");
await userListPage.checkRecordUserList(Driver, "Testing QA"+time, "Auto"+ time + "@test.com","Suspended");
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('TS002: Assign subscription in user list=> 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 - Assign a sub => Success ', (done) => {
(async () => {
try {
// login
Driver = driver.getDriver(webdriver, 'chrome');
// Check Url
await loginPage.openMerchantUrl(Driver, "http://unibee:123456@localhost/plan/list/");
const currentUrl = await Driver.getCurrentUrl();
console.log('当前网址:', currentUrl);
await baseStep.waitUntilElement(Driver, loginPage.email,20000);
await loginPage.loginMerchant(Driver, "[email protected]", "changeme")
await baseStep.wait(Driver, 1000);
await baseStep.waitUntilElement(Driver, userListPage.menu_user_list);
await baseStep.click(Driver, userListPage.menu_user_list);
await baseStep.wait(Driver,2000);
await baseStep.click(Driver, userListPage.add_new_btn);
await baseStep.wait(Driver,2000);
let time = new Date().getTime();
await baseStep.input(Driver, userListPage.new_email, "Auto"+ time + "@test.com");
await baseStep.input(Driver, userListPage.new_ex_user_id, time);
await baseStep.input(Driver, userListPage.new_first_name, "Testing");
await baseStep.input(Driver, userListPage.new_last_name, "QA" + time);
await baseStep.input(Driver, userListPage.new_phone, "15642543250");
await baseStep.input(Driver, userListPage.new_address, "Test Address");
await baseStep.screenShot(Driver, savaPath + "/05_add_user");
await baseStep.click(Driver, userListPage.new_OK_btn);
await baseStep.wait(Driver,1000);
await baseStep.screenShot(Driver, savaPath + "/06_user_list");
await userListPage.checkRecordUserList(Driver, "Testing QA"+time, "Auto"+ time + "@test.com","Active");
await baseStep.click(Driver, userListPage.subscription_tab);
await baseStep.wait(Driver,1000);
await baseStep.click(Driver, userListPage.assign_sub_btn);
await baseStep.wait(Driver,1000);
await userListPage.selectTargetPlan(Driver, "Month Plan");
await baseStep.wait(Driver,1000);
await baseStep.screenShot(Driver, savaPath + "/07_assign_sub");
await baseStep.click(Driver, userListPage.assign_OK_btn);
await baseStep.wait(Driver,3000);
await baseStep.screenShot(Driver, savaPath + "/08_assign_result");
await baseStep.compareText(Driver, userListPage.current_text, "Current Subscription");
await baseStep.compareText(Driver, userListPage.current_plan, "Month Plan");
await baseStep.compareText(Driver, userListPage.current_plan_des, "Month Plan");
await baseStep.compareText(Driver, userListPage.current_status, "Incomplete");
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);
});
});
...@@ -10,7 +10,7 @@ const baseStep = require('../../../CommonStep/Web/Web_Common_Step'); ...@@ -10,7 +10,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("http://localhost:8088"); const ApiReq = new API_Object("http://api.unibee.top");
const addContext = require('mochawesome/addContext'); const addContext = require('mochawesome/addContext');
const {expect} = require("chai"); const {expect} = require("chai");
...@@ -92,7 +92,7 @@ describe('Cancel the subscription', function() { ...@@ -92,7 +92,7 @@ describe('Cancel the subscription', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -117,7 +117,7 @@ describe('Cancel the subscription', function() { ...@@ -117,7 +117,7 @@ describe('Cancel the subscription', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -237,7 +237,7 @@ describe('TS001: Purchase plan with credit card=> Success', function() { ...@@ -237,7 +237,7 @@ describe('TS001: Purchase plan with credit card=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -262,7 +262,7 @@ describe('TS001: Purchase plan with credit card=> Success', function() { ...@@ -262,7 +262,7 @@ describe('TS001: Purchase plan with credit card=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -430,7 +430,7 @@ describe('TS002: Purchase plan with wire transfer and not finish=> Success', fun ...@@ -430,7 +430,7 @@ describe('TS002: Purchase plan with wire transfer and not finish=> Success', fun
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -455,7 +455,7 @@ describe('TS002: Purchase plan with wire transfer and not finish=> Success', fun ...@@ -455,7 +455,7 @@ describe('TS002: Purchase plan with wire transfer and not finish=> Success', fun
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -615,7 +615,7 @@ describe('TS003: Purchase plan with wire transfer and finished=> Success', funct ...@@ -615,7 +615,7 @@ describe('TS003: Purchase plan with wire transfer and finished=> Success', funct
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -640,7 +640,7 @@ describe('TS003: Purchase plan with wire transfer and finished=> Success', funct ...@@ -640,7 +640,7 @@ describe('TS003: Purchase plan with wire transfer and finished=> Success', funct
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
......
...@@ -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("http://localhost:8088"); const ApiReq = new API_Object("http://api.unibee.top");
const addContext = require('mochawesome/addContext'); const addContext = require('mochawesome/addContext');
const {expect} = require("chai"); const {expect} = require("chai");
......
...@@ -11,7 +11,7 @@ const baseStep = require('../../../CommonStep/Web/Web_Common_Step'); ...@@ -11,7 +11,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("http://localhost:8088"); const ApiReq = new API_Object("http://api.unibee.top");
const addContext = require('mochawesome/addContext'); const addContext = require('mochawesome/addContext');
const {expect} = require("chai"); const {expect} = require("chai");
...@@ -94,7 +94,7 @@ describe('TS001: Invoice with Paid=> Success', function() { ...@@ -94,7 +94,7 @@ describe('TS001: Invoice with Paid=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -119,7 +119,7 @@ describe('TS001: Invoice with Paid=> Success', function() { ...@@ -119,7 +119,7 @@ describe('TS001: Invoice with Paid=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -300,7 +300,7 @@ describe('TS001: Invoice with Processing=> Success', function() { ...@@ -300,7 +300,7 @@ describe('TS001: Invoice with Processing=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -325,7 +325,7 @@ describe('TS001: Invoice with Processing=> Success', function() { ...@@ -325,7 +325,7 @@ describe('TS001: Invoice with Processing=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -496,7 +496,7 @@ describe('TS001: Invoice with cancelled=> Success', function() { ...@@ -496,7 +496,7 @@ describe('TS001: Invoice with cancelled=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -521,7 +521,7 @@ describe('TS001: Invoice with cancelled=> Success', function() { ...@@ -521,7 +521,7 @@ describe('TS001: Invoice with cancelled=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
......
...@@ -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("http://localhost:8088"); const ApiReq = new API_Object("http://api.unibee.top");
const addContext = require('mochawesome/addContext'); const addContext = require('mochawesome/addContext');
const {expect} = require("chai"); const {expect} = require("chai");
...@@ -95,7 +95,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() { ...@@ -95,7 +95,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -120,7 +120,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() { ...@@ -120,7 +120,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -190,7 +190,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() { ...@@ -190,7 +190,7 @@ describe('TS001: Transaction with Succeeded=> Success', function() {
await baseStep.click(Driver, userPlanPage.OK_btn); await baseStep.click(Driver, userPlanPage.OK_btn);
await baseStep.wait(Driver,5000); await baseStep.wait(Driver,5000);
await baseStep.switchWindow(Driver); await baseStep.switchWindow(Driver);
await baseStep.waitUntilElement(Driver, userPlanPage.change_card_btn,200000); await baseStep.waitUntilElement(Driver, userPlanPage.change_card_btn,2000);
await baseStep.click(Driver, userPlanPage.change_card_btn); await baseStep.click(Driver, userPlanPage.change_card_btn);
await baseStep.input(Driver,userPlanPage.card_number, '4242424242424242'); await baseStep.input(Driver,userPlanPage.card_number, '4242424242424242');
await baseStep.input(Driver,userPlanPage.card_expiry, '1234'); await baseStep.input(Driver,userPlanPage.card_expiry, '1234');
...@@ -295,7 +295,7 @@ describe('TS002: Transaction with Pending=> Success', function() { ...@@ -295,7 +295,7 @@ describe('TS002: Transaction with Pending=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -320,7 +320,7 @@ describe('TS002: Transaction with Pending=> Success', function() { ...@@ -320,7 +320,7 @@ describe('TS002: Transaction with Pending=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -486,7 +486,7 @@ describe('TS002: Transaction with Failed=> Success', function() { ...@@ -486,7 +486,7 @@ describe('TS002: Transaction with Failed=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -511,7 +511,7 @@ describe('TS002: Transaction with Failed=> Success', function() { ...@@ -511,7 +511,7 @@ describe('TS002: Transaction with Failed=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
......
...@@ -13,7 +13,7 @@ const baseStep = require('../../../CommonStep/Web/Web_Common_Step'); ...@@ -13,7 +13,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("http://localhost:8088"); const ApiReq = new API_Object("http://api.unibee.top");
const addContext = require('mochawesome/addContext'); const addContext = require('mochawesome/addContext');
const {expect} = require("chai"); const {expect} = require("chai");
......
...@@ -11,7 +11,7 @@ const baseStep = require('../../../CommonStep/Web/Web_Common_Step'); ...@@ -11,7 +11,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("http://localhost:8088"); const ApiReq = new API_Object("http://api.unibee.top");
const addContext = require('mochawesome/addContext'); const addContext = require('mochawesome/addContext');
const {expect} = require("chai"); const {expect} = require("chai");
...@@ -94,7 +94,7 @@ describe('TS001: purchase with a vat number=> Success', function() { ...@@ -94,7 +94,7 @@ describe('TS001: purchase with a vat number=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -119,7 +119,7 @@ describe('TS001: purchase with a vat number=> Success', function() { ...@@ -119,7 +119,7 @@ describe('TS001: purchase with a vat number=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -283,7 +283,7 @@ describe('TS002: Check the different taxes under different countries=> Success', ...@@ -283,7 +283,7 @@ describe('TS002: Check the different taxes under different countries=> Success',
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -308,7 +308,7 @@ describe('TS002: Check the different taxes under different countries=> Success', ...@@ -308,7 +308,7 @@ describe('TS002: Check the different taxes under different countries=> Success',
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -495,7 +495,7 @@ describe('TS001: purchase with a discount code=> Success', function() { ...@@ -495,7 +495,7 @@ describe('TS001: purchase with a discount code=> Success', function() {
it('Case 02: Get User List => Success', (done) => { it('Case 02: Get User List => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => { ApiReq.getUserList(API_Env.get().headerSet,urlencoded(testUser),(res, url, header) => {
request = { request = {
URL: url, URL: url,
...@@ -520,7 +520,7 @@ describe('TS001: purchase with a discount code=> Success', function() { ...@@ -520,7 +520,7 @@ describe('TS001: purchase with a discount code=> Success', function() {
it('Case 03: Get subscription => Success', (done) => { it('Case 03: Get subscription => Success', (done) => {
try { try {
setTimeout(() => {//Wait syncTimeAPI*1000 seconds setTimeout(() => {//Wait syncTimeAPI*1000 seconds
API_Env.get().headerSet.Authorization = "Bearer " + testData["token"]; // API_Env.get().headerSet.Authorization = "Bearer " + testData["token"];
ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => { ApiReq.getSubscription(API_Env.get().headerSet, testData['id'],(res, url, header) => {
request = { request = {
URL: url, URL: url,
......
...@@ -4,7 +4,8 @@ Env = { ...@@ -4,7 +4,8 @@ Env = {
url: "https://api.unibee.top" url: "https://api.unibee.top"
}, },
headerSet: { headerSet: {
'Authorization': '', // 'Authorization': 'Bearer iioMWSTNd1qOtdAhxExnjWzQLcv976TT', // joshua.yu+8
'Authorization': 'Bearer b38Q1SbncYQJJYyTTTPtyoNSVVNj6dsO', // local
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
} }
......
...@@ -68,6 +68,14 @@ exports.compareText = async function (driver, xpath, expectText) { ...@@ -68,6 +68,14 @@ exports.compareText = async function (driver, xpath, expectText) {
await expect(actualText).to.equal(expectText); await expect(actualText).to.equal(expectText);
}; };
exports.compareValueText = async function (driver, xpath, expectText){
let element = await driver.findElement(By.xpath(xpath));
let actualText = await element.getAttribute('value');
console.log("Actual Text: " + actualText);
console.log("Expect Text: " + expectText);
await expect(actualText).to.equal(expectText);
}
getTitle = async function (driver) { getTitle = async function (driver) {
let title = await driver.getTitle(); let title = await driver.getTitle();
await console.log('Title <' + title + '>'); await console.log('Title <' + title + '>');
......
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