refactor: move driver/capatibilities options to pkg/uixt/options

This commit is contained in:
lilong.129
2025-02-06 16:01:48 +08:00
parent 3c9c1dddd9
commit f1ef161377
18 changed files with 210 additions and 199 deletions

View File

@@ -0,0 +1,55 @@
package options
import "github.com/httprunner/funplugin"
type DriverOptions struct {
Capabilities Capabilities
Plugin funplugin.IPlugin
WithImageService bool
WithResultFolder bool
WithUIAction bool
}
func NewDriverOptions(opts ...DriverOption) *DriverOptions {
driverOptions := &DriverOptions{
WithImageService: true,
WithResultFolder: true,
WithUIAction: true,
}
for _, option := range opts {
option(driverOptions)
}
return driverOptions
}
type DriverOption func(*DriverOptions)
func WithDriverCapabilities(capabilities Capabilities) DriverOption {
return func(options *DriverOptions) {
options.Capabilities = capabilities
}
}
func WithDriverImageService(withImageService bool) DriverOption {
return func(options *DriverOptions) {
options.WithImageService = withImageService
}
}
func WithDriverResultFolder(withResultFolder bool) DriverOption {
return func(options *DriverOptions) {
options.WithResultFolder = withResultFolder
}
}
func WithUIAction(withUIAction bool) DriverOption {
return func(options *DriverOptions) {
options.WithUIAction = withUIAction
}
}
func WithDriverPlugin(plugin funplugin.IPlugin) DriverOption {
return func(options *DriverOptions) {
options.Plugin = plugin
}
}