-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(e2e): support setting browser's UserAgent in CLI (#32)
Differential Revision: D39777353 fbshipit-source-id: 49c359142822746fd842e0a4d0d75991e66eb9ba
- Loading branch information
1 parent
23b7102
commit 0a2a7fe
Showing
7 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @oncall ws_labs | ||
*/ | ||
|
||
import type {ParsedArgs} from 'minimist'; | ||
import type {MemLabConfig} from '@memlab/core'; | ||
import {BaseOption} from '@memlab/core'; | ||
|
||
export default class SetUserAgentOption extends BaseOption { | ||
getOptionName(): string { | ||
return 'user-agent'; | ||
} | ||
|
||
getDescription(): string { | ||
return ( | ||
'set the UserAgent string in browser (for E2E interaction), ' + | ||
'otherwise it uses the default UserAgent from Chromium' | ||
); | ||
} | ||
|
||
getExampleValues(): string[] { | ||
return ['"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2)"']; | ||
} | ||
|
||
async parse(config: MemLabConfig, args: ParsedArgs): Promise<void> { | ||
const optionName = this.getOptionName(); | ||
if (args[optionName]) { | ||
config.defaultUserAgent = args[optionName]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters