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

Add a description per url in scripting. #814

Merged
merged 3 commits into from
Apr 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions lib/core/engine/collector.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ class Collector {
const results = this.allResults[url]
? this.allResults[url]
: getNewResult(url, this.options);
results.info.description = allData.description;
results.info.title = allData.title;
const statistics = this.allStats[url]
? this.allStats[url]
: new Statistics();
Expand Down
13 changes: 13 additions & 0 deletions lib/core/engine/command/meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

class Meta {
constructor() {}

setDescription(text) {
this.description = text;
}
setTitle(text) {
this.title = text;
}
}
module.exports = Meta;
8 changes: 8 additions & 0 deletions lib/core/engine/iteration.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const JavaScript = require('./command/javaScript.js');
const Switch = require('./command/switch.js');
const Set = require('./command/set.js');
const Cache = require('./command/cache.js');
const Meta = require('./command/meta.js');
const ChromeDevToolsProtocol = require('./command/chromeDevToolsProtocol.js');

const { isAndroidConfigured } = require('../../android');
Expand Down Expand Up @@ -115,6 +116,7 @@ class Iteration {
switch: new Switch(browser),
set: new Set(browser),
cache: new Cache(browser, this.extensionServer),
meta: new Meta(),
cdp: new ChromeDevToolsProtocol(browser, options.browser)
};

Expand Down Expand Up @@ -190,6 +192,12 @@ class Iteration {
}
}
}
if (commands.meta.description) {
result.description = commands.meta.description;
}
if (commands.meta.title) {
result.title = commands.meta.title;
}
return result;
} catch (e) {
log.error(e);
Expand Down