合并 main:同步聊天、风控诊断与迁移基线
This commit is contained in:
commit
a6c0d36ee9
89 files changed
+2974
-365
No files matched your search
@@ -92,13 +92,15 @@ func TestPasswordLoginReferenceProfileAndTiming(t *testing.T) {
|
||||
// TestPasswordPersistentContextOptionsMatchReference 负责Test密码Persistent上下文OptionsMatchReference相关处理。
|
||||
func TestPasswordPersistentContextOptionsMatchReference(t *testing.T) {
|
||||
t.Setenv("PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH", "/opt/chromium")
|
||||
// opts 保存opts,供当前处理流程使用
|
||||
opts := passwordPersistentContextOptions(true)
|
||||
// userAgent 模拟从同版本 Chromium 实测后规范化出的无头身份。
|
||||
userAgent := "Mozilla/5.0 Chrome/149.0.7827.55 Safari/537.36"
|
||||
// opts 验证无头持久化密码登录会把该身份交给 Playwright context。
|
||||
opts := passwordPersistentContextOptions(true, &userAgent)
|
||||
if opts.Headless == nil || !*opts.Headless {
|
||||
t.Fatal("密码登录应按调用参数使用无头模式")
|
||||
}
|
||||
if opts.UserAgent != nil {
|
||||
t.Fatalf("密码登录不应覆盖 Playwright Chromium 原生 UA: %v", *opts.UserAgent)
|
||||
if opts.UserAgent == nil || *opts.UserAgent != userAgent {
|
||||
t.Fatalf("无头密码登录应使用去除 HeadlessChrome 的运行时 UA: %v", opts.UserAgent)
|
||||
}
|
||||
if opts.Viewport == nil || opts.Viewport.Width != 1980 || opts.Viewport.Height != 1024 {
|
||||
t.Fatalf("密码登录 viewport=%+v", opts.Viewport)
|
||||
@@ -118,6 +120,11 @@ func TestPasswordPersistentContextOptionsMatchReference(t *testing.T) {
|
||||
if opts.ExecutablePath == nil || *opts.ExecutablePath != "/opt/chromium" {
|
||||
t.Fatalf("Chromium 路径=%v", opts.ExecutablePath)
|
||||
}
|
||||
// headed 是有头密码登录配置,必须保留 Chromium 的原生 UA 而不使用无头覆盖。
|
||||
headed := passwordPersistentContextOptions(false, &userAgent)
|
||||
if headed.UserAgent != nil {
|
||||
t.Fatalf("有头密码登录应保留 Chromium 原生 UA: %v", headed.UserAgent)
|
||||
}
|
||||
}
|
||||
|
||||
// TestPasswordLoginRejectsBlankCredentialsBeforeBrowserInit 负责Test密码登录RejectsBlankCredentialsBefore浏览器Init相关处理。
|
||||
|
||||
Reference in new issue
Block a user