提交 150e89b0 编写于 作者: 雨爱无痕

Add ui test

上级 0503e460
......@@ -48,5 +48,7 @@ logs/
test/demo/php/conf
test/demo/php/log
test/demo/php/product1
/test/ui/allure-results/
/test/cli/allure-results/
/test/allure-results/
/test/ui/log/
#/bin/bash
if [ ! -d "/data/" ];then
if [ ! -d "zentaoatf" ];then
git clone https://github.com/easysoft/zentaoatf.git
go env -w GOPROXY=https://goproxy.cn,direct
cd zentaoatf
git checkout ztf-42_zhaoke
go mod tidy || true
go run github.com/playwright-community/playwright-go/cmd/playwright install --with-deps
cd ui
npm install
cd ../
else
cd zentaoatf
git pull
go mod tidy || true
fi
cd test/cli
go run ./main.go -zentaoVersion 17.6.1
\ No newline at end of file
......@@ -29,9 +29,5 @@ func main() {
if err != nil {
fmt.Println("Build cli fail ", err)
}
// err = commonTestHelper.BuildServer()
// if err != nil {
// fmt.Println("Build server fail ")
// }
commonTestHelper.TestCli()
}
......@@ -19,11 +19,10 @@ func TestCli() (err error) {
cmdStr := fmt.Sprintf(`%sztf allure -allureReportDir ./test/cli/allure-results go test %stest/cli -v`, RootPath, RootPath)
var cmd *exec.Cmd
if runtime.GOOS == "windows" {
cmdStr = fmt.Sprintf(`%sztf.exe allure -allureReportDir .\test\cli\allure-results go test %stest\cli -v -run=CliVersion`, RootPath, RootPath)
fmt.Println(RootPath, cmdStr)
cmd = exec.Command("cmd", "/C", cmdStr)
cmdStr = fmt.Sprintf(`%sztf.exe allure -allureReportDir .\test\cli\allure-results go test %stest\cli -v`, RootPath, RootPath)
cmd = exec.Command("cmd", "/C", cmdStr, "-uuid", "cli_auto_test")
} else {
cmd = exec.Command("/bin/bash", "-c", cmdStr, "-uuid", "uuuuuuuuuuu")
cmd = exec.Command("/bin/bash", "-c", cmdStr, "-uuid", "cli_auto_test")
}
cmd.Dir = RootPath
fmt.Println(cmd.String())
......@@ -67,16 +66,14 @@ func TestCli() (err error) {
return
}
cmd.Process.Kill()
execHelper.KillProcessByUUID("uuuuuuuuuuu")
execHelper.KillProcessByUUID("cli_auto_test")
report, err := analysisHelper.ReadReportByPath(strings.Replace(reportDir, "result.txt", "result.json", 1))
if err != nil {
return
}
config := commDomain.WorkspaceConf{Url: "http://127.0.0.1:8081/", Password: "Test123456.", Username: "admin"}
fmt.Println(report, config)
err = zentaoHelper.CommitResult(report, 1, 0, config, nil)
fmt.Println(err)
return
}
......@@ -84,11 +81,10 @@ func TestUi() (err error) {
cmdStr := fmt.Sprintf(`%sztf allure -allureReportDir ./test/cli/allure-results go test %stest/ui -v`, RootPath, RootPath)
var cmd *exec.Cmd
if runtime.GOOS == "windows" {
cmdStr = fmt.Sprintf(`%sztf.exe allure -allureReportDir .\test\cli\allure-results go test %stest\ui -v -run=CliVersion`, RootPath, RootPath)
fmt.Println(RootPath, cmdStr)
cmdStr = fmt.Sprintf(`%sztf.exe allure -allureReportDir .\test\cli\allure-results go test %stest\ui -v`, RootPath, RootPath)
cmd = exec.Command("cmd", "/C", cmdStr)
} else {
cmd = exec.Command("/bin/bash", "-c", cmdStr, "-uuid", "uuuuuuuuuuu")
cmd = exec.Command("/bin/bash", "-c", cmdStr)
}
cmd.Dir = RootPath
fmt.Println(cmd.String())
......@@ -132,15 +128,13 @@ func TestUi() (err error) {
return
}
cmd.Process.Kill()
execHelper.KillProcessByUUID("uuuuuuuuuuu")
execHelper.KillProcessByUUID("ui_auto_test")
report, err := analysisHelper.ReadReportByPath(strings.Replace(reportDir, "result.txt", "result.json", 1))
if err != nil {
return
}
config := commDomain.WorkspaceConf{Url: "http://127.0.0.1:8081/", Password: "Test123456.", Username: "admin"}
fmt.Println(report, config)
err = zentaoHelper.CommitResult(report, 1, 0, config, nil)
fmt.Println(err)
return
}
......@@ -32,10 +32,22 @@ func BuildCli() (err error) {
func RunServer() (err error) {
ztfPath := GetZtfPath()
var cmd *exec.Cmd
cmd = exec.Command(ztfPath, "-P", "8085")
cmd = exec.Command(ztfPath, "-P", "8085", "-uuid=ui_auto_test")
cmd.Dir = RootPath
fmt.Println(cmd.String())
_, err = cmd.CombinedOutput()
err = cmd.Start()
if err != nil {
return
}
return
}
func RunUi() (err error) {
var cmd *exec.Cmd
cmd = exec.Command("npm", "run", "serve", "-uuid=ui_auto_test")
cmd.Dir = RootPath + FilePthSep + "ui"
fmt.Println(cmd.String())
err = cmd.Start()
if err != nil {
return
}
......
......@@ -33,5 +33,9 @@ func main() {
if err != nil {
fmt.Println("Build server fail ")
}
commonTestHelper.TestCli()
err = commonTestHelper.RunUi()
if err != nil {
fmt.Println("Build server fail ")
}
commonTestHelper.TestUi()
}
......@@ -28,7 +28,7 @@ func ScriptBug(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -100,7 +100,7 @@ func ScriptsBug(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
......@@ -32,7 +32,7 @@ func CreateInterpreter(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -120,7 +120,7 @@ func EditInterpreter(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -218,7 +218,7 @@ func DeleteInterpreter(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
......@@ -32,7 +32,7 @@ func SwitchLanguage(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
......@@ -30,7 +30,7 @@ func CollapseLog(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -124,7 +124,7 @@ func FullScreenLog(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
......@@ -30,7 +30,7 @@ func SwitchProduct(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
......@@ -31,7 +31,7 @@ func Detail(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -149,7 +149,7 @@ func SubmitResult(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -254,7 +254,7 @@ func SubmitBug(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -349,7 +349,7 @@ func SubmitBugTwoStep(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
......@@ -29,7 +29,7 @@ func RunFailStatistic(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -115,7 +115,7 @@ func RunSuccessStatistic(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -201,7 +201,7 @@ func RunBugStatistic(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
......@@ -32,7 +32,7 @@ func RunScript(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -144,7 +144,7 @@ func RunSelectedScripts(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -280,7 +280,7 @@ func RunOpenedAndLast(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -477,7 +477,7 @@ func RunAll(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -607,7 +607,7 @@ func RunReExecFailCase(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -730,7 +730,7 @@ func RunReExecAllCase(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -853,7 +853,7 @@ func RunWorkspace(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -965,7 +965,7 @@ func RunUnit(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
......@@ -30,7 +30,7 @@ func SaveScript(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -138,7 +138,7 @@ func ViewScript(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
......@@ -32,7 +32,7 @@ func CreateSite(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -153,7 +153,7 @@ func EditSite(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......@@ -286,7 +286,7 @@ func DeleteSite(t provider.T) {
t.Errorf("Create the new page fail: %v", err)
t.FailNow()
}
if _, err = page.Goto("http://127.0.0.1:8081/", playwright.PageGotoOptions{
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()
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册