From d32b1549cbd2807d1fb5f562b61629f269b489ef Mon Sep 17 00:00:00 2001 From: Juan Cisneros Date: Tue, 3 Sep 2024 14:37:47 -0500 Subject: [PATCH] New Features: 1. AI for creating system tests finished New Pages: Bugs Corrected: To Be Corrected: 0. On product delete, delete trace results 1. On product delete, delete flamegraph result --- .../create-system-test.page.html | 16 ++++- .../create-system-test.page.ts | 58 ++++++++++++++++--- www/1143.0dd15591a6841da8.js | 1 + www/1143.a56774e704008734.js | 1 - www/index.html | 2 +- ...db7786a.js => runtime.f0ac8d9119275de0.js} | 2 +- 6 files changed, 67 insertions(+), 13 deletions(-) create mode 100644 www/1143.0dd15591a6841da8.js delete mode 100644 www/1143.a56774e704008734.js rename www/{runtime.a60f26492db7786a.js => runtime.f0ac8d9119275de0.js} (97%) diff --git a/src/app/pages/software_testing/system_tests/create-system-test/create-system-test.page.html b/src/app/pages/software_testing/system_tests/create-system-test/create-system-test.page.html index be15301..920e273 100644 --- a/src/app/pages/software_testing/system_tests/create-system-test/create-system-test.page.html +++ b/src/app/pages/software_testing/system_tests/create-system-test/create-system-test.page.html @@ -89,21 +89,24 @@

{{step.stepTitle}}

- + @if (disableAI){ -
+ } @if (!disableAI){ +
+
} - DevProbe AI Answer @@ -118,4 +121,11 @@

{{step.stepTitle}}

