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: add ability to use devtools procotol through cli option #827

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

DudaGod
Copy link
Member

@DudaGod DudaGod commented Jan 16, 2024

What is done

add ability to use devtools procotol through cli option --devtools in order to make it easier to switch between the two protocols (devtools and webdriver).

@DudaGod DudaGod force-pushed the HERMIONE-1333.devtools_cli_option branch from ca4199f to b085065 Compare January 16, 2024 15:28
@@ -67,6 +67,7 @@ exports.run = () => {
)
.option("--repl-before-test [type]", "open repl interface before test run", Boolean, false)
.option("--repl-on-fail [type]", "open repl interface on test fail only", Boolean, false)
.option("--devtools", "switches the browser to the devtools mode with using CDP protocol")
Copy link
Member Author

Choose a reason for hiding this comment

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

Если опция не указана, то devtools: undefined, а если указана то devtools: true

@@ -99,6 +101,7 @@ exports.run = () => {
beforeTest: replBeforeTest,
onFail: replOnFail,
},
devtools: devtools || false,
Copy link
Member Author

Choose a reason for hiding this comment

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

Если devtools не указана пользователем, то привожу опцию к false

reporters = [],
}: Partial<RunOpts> = {},
): Promise<boolean> {
validateUnknownBrowsers(browsers, _.keys(this._config.browsers));

RuntimeConfig.getInstance().extend({ updateRefs, requireModules, inspectMode, replMode });
RuntimeConfig.getInstance().extend({ updateRefs, requireModules, inspectMode, replMode, devtools });
Copy link
Member Author

Choose a reason for hiding this comment

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

Опцию переданную из cli сохраняю в runtime конфиге, чтобы затем заюзать при создании браузера.

@DudaGod DudaGod force-pushed the HERMIONE-1333.devtools_cli_option branch from b085065 to 7750da9 Compare January 16, 2024 15:30
@@ -100,7 +102,7 @@ module.exports = class NewBrowser extends Browser {
path: gridUri.path(),
queryParams: this._getQueryParams(gridUri.query()),
capabilities,
automationProtocol: config.automationProtocol,
automationProtocol: devtools ? "devtools" : config.automationProtocol,
Copy link
Member

Choose a reason for hiding this comment

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

почему ты в тестах используешь константу DEVTOOLS_PROTOCOL, а здесь строкой добавляешь?

Copy link
Member Author

Choose a reason for hiding this comment

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

Забыл тут заюзать, поправил.

@DudaGod DudaGod force-pushed the HERMIONE-1333.devtools_cli_option branch from 7750da9 to 852f375 Compare January 17, 2024 08:15
@DudaGod DudaGod merged commit 30ab0ec into master Jan 17, 2024
2 checks passed
@DudaGod DudaGod deleted the HERMIONE-1333.devtools_cli_option branch January 17, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants