(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[8009],{76793:function(k,E,t){"use strict";t.r(E);var S=t(90228),u=t.n(S),D=t(87999),g=t.n(D),$=t(48305),F=t.n($),v=t(50959),h=t(7485),I=t(9772),K=t(85385),O=t(83098),X=t(89937),z=t(89350),H=t(542),J=t(45443),m=t(11527),G="/",L=!1;function A(a){var r=(0,O.gD)(),e=(0,v.useState)(void 0),s=F()(e,2),l=s[0],i=s[1];if((0,v.useEffect)(function(){var p=function(){var o=g()(u()().mark(function d(){var y,T,P,C,R,M,j,w;return u()().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.next=2,(0,X.s)(r);case 2:return y=f.sent,T=y.routes,P=y.routeComponents,f.next=7,r.applyPlugins({key:"patchRoutes",type:h.ApplyPluginsType.event,args:{routes:T,routeComponents:P}});case 7:return C=r.applyPlugins({key:"modifyContextOpts",type:h.ApplyPluginsType.modify,initialValue:{}}),R=C.basename||"/",M=(0,K.f)({type:"memory",basename:R}),j={routes:T,routeComponents:P,pluginManager:r,rootElement:C.rootElement||document.getElementById("root"),publicPath:G,runtimePublicPath:L,history:M,basename:R,components:!0},w=r.applyPlugins({key:"modifyClientRenderOpts",type:h.ApplyPluginsType.modify,initialValue:j}),f.abrupt("return",w);case 13:case"end":return f.stop()}},d)}));return function(){return o.apply(this,arguments)}}();p().then(function(o){if(i(o),a.location){var d;o==null||(d=o.history)===null||d===void 0||d.push(a.location)}a.historyRef&&(a.historyRef.current=o==null?void 0:o.history)})},[]),l===void 0)return(0,m.jsx)("div",{id:"loading"});var n=(0,I.p6)(l);return(0,m.jsx)(v.Fragment,{children:(0,m.jsx)(n,{})})}var c=t(66303),V=t(84898),Y=t(32699),b=t(80209),N="/",U=function(r){var e=(0,Y.merge)({port:7e3,scene:"default"},r),s=e.port,l=e.scene;return new Promise(function(i,n){var p=(0,V.fork)((0,b.join)(N,"./startMock.js"),[],{env:{scene:l,port:String(s)}});p.on("exit",function(o){o!==0&&n(new Error("Mock server exited with code ".concat(o)))}),i({close:function(){p.kill()}})})},B=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;return new Promise(function(e){setTimeout(function(){e(!0)},r)})},x;describe("Login Page",function(){beforeAll(g()(u()().mark(function a(){return u()().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,U({port:8e3,scene:"login"});case 2:x=e.sent;case 3:case"end":return e.stop()}},a)}))),afterAll(function(){var a;(a=x)===null||a===void 0||a.close()}),it("should show login form",g()(u()().mark(function a(){var r,e,s;return u()().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return e=v.createRef(),s=(0,c.sY)((0,m.jsx)(A,{historyRef:e,location:{pathname:"/user/login"}})),i.next=4,s.findAllByText("Ant Design");case 4:(0,c.TK)(function(){var n;(n=e.current)===null||n===void 0||n.push("/user/login")}),expect((r=s.baseElement)===null||r===void 0||(r=r.querySelector(".ant-pro-form-login-desc"))===null||r===void 0?void 0:r.textContent).toBe("Ant Design is the most influential web design specification in Xihu district"),expect(s.asFragment()).toMatchSnapshot(),s.unmount();case 8:case"end":return i.stop()}},a)}))),it("should login success",g()(u()().mark(function a(){var r,e,s,l;return u()().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return r=v.createRef(),e=(0,c.sY)((0,m.jsx)(A,{historyRef:r,location:{pathname:"/user/login"}})),n.next=4,e.findAllByText("Ant Design");case 4:return n.next=6,e.findByPlaceholderText("Username: admin or user");case 6:return s=n.sent,(0,c.TK)(function(){c.BX.change(s,{target:{value:"admin"}})}),n.next=10,e.findByPlaceholderText("Password: ant.design");case 10:return l=n.sent,(0,c.TK)(function(){c.BX.change(l,{target:{value:"ant.design"}})}),n.next=14,e.findByText("Login");case 14:return n.next=16,n.sent.click();case 16:return n.next=18,B(5e3);case 18:return n.next=20,e.findAllByText("Ant Design Pro");case 20:return expect(e.asFragment()).toMatchSnapshot(),n.next=23,B(2e3);case 23:e.unmount();case 24:case"end":return n.stop()}},a)})))})},65660:function(){},84898:function(){}}]);
