validation - Angular e2e testing ng-show -
i use ng-pattern validation, use ng-show display error message. works fine on browser, how code in e2e test if error message shows up?
here html:
<input type="text" ng-model="test.pname" name="pname" ng-maxlength="30" ng-pattern="/^[a-za-z0-9 ]*$/"/> <span class="custom-error" id="pnamevalidate" ng-show="addproviderform.pname.$error.pattern"> pname can alpha-numeric 30 characters – spaces allowed, no special characters</span>
here e2e script:
input('test.pname').enter('cakes`'); expect(element('#pnamevalidate:visible').text()).tomatch(/up 30 characters/); input('test.pname').enter('cakes good'); expect(element('#pnamevalidate:visible').text()).tobe('');
here result test runner:
expected "" "\n pname can alpha-numeric 30 characters – spaces allowed, no special characters"
it seems in test runner #pnamevalidate shows no matter specify in e2e.
have tried adding wait time test allow ui catch script?
input('test.pname').enter('cakes`'); expect(element('#pnamevalidate:visible').count()).tobe(1); expect(element('#pnamevalidate:visible').text()).tomatch(/up 30 characters/); input('test.pname').enter('cakes good'); settimeout(function() { expect(element('#pnamevalidate:visible').count()).tobe(0); expect(element('#pnamevalidate:visible').text()).tobe(''); }, 500);
Comments
Post a Comment