提交 ba5bb658 编写于 作者: Z zhaoke

Fix issue

上级 bb6d73fb
......@@ -3,7 +3,6 @@ package plw
import (
"errors"
"fmt"
"regexp"
"time"
constTestHelper "github.com/easysoft/zentaoatf/test/helper/conf"
......@@ -207,8 +206,7 @@ func (p *Webpage) ScreenShot() {
p.Page.Screenshot(playwright.PageScreenshotOptions{Path: &screenshotPath})
}
func (p *Webpage) WaitForResponse(regx string) (resp playwright.Response) {
re := regexp.MustCompile(regx)
resp = p.Page.WaitForResponse(re)
func (p *Webpage) WaitForResponse(url string) (resp playwright.Response) {
resp = p.Page.WaitForResponse(url, playwright.PageWaitForResponseOptions{Timeout: playwright.Float(3000)})
return
}
......@@ -23,7 +23,7 @@ func ScriptBug(t provider.T) {
ztfTestHelper.RunScript(webpage, "1_string_match.php")
ztfTestHelper.SubmitResult(webpage)
webpage.Click(".tree-node-title:has-text('1_string_match.php')")
webpage.WaitForResponse(".*/bugs")
webpage.WaitForResponse("**/bugs")
webpage.WaitForSelectorTimeout(".statistic>>span>>nth=3", 3000)
webpage.Click(".statistic>>span>>nth=3")
webpage.WaitForSelectorTimeout("#bugsModal>>tr", 3000)
......
......@@ -30,7 +30,7 @@ func RunFailStatistic(t provider.T) {
failTimesInt, _ := strconv.Atoi(failTimes)
webpage.Click(".tabs-nav-toolbar>>[title=\"Run\"]")
webpage.WaitForSelector("#log-list>>.msg-span>>:has-text('执行1个用例,耗时')")
webpage.WaitForResponse(".*/statistic")
webpage.WaitForResponse("**/statistic")
webpage.WaitForTimeout(1000)
elements = webpage.QuerySelectorAll(".statistic>>span")
runTimes2 := elements.InnerText(0)
......@@ -66,7 +66,7 @@ func RunSuccessStatistic(t provider.T) {
succTimesInt, _ := strconv.Atoi(succTimes)
webpage.Click(".tabs-nav-toolbar>>[title=\"Run\"]")
webpage.WaitForSelector("#log-list>>.msg-span>>:has-text('执行1个用例,耗时')")
webpage.WaitForResponse(".*/statistic")
webpage.WaitForResponse("**/statistic")
webpage.WaitForTimeout(1000)
elements = webpage.QuerySelectorAll(".statistic>>span")
runTimes2 := elements.InnerText(0)
......@@ -96,7 +96,7 @@ func RunBugStatistic(t provider.T) {
ztfTestHelper.ExpandWorspace(webpage)
scriptLocator := webpage.Locator(".tree-node-title>>text=1_string_match.php")
scriptLocator.Click()
webpage.WaitForResponse(".*/statistic")
webpage.WaitForResponse("**/statistic")
webpage.WaitForTimeout(1000)
elements := webpage.QuerySelectorAll(".statistic>>span")
bugTimes := elements.InnerText(3)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册