提交 982763ec 编写于 作者: 雨爱无痕

Add case id

上级 9324c40e
......@@ -11,6 +11,8 @@ import (
var bugBrowser playwright.Browser
func ScriptBug(t provider.T) {
t.ID("5747")
t.AddParentSuite("查看bug列表")
pw, err := playwright.Run()
if err != nil {
t.Error(err)
......@@ -87,6 +89,8 @@ func ScriptBug(t provider.T) {
}
func ScriptsBug(t provider.T) {
t.ID("5748")
t.AddParentSuite("查看bug列表")
pw, err := playwright.Run()
if err != nil {
t.Error(err)
......
......@@ -11,8 +11,8 @@ import (
var interpreterBrowser playwright.Browser
func CreateInterpreter(t provider.T) {
t.ID("5465")
t.AddParentSuite("设置界面语言")
t.ID("5744")
t.AddParentSuite("管理解析器")
pw, err := playwright.Run()
if err != nil {
t.Error(err)
......@@ -105,8 +105,8 @@ func CreateInterpreter(t provider.T) {
}
}
func EditInterpreter(t provider.T) {
t.ID("5465")
t.AddParentSuite("设置界面语言")
t.ID("5745")
t.AddParentSuite("管理解析器")
pw, err := playwright.Run()
if err != nil {
t.Error(err)
......@@ -212,7 +212,7 @@ func EditInterpreter(t provider.T) {
}
func DeleteInterpreter(t provider.T) {
t.ID("5465")
t.AddParentSuite("设置界面语言")
t.AddParentSuite("管理解析器")
pw, err := playwright.Run()
if err != nil {
t.Error(err)
......@@ -291,7 +291,7 @@ func DeleteInterpreter(t provider.T) {
}
func TestUiInterpreter(t *testing.T) {
runner.Run(t, "客户端-创建解析器", CreateInterpreter)
runner.Run(t, "客户端-编辑解析器", EditInterpreter)
runner.Run(t, "客户端-删除解析器", DeleteInterpreter)
runner.Run(t, "客户端-创建语言解析器", CreateInterpreter)
runner.Run(t, "客户端-编辑语言解析器", EditInterpreter)
runner.Run(t, "客户端-删除语言解析器", DeleteInterpreter)
}
......@@ -109,7 +109,7 @@ func CollapseLog(t provider.T) {
}
func FullScreenLog(t provider.T) {
t.ID("5502")
t.ID("5749")
t.AddParentSuite("脚本执行日志")
pw, err := playwright.Run()
if err != nil {
......
......@@ -11,7 +11,7 @@ import (
var proxyBrowser playwright.Browser
func CreateProxy(t provider.T) {
t.ID("5465")
t.ID("5740")
t.AddParentSuite("设置界面语言")
pw, err := playwright.Run()
if err != nil {
......@@ -102,7 +102,7 @@ func CreateProxy(t provider.T) {
}
}
func EditProxy(t provider.T) {
t.ID("5465")
t.ID("5741")
t.AddParentSuite("设置界面语言")
pw, err := playwright.Run()
if err != nil {
......@@ -193,7 +193,7 @@ func EditProxy(t provider.T) {
}
}
func DeleteProxy(t provider.T) {
t.ID("5465")
t.ID("5742")
t.AddParentSuite("设置界面语言")
pw, err := playwright.Run()
if err != nil {
......@@ -268,7 +268,7 @@ func DeleteProxy(t provider.T) {
}
func TestUiProxy(t *testing.T) {
runner.Run(t, "客户端-创建解析器", CreateProxy)
runner.Run(t, "客户端-编辑解析器", EditProxy)
runner.Run(t, "客户端-删除解析器", DeleteProxy)
runner.Run(t, "客户端-创建执行节点", CreateProxy)
runner.Run(t, "客户端-编辑执行节点", EditProxy)
runner.Run(t, "客户端-删除执行节点", DeleteProxy)
}
......@@ -139,7 +139,7 @@ func RunReExecFailCase(t provider.T) {
}
func RunReExecAllCase(t provider.T) {
t.ID("5491")
t.ID("5750")
t.AddParentSuite("测试结果页面执行脚本")
pw, err := playwright.Run()
if err != nil {
......
......@@ -14,7 +14,7 @@ import (
)
func RunScript(t provider.T) {
t.ID("5479")
t.ID("5743")
t.AddParentSuite("执行脚本")
pw, err := playwright.Run()
if err != nil {
......@@ -1233,6 +1233,154 @@ func createWorkspace(t provider.T, workspacePath string, page playwright.Page) {
}
}
func RunUseProxy(t provider.T) {
t.ID("5746")
t.AddParentSuite("执行脚本")
pw, err := playwright.Run()
if err != nil {
t.Error(err)
t.FailNow()
}
headless := true
var slowMo float64 = 100
runBrowser, err := pw.Chromium.Launch(playwright.BrowserTypeLaunchOptions{Headless: &headless, SlowMo: &slowMo})
if err != nil {
t.Errorf("Fail to launch the web runBrowser: %v", err)
t.FailNow()
}
page, err := runBrowser.NewPage()
if err != nil {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
defer func() {
if err = runBrowser.Close(); err != nil {
t.Errorf("The workspaceBrowser cannot be closed: %v", err)
t.FailNow()
return
}
if err = pw.Stop(); err != nil {
t.Errorf("The playwright cannot be stopped: %v", err)
t.FailNow()
return
}
}()
if _, err = page.Goto("http://127.0.0.1:8000/", playwright.PageGotoOptions{
WaitUntil: playwright.WaitUntilStateDomcontentloaded}); err != nil {
t.Errorf("The specific URL is missing: %v", err)
t.FailNow()
}
CreateProxyAndInterpreter(page, t)
_, err = page.WaitForSelector(".tree-node")
if err != nil {
t.Errorf("Wait tree-node fail: %v", err)
t.FailNow()
}
locator, err := page.Locator(".tree-node", playwright.PageLocatorOptions{HasText: "单元测试工作目录"})
c, err := locator.Count()
if err != nil || c == 0 {
t.Errorf("Find workspace fail: %v", err)
t.FailNow()
}
err = locator.Click()
if err != nil {
t.Errorf("Click node fail: %v", err)
t.FailNow()
}
scriptLocator, err := locator.Locator("text=1_string_match.php")
if err != nil {
t.Errorf("Find 1_string_match.php fail: %v", err)
t.FailNow()
}
err = scriptLocator.Click()
if err != nil {
t.Errorf("Click script fail: %v", err)
t.FailNow()
}
err = page.Click("#proxyMenuToggle")
if err != nil {
t.Errorf("Click proxy nav fail: %v", err)
t.FailNow()
}
err = page.Click(".list-item-title:has-text('测试执行节点')")
if err != nil {
t.Errorf("Select proxy fail: %v", err)
t.FailNow()
}
err = page.Click(".tabs-nav-toolbar>>[title=\"Run\"]")
if err != nil {
t.Errorf("Click run fail: %v", err)
t.FailNow()
}
_, err = page.WaitForSelector("#log-list>>.msg-span>>:has-text('执行1个用例,耗时')")
if err != nil {
t.Errorf("Wait exec result fail: %v", err)
t.FailNow()
}
element, err := page.QuerySelector("#log-list>>.msg-span>>:has-text('执行1个用例,耗时')")
innerText, err := element.InnerText()
if err != nil {
t.Errorf("Find result fail: %v", err)
t.FailNow()
}
if !strings.Contains(innerText, "1(100.0%) 失败") {
t.Errorf("Exec 1_string_match.php fail: %v", err)
t.FailNow()
}
resultTitleElement, err := page.QuerySelector("#rightPane .result-list-item .list-item-title")
if err != nil {
t.Errorf("Find log title in logPane fail: %v", err)
t.FailNow()
}
resultTitle, err := resultTitleElement.InnerText()
if err != nil || resultTitle != "1_string_match.php" {
t.Errorf("Find result in rightPane fail: %v", err)
t.FailNow()
}
timeElement, err := page.QuerySelector("#log-list .item .time")
if err != nil {
t.Errorf("Find log time in logPane fail: %v", err)
t.FailNow()
}
logTime, err := timeElement.InnerText()
if err != nil {
t.Errorf("Find log time in logPane fail: %v", err)
t.FailNow()
}
resultTimeElement, err := page.QuerySelector("#rightPane .result-list-item .list-item-trailing-text")
if err != nil {
t.Errorf("Find log time in logPane fail: %v", err)
t.FailNow()
}
resultTime, err := resultTimeElement.InnerText()
if err != nil || logTime[:5] != resultTime {
t.Errorf("Find result in rightPane fail: %v", err)
t.FailNow()
}
}
func CreateProxyAndInterpreter(page playwright.Page, t provider.T) {
page.Click("#navbar>>[title=\"设置\"]")
page.WaitForSelector("#proxyTable", playwright.PageWaitForSelectorOptions{State: playwright.WaitForSelectorStateAttached})
locator, _ := page.Locator("#proxyTable>>.z-tbody-td>>:scope:has-text('测试执行节点')")
c, _ := locator.Count()
if c > 0 {
page.Click("#settingModal>>.modal-close")
return
}
page.Click("#serverTable>>button:has-text('新建执行节点')")
locator, _ = page.Locator("#proxyFormModal input")
nameInput, _ := locator.Nth(0)
nameInput.Fill("测试执行节点")
page.WaitForTimeout(200)
pathSelect, _ := locator.Nth(1)
pathSelect.Fill("http://127.0.0.1:8085")
page.Click("#proxyFormModal>>text=确定")
page.WaitForSelector("#proxyFormModal", playwright.PageWaitForSelectorOptions{State: playwright.WaitForSelectorStateDetached})
page.WaitForTimeout(1000)
page.Click("#settingModal>>.modal-close")
}
func TestUiRun(t *testing.T) {
runner.Run(t, "客户端-执行单个脚本", RunScript)
runner.Run(t, "客户端-右键执行单个脚本", RunScriptByRightClick)
......@@ -1243,4 +1391,5 @@ func TestUiRun(t *testing.T) {
runner.Run(t, "客户端-右键执行工作目录", RunWorkspace)
runner.Run(t, "客户端-右键执行文件夹", RunDir)
runner.Run(t, "客户端-执行TestNG单元测试", RunUnit)
runner.Run(t, "客户端-使用代理执行单个脚本", RunUseProxy)
}
......@@ -11,8 +11,8 @@ import (
var serverBrowser playwright.Browser
func CreateServer(t provider.T) {
t.ID("5465")
t.AddParentSuite("设置界面语言")
t.ID("5737")
t.AddParentSuite("管理服务器")
pw, err := playwright.Run()
if err != nil {
t.Error(err)
......@@ -100,8 +100,8 @@ func CreateServer(t provider.T) {
}
}
func EditServer(t provider.T) {
t.ID("5465")
t.AddParentSuite("设置界面语言")
t.ID("5738")
t.AddParentSuite("管理服务器")
pw, err := playwright.Run()
if err != nil {
t.Error(err)
......@@ -190,8 +190,8 @@ func EditServer(t provider.T) {
}
}
func DeleteServer(t provider.T) {
t.ID("5465")
t.AddParentSuite("设置界面语言")
t.ID("5739")
t.AddParentSuite("管理服务器")
pw, err := playwright.Run()
if err != nil {
t.Error(err)
......@@ -265,7 +265,7 @@ func DeleteServer(t provider.T) {
}
func TestUiServer(t *testing.T) {
runner.Run(t, "客户端-创建解析器", CreateServer)
runner.Run(t, "客户端-编辑解析器", EditServer)
runner.Run(t, "客户端-删除解析器", DeleteServer)
runner.Run(t, "客户端-创建服务器", CreateServer)
runner.Run(t, "客户端-编辑服务器", EditServer)
runner.Run(t, "客户端-删除服务器", DeleteServer)
}
......@@ -173,7 +173,7 @@ func CreateWorkspace(t provider.T) {
}
func SyncFromZentao(t provider.T) {
t.ID("5468")
t.ID("5751")
t.AddParentSuite("管理禅道站点下工作目录")
pw, err := playwright.Run()
if err != nil {
......@@ -267,7 +267,7 @@ func SyncFromZentao(t provider.T) {
}
func SyncTwoCaseFromZentao(t provider.T) {
t.ID("5468")
t.ID("5752")
t.AddParentSuite("管理禅道站点下工作目录")
pw, err := playwright.Run()
if err != nil {
......@@ -365,7 +365,7 @@ func SyncTwoCaseFromZentao(t provider.T) {
}
func SyncToZentao(t provider.T) {
t.ID("5468")
t.ID("5431")
t.AddParentSuite("管理禅道站点下工作目录")
pw, err := playwright.Run()
if err != nil {
......@@ -1425,7 +1425,7 @@ func Collapse(t provider.T) {
}
func TestUiWorkspace(t *testing.T) {
runner.Run(t, "客户端-同步到禅道", SyncToZentao)
runner.Run(t, "客户端-从禅道同步部分用例", SyncTwoCaseFromZentao)
runner.Run(t, "客户端-从禅道同步选中用例", SyncTwoCaseFromZentao)
runner.Run(t, "客户端-从禅道同步", SyncFromZentao)
runner.Run(t, "客户端-复制粘贴树状脚本文件", Copy)
runner.Run(t, "客户端-剪切粘贴树状脚本文件", Clip)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册