????????UI?????????
?????BeckJin ???????[ 2017/4/24 11:00:31 ] ????????UI???? ?????????
	?????????????????????????????????????о??????檔
	????????????UI????????????????????????????????????????????
	??????????????????а?????UI?????????/?????????????????????????UI????????????????????????????10%???????????????????????????????????????????????????????????????ж??????????UI???????????????e?????????????????????????UI??????????????????????????????Щ????????
	??????????????WebdriverIO??WebdriverIO??Webdriver Node.js??飬API????????????Mobile?????????Webdriver?????????????Selenuim???????????????????????????????????????
	????WebdriverIO??????????????????Standalone Mode???????WDIO????????????????WDIO???????????
	????1?????????
	????2??????鰱?в???
	????3?????????ж?????????????????????????????????Standalone Mode???????????????then...then...
	????4??????????????????????????????
	???????濪???????????
	???????????????
	????· ???JDK
	????· ???Node.js
	????· ???webdriverio
	????· ???selenium-standalone
	????· ???wdio
	????· ???mocha????????
	????· ???chai??????
	??????????
	
	????
	???????????
	????package.json??
	"devDependencies": {
	"webdriverio": "^4.6.2"??  // webdriverio ??
	"selenium-standalone": "^6.2.0"??  // selenium standalone server???????driver???
	"wdio": "^0.3.3"??  // wdio??????????
	"wdio-mocha-framework": "^0.5.9"??  // ?????????
	"chai": "^3.5.0"??  // ????
	"wdio-spec-reporter": "^0.1.0"??  // ???????????????
	"allure-commandline": "^1.5.0"??  // ???????????????????
	"wdio-allure-reporter": "^0.1.2"  // ??????????????????UI????
	}??
	"scripts": {
	"selenium": "selenium-standalone start"?? // ???selenium
	"test": ".\node_modules\.bin\wdio"?? // ???test
	"allure": "allure generate allure-results && allure report open" //??????????
	}
	????????wdio-spec-reporter??allure-commandline??wdio-allure-reporter ??????????????
	????selenium-standalone????????????????????????????????????driver?????????????? selenium-standalone??install??????п???????????????鷭?????
	????selenium-standalone install
	?????????????????????????????selenium-server??
	????selenium-standalone start
	????wdio?????????
	var config = require('./config');
	var common = require('./common');
	exports.config = {
	// selenium-server ?????IP??????????4444
	host: '127.0.0.1'??
	port: 4444??
	// ??Щ?????в???
	specs: [
	'./modules/*.js'
	]??
	// ??Щ???????в???
	exclude: [
	'./modules/function.js'??
	'./modules/register.js'??
	'./modules/invite.js'
	]??
	// ??????????????в???
	capabilities: [{
	browserName: 'chrome'??
	maxInstances: 1?? // ?????????????????????????
	chromeOptions: {
	args: ['disable-extensions']
	}
	}]??
	logLevel: 'silent'??
	coloredLogs: true??
	baseUrl: config.webUrl??
	waitforTimeout: 100000?? // 100s
	framework: 'mocha'??
	reporters: ['spec'?? 'allure']?? // ?????????淽?
	reporterOptions: {
	allure: {
	outputDir: 'allure-results' // allure???????????
	}
	}??
	mochaOpts: {
	ui: 'bdd'??
	timeout: 99999999  // ??????????е????????????
	}??
	// ?????в????????allure?????????????
	onPrepare: function (config?? capabilities) {
	common.deleteFile('./allure-report');
	common.deleteFile('./allure-results');
	}
	};
	?????????????????
	????describe('login-test'?? function () {
	????it('login'?? function () {
	????return browser
	????.deleteCookie() // ???????cookie
	????.url(config.webUrl + '/login.htm') // ????????
	????.setValue('#txtMobilePhone'?? config.loginInfo.mobilePhone) // ?????????
	????.setValue('#txtPassword'?? config.loginInfo.password) // ????????
	????.click('#btnLogin') // ?????????
	????.waitForExist('#topBarContent'?? config.waitMS); // ??????????????????
	????});
	????});
	?????????????????????
	????// ??????? browser.checkInviteSuccess()????
	????browser.addCommand('checkInviteSuccess'?? function (inboxType) {
	????$('.sessionList .sessionItem[id="' + inboxType + '"]').click();
	????browser.waitForExist('.messageItem'?? config.waitMS);
	????var result = browser
	????.execute(function () {
	????var text = null;
	????$('.inboxBox .messageItem .textMsg').each(function () {
	????text += $(this).text();
	????});
	????return text;
	????});
	????// ???????????????
	????assert.match(result.value?? /??????????|???????|???????|???????/?? '?ж????????????????????????');
	????});
	??????в????
	?????????A
	????npm run selenium  //???selenium-server
	?????????B
	????npm run test //???test
	?????????????棺
	????npm run allure
	
	????
	??β?????
	???????
	????· WebdriverIO??????????????????С??????????????????????
	????· describe??it ????Mocha??????????????????????????????it.only??????describe????describe.only??????Mocha????????? Mocha??
	????· Chai??BDD(???????????) ???????TDD(????????????)??????????Chai????????? Chai??
	????· ??????÷???????????????????????У?????????????????У?waitForExist?????????????????????????????????????????????
??????
					
					???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44
					
			
								
								
								
								
								
								
								
								
								
								
				
sales@spasvo.com