blob: 7608a5093f3bcf3f1f2dc16f67c2981272a92d0b [file] [log] [blame]
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[277],{3905:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return d}});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),u=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=u(e.components);return r.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=u(n),d=a,f=m["".concat(l,".").concat(d)]||m[d]||p[d]||i;return n?r.createElement(f,o(o({ref:t},c),{},{components:n})):r.createElement(f,o({ref:t},c))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var u=2;u<i;u++)o[u]=n[u];return r.createElement.apply(null,o)}return r.createElement.apply(null,n)}m.displayName="MDXCreateElement"},1547:function(e,t,n){n.r(t),n.d(t,{assets:function(){return c},contentTitle:function(){return l},default:function(){return d},frontMatter:function(){return s},metadata:function(){return u},toc:function(){return p}});var r=n(7462),a=n(3366),i=(n(7294),n(3905)),o=["components"],s={title:"How to Run Frontend Integration Test"},l=void 0,u={unversionedId:"devDocs/IntegrationTestE2E",id:"version-0.6.0/devDocs/IntegrationTestE2E",title:"How to Run Frontend Integration Test",description:"\x3c!---",source:"@site/versioned_docs/version-0.6.0/devDocs/IntegrationTestE2E.md",sourceDirName:"devDocs",slug:"/devDocs/IntegrationTestE2E",permalink:"/docs/0.6.0/devDocs/IntegrationTestE2E",editUrl:"https://github.com/apache/submarine/edit/master/website/versioned_docs/version-0.6.0/devDocs/IntegrationTestE2E.md",tags:[],version:"0.6.0",frontMatter:{title:"How to Run Frontend Integration Test"},sidebar:"docs",previous:{title:"How to Run Integration K8s Test",permalink:"/docs/0.6.0/devDocs/IntegrationTestK8s"},next:{title:"Apache Submarine Community",permalink:"/docs/0.6.0/community/"}},c={},p=[{value:"Introduction",id:"introduction",level:2},{value:"Run E2E test locally",id:"run-e2e-test-locally",level:2},{value:"Run E2E test in GitHub Actions",id:"run-e2e-test-in-github-actions",level:2},{value:"Add a new frontend E2E test case",id:"add-a-new-frontend-e2e-test-case",level:2}],m={toc:p};function d(e){var t=e.components,n=(0,a.Z)(e,o);return(0,i.kt)("wrapper",(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h2",{id:"introduction"},"Introduction"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"The test cases under the directory ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/apache/submarine/tree/master/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration"},"test-e2e")," are integration tests to ensure the correctness of the Submarine Workbench.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},"These test cases can be run either locally or on GitHub Actions."))),(0,i.kt)("h2",{id:"run-e2e-test-locally"},"Run E2E test locally"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Ensure you have setup the submarine locally. If not, you can refer to ",(0,i.kt)("inlineCode",{parentName:"p"},"Submarine Local Deployment"),".")),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Forward port"),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl port-forward --address 0.0.0.0 service/submarine-traefik 32080:80\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Modify run_frontend_e2e.sh"),(0,i.kt)("p",{parentName:"li"}," You need to modify the port and the URL in this script to where you run the workbench on."),(0,i.kt)("blockquote",{parentName:"li"},(0,i.kt)("p",{parentName:"blockquote"},"Example:\nIf your Submarine workbench is running on 127.0.0.1:4200, you should modify the ",(0,i.kt)("strong",{parentName:"p"},"WORKBENCH_PORT")," to 4200.")),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'# at submarine-test/test_e2e/run_frontend_e2e.sh\n...\n# ======= Modifiable Variables ======= #\n # Note: URL must start with "http" \n # (Ref: https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/WebDriver.html#get(java.lang.String))\n WORKBENCH_PORT=8080 #<= modify this\n URL="http://127.0.0.1" #<=modify this\n # ==================================== #\n ...\n'))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Run run_frontend_e2e.sh (Run a specific test case)"),(0,i.kt)("p",{parentName:"li"},"This script will check whether the port can be accessed or not, and run the test case."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"# at submarine-test/test_e2e\n./run_fronted_e2e.sh ${TESTCASE}\n# TESTCASE is the IT you want to run, ex: loginIT, experimentIT...\n"))),(0,i.kt)("li",{parentName:"ol"},(0,i.kt)("p",{parentName:"li"},"Run all test cases"))),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},'Following commands will compile all files and run all files ending with "IT" in the ',(0,i.kt)("a",{parentName:"p",href:"https://github.com/apache/submarine/tree/master/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration"},"directory"),"."),(0,i.kt)("pre",{parentName:"li"},(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"# Make sure the Submarine workbench is running on 127.0.0.1:8080\ncd submarine/submarine-test/test-e2e\n# Method 1: \nmvn verify\n\n# Method 2:\nmvn clean install -U\n")))),(0,i.kt)("h2",{id:"run-e2e-test-in-github-actions"},"Run E2E test in GitHub Actions"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Each time a commit is pushed, GitHub Actions will be triggered automatically.")),(0,i.kt)("h2",{id:"add-a-new-frontend-e2e-test-case"},"Add a new frontend E2E test case"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"WARNING"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},"You ",(0,i.kt)("strong",{parentName:"li"},"MUST")," read the ",(0,i.kt)("a",{parentName:"li",href:"https://www.selenium.dev/documentation/en/webdriver/waits/"},"document")," carefully, and understand the difference between ",(0,i.kt)("strong",{parentName:"li"},"explicit wait"),", ",(0,i.kt)("strong",{parentName:"li"},"implicit wait"),", and ",(0,i.kt)("strong",{parentName:"li"},"fluent wait"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"Do not mix implicit and explicit waits.")," Doing so can cause unpredictable wait times."))),(0,i.kt)("li",{parentName:"ul"},"We define many useful functions in ",(0,i.kt)("a",{parentName:"li",href:"https://github.com/apache/submarine/blob/master/submarine-test/test-e2e/src/test/java/org/apache/submarine/AbstractSubmarineIT.java"},"AbstractSubmarineIT.java"),".")))}d.isMDXComponent=!0}}]);