feat: 优化顺运宝同步反馈与记录刷新 (#61)
This commit is contained in:
+17
-1
@@ -67,7 +67,8 @@ func TestMainPagesReturnOK(t *testing.T) {
|
||||
sybResponse := httptest.NewRecorder()
|
||||
router.ServeHTTP(sybResponse, sybRequest)
|
||||
for _, want := range []string{
|
||||
"同步记录", `name="date_from"`, `name="date_to"`,
|
||||
"同步记录", "刷新记录", `data-history-refresh-url=`,
|
||||
`name="date_from"`, `name="date_to"`,
|
||||
"按顺运宝货运单创建日期(UTC+8)同步",
|
||||
} {
|
||||
if !strings.Contains(sybResponse.Body.String(), want) {
|
||||
@@ -78,6 +79,21 @@ func TestMainPagesReturnOK(t *testing.T) {
|
||||
t.Error("顺运宝页面不应再显示旧的指定日期同步入口")
|
||||
}
|
||||
|
||||
if !service.TryStartSybSync() {
|
||||
t.Fatal("准备同步中页面状态失败")
|
||||
}
|
||||
runningRequest := httptest.NewRequest(http.MethodGet, "/syb", nil)
|
||||
addAuth(runningRequest)
|
||||
runningResponse := httptest.NewRecorder()
|
||||
router.ServeHTTP(runningResponse, runningRequest)
|
||||
service.FinishSybSync(service.SyncReport{})
|
||||
if runningResponse.Code != http.StatusOK ||
|
||||
!strings.Contains(runningResponse.Body.String(), "同步中…") ||
|
||||
!strings.Contains(runningResponse.Body.String(), `disabled aria-busy="true"`) ||
|
||||
!strings.Contains(runningResponse.Body.String(), "同步正在进行,请耐心等待") {
|
||||
t.Fatalf("同步运行时页面应禁用按钮并显示等待提示,响应:%s", runningResponse.Body.String())
|
||||
}
|
||||
|
||||
pdd, err := repository.EnsurePddProduct(
|
||||
db, "737116531267",
|
||||
"https://mobile.yangkeduo.com/goods.html?goods_id=737116531267")
|
||||
|
||||
Reference in New Issue
Block a user