2 <div class="wrapper wrapper-content animated fadeIn">
3 <div class="row" style="margin-bottom: 20px;">
5 <ol class="breadcrumb" style="padding-left: 20px; font-size: 17px;">
7 <router-link to="/" >root</router-link>
10 <router-link :to="{ path: '/testcase', query: { name: suitename }}" >{{this.$route.query.suiteName}}</router-link>
13 <router-link :to="{ path: '/content', query: { suiteName: suitename, caseName: casename } }"><b>{{this.$route.query.caseName}}</b></router-link>
18 <div id="page-content" class="row">
19 <div class="col-lg-12">
21 <div class="ibox-title">
22 <h5 style="font-size:26px;margin-top: -3px;">Test Case Content</h5>
23 <div v-show="contentLoading || contentSaving" class="sk-spinner sk-spinner-circle" style="float: left;margin-left: 10px;">
24 <div class="sk-circle1 sk-circle"></div>
25 <div class="sk-circle2 sk-circle"></div>
26 <div class="sk-circle3 sk-circle"></div>
27 <div class="sk-circle4 sk-circle"></div>
28 <div class="sk-circle5 sk-circle"></div>
29 <div class="sk-circle6 sk-circle"></div>
30 <div class="sk-circle7 sk-circle"></div>
31 <div class="sk-circle8 sk-circle"></div>
32 <div class="sk-circle9 sk-circle"></div>
33 <div class="sk-circle10 sk-circle"></div>
34 <div class="sk-circle11 sk-circle"></div>
35 <div class="sk-circle12 sk-circle"></div>
37 <div class="ibox-tools">
38 <button class="btn btn-info btn-sm my-button-sm" type="button" v-on:click="runTestcase()">Run</button>
39 <button class="btn btn-success btn-sm my-button-sm" type="button" v-on:click="setEditable()">Edit</button>
40 <button v-show="isEditable" class="btn btn-warning btn-sm my-button-sm" v-on:click="saveTestcase()" type="button">Save</button>
41 <button v-show="isEditable" class="btn btn-danger btn-sm my-button-sm" v-on:click="cancelEdit()" type="button">Cancel</button>
42 <a class="collapse-link">
43 <i class="fa fa-chevron-up"></i>
45 <a class="fullscreen-link">
46 <i class="fa fa-expand"></i>
50 <div class="ibox-content" style="max-height: 600px; overflow-y: auto; padding: 0; border: 1px solid #e7e7e7;">
51 <div style='text-align:center;'>
52 <textarea v-show='!isEditable' v-model="content" id="tc_content" style="white-space:nowrap; overflow:scroll;max-width:2400px; width: 100%;height: 100%;min-height: 500px;font-size:16px;border:none; vertical-align: middle; padding: 30px 0 20px 40px;">
54 </div><editor v-show='isEditable' v-bind:saveSignal='saveSignal' v-bind = 'editorContent' v-on:saveResponse='processSaveResponse'></editor>
61 <div class="col-lg-12">
63 <div class="ibox-title">
64 <h5 style="font-size:26px;margin-top: -3px;">Workflow</h5>
65 <div class="ibox-tools">
66 <a class="collapse-link">
67 <i class="fa fa-chevron-up"></i>
69 <a class="fullscreen-link">
70 <i class="fa fa-expand"></i>
74 <div class="ibox-content" style="padding-top: 60px;">
75 <wfresult v-bind:workflowId="workflowId" v-bind:wfloading='wfloading' v-bind:wfJson='wfJson'></wfresult>
83 import editor from './editor/editor.vue'
84 import wfresult from './workflow_graph/wfresult.vue'
85 import showMessage from './message/showMessage.js'
87 name: 'testcase_content',
91 editorContent: {'stepList': [], 'mainOrdersList': [], 'subflowList': []},
94 contentLoading: false,
96 suitename:this.$route.query.suiteName,
97 casename:this.$route.query.caseName,
104 created: function() {
108 setEditable: function(){
109 this.isEditable = true;
110 this.bakContent = this.content;
112 cancelEdit: function(){
113 this.content = this.bakContent;
114 this.isEditable = false;
116 saveTestcase: function(){
118 this.saveSignal = true;
119 this.contentSaving = true;
121 runTestcase: function(){
123 var msgTitle = "RUN -- TESTCASE";
125 url: this.global.SERVER_ADDR + "execute/testcase",
128 "suiteName": this.$route.query.suiteName,
129 "caseName": this.$route.query.caseName
131 beforeSend: function(XHR) {
132 self.wfloading = true;
133 showMessage("info", msgTitle, "start to run <strong>" + self.$route.query.caseName + "</strong>");
135 success: function(data) {
136 if(data['code'] == 200) {
137 self.workflowId = data['result']['workflowId'];
138 showMessage(data['code'], msgTitle, "<strong>" + self.$route.query.caseName + "</strong> finished!");
140 url: self.global.SERVER_ADDR + "story-content",
143 "service": self.$route.query.suiteName,
144 "story": self.$route.query.caseName
146 success: function(data) {
147 if(data['code'] == 200) {
148 self.wfJson = data['result']['content'];
150 showMessage(data['code'], msgTitle, "workflow.json get failed!");
153 error: function(obj, status, msg) {
154 showMessage(status, msgTitle, msg);
158 self.wfloading = false;
159 showMessage(data['code'], msgTitle, "Failed to run <strong>" + self.$route.query.caseName + "</strong>", data['error']);
162 error: function(obj, status, msg) {
163 self.wfloading = false;
164 showMessage(status, msgTitle, "Failed to run <strong>" + self.$route.query.caseName + "</strong>", msg);
168 getTestcase: function(){
170 var msgTitle = "GET -- TESTCASE";
172 url: this.global.SERVER_ADDR + "testcase/content",
175 suiteName: this.$route.query.suiteName,
176 caseName: this.$route.query.caseName
178 beforeSend: function(XHR) {
179 self.contentLoading = true;
181 success:function (data) {
182 if(data['code'] == 200) {
183 self.content = data['result']['content'];
184 self.contentLoading = false;
185 self.editorContent = data['result']['editorContent'];
188 showMessage("error", msgTitle, "fail to load testcase content!", data['error']);
189 self.contentLoading = false;
192 error: function (obj, status, msg) {
193 showMessage(status, msgTitle, "fail to load testcase content!", msg);
194 self.contentLoading = false;
198 async processSaveResponse(result) {
200 this.saveSignal = false;
201 this.isEditable = false;
202 this.contentSaving = false;
205 this.saveSignal = false;
206 this.contentSaving = false;