Ability to specify log level via `LOG_LEVEL=all npm start`

This commit is contained in:
Fredrik Wollsén 2018-10-28 13:04:46 +02:00
Родитель a8a12c741e
Коммит bba71a31b3
2 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -27,7 +27,7 @@
- (Create profile: <https://developer.mozilla.org/Firefox/Multiple_profiles>, or via some other method) - (Create profile: <https://developer.mozilla.org/Firefox/Multiple_profiles>, or via some other method)
- Navigate to _about:config_ and set the following preferences. (If a preference does not exist, create it be right-clicking in the white area and selecting New -> String) - Navigate to _about:config_ and set the following preferences. (If a preference does not exist, create it be right-clicking in the white area and selecting New -> String)
- Set `shieldStudy.logLevel` to `All`. This permits shield-add-on log output in browser console. - Set `shieldStudy.logLevel` to `info`. This permits shield-add-on log output in browser console.
- Go to [this study's tracking bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1496154) and install the latest add-on zip file - Go to [this study's tracking bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1496154) and install the latest add-on zip file
## Expected User Experience / Functionality ## Expected User Experience / Functionality
@ -40,6 +40,7 @@ Ordinary regression tests.
### Note: checking "sent Telemetry is correct" ### Note: checking "sent Telemetry is correct"
- Set `shieldStudy.logLevel` to `all`. This permits debug-level shield-add-on log output in the browser console. Note that this will negatively affect the performance of Firefox.
- Open the Browser Console using Firefox's top menu at `Tools > Web Developer > Browser Console`. This will display Shield (loading/telemetry) log output from the add-on. - Open the Browser Console using Firefox's top menu at `Tools > Web Developer > Browser Console`. This will display Shield (loading/telemetry) log output from the add-on.
See [TELEMETRY.md](./TELEMETRY.md) for more details on what pings are sent by this add-on. See [TELEMETRY.md](./TELEMETRY.md) for more details on what pings are sent by this add-on.

Просмотреть файл

@ -7,19 +7,25 @@ process.on("unhandledRejection", r => console.error(r)); // eslint-disable-line
const utils = require("./test/functional/utils"); const utils = require("./test/functional/utils");
const STUDY_TYPE = process.env.STUDY_TYPE || "pioneer"; const STUDY_TYPE = process.env.STUDY_TYPE || "pioneer";
const LOG_LEVEL = process.env.LOG_LEVEL || "info";
const run = async studyType => { const run = async (studyType, shieldStudyLogLevel) => {
const driver = await utils.setupWebdriver.promiseSetupDriver( const driver = await utils.setupWebdriver.promiseSetupDriver(
utils.FIREFOX_PREFERENCES, utils.FIREFOX_PREFERENCES,
); );
const widgetId = utils.ui.makeWidgetId( const widgetId = utils.ui.makeWidgetId(
"shield-utils-test-addon@shield.mozilla.org", "jestr-pioneer-shield-study@pioneer.mozilla.org",
); );
await utils.preferences.set( await utils.preferences.set(
driver, driver,
`extensions.${widgetId}.test.studyType`, `extensions.${widgetId}.test.studyType`,
studyType, studyType,
); );
await utils.preferences.set(
driver,
`shieldStudy.logLevel`,
shieldStudyLogLevel,
);
if (studyType === "pioneer") { if (studyType === "pioneer") {
await utils.setupWebdriver.installPioneerOptInAddon(driver); await utils.setupWebdriver.installPioneerOptInAddon(driver);
} }
@ -30,4 +36,4 @@ const run = async studyType => {
driver.quit(); driver.quit();
}; };
run(STUDY_TYPE); run(STUDY_TYPE, LOG_LEVEL);