Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/example page test option #372

Merged
merged 3 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
change option globalErrorLogVariable
  • Loading branch information
jinwoo-kim-nhn committed Apr 1, 2020
commit ec4b28eaba02d77783762ebf43e64f2e27ea667e
22 changes: 18 additions & 4 deletions exampleTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ const http = require('http');
const {Builder} = require('selenium-webdriver');
const HttpAgent = new http.Agent({keepAlive: true});
const DOCUMENT_LOAD_MAX_TIMEOUT = 20000;
const config = require(path.resolve(process.cwd(), 'tuidoc.config.json'));
const examples = config.examples || {};
const {globalErrorLogVariable = false, filePath = ''} = examples;
const testUrls = getTestUrls();


/**
* Url prefix
*/
Expand Down Expand Up @@ -86,6 +90,7 @@ async function testExamplePage(urls) {
*/
async function testPlatform(platformInfo, urls) {
const driver = getDriver(platformInfo);
const errorLogVariable = getGlobalErrorLogVariable();
const result = [];

for(let i = 0; i < urls.length; i += 1) {
Expand All @@ -96,7 +101,7 @@ async function testPlatform(platformInfo, urls) {
, DOCUMENT_LOAD_MAX_TIMEOUT);

const browserInfo = await driver.getCapabilities();
const errorLogs = await driver.executeScript('return window.errorLogs');
const errorLogs = await driver.executeScript(`return window.${errorLogVariable}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getGlobalErrorLogVariable()์—์„œ false๊ฐ’์ด ๋ฐ˜ํ™˜๋  ์ˆ˜ ๋„์žˆ์Šต๋‹ˆ๋‹ค.
ํ™•์ธ๋ถ€ํƒ๋“œ๋ ค์š”.

Copy link
Contributor Author

@jinwoo-kim-nhn jinwoo-kim-nhn Apr 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ใ… ใ…  ์•„ ๊ทธ๋ ‡๋„ค์š”;; ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค ํฐ์ผ๋‚ ๋ป” ํ–ˆ๋„ค์š”

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

globalErrorLogVariable ๊ฐ’์ด ์œ ํšจํ•œ ๊ฒฝ์šฐ์—๋งŒ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ์ฒ˜๋ฆฌํ•˜๋Š”๊ฒŒ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
์ œ ์ƒ๊ฐ์—๋Š” testPlatform ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋˜๊ธฐ ์ „์— ์ฒดํฌํ•˜๋Š”๊ฒŒ ๋งž์„ ๊ฒƒ ๊ฐ™์•„์š”.
globalErrorLogVariable ์˜ต์…˜ ๊ฐ’์ด false์ธ๋ฐ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋Š”๊ฒŒ ์˜๋ฏธ๊ฐ€ ์—†์–ด๋ณด์—ฌ์„œ์š”ใ…Ž

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์„ ์ž„์„ ์ž„๋‹˜ ์˜๊ฒฌ์ด ์ •๋‹ต์ด๋„ค์š”. ๋ฐ”๋กœ ๋ฐ˜์˜ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

const browserName = browserInfo.get("browserName");
const browserVersion = browserInfo.get("version") || browserInfo.get("browserVersion");

Expand Down Expand Up @@ -140,12 +145,21 @@ function printErrorLog(errorBrowsersInfo) {
* Get Examples Url
*/
function getTestUrls() {
const config = require(path.resolve(process.cwd(), 'tuidoc.config.json'));
const filePath = (config.examples || {filePath: ''}).filePath;
return fs.readdirSync(filePath).reduce((urls, fileName) => {
if (/html$/.test(fileName)) {
urls.push(`/${filePath}/${fileName}`);
}
return urls;
}, []);
}
}

/**
* Get globalErrorLogVariable for example
*/
function getGlobalErrorLogVariable() {
if (globalErrorLogVariable) {
return typeof globalErrorLogVariable === 'string' ? globalErrorLogVariable : 'errorLogs';
}

return false;
}
5 changes: 3 additions & 2 deletions tuidoc.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"example01-includeUi": "1. Include ui",
"example02-useApiDirect": "2. Use api direct (basic)",
"example03-mobile": "3. Mobile"
}
},
"globalErrorLogVariable": "errorLogs"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"globalErrorLogVariable": true๋กœ ํ•ด๋„ ๋˜์ง€ ์•Š์„๊นŒ์š”?ใ…Ž ์•„๋‹ˆ๋ฉด ์˜ˆ์ œ๋กœ ์‚ฌ์šฉํ•˜์‹ ๊ฑด๊ฐ€์š”??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true๋กœ ํ•˜๋ฉด ๋˜๊ฒ ๋„ค์š”ใ…Žใ…Ž ๋ฆฌ๋ทฐ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

},
"pathPrefix": "tui.image-editor"
}
}