+ + + + + + + diff --git a/src/app/pages/software_testing/system_tests/create-system-test/create-system-test.page.ts b/src/app/pages/software_testing/system_tests/create-system-test/create-system-test.page.ts index a9aa681..16c0401 100644 --- a/src/app/pages/software_testing/system_tests/create-system-test/create-system-test.page.ts +++ b/src/app/pages/software_testing/system_tests/create-system-test/create-system-test.page.ts @@ -36,6 +36,7 @@ export class CreateSystemTestPage implements OnInit { aiSteps:AiMessage[] = []; extraData: string = ''; disableAI: boolean = false; + showContext: boolean = false; @@ -211,14 +212,14 @@ export class CreateSystemTestPage implements OnInit { if (!this.systemTest.title || this.systemTest.title === '') { await this.hideLoading(); - this.showAlert('Please fill out the title of the test before asking for help with the description.', 'Error').then(r => + await this.showAlert('Please fill out the title of the test before asking for help with the description.', 'Error').then(r => console.log('Alert shown')); return; } let chat = this.model.startChat(forDescription as any); - let msg = "Given this test title:" + this.systemTest.title + "I need help to create the description of the test, just give me the test main objective"; + let msg = "Given this test title:" + this.systemTest.title + ". Here is more information about the test: " + this.extraData + "I need help to create the description of the test, just give me the test main objective"; console.log(msg); await chat.sendMessage(msg).then(response => { this.systemTest.description = response.response.text(); @@ -231,7 +232,7 @@ export class CreateSystemTestPage implements OnInit { if (!this.systemTest.title || this.systemTest.title === '' || !this.systemTest.description || this.systemTest.description === '') { await this.hideLoading(); - this.showAlert('Please fill out the title and description of the test before asking for help with the steps.', 'Error').then(r => + await this.showAlert('Please fill out the title and description of the test before asking for help with the steps.', 'Error').then(r => console.log('Alert shown')); return; } @@ -299,11 +300,54 @@ export class CreateSystemTestPage implements OnInit { } for (var i = 0; i < ul.length; i++) { - ul[i].style.fontSize = "1em"; - // add a - before the text - ul[i].innerHTML = " - " + ul[i].innerHTML; - console.log(ul[i].innerHTML); + //get the ul li elements + let ulLi = ul[i].getElementsByTagName("li"); + for (var j = 0; j < ulLi.length; j++) { + ulLi[j].style.fontSize = "0.5em"; + // add a - before the text + ulLi[j].innerHTML = "- " + ulLi[j].innerHTML; + console.log(ulLi[j].innerHTML); + } } } + + + + + giveContext() { + let alertButtons = ['Give Context', 'Cancel']; + let alertInputs = [ + { + name: 'context', + type: 'text', + placeholder: 'Give AI Context' + } + ]; + + this.showAlertWithInputs('Give Global Test Context', 'Please provide the AI with some context, provide code, HTML, or instructions.' , alertButtons, alertInputs).then(r => + console.log('Alert shown') + ); + } + + async showAlertWithInputs(header:string, message:string, buttons:string[], inputs:any[]) { + const alert = await this.alertCtrl.create({ + header: header, + message: message, + buttons: buttons, + inputs: inputs + }); + await alert.present(); + + // Get the alert inputs + const { data } = await alert.onDidDismiss(); + console.log(data); + if (data.values) { + this.extraData = data.values.context; + this.showContext = true; + } + console.log(this.extraData); + } + + } diff --git a/www/1143.0dd15591a6841da8.js b/www/1143.0dd15591a6841da8.js new file mode 100644 index 0000000..3519fb8 --- /dev/null +++ b/www/1143.0dd15591a6841da8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[1143],{5553:(x,T,a)=>{a.d(T,{h:()=>_});var d=a(177),y=a(7863),n=a(4438);let _=(()=>{var m;class e{}return(m=e).\u0275fac=function(g){return new(g||m)},m.\u0275mod=n.$C({type:m}),m.\u0275inj=n.G2t({imports:[d.MD,y.bv]}),e})()},3241:(x,T,a)=>{a.d(T,{p:()=>_});var d=a(4438),y=a(177),n=a(7863);let _=(()=>{var m;class e{constructor(g){this.location=g,this.title="Header Title"}ngOnInit(){}goBack(){this.location.back()}}return(m=e).\u0275fac=function(g){return new(g||m)(d.rXU(y.aZ))},m.\u0275cmp=d.VBU({type:m,selectors:[["app-header-return"]],inputs:{title:"title"},decls:6,vars:2,consts:[[3,"translucent"],["slot","start","menu","menu-id"],["name","arrow-back","slot","start",1,"p-4","bigger-icon",3,"click"]],template:function(g,S){1&g&&(d.j41(0,"ion-header",0)(1,"ion-toolbar"),d.nrm(2,"ion-menu-button",1),d.j41(3,"ion-icon",2),d.bIt("click",function(){return S.goBack()}),d.k0s(),d.j41(4,"ion-title"),d.EFF(5),d.k0s()()()),2&g&&(d.Y8G("translucent",!0),d.R7$(5),d.JRh(S.title))},dependencies:[n.eU,n.iq,n.MC,n.BC,n.ai],styles:[".bigger-icon[_ngcontent-%COMP%]{font-size:1.5em}"]}),e})()},1143:(x,T,a)=>{a.r(T),a.d(T,{CreateSystemTestPageModule:()=>B});var d=a(177),y=a(4341),n=a(7863),_=a(7650),m=a(467),e=a(4438),f=a(9032),g=a(9274),S=a(8453),P=a(3241),b=a(9549);function k(o,u){return this.testStepTitle}function M(o,u){return this.aiSteps}function E(o,u){if(1&o){const r=e.RV6();e.j41(0,"ion-item")(1,"ion-label")(2,"h1"),e.EFF(3),e.k0s(),e.j41(4,"p"),e.EFF(5),e.k0s()(),e.j41(6,"ion-icon",24),e.bIt("click",function(){const s=e.eBV(r).$implicit,l=e.XpG();return e.Njj(l.delete(s.stepTitle))}),e.k0s()()}if(2&o){const r=u.$implicit;e.R7$(3),e.JRh(r.stepTitle),e.R7$(2),e.JRh(r.expectedResults)}}function R(o,u){1&o&&(e.j41(0,"ion-card-content",32)(1,"div",34),e.nrm(2,"ion-icon",35),e.k0s()())}function j(o,u){if(1&o){const r=e.RV6();e.j41(0,"ion-card-content",13)(1,"div",36)(2,"ion-icon",12),e.bIt("click",function(){e.eBV(r);const s=e.XpG(2);return e.Njj(s.askAIForHelp("step"))}),e.k0s()()()}}function I(o,u){if(1&o&&(e.j41(0,"markdown",33),e.EFF(1),e.k0s()),2&o){const r=u.$implicit;e.R7$(),e.JRh(r.message)}}function w(o,u){if(1&o){const r=e.RV6();e.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons",25)(3,"ion-button",26),e.bIt("click",function(){e.eBV(r);const s=e.XpG();return e.Njj(s.cancel())}),e.EFF(4,"Cancel"),e.k0s()(),e.j41(5,"ion-title"),e.EFF(6,"Add Test Step"),e.k0s(),e.j41(7,"ion-buttons",27)(8,"ion-button",26),e.bIt("click",function(){e.eBV(r);const s=e.XpG();return e.Njj(s.save())}),e.EFF(9,"Save"),e.k0s()()()(),e.j41(10,"ion-content",28)(11,"ion-card",29)(12,"ion-label"),e.EFF(13,"Step"),e.k0s(),e.j41(14,"div",30)(15,"div",8)(16,"ion-input",31),e.mxI("ngModelChange",function(s){e.eBV(r);const l=e.XpG();return e.DH7(l.testStepTitle,s)||(l.testStepTitle=s),e.Njj(s)}),e.k0s()()(),e.nrm(17,"br"),e.j41(18,"ion-label"),e.EFF(19,"Expected"),e.k0s(),e.j41(20,"div",30)(21,"div",8)(22,"ion-input",31),e.mxI("ngModelChange",function(s){e.eBV(r);const l=e.XpG();return e.DH7(l.testExpectedResults,s)||(l.testExpectedResults=s),e.Njj(s)}),e.k0s()()()(),e.j41(23,"ion-card"),e.DNE(24,R,3,0,"ion-card-content",32)(25,j,3,0,"ion-card-content",13),e.j41(26,"ion-card-content")(27,"ion-label"),e.EFF(28,"DevProbe AI Answer"),e.k0s()(),e.j41(29,"ion-card-content"),e.Z7z(30,I,2,1,"markdown",33,M,!0),e.k0s()()()}if(2&o){const r=e.XpG();e.R7$(16),e.R50("ngModel",r.testStepTitle),e.R7$(6),e.R50("ngModel",r.testExpectedResults),e.R7$(2),e.vxM(24,r.disableAI?24:-1),e.R7$(),e.vxM(25,r.disableAI?-1:25),e.R7$(5),e.Dyx(r.aiSteps)}}const A=[{path:"",component:(()=>{var o;class u{constructor(t,s,l,c){this.activatedRoute=t,this.alertCtrl=s,this.systemTestService=l,this.loadingCtrl=c,this.productObjective="",this.productStep="",this.systemTest={title:"",description:"",steps:[],type:"system-test",state:!1},this.testStepTitle="",this.testExpectedResults="",this.user={},this.orgName="",this.vertexAI=(0,e.WQX)(f.L9),this.model=(0,f.oc)(this.vertexAI,{model:"gemini-1.5-flash"}),this.aiSteps=[],this.extraData="",this.disableAI=!1,this.showContext=!1}ngOnInit(){this.getProductFromParams()}getProductFromParams(){this.activatedRoute.params.subscribe(t=>{this.productObjective=t.productObjective,this.productStep=t.step}),console.log(this.productObjective),console.log(this.productStep)}onWillDismiss(t){}cancel(){var t;null===(t=this.modal)||void 0===t||t.dismiss()}save(){var t;this.testStepTitle&&this.testExpectedResults?(this.systemTest.steps.push({stepTitle:this.testStepTitle,expectedResults:this.testExpectedResults,isComplete:!1}),this.testStepTitle="",this.testExpectedResults="",null===(t=this.modal)||void 0===t||t.dismiss()):this.showAlert("Please fill out the Step Title and the Expected Result fields.","Error").then(s=>console.log("Alert shown"))}delete(t){this.systemTest.steps=this.systemTest.steps.filter(s=>s.stepTitle!==t)}showAlert(t,s){var l=this;return(0,m.A)(function*(){yield(yield l.alertCtrl.create({header:s,message:t,buttons:["OK"]})).present()})()}createSystemTest(){var t=this;return(0,m.A)(function*(){if(yield t.showLoading(),console.log(t.systemTest),!t.systemTest.title||!t.systemTest.description||0===t.systemTest.steps.length)return yield t.hideLoading(),void t.showAlert("Please fill out the title, description, and at least one step.","Error").then(l=>console.log("Alert shown"));const s=localStorage.getItem("user");s&&(t.user=JSON.parse(s),t.orgName=t.user.orgName,console.log(t.orgName),t.systemTestService.addSystemTest(t.orgName,t.productObjective,t.productStep,t.systemTest),t.systemTest={title:"",description:"",steps:[],type:"system-test",state:!1},yield t.hideLoading(),window.history.back())})()}showLoading(){var t=this;return(0,m.A)(function*(){yield(yield t.loadingCtrl.create({})).present()})()}hideLoading(){var t=this;return(0,m.A)(function*(){yield t.loadingCtrl.dismiss()})()}doRefresh(t){}aiGenerate(t){var s=this;return(0,m.A)(function*(){yield s.showLoading();const l={history:[{role:"user",parts:[{text:"Hey, I need help to create a system test case description"}]},{role:"model",parts:[{text:"Sure, I can help you with that. What do you need help with?"}]}],generationConfig:{maxOutputTokens:100}},c={history:[{role:"user",parts:[{text:"Hey, I need help to create a system test case steps, dont give me more information about the test, JUST LIST THE STEPS"}]},{role:"model",parts:[{text:"Sure, I can help you with that."}]}],generationConfig:{maxOutputTokens:250}};if("description"===t){if(!s.systemTest.title||""===s.systemTest.title)return yield s.hideLoading(),void(yield s.showAlert("Please fill out the title of the test before asking for help with the description.","Error").then(i=>console.log("Alert shown")));let p=s.model.startChat(l),h="Given this test title:"+s.systemTest.title+". Here is more information about the test: "+s.extraData+"I need help to create the description of the test, just give me the test main objective";console.log(h),yield p.sendMessage(h).then(i=>{s.systemTest.description=i.response.text()})}if("step"===t){if(!s.systemTest.title||""===s.systemTest.title||!s.systemTest.description||""===s.systemTest.description)return yield s.hideLoading(),void(yield s.showAlert("Please fill out the title and description of the test before asking for help with the steps.","Error").then(i=>console.log("Alert shown")));let p=s.model.startChat(c),h="Given this test title:"+s.systemTest.title+"and this test description:"+s.systemTest.description+". Here is more information about the test: "+s.extraData+"I need help to create the steps of the test, just list the steps";console.log(h),yield p.sendMessage(h).then(i=>{s.aiSteps.push({message:i.response.text(),from:"AI",id:"1"}),console.log(i.response.text())}),s.disableAI=!0}yield s.hideLoading()})()}askAIForHelp(t){var s=this;return(0,m.A)(function*(){yield s.aiGenerate(t).then(c=>console.log("AI generated"));const l=document.getElementById("mk-1");console.log(l),s.chatStyle()})()}chatStyle(){const t=document.getElementById("mk-1");if(console.log(t),!t)return;let s=t.getElementsByTagName("h1"),l=t.getElementsByTagName("h2"),c=t.getElementsByTagName("li"),p=t.getElementsByTagName("strong"),h=t.getElementsByTagName("ul");for(var i=0;iconsole.log("Alert shown"))}showAlertWithInputs(t,s,l,c){var p=this;return(0,m.A)(function*(){const h=yield p.alertCtrl.create({header:t,message:s,buttons:l,inputs:c});yield h.present();const{data:i}=yield h.onDidDismiss();console.log(i),i.values&&(p.extraData=i.values.context,p.showContext=!0),console.log(p.extraData)})()}}return(o=u).\u0275fac=function(t){return new(t||o)(e.rXU(_.nX),e.rXU(n.hG),e.rXU(g.h),e.rXU(n.Xi))},o.\u0275cmp=e.VBU({type:o,selectors:[["app-create-system-test"]],viewQuery:function(t,s){if(1&t&&e.GBs(n.Sb,5),2&t){let l;e.mGM(l=e.lsd())&&(s.modal=l.first)}},decls:42,vars:5,consts:[[3,"title"],[3,"fullscreen"],[1,"lg:m-10","md:m-10"],["size","12","size-md","4","size-lg","4",1,""],["size","12","size-md","12","size-lg","12",1,""],[1,"min-h-full","flex","flex-col","p-8"],[1,"bg-gray-600","p-2"],[1,"flex","flex-row","items-center","w-full"],[1,"w-full","m-2"],["placeholder","Test Title","type","text",1,"text-3xl",3,"ngModelChange","ngModel"],["placeholder","Test Description","type","text",1,"text-sm",3,"ngModelChange","ngModel"],[1,"rounded-full","p-3","bg-purple-800"],["name","color-wand-outline",3,"click"],[1,""],[1,"flex","flex-row","items-center"],[1,"text-4xl"],["id","open-modal",1,"flex","flex-row","items-center","bg-cyan-800","m-4","p-1",3,"click"],["name","add"],[1,"bg-gray-600"],["color","primary","expand","block","fill","outline",3,"click"],["trigger","open-modal",3,"willPresent","willDismiss"],["vertical","bottom","horizontal","end","slot","fixed",1,"m-2","z-10",3,"click"],[1,"bg-purple-300","p-4"],["name","chatbubble-outline",1,"w-full","h-full"],["aria-hidden","true","name","trash","slot","end",3,"click"],["slot","start"],[3,"click"],["slot","end"],[1,"flex","flex-col","justify-center","items-center"],[1,"m-2","p-2"],[1,"flex-row","flex","justify-center","items-center","w-full"],["type","text",3,"ngModelChange","ngModel"],[1,"hidden"],["id","mk-1",1,"text-white"],[1,"rounded-full","p-3","bg-gray-400","flex","flex-row","justify-center","items-center","hidden"],["name","color-wand-outline",1,"hidden"],[1,"rounded-full","p-3","bg-purple-800","flex","flex-row","justify-center","items-center"]],template:function(t,s){1&t&&(e.nrm(0,"app-header-return",0),e.j41(1,"ion-content",1)(2,"ion-grid"),e.nrm(3,"app-title",0),e.j41(4,"ion-row",2)(5,"ion-col",3)(6,"p"),e.EFF(7,"Fill the test from to create a system test."),e.k0s(),e.nrm(8,"p"),e.k0s()(),e.j41(9,"ion-row",2)(10,"ion-col",4)(11,"ion-card",5)(12,"ion-card-title",6)(13,"div",7)(14,"div",8)(15,"ion-input",9),e.mxI("ngModelChange",function(c){return e.DH7(s.systemTest.title,c)||(s.systemTest.title=c),c}),e.k0s()()()(),e.nrm(16,"br"),e.j41(17,"ion-card-title",6)(18,"div",7)(19,"div",8)(20,"ion-textarea",10),e.mxI("ngModelChange",function(c){return e.DH7(s.systemTest.description,c)||(s.systemTest.description=c),c}),e.k0s()(),e.j41(21,"div",11)(22,"ion-icon",12),e.bIt("click",function(){return s.askAIForHelp("description")}),e.k0s()()()(),e.nrm(23,"br"),e.j41(24,"ion-card-title",13)(25,"div",14)(26,"h1",15),e.EFF(27,"Test Steps..."),e.k0s(),e.j41(28,"div",16),e.bIt("click",function(){return s.chatStyle()}),e.nrm(29,"ion-icon",17),e.k0s()()(),e.j41(30,"ion-card-content",18)(31,"ion-list"),e.Z7z(32,E,7,2,"ion-item",null,k,!0),e.k0s()(),e.nrm(34,"br"),e.j41(35,"ion-button",19),e.bIt("click",function(){return s.createSystemTest()}),e.EFF(36,"Create System Test"),e.k0s()()()()(),e.j41(37,"ion-modal",20),e.bIt("willPresent",function(){return s.chatStyle()})("willDismiss",function(c){return s.onWillDismiss(c)}),e.DNE(38,w,32,4,"ng-template"),e.k0s(),e.j41(39,"ion-fab",21),e.bIt("click",function(){return s.giveContext()}),e.j41(40,"ion-avatar",22),e.nrm(41,"ion-icon",23),e.k0s()()()),2&t&&(e.Y8G("title","Create System Test"),e.R7$(),e.Y8G("fullscreen",!0),e.R7$(2),e.Y8G("title","Create System Test"),e.R7$(12),e.R50("ngModel",s.systemTest.title),e.R7$(5),e.R50("ngModel",s.systemTest.description),e.R7$(12),e.Dyx(s.systemTest.steps))},dependencies:[y.BC,y.vS,n.mC,n.Jm,n.QW,n.b_,n.I9,n.tN,n.hU,n.W9,n.Q8,n.lO,n.eU,n.iq,n.$w,n.uz,n.he,n.nf,n.ln,n.nc,n.BC,n.ai,n.Sb,n.Gw,S.W,P.p,b.NN]}),u})()}];let F=(()=>{var o;class u{}return(o=u).\u0275fac=function(t){return new(t||o)},o.\u0275mod=e.$C({type:o}),o.\u0275inj=e.G2t({imports:[_.iI.forChild(A),_.iI]}),u})();var D=a(5553);let B=(()=>{var o;class u{}return(o=u).\u0275fac=function(t){return new(t||o)},o.\u0275mod=e.$C({type:o}),o.\u0275inj=e.G2t({imports:[d.MD,y.YN,n.bv,F,D.h,b.NN]}),u})()}}]); \ No newline at end of file diff --git a/www/1143.a56774e704008734.js b/www/1143.a56774e704008734.js deleted file mode 100644 index b406374..0000000 --- a/www/1143.a56774e704008734.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[1143],{5553:(S,f,a)=>{a.d(f,{h:()=>y});var d=a(177),h=a(7863),o=a(4438);let y=(()=>{var m;class e{}return(m=e).\u0275fac=function(g){return new(g||m)},m.\u0275mod=o.$C({type:m}),m.\u0275inj=o.G2t({imports:[d.MD,h.bv]}),e})()},3241:(S,f,a)=>{a.d(f,{p:()=>y});var d=a(4438),h=a(177),o=a(7863);let y=(()=>{var m;class e{constructor(g){this.location=g,this.title="Header Title"}ngOnInit(){}goBack(){this.location.back()}}return(m=e).\u0275fac=function(g){return new(g||m)(d.rXU(h.aZ))},m.\u0275cmp=d.VBU({type:m,selectors:[["app-header-return"]],inputs:{title:"title"},decls:6,vars:2,consts:[[3,"translucent"],["slot","start","menu","menu-id"],["name","arrow-back","slot","start",1,"p-4","bigger-icon",3,"click"]],template:function(g,C){1&g&&(d.j41(0,"ion-header",0)(1,"ion-toolbar"),d.nrm(2,"ion-menu-button",1),d.j41(3,"ion-icon",2),d.bIt("click",function(){return C.goBack()}),d.k0s(),d.j41(4,"ion-title"),d.EFF(5),d.k0s()()()),2&g&&(d.Y8G("translucent",!0),d.R7$(5),d.JRh(C.title))},dependencies:[o.eU,o.iq,o.MC,o.BC,o.ai],styles:[".bigger-icon[_ngcontent-%COMP%]{font-size:1.5em}"]}),e})()},1143:(S,f,a)=>{a.r(f),a.d(f,{CreateSystemTestPageModule:()=>A});var d=a(177),h=a(4341),o=a(7863),y=a(7650),m=a(467),e=a(4438),_=a(9032),g=a(9274),C=a(8453),v=a(3241),x=a(9549);function P(n,u){return this.testStepTitle}function M(n,u){return this.aiSteps}function k(n,u){if(1&n){const r=e.RV6();e.j41(0,"ion-item")(1,"ion-label")(2,"h1"),e.EFF(3),e.k0s(),e.j41(4,"p"),e.EFF(5),e.k0s()(),e.j41(6,"ion-icon",21),e.bIt("click",function(){const s=e.eBV(r).$implicit,l=e.XpG();return e.Njj(l.delete(s.stepTitle))}),e.k0s()()}if(2&n){const r=u.$implicit;e.R7$(3),e.JRh(r.stepTitle),e.R7$(2),e.JRh(r.expectedResults)}}function j(n,u){1&n&&(e.j41(0,"div",29),e.nrm(1,"ion-icon",32),e.k0s())}function E(n,u){if(1&n){const r=e.RV6();e.j41(0,"div",30)(1,"ion-icon",12),e.bIt("click",function(){e.eBV(r);const s=e.XpG(2);return e.Njj(s.askAIForHelp("step"))}),e.k0s()()}}function R(n,u){if(1&n&&(e.j41(0,"markdown",31),e.EFF(1),e.k0s()),2&n){const r=u.$implicit;e.R7$(),e.JRh(r.message)}}function b(n,u){if(1&n){const r=e.RV6();e.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons",22)(3,"ion-button",23),e.bIt("click",function(){e.eBV(r);const s=e.XpG();return e.Njj(s.cancel())}),e.EFF(4,"Cancel"),e.k0s()(),e.j41(5,"ion-title"),e.EFF(6,"Add Test Step"),e.k0s(),e.j41(7,"ion-buttons",24)(8,"ion-button",23),e.bIt("click",function(){e.eBV(r);const s=e.XpG();return e.Njj(s.save())}),e.EFF(9,"Save"),e.k0s()()()(),e.j41(10,"ion-content",25)(11,"ion-card",26)(12,"ion-label"),e.EFF(13,"Step"),e.k0s(),e.j41(14,"div",27)(15,"div",8)(16,"ion-input",28),e.mxI("ngModelChange",function(s){e.eBV(r);const l=e.XpG();return e.DH7(l.testStepTitle,s)||(l.testStepTitle=s),e.Njj(s)}),e.k0s()()(),e.nrm(17,"br"),e.j41(18,"ion-label"),e.EFF(19,"Expected"),e.k0s(),e.j41(20,"div",27)(21,"div",8)(22,"ion-input",28),e.mxI("ngModelChange",function(s){e.eBV(r);const l=e.XpG();return e.DH7(l.testExpectedResults,s)||(l.testExpectedResults=s),e.Njj(s)}),e.k0s()()()(),e.j41(23,"ion-card")(24,"ion-card-content"),e.DNE(25,j,2,0,"div",29)(26,E,2,0,"div",30),e.k0s(),e.j41(27,"ion-card-content")(28,"ion-label"),e.EFF(29,"DevProbe AI Answer"),e.k0s()(),e.j41(30,"ion-card-content"),e.Z7z(31,R,2,1,"markdown",31,M,!0),e.k0s()()()}if(2&n){const r=e.XpG();e.R7$(16),e.R50("ngModel",r.testStepTitle),e.R7$(6),e.R50("ngModel",r.testExpectedResults),e.R7$(3),e.vxM(25,r.disableAI?25:-1),e.R7$(),e.vxM(26,r.disableAI?-1:26),e.R7$(5),e.Dyx(r.aiSteps)}}const I=[{path:"",component:(()=>{var n;class u{constructor(t,s,l,c){this.activatedRoute=t,this.alertCtrl=s,this.systemTestService=l,this.loadingCtrl=c,this.productObjective="",this.productStep="",this.systemTest={title:"",description:"",steps:[],type:"system-test",state:!1},this.testStepTitle="",this.testExpectedResults="",this.user={},this.orgName="",this.vertexAI=(0,e.WQX)(_.L9),this.model=(0,_.oc)(this.vertexAI,{model:"gemini-1.5-flash"}),this.aiSteps=[],this.extraData="",this.disableAI=!1}ngOnInit(){this.getProductFromParams()}getProductFromParams(){this.activatedRoute.params.subscribe(t=>{this.productObjective=t.productObjective,this.productStep=t.step}),console.log(this.productObjective),console.log(this.productStep)}onWillDismiss(t){}cancel(){var t;null===(t=this.modal)||void 0===t||t.dismiss()}save(){var t;this.testStepTitle&&this.testExpectedResults?(this.systemTest.steps.push({stepTitle:this.testStepTitle,expectedResults:this.testExpectedResults,isComplete:!1}),this.testStepTitle="",this.testExpectedResults="",null===(t=this.modal)||void 0===t||t.dismiss()):this.showAlert("Please fill out the Step Title and the Expected Result fields.","Error").then(s=>console.log("Alert shown"))}delete(t){this.systemTest.steps=this.systemTest.steps.filter(s=>s.stepTitle!==t)}showAlert(t,s){var l=this;return(0,m.A)(function*(){yield(yield l.alertCtrl.create({header:s,message:t,buttons:["OK"]})).present()})()}createSystemTest(){var t=this;return(0,m.A)(function*(){if(yield t.showLoading(),console.log(t.systemTest),!t.systemTest.title||!t.systemTest.description||0===t.systemTest.steps.length)return yield t.hideLoading(),void t.showAlert("Please fill out the title, description, and at least one step.","Error").then(l=>console.log("Alert shown"));const s=localStorage.getItem("user");s&&(t.user=JSON.parse(s),t.orgName=t.user.orgName,console.log(t.orgName),t.systemTestService.addSystemTest(t.orgName,t.productObjective,t.productStep,t.systemTest),t.systemTest={title:"",description:"",steps:[],type:"system-test",state:!1},yield t.hideLoading(),window.history.back())})()}showLoading(){var t=this;return(0,m.A)(function*(){yield(yield t.loadingCtrl.create({})).present()})()}hideLoading(){var t=this;return(0,m.A)(function*(){yield t.loadingCtrl.dismiss()})()}doRefresh(t){}aiGenerate(t){var s=this;return(0,m.A)(function*(){yield s.showLoading();const l={history:[{role:"user",parts:[{text:"Hey, I need help to create a system test case description"}]},{role:"model",parts:[{text:"Sure, I can help you with that. What do you need help with?"}]}],generationConfig:{maxOutputTokens:100}},c={history:[{role:"user",parts:[{text:"Hey, I need help to create a system test case steps, dont give me more information about the test, JUST LIST THE STEPS"}]},{role:"model",parts:[{text:"Sure, I can help you with that."}]}],generationConfig:{maxOutputTokens:250}};if("description"===t){if(!s.systemTest.title||""===s.systemTest.title)return yield s.hideLoading(),void s.showAlert("Please fill out the title of the test before asking for help with the description.","Error").then(i=>console.log("Alert shown"));let T=s.model.startChat(l),p="Given this test title:"+s.systemTest.title+"I need help to create the description of the test, just give me the test main objective";console.log(p),yield T.sendMessage(p).then(i=>{s.systemTest.description=i.response.text()})}if("step"===t){if(!s.systemTest.title||""===s.systemTest.title||!s.systemTest.description||""===s.systemTest.description)return yield s.hideLoading(),void s.showAlert("Please fill out the title and description of the test before asking for help with the steps.","Error").then(i=>console.log("Alert shown"));let T=s.model.startChat(c),p="Given this test title:"+s.systemTest.title+"and this test description:"+s.systemTest.description+". Here is more information about the test: "+s.extraData+"I need help to create the steps of the test, just list the steps";console.log(p),yield T.sendMessage(p).then(i=>{s.aiSteps.push({message:i.response.text(),from:"AI",id:"1"}),console.log(i.response.text())}),s.disableAI=!0}yield s.hideLoading()})()}askAIForHelp(t){var s=this;return(0,m.A)(function*(){yield s.aiGenerate(t).then(c=>console.log("AI generated"));const l=document.getElementById("mk-1");console.log(l),s.chatStyle()})()}chatStyle(){const t=document.getElementById("mk-1");if(console.log(t),!t)return;let s=t.getElementsByTagName("h1"),l=t.getElementsByTagName("h2"),c=t.getElementsByTagName("li"),T=t.getElementsByTagName("strong"),p=t.getElementsByTagName("ul");for(var i=0;i{var n;class u{}return(n=u).\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.$C({type:n}),n.\u0275inj=e.G2t({imports:[y.iI.forChild(I),y.iI]}),u})();var w=a(5553);let A=(()=>{var n;class u{}return(n=u).\u0275fac=function(t){return new(t||n)},n.\u0275mod=e.$C({type:n}),n.\u0275inj=e.G2t({imports:[d.MD,h.YN,o.bv,F,w.h,x.NN]}),u})()}}]); \ No newline at end of file diff --git a/www/index.html b/www/index.html index ae08fe7..bd4c273 100644 --- a/www/index.html +++ b/www/index.html @@ -21,6 +21,6 @@ - + diff --git a/www/runtime.a60f26492db7786a.js b/www/runtime.f0ac8d9119275de0.js similarity index 97% rename from www/runtime.a60f26492db7786a.js rename to www/runtime.f0ac8d9119275de0.js index 715b464..8719458 100644 --- a/www/runtime.a60f26492db7786a.js +++ b/www/runtime.f0ac8d9119275de0.js @@ -1 +1 @@ -(()=>{"use strict";var e,v={},g={};function f(e){var c=g[e];if(void 0!==c)return c.exports;var a=g[e]={exports:{}};return v[e].call(a.exports,a,a.exports,f),a.exports}f.m=v,e=[],f.O=(c,a,t,b)=>{if(!a){var d=1/0;for(r=0;r=b)&&Object.keys(f.O).every(p=>f.O[p](a[n]))?a.splice(n--,1):(l=!1,b0&&e[r-1][2]>b;r--)e[r]=e[r-1];e[r]=[a,t,b]},f.n=e=>{var c=e&&e.__esModule?()=>e.default:()=>e;return f.d(c,{a:c}),c},(()=>{var c,e=Object.getPrototypeOf?a=>Object.getPrototypeOf(a):a=>a.__proto__;f.t=function(a,t){if(1&t&&(a=this(a)),8&t||"object"==typeof a&&a&&(4&t&&a.__esModule||16&t&&"function"==typeof a.then))return a;var b=Object.create(null);f.r(b);var r={};c=c||[null,e({}),e([]),e(e)];for(var d=2&t&&a;"object"==typeof d&&!~c.indexOf(d);d=e(d))Object.getOwnPropertyNames(d).forEach(l=>r[l]=()=>a[l]);return r.default=()=>a,f.d(b,r),b}})(),f.d=(e,c)=>{for(var a in c)f.o(c,a)&&!f.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:c[a]})},f.f={},f.e=e=>Promise.all(Object.keys(f.f).reduce((c,a)=>(f.f[a](e,c),c),[])),f.u=e=>(({2076:"common",7278:"polyfills-dom",9329:"polyfills-core-js"}[e]||e)+"."+{441:"c8d135e5d56e5723",839:"283ada25cfa51ac0",964:"466b88054b5c618c",1010:"2bace76a66f84131",1015:"3d449385ac057e7f",1049:"7ef232095c56e4df",1081:"724852e553670d61",1102:"010dfe13f6ca7e15",1143:"a56774e704008734",1293:"ee80f2d33790618d",1313:"46ae0a0d0e94f2f8",1459:"32c41a59c0fd4cf1",1577:"f6f558490ff910b3",2075:"1971ba880d06cc30",2076:"7162eac78dfcd0da",2144:"5d46fa3641b801f2",2348:"12b471577685ffbe",2375:"efb0d99d1467ed67",2415:"dddee43f1c9b92e7",2560:"f34ba2c5e85b55c8",2580:"dd2d37daccf76d3f",2757:"3abded5cb12716d3",2885:"d64fa10bd441cbc8",3100:"be59eccfa5c9316f",3162:"825364e1635b086f",3451:"5cb648a56743fe4c",3506:"899dcc5e5d913023",3511:"16739e7034875331",3646:"554cb7eb2d8d0ce0",3814:"4f667f072e44b4e7",4171:"f5bc55c1acb0f5c1",4183:"0d54a4cc8cbc3a61",4348:"16e6409072fc8e11",4406:"03b087c2d77cb960",4443:"74ec71e1102d5a82",4463:"ce74c63a27a7a872",4591:"7a48c0cf9464e62b",4699:"01733b3942afbe92",4839:"1358f2425ffb5332",4867:"17817bc208c2836c",4914:"52404a177d9d7dd4",5054:"a36f0725f93c0766",5100:"659224ed1f94442c",5197:"cfc60de4c5213fec",5222:"9cbea5f62b0fb679",5399:"0706ad352f9b7c14",5712:"a9a2db8da6f1a8cd",5887:"708ea3877f30ffcd",5949:"2ed93c457aa1e9fb",5995:"2de4ee42f61961e5",6024:"3c02ab7fe82fedfe",6303:"1f016d3c5e585274",6433:"26eeba8bb230b119",6480:"2d3c5432c242ecc0",6521:"3c5b756783b6739a",6536:"a4f178f939f2d134",6840:"fd32dada9c8ec44e",6975:"6d2e5de0574c6402",7030:"f2a9bf080bedfc5b",7056:"ea1f1c37ffd3186d",7076:"2b7ea8b1f54f4458",7179:"80391eb100990080",7240:"680a87741a5535b1",7278:"bf542500b6fca113",7356:"911eacb1ce959b5e",7372:"4ea07cfe7eb821be",7428:"cb325b96b92ea4c2",7720:"78509b154c08b472",7762:"6371eca429bb8376",8066:"67e76a5c3f71f306",8193:"476b12959c4b189d",8314:"52348a57ed623e38",8361:"3d466d853997fbb0",8477:"15dacf21c512c8d4",8566:"52fa7b8c5c22d53f",8584:"94ca33677cedf961",8711:"4db3a14e6ae9d375",8805:"7a687270c4acd743",8814:"4175e28b98837400",8886:"87f743bcbe3c6802",8970:"402b7daea47854b9",8984:"d28cf89bc8592645",9013:"b8cefd92ba4e66d6",9070:"29b18cc91c088f3f",9273:"16673f4c5278d1b8",9329:"c76198334f717402",9344:"2d668603b6130b28",9456:"0b4cbaf1cbe8b46a",9546:"52a073ad6dd48f2b",9697:"57e559625e67bb53",9977:"948bf38bed890db4"}[e]+".js"),f.miniCssF=e=>{},f.o=(e,c)=>Object.prototype.hasOwnProperty.call(e,c),(()=>{var e={},c="app:";f.l=(a,t,b,r)=>{if(e[a])e[a].push(t);else{var d,l;if(void 0!==b)for(var n=document.getElementsByTagName("script"),i=0;i{d.onerror=d.onload=null,clearTimeout(u);var y=e[a];if(delete e[a],d.parentNode&&d.parentNode.removeChild(d),y&&y.forEach(_=>_(p)),m)return m(p)},u=setTimeout(s.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=s.bind(null,d.onerror),d.onload=s.bind(null,d.onload),l&&document.head.appendChild(d)}}})(),f.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;f.tt=()=>(void 0===e&&(e={createScriptURL:c=>c},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),f.tu=e=>f.tt().createScriptURL(e),f.p="",(()=>{var e={9121:0};f.f.j=(t,b)=>{var r=f.o(e,t)?e[t]:void 0;if(0!==r)if(r)b.push(r[2]);else if(9121!=t){var d=new Promise((o,s)=>r=e[t]=[o,s]);b.push(r[2]=d);var l=f.p+f.u(t),n=new Error;f.l(l,o=>{if(f.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=o&&("load"===o.type?"missing":o.type),u=o&&o.target&&o.target.src;n.message="Loading chunk "+t+" failed.\n("+s+": "+u+")",n.name="ChunkLoadError",n.type=s,n.request=u,r[1](n)}},"chunk-"+t,t)}else e[t]=0},f.O.j=t=>0===e[t];var c=(t,b)=>{var n,i,[r,d,l]=b,o=0;if(r.some(u=>0!==e[u])){for(n in d)f.o(d,n)&&(f.m[n]=d[n]);if(l)var s=l(f)}for(t&&t(b);o{"use strict";var e,v={},g={};function f(e){var c=g[e];if(void 0!==c)return c.exports;var a=g[e]={exports:{}};return v[e].call(a.exports,a,a.exports,f),a.exports}f.m=v,e=[],f.O=(c,a,t,b)=>{if(!a){var d=1/0;for(r=0;r=b)&&Object.keys(f.O).every(p=>f.O[p](a[n]))?a.splice(n--,1):(l=!1,b0&&e[r-1][2]>b;r--)e[r]=e[r-1];e[r]=[a,t,b]},f.n=e=>{var c=e&&e.__esModule?()=>e.default:()=>e;return f.d(c,{a:c}),c},(()=>{var c,e=Object.getPrototypeOf?a=>Object.getPrototypeOf(a):a=>a.__proto__;f.t=function(a,t){if(1&t&&(a=this(a)),8&t||"object"==typeof a&&a&&(4&t&&a.__esModule||16&t&&"function"==typeof a.then))return a;var b=Object.create(null);f.r(b);var r={};c=c||[null,e({}),e([]),e(e)];for(var d=2&t&&a;"object"==typeof d&&!~c.indexOf(d);d=e(d))Object.getOwnPropertyNames(d).forEach(l=>r[l]=()=>a[l]);return r.default=()=>a,f.d(b,r),b}})(),f.d=(e,c)=>{for(var a in c)f.o(c,a)&&!f.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:c[a]})},f.f={},f.e=e=>Promise.all(Object.keys(f.f).reduce((c,a)=>(f.f[a](e,c),c),[])),f.u=e=>(({2076:"common",7278:"polyfills-dom",9329:"polyfills-core-js"}[e]||e)+"."+{441:"c8d135e5d56e5723",839:"283ada25cfa51ac0",964:"466b88054b5c618c",1010:"2bace76a66f84131",1015:"3d449385ac057e7f",1049:"7ef232095c56e4df",1081:"724852e553670d61",1102:"010dfe13f6ca7e15",1143:"0dd15591a6841da8",1293:"ee80f2d33790618d",1313:"46ae0a0d0e94f2f8",1459:"32c41a59c0fd4cf1",1577:"f6f558490ff910b3",2075:"1971ba880d06cc30",2076:"7162eac78dfcd0da",2144:"5d46fa3641b801f2",2348:"12b471577685ffbe",2375:"efb0d99d1467ed67",2415:"dddee43f1c9b92e7",2560:"f34ba2c5e85b55c8",2580:"dd2d37daccf76d3f",2757:"3abded5cb12716d3",2885:"d64fa10bd441cbc8",3100:"be59eccfa5c9316f",3162:"825364e1635b086f",3451:"5cb648a56743fe4c",3506:"899dcc5e5d913023",3511:"16739e7034875331",3646:"554cb7eb2d8d0ce0",3814:"4f667f072e44b4e7",4171:"f5bc55c1acb0f5c1",4183:"0d54a4cc8cbc3a61",4348:"16e6409072fc8e11",4406:"03b087c2d77cb960",4443:"74ec71e1102d5a82",4463:"ce74c63a27a7a872",4591:"7a48c0cf9464e62b",4699:"01733b3942afbe92",4839:"1358f2425ffb5332",4867:"17817bc208c2836c",4914:"52404a177d9d7dd4",5054:"a36f0725f93c0766",5100:"659224ed1f94442c",5197:"cfc60de4c5213fec",5222:"9cbea5f62b0fb679",5399:"0706ad352f9b7c14",5712:"a9a2db8da6f1a8cd",5887:"708ea3877f30ffcd",5949:"2ed93c457aa1e9fb",5995:"2de4ee42f61961e5",6024:"3c02ab7fe82fedfe",6303:"1f016d3c5e585274",6433:"26eeba8bb230b119",6480:"2d3c5432c242ecc0",6521:"3c5b756783b6739a",6536:"a4f178f939f2d134",6840:"fd32dada9c8ec44e",6975:"6d2e5de0574c6402",7030:"f2a9bf080bedfc5b",7056:"ea1f1c37ffd3186d",7076:"2b7ea8b1f54f4458",7179:"80391eb100990080",7240:"680a87741a5535b1",7278:"bf542500b6fca113",7356:"911eacb1ce959b5e",7372:"4ea07cfe7eb821be",7428:"cb325b96b92ea4c2",7720:"78509b154c08b472",7762:"6371eca429bb8376",8066:"67e76a5c3f71f306",8193:"476b12959c4b189d",8314:"52348a57ed623e38",8361:"3d466d853997fbb0",8477:"15dacf21c512c8d4",8566:"52fa7b8c5c22d53f",8584:"94ca33677cedf961",8711:"4db3a14e6ae9d375",8805:"7a687270c4acd743",8814:"4175e28b98837400",8886:"87f743bcbe3c6802",8970:"402b7daea47854b9",8984:"d28cf89bc8592645",9013:"b8cefd92ba4e66d6",9070:"29b18cc91c088f3f",9273:"16673f4c5278d1b8",9329:"c76198334f717402",9344:"2d668603b6130b28",9456:"0b4cbaf1cbe8b46a",9546:"52a073ad6dd48f2b",9697:"57e559625e67bb53",9977:"948bf38bed890db4"}[e]+".js"),f.miniCssF=e=>{},f.o=(e,c)=>Object.prototype.hasOwnProperty.call(e,c),(()=>{var e={},c="app:";f.l=(a,t,b,r)=>{if(e[a])e[a].push(t);else{var d,l;if(void 0!==b)for(var n=document.getElementsByTagName("script"),i=0;i{d.onerror=d.onload=null,clearTimeout(u);var y=e[a];if(delete e[a],d.parentNode&&d.parentNode.removeChild(d),y&&y.forEach(_=>_(p)),m)return m(p)},u=setTimeout(s.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=s.bind(null,d.onerror),d.onload=s.bind(null,d.onload),l&&document.head.appendChild(d)}}})(),f.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;f.tt=()=>(void 0===e&&(e={createScriptURL:c=>c},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),f.tu=e=>f.tt().createScriptURL(e),f.p="",(()=>{var e={9121:0};f.f.j=(t,b)=>{var r=f.o(e,t)?e[t]:void 0;if(0!==r)if(r)b.push(r[2]);else if(9121!=t){var d=new Promise((o,s)=>r=e[t]=[o,s]);b.push(r[2]=d);var l=f.p+f.u(t),n=new Error;f.l(l,o=>{if(f.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var s=o&&("load"===o.type?"missing":o.type),u=o&&o.target&&o.target.src;n.message="Loading chunk "+t+" failed.\n("+s+": "+u+")",n.name="ChunkLoadError",n.type=s,n.request=u,r[1](n)}},"chunk-"+t,t)}else e[t]=0},f.O.j=t=>0===e[t];var c=(t,b)=>{var n,i,[r,d,l]=b,o=0;if(r.some(u=>0!==e[u])){for(n in d)f.o(d,n)&&(f.m[n]=d[n]);if(l)var s=l(f)}for(t&&t(b);o