How to use clickElement method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

coding-rules.spec.js

Source:coding-rules.spec.js Github

copy

Full Screen

...10 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-no-available-profiles.json')11 .mockFromString('/api/issues/search', '{}')12 .startAppBrowserify('coding-rules')13 .checkElementExist('.coding-rule.selected')14 .clickElement('.coding-rule.selected .js-rule')15 .checkElementExist('.coding-rules-detail-header')16 .checkElementExist('#coding-rules-quality-profile-activate')17 .clickElement('#coding-rules-quality-profile-activate')18 .checkElementExist('.modal')19 .checkElementExist('.modal .alert');20 });21 bdd.it('should show profile facet', function () {22 return this.remote23 .open()24 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')25 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-profile-facet.json')26 .startAppBrowserify('coding-rules')27 .checkElementExist('.coding-rule')28 .checkElementInclude('#coding-rules-total', '609')29 .clickElement('[data-property="qprofile"] .js-facet-toggle')30 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')31 .clearMocks()32 .mockFromFile('/api/rules/search',33 'coding-rules-spec/search-profile-facet-qprofile-active.json',34 { data: { activation: true } })35 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')36 .checkElementInclude('#coding-rules-total', '407')37 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-active.facet-toggle-active')38 .clearMocks()39 .mockFromFile('/api/rules/search',40 'coding-rules-spec/search-profile-facet-qprofile-inactive.json',41 { data: { activation: 'false' } })42 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-inactive')43 .checkElementInclude('#coding-rules-total', '408')44 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-inactive.facet-toggle-active')45 .clearMocks()46 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-profile-facet.json')47 .clickElement('[data-property="qprofile"] .js-facet-toggle')48 .checkElementInclude('#coding-rules-total', '609');49 });50 bdd.it('should show query facet', function () {51 return this.remote52 .open()53 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')54 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')55 .startAppBrowserify('coding-rules')56 .checkElementExist('.coding-rule')57 .checkElementInclude('#coding-rules-total', '609')58 .clearMocks()59 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-query.json', { data: { q: 'query' } })60 .fillElement('[data-property="q"] input', 'query')61 .submitForm('[data-property="q"] form')62 .checkElementInclude('#coding-rules-total', '4')63 .clearMocks()64 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')65 .fillElement('[data-property="q"] input', '')66 .submitForm('[data-property="q"] form')67 .checkElementInclude('#coding-rules-total', '609');68 });69 bdd.it('should show rule permalink', function () {70 return this.remote71 .open()72 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')73 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')74 .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json')75 .mockFromString('/api/issues/search', '{}')76 .startAppBrowserify('coding-rules')77 .checkElementExist('.coding-rule.selected')78 .clickElement('.coding-rule.selected .js-rule')79 .checkElementExist('.coding-rules-detail-header')80 .checkElementExist('a[href="/coding_rules#rule_key=squid%3AS2204"]');81 });82 bdd.it('should activate profile', function () {83 return this.remote84 .open()85 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')86 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')87 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-activate-profile.json')88 .mockFromString('/api/qualityprofiles/activate_rule', '{}')89 .mockFromString('/api/issues/search', '{}')90 .startAppBrowserify('coding-rules')91 .checkElementExist('.coding-rule.selected')92 .clickElement('.coding-rule.selected .js-rule')93 .checkElementExist('.coding-rules-detail-header')94 .checkElementNotExist('.coding-rules-detail-quality-profile-name')95 .checkElementExist('#coding-rules-quality-profile-activate')96 .clickElement('#coding-rules-quality-profile-activate')97 .checkElementExist('.modal')98 .clearMocks()99 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-activate-profile-with-profile.json')100 .mockFromString('/api/qualityprofiles/activate_rule', '{}')101 .mockFromString('/api/issues/search', '{}')102 .clickElement('#coding-rules-quality-profile-activation-activate')103 .checkElementExist('.coding-rules-detail-quality-profile-name')104 .checkElementExist('.coding-rules-detail-quality-profile-name')105 .checkElementExist('.coding-rules-detail-quality-profile-severity')106 .checkElementExist('.coding-rules-detail-quality-profile-deactivate');107 });108 bdd.it('should create custom rule', function () {109 return this.remote110 .open()111 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')112 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-custom-rules.json')113 .startAppBrowserify('coding-rules')114 .checkElementExist('.coding-rule.selected')115 .clearMocks()116 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-custom-rules.json')117 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-custom-rules.json',118 { data: { template_key: 'squid:ArchitecturalConstraint' } })119 .mockFromString('/api/rules/create', '{}')120 .mockFromString('/api/issues/search', '{}')121 .clickElement('.coding-rule.selected .js-rule')122 .checkElementExist('#coding-rules-detail-custom-rules .coding-rules-detail-list-name')123 .clearMocks()124 .mockFromString('/api/rules/create', '{}')125 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-custom-rules.json')126 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-custom-rules2.json')127 .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 1)128 .clickElement('.js-create-custom-rule')129 .fillElement('.modal form [name="name"]', 'test')130 .fillElement('.modal form [name="markdown_description"]', 'test')131 .clickElement('#coding-rules-custom-rule-creation-create')132 .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 2);133 });134 bdd.it('should reactivate custom rule', function () {135 return this.remote136 .open()137 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')138 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-custom-rules.json')139 .startAppBrowserify('coding-rules')140 .forceJSON()141 .checkElementExist('.coding-rule.selected')142 .clearMocks()143 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-custom-rules.json')144 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-custom-rules.json',145 { data: { template_key: 'squid:ArchitecturalConstraint' } })146 .mockFromFile('/api/rules/create', 'coding-rules-spec/create-create-custom-rules.json', { status: 409 })147 .mockFromString('/api/issues/search', '{}')148 .clickElement('.coding-rule.selected .js-rule')149 .checkElementExist('.js-create-custom-rule')150 .clickElement('.js-create-custom-rule')151 .checkElementExist('.modal')152 .fillElement('.modal form [name="name"]', 'My Custom Rule')153 .fillElement('.modal form [name="markdown_description"]', 'My Description')154 .clickElement('#coding-rules-custom-rule-creation-create')155 .checkElementExist('.modal .alert-warning')156 .clearMocks()157 .mockFromFile('/api/rules/create', 'coding-rules-spec/create-create-custom-rules.json')158 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-custom-rules2.json',159 { data: { template_key: 'squid:ArchitecturalConstraint' } })160 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-custom-rules.json')161 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-custom-rules.json')162 .clickElement('.modal #coding-rules-custom-rule-creation-reactivate')163 .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 2);164 });165 bdd.it('should create manual rule', function () {166 return this.remote167 .open()168 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')169 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-manual-rule.json')170 .mockFromFile('/api/rules/create', 'coding-rules-spec/show-create-manual-rule.json')171 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-manual-rule.json')172 .mockFromString('/api/issues/search', '{}')173 .startAppBrowserify('coding-rules')174 .forceJSON()175 .checkElementExist('.js-create-manual-rule')176 .clickElement('.js-create-manual-rule')177 .checkElementExist('.modal')178 .fillElement('.modal [name="name"]', 'Manual Rule')179 .fillElement('.modal [name="markdown_description"]', 'Manual Rule Description')180 .clickElement('.modal #coding-rules-manual-rule-creation-create')181 .checkElementExist('.coding-rules-detail-header')182 .checkElementInclude('.coding-rules-detail-header', 'Manual Rule')183 .checkElementInclude('.coding-rule-details', 'manual:Manual_Rule')184 .checkElementInclude('.coding-rules-detail-description', 'Manual Rule Description');185 });186 bdd.it('should reactivate manual rule', function () {187 return this.remote188 .open()189 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')190 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-create-manual-rule.json')191 .mockFromFile('/api/rules/create', 'coding-rules-spec/show-create-manual-rule.json', { status: 409 })192 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-manual-rule.json')193 .mockFromString('/api/issues/search', '{}')194 .startAppBrowserify('coding-rules')195 .forceJSON()196 .checkElementExist('.js-create-manual-rule')197 .clickElement('.js-create-manual-rule')198 .checkElementExist('.modal')199 .checkElementExist('.modal #coding-rules-manual-rule-creation-create')200 .fillElement('.modal [name="name"]', 'Manual Rule')201 .fillElement('.modal [name="markdown_description"]', 'Manual Rule Description')202 .clickElement('.modal #coding-rules-manual-rule-creation-create')203 .checkElementExist('.modal .alert-warning')204 .clearMocks()205 .mockFromFile('/api/rules/create', 'coding-rules-spec/show.json')206 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-create-manual-rule.json')207 .clickElement('.modal #coding-rules-manual-rule-creation-reactivate')208 .checkElementExist('.coding-rules-detail-header')209 .checkElementInclude('.coding-rules-detail-header', 'Manual Rule')210 .checkElementInclude('.coding-rule-details', 'manual:Manual_Rule')211 .checkElementInclude('.coding-rules-detail-description', 'Manual Rule Description');212 });213 bdd.it('should delete custom rules', function () {214 return this.remote215 .open()216 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')217 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-delete-custom-rule-custom-rules.json',218 { data: { template_key: 'squid:ArchitecturalConstraint' } })219 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-delete-custom-rule.json')220 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-delete-custom-rule.json')221 .mockFromString('/api/rules/delete', '{}')222 .mockFromString('/api/issues/search', '{}')223 .startAppBrowserify('coding-rules')224 .checkElementExist('.coding-rule.selected')225 .clickElement('.coding-rule.selected .js-rule')226 .checkElementExist('#coding-rules-detail-custom-rules .coding-rules-detail-list-name')227 .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 2)228 .clickElement('.js-delete-custom-rule')229 .clickElement('[data-confirm="yes"]')230 .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 1);231 });232 bdd.it('should delete manual rules', function () {233 return this.remote234 .open()235 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')236 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-delete-manual-rule-before.json')237 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-delete-manual-rule.json')238 .mockFromString('/api/issues/search', '{}')239 .startAppBrowserify('coding-rules')240 .forceJSON()241 .checkElementExist('.coding-rule.selected')242 .clickElement('.coding-rule.selected .js-rule')243 .checkElementExist('.js-delete')244 .clickElement('.js-delete')245 .checkElementExist('[data-confirm="yes"]')246 .clearMocks()247 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-delete-manual-rule-after.json')248 .mockFromString('/api/rules/delete', '{}')249 .clickElement('[data-confirm="yes"]')250 .checkElementInclude('#coding-rules-total', 0);251 });252 bdd.it('should show custom rules', function () {253 return this.remote254 .open()255 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')256 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-show-cutsom-rule-custom-rules.json',257 { data: { template_key: 'squid:ArchitecturalConstraint' } })258 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-show-cutsom-rule.json')259 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-show-cutsom-rule.json')260 .mockFromString('/api/issues/search', '{}')261 .startAppBrowserify('coding-rules')262 .checkElementExist('.coding-rule.selected')263 .clickElement('.coding-rule.selected .js-rule')264 .checkElementExist('#coding-rules-detail-custom-rules .coding-rules-detail-list-name')265 .checkElementExist('#coding-rules-detail-custom-rules')266 .checkElementCount('#coding-rules-detail-custom-rules .coding-rules-detail-list-name', 2)267 .checkElementInclude('#coding-rules-detail-custom-rules .coding-rules-detail-list-name',268 'Do not use org.h2.util.StringUtils');269 });270 bdd.it('should show deprecated label', function () {271 return this.remote272 .open()273 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')274 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-deprecated.json')275 .startAppBrowserify('coding-rules')276 .checkElementExist('.coding-rule.selected')277 .checkElementInclude('.coding-rule.selected', 'DEPRECATED');278 });279 bdd.it('should show rule details', function () {280 return this.remote281 .open()282 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')283 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-show-details.json')284 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-show-details.json')285 .mockFromString('/api/issues/search', '{}')286 .startAppBrowserify('coding-rules')287 .checkElementExist('.coding-rule.selected')288 .clickElement('.coding-rule.selected .js-rule')289 .checkElementExist('.coding-rules-detail-header')290 .checkElementInclude('.search-navigator-workspace-details',291 'Throwable and Error classes should not be caught')292 .checkElementInclude('.search-navigator-workspace-details', 'squid:S1181')293 .checkElementExist('.coding-rules-detail-properties .icon-severity-blocker')294 .checkElementInclude('.coding-rules-detail-properties', 'error-handling')295 .checkElementInclude('.coding-rules-detail-properties', '2013')296 .checkElementInclude('.coding-rules-detail-properties', 'SonarQube (Java)')297 .checkElementInclude('.coding-rules-detail-properties', 'Reliability > Exception handling')298 .checkElementInclude('.coding-rules-detail-properties', 'LINEAR')299 .checkElementInclude('.coding-rules-detail-properties', '20min')300 .checkElementInclude('.coding-rules-detail-description', 'is the superclass of all errors and')301 .checkElementInclude('.coding-rules-detail-description', 'its subclasses should be caught.')302 .checkElementInclude('.coding-rules-detail-description', 'Noncompliant Code Example')303 .checkElementInclude('.coding-rules-detail-description', 'Compliant Solution')304 .checkElementInclude('.coding-rules-detail-parameters', 'max')305 .checkElementInclude('.coding-rules-detail-parameters', 'Maximum authorized number of parameters')306 .checkElementInclude('.coding-rules-detail-parameters', '7')307 .checkElementCount('.coding-rules-detail-quality-profile-name', 6)308 .checkElementInclude('.coding-rules-detail-quality-profile-name', 'Default - Top')309 .checkElementCount('.coding-rules-detail-quality-profile-inheritance', 4)310 .checkElementInclude('.coding-rules-detail-quality-profile-inheritance', 'Default - Top');311 });312 bdd.it('should show empty list', function () {313 return this.remote314 .open()315 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')316 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-empty.json')317 .startAppBrowserify('coding-rules')318 .checkElementExist('.search-navigator-facet-box')319 .checkElementNotExist('.coding-rule')320 .checkElementInclude('#coding-rules-total', 0)321 .checkElementExist('.search-navigator-no-results');322 });323 bdd.it('should show facets', function () {324 return this.remote325 .open()326 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')327 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')328 .startAppBrowserify('coding-rules')329 .checkElementExist('.search-navigator-facet-box')330 .checkElementCount('.search-navigator-facet-box', 13);331 });332 bdd.it('should show rule', function () {333 return this.remote334 .open()335 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')336 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')337 .startAppBrowserify('coding-rules')338 .checkElementExist('.coding-rule.selected')339 .checkElementInclude('.coding-rule.selected', 'Values passed to SQL commands should be sanitized')340 .checkElementInclude('.coding-rule.selected', 'Java')341 .checkElementInclude('.coding-rule.selected', 'cwe')342 .checkElementInclude('.coding-rule.selected', 'owasp-top10')343 .checkElementInclude('.coding-rule.selected', 'security')344 .checkElementInclude('.coding-rule.selected', 'sql')345 .checkElementInclude('.coding-rule.selected', 'custom-tag');346 });347 bdd.it('should show rule issues', function () {348 return this.remote349 .open()350 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')351 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')352 .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json')353 .mockFromFile('/api/issues/search', 'coding-rules-spec/issues-search.json')354 .startAppBrowserify('coding-rules')355 .checkElementExist('.coding-rule.selected')356 .clickElement('.coding-rule.selected .js-rule')357 .checkElementExist('.coding-rules-most-violated-projects')358 .checkElementInclude('.js-rule-issues', '7')359 .checkElementInclude('.coding-rules-most-violated-projects', 'SonarQube')360 .checkElementInclude('.coding-rules-most-violated-projects', '2')361 .checkElementInclude('.coding-rules-most-violated-projects', 'SonarQube Runner')362 .checkElementInclude('.coding-rules-most-violated-projects', '1');363 });364 bdd.it('should show rules', function () {365 return this.remote366 .open()367 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')368 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')369 .startAppBrowserify('coding-rules')370 .checkElementExist('.coding-rule')371 .checkElementCount('.coding-rule', 25)372 .checkElementInclude('.coding-rule', 'Values passed to SQL commands should be sanitized')373 .checkElementInclude('.coding-rule', 'An open curly brace should be located at the beginning of a line')374 .checkElementInclude('#coding-rules-total', '609');375 });376 bdd.it('should move between rules from detailed view', function () {377 return this.remote378 .open()379 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')380 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')381 .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json')382 .startAppBrowserify('coding-rules')383 .checkElementExist('.coding-rule.selected')384 .clickElement('.coding-rule.selected .js-rule')385 .checkElementExist('.coding-rules-detail-header')386 .checkElementInclude('.coding-rules-detail-header',387 '".equals()" should not be used to test the values')388 .clearMocks()389 .mockFromFile('/api/rules/show', 'coding-rules-spec/show2.json')390 .clickElement('.js-next')391 .checkElementInclude('.coding-rules-detail-header', '"@Override" annotation should be used on any')392 .clearMocks()393 .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json')394 .clickElement('.js-prev')395 .checkElementInclude('.coding-rules-detail-header', '".equals()" should not be used to test the values');396 });397 bdd.it('should filter similar rules', function () {398 return this.remote399 .open()400 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')401 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')402 .startAppBrowserify('coding-rules')403 .checkElementExist('.coding-rule.selected .js-rule-filter')404 .checkElementInclude('#coding-rules-total', '609')405 .clickElement('.js-rule-filter')406 .checkElementExist('.bubble-popup')407 .checkElementExist('.bubble-popup [data-property="languages"][data-value="java"]')408 .clearMocks()409 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-sql-tag.json', { data: { tags: 'sql' } })410 .clickElement('.bubble-popup [data-property="tags"][data-value="sql"]')411 .checkElementInclude('#coding-rules-total', '2');412 });413 bdd.it('should show active severity facet', function () {414 return this.remote415 .open()416 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')417 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')418 .startAppBrowserify('coding-rules')419 .checkElementExist('.coding-rule')420 .checkElementInclude('#coding-rules-total', '609')421 .checkElementExist('.search-navigator-facet-box-forbidden[data-property="active_severities"]')422 .clickElement('[data-property="qprofile"] .js-facet-toggle')423 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')424 .clearMocks()425 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-qprofile.json',426 { data: { qprofile: 'java-default-with-mojo-conventions-49307' } })427 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')428 .checkElementInclude('#coding-rules-total', '407')429 .checkElementNotExist('.search-navigator-facet-box-forbidden[data-property="active_severities"]')430 .clearMocks()431 .mockFromFile('/api/rules/search', 'coding-rules-spec/active-severities-facet.json',432 { data: { facets: 'active_severities', ps: 1 } })433 .clickElement('[data-property="active_severities"] .js-facet-toggle')434 .checkElementExist('[data-property="active_severities"] [data-value="BLOCKER"]')435 .clearMocks()436 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-BLOCKER.json',437 { data: { active_severities: 'BLOCKER' } })438 .clickElement('[data-property="active_severities"] [data-value="BLOCKER"]')439 .checkElementInclude('#coding-rules-total', '4')440 .clearMocks()441 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')442 .clickElement('[data-property="qprofile"] .js-facet-toggle')443 .checkElementInclude('#coding-rules-total', '609')444 .checkElementExist('.search-navigator-facet-box-forbidden[data-property="active_severities"]');445 });446 bdd.it('should show available since facet', function () {447 return this.remote448 .open()449 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')450 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')451 .startAppBrowserify('coding-rules')452 .checkElementExist('.coding-rule')453 .checkElementInclude('#coding-rules-total', '609')454 .clearMocks()455 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-limited.json',456 { data: { available_since: '2014-12-01' } })457 .clickElement('[data-property="available_since"] .js-facet-toggle')458 .fillElement('[data-property="available_since"] input', '2014-12-01')459 .execute(function () {460 // TODO do not use jQuery461 jQuery('[data-property="available_since"] input').change();462 })463 .checkElementInclude('#coding-rules-total', '101');464 });465 bdd.it('should bulk activate', function () {466 return this.remote467 .open()468 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')469 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')470 .mockFromString('/api/qualityprofiles/activate_rules', '{ "succeeded": 225 }')471 .startAppBrowserify('coding-rules')472 .forceJSON()473 .checkElementExist('.coding-rule')474 .checkElementExist('.js-bulk-change')475 .clickElement('.js-bulk-change')476 .checkElementExist('.bubble-popup')477 .checkElementExist('.bubble-popup .js-bulk-change[data-action="activate"]')478 .clickElement('.js-bulk-change[data-action="activate"]')479 .checkElementExist('.modal')480 .checkElementExist('.modal #coding-rules-bulk-change-profile')481 .checkElementExist('.modal #coding-rules-submit-bulk-change')482 .fillElement('#coding-rules-bulk-change-profile', 'java-default-with-mojo-conventions-49307')483 .clickElement('.modal #coding-rules-submit-bulk-change')484 .checkElementExist('.modal .alert-success')485 .checkElementInclude('.modal', 'Default - Maven Conventions')486 .checkElementInclude('.modal', 'Java')487 .checkElementInclude('.modal', '225');488 });489 bdd.it('should fail to bulk activate', function () {490 return this.remote491 .open()492 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')493 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')494 .mockFromString('/api/qualityprofiles/activate_rules', '{ "succeeded": 225, "failed": 395 }')495 .startAppBrowserify('coding-rules')496 .forceJSON()497 .checkElementExist('.coding-rule')498 .checkElementExist('.js-bulk-change')499 .clickElement('.js-bulk-change')500 .checkElementExist('.bubble-popup')501 .checkElementExist('.bubble-popup .js-bulk-change[data-action="activate"]')502 .clickElement('.js-bulk-change[data-action="activate"]')503 .checkElementExist('.modal')504 .checkElementExist('.modal #coding-rules-bulk-change-profile')505 .checkElementExist('.modal #coding-rules-submit-bulk-change')506 .fillElement('#coding-rules-bulk-change-profile', 'java-default-with-mojo-conventions-49307')507 .clickElement('.modal #coding-rules-submit-bulk-change')508 .checkElementExist('.modal .alert-warning')509 .checkElementInclude('.modal', '225')510 .checkElementInclude('.modal', '395');511 });512 bdd.it('should filter profiles by language during bulk change', function () {513 return this.remote514 .open()515 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')516 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')517 .startAppBrowserify('coding-rules')518 .checkElementExist('.coding-rule')519 .clickElement('.js-facet[data-value="java"]')520 .checkElementExist('.js-bulk-change')521 .clickElement('.js-bulk-change')522 .checkElementExist('.bubble-popup')523 .checkElementExist('.bubble-popup .js-bulk-change[data-action="activate"]')524 .clickElement('.js-bulk-change[data-action="activate"]')525 .checkElementExist('.modal')526 .checkElementExist('.modal #coding-rules-bulk-change-profile')527 .checkElementCount('.modal #coding-rules-bulk-change-profile option', 8);528 });529 bdd.it('should change selected profile during bulk change', function () {530 return this.remote531 .open()532 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')533 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-qprofile-active.json',534 { data: { activation: true } })535 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')536 .mockFromString('/api/qualityprofiles/deactivate_rules', '{ "succeeded": 7 }')537 .startAppBrowserify('coding-rules')538 .checkElementExist('.coding-rule')539 .clickElement('[data-property="qprofile"] .js-facet-toggle')540 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')541 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')542 .checkElementExist('.js-bulk-change')543 .clickElement('.js-bulk-change')544 .checkElementExist('.bubble-popup')545 .checkElementExist('.bubble-popup .js-bulk-change[data-param="java-default-with-mojo-conventions-49307"]')546 .clickElement('.js-bulk-change[data-param="java-default-with-mojo-conventions-49307"]')547 .checkElementExist('.modal')548 .checkElementNotExist('.modal #coding-rules-bulk-change-profile')549 .clickElement('.modal #coding-rules-submit-bulk-change')550 .checkElementExist('.modal .alert-success')551 .checkElementInclude('.modal', '7');552 });553 bdd.it('should show characteristic facet', function () {554 return this.remote555 .open()556 .mockFromString('/api/l10n/index', '{}')557 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')558 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')559 .startAppBrowserify('coding-rules')560 .checkElementExist('.coding-rule')561 .checkElementExist('.search-navigator-facet-box-collapsed[data-property="debt_characteristics"]')562 .clearMocks()563 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-characteristic.json',564 { data: { facets: 'debt_characteristics' } })565 .clickElement('[data-property="debt_characteristics"] .js-facet-toggle')566 .checkElementExist('.js-facet[data-value="PORTABILITY"]')567 .checkElementCount('[data-property="debt_characteristics"] .js-facet', 32)568 .checkElementCount('[data-property="debt_characteristics"] .js-facet.search-navigator-facet-indent', 24)569 .clearMocks()570 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-portability-characteristic.json',571 { data: { debt_characteristics: 'PORTABILITY' } })572 .clickElement('.js-facet[data-value="PORTABILITY"]')573 .checkElementInclude('#coding-rules-total', 21)574 .clearMocks()575 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-without-characteristic.json',576 { data: { has_debt_characteristic: 'false' } })577 .clickElement('.js-facet[data-empty-characteristic]')578 .checkElementInclude('#coding-rules-total', 208)579 .clearMocks()580 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-memory-efficiency-characteristic.json',581 { data: { debt_characteristics: 'MEMORY_EFFICIENCY' } })582 .clickElement('.js-facet[data-value="MEMORY_EFFICIENCY"]')583 .checkElementInclude('#coding-rules-total', 3);584 });585 bdd.it('should disable characteristic facet', function () {586 return this.remote587 .open()588 .mockFromString('/api/l10n/index', '{}')589 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')590 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')591 .startAppBrowserify('coding-rules')592 .checkElementExist('.coding-rule')593 .clearMocks()594 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-characteristic.json',595 { data: { facets: 'debt_characteristics' } })596 .clickElement('[data-property="debt_characteristics"] .js-facet-toggle')597 .checkElementExist('.js-facet[data-value="PORTABILITY"]')598 .clearMocks()599 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-portability-characteristic.json',600 { data: { debt_characteristics: 'PORTABILITY' } })601 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')602 .clickElement('.js-facet[data-value="PORTABILITY"]')603 .checkElementInclude('#coding-rules-total', 21)604 .clearMocks()605 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')606 .clickElement('[data-property="debt_characteristics"] .js-facet-toggle')607 .checkElementInclude('#coding-rules-total', 609)608 .clearMocks()609 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-characteristic.json',610 { data: { facets: 'debt_characteristics' } })611 .clickElement('[data-property="debt_characteristics"] .js-facet-toggle')612 .checkElementExist('.js-facet[data-value="MEMORY_EFFICIENCY"]')613 .clearMocks()614 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-memory-efficiency-characteristic.json',615 { data: { debt_characteristics: 'MEMORY_EFFICIENCY' } })616 .clickElement('.js-facet[data-value="MEMORY_EFFICIENCY"]')617 .checkElementInclude('#coding-rules-total', 3)618 .clearMocks()619 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')620 .clickElement('[data-property="debt_characteristics"] .js-facet-toggle')621 .checkElementInclude('#coding-rules-total', 609)622 .clearMocks()623 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-characteristic.json',624 { data: { facets: 'debt_characteristics' } })625 .clickElement('[data-property="debt_characteristics"] .js-facet-toggle')626 .checkElementExist('.js-facet[data-empty-characteristic]')627 .clearMocks()628 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-without-characteristic.json',629 { data: { has_debt_characteristic: 'false' } })630 .clickElement('.js-facet[data-empty-characteristic]')631 .checkElementInclude('#coding-rules-total', 208)632 .clearMocks()633 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')634 .clickElement('[data-property="debt_characteristics"] .js-facet-toggle')635 .checkElementInclude('#coding-rules-total', 609);636 });637 bdd.it('should show template facet', function () {638 return this.remote639 .open()640 .mockFromString('/api/l10n/index', '{}')641 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')642 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')643 .startAppBrowserify('coding-rules')644 .checkElementExist('.coding-rule')645 .checkElementExist('.search-navigator-facet-box-collapsed[data-property="is_template"]')646 .clickElement('[data-property="is_template"] .js-facet-toggle')647 .checkElementExist('[data-property="is_template"] .js-facet[data-value="true"]')648 .clearMocks()649 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-only-templates.json',650 { data: { 'is_template': 'true' } })651 .clickElement('[data-property="is_template"] .js-facet[data-value="true"]')652 .checkElementInclude('#coding-rules-total', 8)653 .clearMocks()654 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-hide-templates.json',655 { data: { 'is_template': 'false' } })656 .clickElement('[data-property="is_template"] .js-facet[data-value="false"]')657 .checkElementInclude('#coding-rules-total', 7)658 .clearMocks()659 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')660 .clickElement('[data-property="is_template"] .js-facet-toggle')661 .checkElementInclude('#coding-rules-total', 609);662 });663 bdd.it('should show language facet', function () {664 return this.remote665 .open()666 .mockFromString('/api/l10n/index', '{}')667 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')668 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')669 .mockFromString('/api/languages/list', '{"languages":[{"key":"custom","name":"Custom"}]}',670 { data: { q: 'custom' } })671 .startAppBrowserify('coding-rules')672 .checkElementExist('.coding-rule')673 .clickElement('[data-property="languages"] .select2-choice')674 .checkElementExist('.select2-search')675 .fillElement('.select2-input', 'custom')676 .execute(function () {677 // TODO remove jQuery usage678 jQuery('.select2-input').trigger('keyup-change');679 })680 .checkElementExist('.select2-result')681 .checkElementInclude('.select2-result', 'Custom')682 .clearMocks()683 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-with-custom-language.json',684 { data: { languages: 'custom' } })685 .execute(function () {686 // TODO remove jQuery usage687 jQuery('.select2-result').mouseup();688 })689 .checkElementInclude('#coding-rules-total', 13)690 .checkElementExist('[data-property="languages"] .js-facet.active')691 .checkElementInclude('[data-property="languages"] .js-facet.active', 'custom')692 .checkElementInclude('[data-property="languages"] .js-facet.active', '13');693 });694 bdd.it('should reload results', function () {695 return this.remote696 .open()697 .mockFromString('/api/l10n/index', '{}')698 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')699 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')700 .startAppBrowserify('coding-rules')701 .checkElementExist('.coding-rule')702 .checkElementInclude('#coding-rules-total', 609)703 .clearMocks()704 .mockFromFile('/api/rules/search', 'coding-rules-spec/search2.json')705 .clickElement('.js-reload')706 .checkElementInclude('#coding-rules-total', 413);707 });708 bdd.it('should do a new search', function () {709 return this.remote710 .open()711 .mockFromString('/api/l10n/index', '{}')712 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')713 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')714 .startAppBrowserify('coding-rules')715 .checkElementExist('.coding-rule')716 .checkElementInclude('#coding-rules-total', 609)717 .clearMocks()718 .mockFromFile('/api/rules/search', 'coding-rules-spec/search2.json', { data: { languages: 'java' } })719 .clickElement('.js-facet[data-value="java"]')720 .checkElementInclude('#coding-rules-total', 413)721 .clearMocks()722 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')723 .clickElement('.js-new-search')724 .checkElementInclude('#coding-rules-total', 609);725 });726 bdd.it('should go back', function () {727 return this.remote728 .open()729 .mockFromString('/api/l10n/index', '{}')730 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')731 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')732 .mockFromFile('/api/rules/show', 'coding-rules-spec/show.json')733 .startAppBrowserify('coding-rules')734 .checkElementExist('.coding-rule.selected')735 .clickElement('.coding-rule.selected .js-rule')736 .checkElementExist('.coding-rules-detail-header')737 .clickElement('.js-back')738 .checkElementNotExist('.js-back')739 .checkElementNotExist('.coding-rules-detail-header');740 });741 bdd.it('should show inheritance facet', function () {742 return this.remote743 .open()744 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')745 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')746 .startAppBrowserify('coding-rules')747 .checkElementExist('.coding-rule')748 .checkElementInclude('#coding-rules-total', '609')749 .checkElementExist('.search-navigator-facet-box-forbidden[data-property="inheritance"]')750 .clickElement('[data-property="qprofile"] .js-facet-toggle')751 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')752 .clearMocks()753 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-qprofile.json',754 { data: { qprofile: 'java-default-with-mojo-conventions-49307' } })755 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')756 .checkElementInclude('#coding-rules-total', '407')757 .checkElementNotExist('.search-navigator-facet-box-forbidden[data-property="inheritance"]')758 .clickElement('[data-property="inheritance"] .js-facet-toggle')759 .checkElementExist('[data-property="inheritance"] [data-value="NONE"]')760 .clearMocks()761 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-not-inherited.json',762 { data: { inheritance: 'NONE' } })763 .clickElement('[data-property="inheritance"] [data-value="NONE"]')764 .checkElementInclude('#coding-rules-total', '103')765 .clearMocks()766 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-inherited.json',767 { data: { inheritance: 'INHERITED' } })768 .clickElement('[data-property="inheritance"] [data-value="INHERITED"]')769 .checkElementInclude('#coding-rules-total', '101')770 .clearMocks()771 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-overriden.json',772 { data: { inheritance: 'OVERRIDES' } })773 .clickElement('[data-property="inheritance"] [data-value="OVERRIDES"]')774 .checkElementInclude('#coding-rules-total', '102')775 .clearMocks()776 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-qprofile2.json',777 { data: { qprofile: 'java-top-profile-without-formatting-conventions-50037' } })778 .clickElement('.js-facet[data-value="java-top-profile-without-formatting-conventions-50037"]')779 .checkElementInclude('#coding-rules-total', '408')780 .checkElementExist('.search-navigator-facet-box-forbidden[data-property="inheritance"]')781 .clearMocks()782 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')783 .clickElement('[data-property="qprofile"] .js-facet-toggle')784 .checkElementInclude('#coding-rules-total', '609')785 .checkElementExist('.search-navigator-facet-box-forbidden[data-property="inheritance"]');786 });787 bdd.it('should show activation details', function () {788 return this.remote789 .open()790 .mockFromString('/api/l10n/index', '{}')791 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')792 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')793 .startAppBrowserify('coding-rules')794 .checkElementExist('.coding-rule')795 .checkElementNotExist('.coding-rule-activation')796 .clickElement('[data-property="qprofile"] .js-facet-toggle')797 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')798 .clearMocks()799 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-actives.json', { data: { activation: true } })800 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')801 .checkElementCount('.coding-rule-activation', 2)802 .checkElementCount('.coding-rule-activation .icon-severity-major', 2)803 .checkElementCount('.coding-rule-activation .icon-inheritance', 1)804 .checkElementNotExist('.coding-rules-detail-quality-profile-activate');805 });806 bdd.it('should activate rule', function () {807 return this.remote808 .open()809 .mockFromString('/api/l10n/index', '{}')810 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')811 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-inactive.json',812 { data: { activation: 'false' } })813 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')814 .mockFromString('/api/qualityprofiles/activate_rule', '{}')815 .startAppBrowserify('coding-rules')816 .checkElementExist('.coding-rule')817 .checkElementNotExist('.coding-rule-activation')818 .clickElement('[data-property="qprofile"] .js-facet-toggle')819 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')820 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')821 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-inactive')822 .checkElementNotExist('.coding-rule-activation .icon-severity-major')823 .checkElementExist('.coding-rules-detail-quality-profile-activate')824 .clickElement('.coding-rules-detail-quality-profile-activate')825 .checkElementExist('.modal')826 .checkElementExist('#coding-rules-quality-profile-activation-select')827 .checkElementCount('#coding-rules-quality-profile-activation-select option', 1)828 .checkElementExist('#coding-rules-quality-profile-activation-severity')829 .clickElement('#coding-rules-quality-profile-activation-activate')830 .checkElementExist('.coding-rule-activation .icon-severity-major')831 .checkElementExist('.coding-rule-activation .icon-severity-major')832 .checkElementNotExist('.coding-rules-detail-quality-profile-activate')833 .checkElementExist('.coding-rules-detail-quality-profile-deactivate');834 });835 bdd.it('should deactivate rule', function () {836 return this.remote837 .open()838 .mockFromString('/api/l10n/index', '{}')839 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')840 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')841 .startAppBrowserify('coding-rules')842 .checkElementExist('.coding-rule')843 .checkElementNotExist('.coding-rule-activation')844 .clickElement('[data-property="qprofile"] .js-facet-toggle')845 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')846 .clearMocks()847 .mockFromString('/api/qualityprofiles/deactivate_rule', '{}')848 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-active.json', { data: { activation: true } })849 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')850 .checkElementExist('.coding-rule-activation .icon-severity-major')851 .checkElementNotExist('.coding-rules-detail-quality-profile-activate')852 .clickElement('.coding-rules-detail-quality-profile-deactivate')853 .checkElementExist('button[data-confirm="yes"]')854 .clickElement('button[data-confirm="yes"]')855 .checkElementNotExist('.coding-rule-activation .icon-severity-major')856 .checkElementNotExist('.coding-rule-activation .icon-severity-major')857 .checkElementExist('.coding-rules-detail-quality-profile-activate')858 .checkElementNotExist('.coding-rules-detail-quality-profile-deactivate');859 });860 bdd.it('should deactivate just activated rule', function () {861 return this.remote862 .open()863 .mockFromString('/api/l10n/index', '{}')864 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')865 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-inactive.json',866 { data: { activation: 'false' } })867 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')868 .mockFromString('/api/qualityprofiles/activate_rule', '{}',869 {870 data: {871 profile_key: 'java-default-with-mojo-conventions-49307',872 rule_key: 'common-java:FailedUnitTests'873 }874 })875 .mockFromString('/api/qualityprofiles/deactivate_rule', '{}',876 {877 data: {878 profile_key: 'java-default-with-mojo-conventions-49307',879 rule_key: 'common-java:FailedUnitTests'880 }881 })882 .startAppBrowserify('coding-rules')883 .checkElementExist('.coding-rule')884 .clickElement('[data-property="qprofile"] .js-facet-toggle')885 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')886 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')887 .clickElement('.js-facet[data-value="java-default-with-mojo-conventions-49307"] .js-inactive')888 .checkElementNotExist('.coding-rule-activation .icon-severity-major')889 .checkElementExist('.coding-rules-detail-quality-profile-activate')890 .clickElement('.coding-rules-detail-quality-profile-activate')891 .checkElementExist('.modal')892 .checkElementExist('#coding-rules-quality-profile-activation-select')893 .checkElementCount('#coding-rules-quality-profile-activation-select option', 1)894 .checkElementExist('#coding-rules-quality-profile-activation-severity')895 .clickElement('#coding-rules-quality-profile-activation-activate')896 .checkElementExist('.coding-rule-activation .icon-severity-major')897 .checkElementExist('.coding-rule-activation .icon-severity-major')898 .checkElementNotExist('.coding-rules-detail-quality-profile-activate')899 .checkElementExist('.coding-rules-detail-quality-profile-deactivate')900 .clickElement('.coding-rules-detail-quality-profile-deactivate')901 .clickElement('[data-confirm="yes"]')902 .checkElementNotExist('.coding-rule-activation .icon-severity-major')903 .checkElementNotExist('.coding-rule-activation .icon-severity-major')904 .checkElementExist('.coding-rules-detail-quality-profile-activate')905 .checkElementNotExist('.coding-rules-detail-quality-profile-deactivate');906 });907 bdd.it('should pre-select context profile in the activation modal', function () {908 return this.remote909 .open()910 .mockFromString('/api/l10n/index', '{}')911 .mockFromFile('/api/rules/app', 'coding-rules-spec/app.json')912 .mockFromFile('/api/rules/search', 'coding-rules-spec/search.json')913 .startAppBrowserify('coding-rules')914 .clickElement('[data-property="qprofile"] .js-facet-toggle')915 .checkElementExist('.js-facet[data-value="java-default-with-mojo-conventions-49307"]')916 .clearMocks()917 .mockFromFile('/api/rules/search', 'coding-rules-spec/search-inactive.json')918 .mockFromFile('/api/rules/show', 'coding-rules-spec/show-activate-profile.json')919 .clickElement('.js-facet[data-value="java-findbugs-14954"]')920 .clickElement('.js-facet[data-value="java-findbugs-14954"] .js-inactive')921 .checkElementExist('.coding-rule.selected')922 .clickElement('.coding-rule.selected .js-rule')923 .checkElementExist('.coding-rules-detail-header')924 .checkElementNotExist('.coding-rules-detail-quality-profile-name')925 .checkElementExist('#coding-rules-quality-profile-activate')926 .clickElement('#coding-rules-quality-profile-activate')927 .checkElementExist('.modal')928 .checkElementInclude('#coding-rules-quality-profile-activation-select option[selected]', 'FindBugs');929 });930 });...

Full Screen

Full Screen

from-import-ui.spec.js

Source:from-import-ui.spec.js Github

copy

Full Screen

...52 })53 describe('First time flow starting from an existing seed phrase', function () {54 it('clicks the continue button on the welcome screen', async function () {55 await driver.findElement(By.css('.welcome-page__header'))56 await driver.clickElement(57 By.xpath(58 `//button[contains(text(), '${enLocaleMessages.getStarted.message}')]`,59 ),60 )61 await driver.delay(largeDelayMs)62 })63 it('clicks the "Import Wallet" option', async function () {64 await driver.clickElement(65 By.xpath(`//button[contains(text(), 'Import wallet')]`),66 )67 await driver.delay(largeDelayMs)68 })69 it('clicks the "No thanks" option on the metametrics opt-in screen', async function () {70 await driver.clickElement(By.css('.btn-default'))71 await driver.delay(largeDelayMs)72 })73 it('imports a seed phrase', async function () {74 const [seedTextArea] = await driver.findElements(75 By.css('input[placeholder="Paste seed phrase from clipboard"]'),76 )77 await seedTextArea.sendKeys(testSeedPhrase)78 await driver.delay(regularDelayMs)79 const [password] = await driver.findElements(By.id('password'))80 await password.sendKeys('correct horse battery staple')81 const [confirmPassword] = await driver.findElements(82 By.id('confirm-password'),83 )84 confirmPassword.sendKeys('correct horse battery staple')85 await driver.clickElement(By.css('.first-time-flow__terms'))86 await driver.clickElement(87 By.xpath(`//button[contains(text(), 'Import')]`),88 )89 await driver.delay(regularDelayMs)90 })91 it('clicks through the success screen', async function () {92 await driver.findElement(93 By.xpath(`//div[contains(text(), 'Congratulations')]`),94 )95 await driver.clickElement(96 By.xpath(97 `//button[contains(text(), '${enLocaleMessages.endOfFlowMessage10.message}')]`,98 ),99 )100 await driver.delay(regularDelayMs)101 })102 })103 describe('Show account information', function () {104 it('shows the correct account address', async function () {105 await driver.clickElement(106 By.css('[data-testid="account-options-menu-button"]'),107 )108 await driver.clickElement(109 By.css('[data-testid="account-options-menu__account-details"]'),110 )111 await driver.findVisibleElement(By.css('.qr-code__wrapper'))112 await driver.delay(regularDelayMs)113 const [address] = await driver.findElements(114 By.css('.readonly-input__input'),115 )116 assert.equal(await address.getAttribute('value'), testAddress)117 await driver.clickElement(By.css('.account-modal__close'))118 await driver.delay(largeDelayMs)119 })120 it('shows a QR code for the account', async function () {121 await driver.clickElement(122 By.css('[data-testid="account-options-menu-button"]'),123 )124 await driver.clickElement(125 By.css('[data-testid="account-options-menu__account-details"]'),126 )127 await driver.findVisibleElement(By.css('.qr-code__wrapper'))128 const detailModal = await driver.findElement(By.css('span .modal'))129 await driver.delay(regularDelayMs)130 await driver.clickElement(By.css('.account-modal__close'))131 await driver.wait(until.stalenessOf(detailModal))132 await driver.delay(regularDelayMs)133 })134 })135 describe('Lock and unlock', function () {136 it('logs out of the account', async function () {137 await driver.clickElement(By.css('.account-menu__icon .identicon'))138 await driver.delay(regularDelayMs)139 const lockButton = await driver.findClickableElement(140 By.css('.account-menu__lock-button'),141 )142 assert.equal(await lockButton.getText(), 'Lock')143 await lockButton.click()144 await driver.delay(regularDelayMs)145 })146 it('accepts the account password after lock', async function () {147 const passwordField = await driver.findElement(By.id('password'))148 await passwordField.sendKeys('correct horse battery staple')149 await passwordField.sendKeys(Key.ENTER)150 await driver.delay(largeDelayMs)151 })152 })153 describe('Add an account', function () {154 it('switches to localhost', async function () {155 await driver.clickElement(By.css('.network-name'))156 await driver.delay(regularDelayMs)157 await driver.clickElement(158 By.xpath(`//span[contains(text(), 'Localhost')]`),159 )160 await driver.delay(largeDelayMs)161 })162 it('choose Create Account from the account menu', async function () {163 await driver.clickElement(By.css('.account-menu__icon'))164 await driver.delay(regularDelayMs)165 await driver.clickElement(166 By.xpath(`//div[contains(text(), 'Create Account')]`),167 )168 await driver.delay(regularDelayMs)169 })170 it('set account name', async function () {171 const [accountName] = await driver.findElements(172 By.css('.new-account-create-form input'),173 )174 await accountName.sendKeys('2nd account')175 await driver.delay(regularDelayMs)176 await driver.clickElement(177 By.xpath(`//button[contains(text(), 'Create')]`),178 )179 await driver.delay(regularDelayMs)180 })181 it('should show the correct account name', async function () {182 const accountName = await driver.findElement(183 By.css('.selected-account__name'),184 )185 assert.equal(await accountName.getText(), '2nd account')186 await driver.delay(regularDelayMs)187 })188 })189 describe('Switch back to original account', function () {190 it('chooses the original account from the account menu', async function () {191 await driver.clickElement(By.css('.account-menu__icon'))192 await driver.delay(regularDelayMs)193 await driver.clickElement(By.css('.account-menu__name'))194 await driver.delay(regularDelayMs)195 })196 })197 describe('Send ETH from inside MetaMask', function () {198 it('starts a send transaction', async function () {199 await driver.clickElement(By.css('[data-testid="eth-overview-send"]'))200 await driver.delay(regularDelayMs)201 const inputAddress = await driver.findElement(202 By.css('input[placeholder="Search, public address (0x), or ENS"]'),203 )204 await inputAddress.sendKeys('0x2f318C334780961FB129D2a6c30D0763d9a5C970')205 const inputAmount = await driver.findElement(By.css('.unit-input__input'))206 await inputAmount.sendKeys('1')207 // Set the gas limit208 await driver.clickElement(By.css('.advanced-gas-options-btn'))209 await driver.delay(regularDelayMs)210 const gasModal = await driver.findElement(By.css('span .modal'))211 await driver.clickElement(By.xpath(`//button[contains(text(), 'Save')]`))212 await driver.wait(until.stalenessOf(gasModal))213 await driver.delay(regularDelayMs)214 // Continue to next screen215 await driver.clickElement(By.xpath(`//button[contains(text(), 'Next')]`))216 await driver.delay(regularDelayMs)217 })218 it('confirms the transaction', async function () {219 await driver.clickElement(220 By.xpath(`//button[contains(text(), 'Confirm')]`),221 )222 await driver.delay(regularDelayMs)223 })224 it('finds the transaction in the transactions list', async function () {225 await driver.clickElement(By.css('[data-testid="home__activity-tab"]'))226 await driver.wait(async () => {227 const confirmedTxes = await driver.findElements(228 By.css(229 '.transaction-list__completed-transactions .transaction-list-item',230 ),231 )232 return confirmedTxes.length === 1233 }, 10000)234 const txValues = await driver.findElements(235 By.css('.transaction-list-item__primary-currency'),236 )237 assert.equal(txValues.length, 1)238 assert.ok(/-1\s*ETH/u.test(await txValues[0].getText()))239 })240 })241 describe('Imports an account with private key', function () {242 it('choose Create Account from the account menu', async function () {243 await driver.clickElement(By.css('.account-menu__icon'))244 await driver.delay(regularDelayMs)245 await driver.clickElement(246 By.xpath(`//div[contains(text(), 'Import Account')]`),247 )248 await driver.delay(regularDelayMs)249 })250 it('enter private key', async function () {251 const privateKeyInput = await driver.findElement(252 By.css('#private-key-box'),253 )254 await privateKeyInput.sendKeys(testPrivateKey2)255 await driver.delay(regularDelayMs)256 await driver.clickElement(257 By.xpath(`//button[contains(text(), 'Import')]`),258 )259 await driver.delay(regularDelayMs)260 })261 it('should show the correct account name', async function () {262 const accountName = await driver.findElement(263 By.css('.selected-account__name'),264 )265 assert.equal(await accountName.getText(), 'Account 4')266 await driver.delay(regularDelayMs)267 })268 it('should show the imported label', async function () {269 await driver.clickElement(By.css('.account-menu__icon'))270 // confirm 4th account is account 4, as expected271 const accountMenuItemSelector = '.account-menu__account:nth-child(4)'272 const accountName = await driver.findElement(273 By.css(`${accountMenuItemSelector} .account-menu__name`),274 )275 assert.equal(await accountName.getText(), 'Account 4')276 // confirm label is present on the same menu item277 const importedLabel = await driver.findElement(278 By.css(`${accountMenuItemSelector} .keyring-label`),279 )280 assert.equal(await importedLabel.getText(), 'IMPORTED')281 })282 })283 describe('Imports and removes an account', function () {284 it('choose Create Account from the account menu', async function () {285 await driver.clickElement(286 By.xpath(`//div[contains(text(), 'Import Account')]`),287 )288 await driver.delay(regularDelayMs)289 })290 it('enter private key', async function () {291 const privateKeyInput = await driver.findElement(292 By.css('#private-key-box'),293 )294 await privateKeyInput.sendKeys(testPrivateKey3)295 await driver.delay(regularDelayMs)296 await driver.clickElement(297 By.xpath(`//button[contains(text(), 'Import')]`),298 )299 await driver.delay(regularDelayMs)300 })301 it('should see new account in account menu', async function () {302 const accountName = await driver.findElement(303 By.css('.selected-account__name'),304 )305 assert.equal(await accountName.getText(), 'Account 5')306 await driver.delay(regularDelayMs)307 await driver.clickElement(By.css('.account-menu__icon'))308 await driver.delay(regularDelayMs)309 const accountListItems = await driver.findElements(310 By.css('.account-menu__account'),311 )312 assert.equal(accountListItems.length, 5)313 await driver.clickPoint(By.css('.account-menu__icon'), 0, 0)314 })315 it('should open the remove account modal', async function () {316 await driver.clickElement(317 By.css('[data-testid="account-options-menu-button"]'),318 )319 await driver.clickElement(320 By.css('[data-testid="account-options-menu__remove-account"]'),321 )322 await driver.findElement(By.css('.confirm-remove-account__account'))323 })324 it('should remove the account', async function () {325 await driver.clickElement(326 By.xpath(`//button[contains(text(), 'Remove')]`),327 )328 await driver.delay(regularDelayMs)329 const accountName = await driver.findElement(330 By.css('.selected-account__name'),331 )332 assert.equal(await accountName.getText(), 'Account 1')333 await driver.delay(regularDelayMs)334 await driver.clickElement(By.css('.account-menu__icon'))335 const accountListItems = await driver.findElements(336 By.css('.account-menu__account'),337 )338 assert.equal(accountListItems.length, 4)339 })340 })341 describe('Connects to a Hardware wallet', function () {342 it('choose Connect Hardware Wallet from the account menu', async function () {343 await driver.clickElement(344 By.xpath(`//div[contains(text(), 'Connect Hardware Wallet')]`),345 )346 await driver.delay(regularDelayMs)347 })348 it('should open the TREZOR Connect popup', async function () {349 await driver.clickElement(By.css('.hw-connect__btn:nth-of-type(2)'))350 await driver.delay(regularDelayMs)351 await driver.clickElement(352 By.xpath(`//button[contains(text(), 'Connect')]`),353 )354 await driver.delay(regularDelayMs)355 const allWindows = await driver.getAllWindowHandles()356 assert.equal(allWindows.length, 2)357 })358 })...

Full Screen

Full Screen

users.spec.js

Source:users.spec.js Github

copy

Full Screen

...16 .checkElementCount('#users-list .js-user-change-password', 3)17 .checkElementCount('#users-list .js-user-deactivate', 3)18 .checkElementInclude('#users-list-footer', '3/3')19 .checkElementNotInclude('[data-login="ryan"]', 'another@example.com')20 .clickElement('[data-login="ryan"] .js-user-more-scm')21 .checkElementInclude('[data-login="ryan"]', 'another@example.com')22 .checkElementNotInclude('[data-login="ryan"]', 'four')23 .clickElement('[data-login="ryan"] .js-user-more-groups')24 .checkElementInclude('[data-login="ryan"]', 'four');25 });26 bdd.it('should search users', function () {27 return this.remote28 .open()29 .mockFromString('/api/l10n/index', '{}')30 .mockFromFile('/api/users/search', 'users-spec/search.json')31 .startAppBrowserify('users')32 .checkElementCount('#users-list li[data-login]', 3)33 .clearMocks()34 .mockFromFile('/api/users/search', 'users-spec/search-filtered.json')35 .fillElement('#users-search-query', 'ryan')36 .clickElement('#users-search-submit')37 .checkElementNotExist('[data-login="admin"]')38 .checkElementCount('#users-list li[data-login]', 1)39 .clearMocks()40 .mockFromFile('/api/users/search', 'users-spec/search.json')41 .fillElement('#users-search-query', '')42 .clickElement('#users-search-submit')43 .checkElementCount('[data-login="admin"]', 1)44 .checkElementCount('#users-list li[data-login]', 3);45 });46 bdd.it('should show more', function () {47 return this.remote48 .open()49 .mockFromString('/api/l10n/index', '{}')50 .mockFromFile('/api/users/search', 'users-spec/search-big-1.json')51 .startAppBrowserify('users')52 .checkElementCount('#users-list li[data-login]', 2)53 .clearMocks()54 .mockFromFile('/api/users/search', 'users-spec/search-big-2.json')55 .clickElement('#users-fetch-more')56 .checkElementCount('[data-login="ryan"]', 1)57 .checkElementCount('#users-list li[data-login]', 3);58 });59 bdd.it('should create a new user', function () {60 return this.remote61 .open()62 .mockFromString('/api/l10n/index', '{}')63 .mockFromFile('/api/users/search', 'users-spec/search.json')64 .startAppBrowserify('users')65 .checkElementCount('#users-list li[data-login]', 3)66 .clickElement('#users-create')67 .checkElementCount('#create-user-form', 1)68 .clearMocks()69 .mockFromFile('/api/users/search', 'users-spec/search-created.json')70 .mockFromString('/api/users/create', '{}')71 .clickElement('#create-user-add-scm-account')72 .clickElement('#create-user-add-scm-account')73 .fillElement('#create-user-login', 'login')74 .fillElement('#create-user-name', 'name')75 .fillElement('#create-user-email', 'email@example.com')76 .fillElement('#create-user-password', 'secret')77 .fillElement('[name="scmAccounts"]:first-child', 'scm1')78 .fillElement('[name="scmAccounts"]:last-child', 'scm2')79 .clickElement('#create-user-submit')80 .checkElementCount('[data-login="login"]', 1)81 .checkElementCount('#users-list li[data-login]', 4)82 .checkElementInclude('#users-list .js-user-login', 'login')83 .checkElementInclude('#users-list .js-user-name', 'name')84 .checkElementInclude('#users-list .js-user-email', 'email@example.com');85 });86 bdd.it('should update a user', function () {87 return this.remote88 .open()89 .mockFromString('/api/l10n/index', '{}')90 .mockFromFile('/api/users/search', 'users-spec/search.json')91 .startAppBrowserify('users')92 .clickElement('[data-login="smith"] .js-user-update')93 .checkElementCount('#create-user-form', 1)94 .clearMocks()95 .mockFromFile('/api/users/search', 'users-spec/search-updated.json')96 .mockFromString('/api/users/update', '{}')97 .clickElement('#create-user-add-scm-account')98 .fillElement('#create-user-name', 'Mike')99 .fillElement('#create-user-email', 'mike@example.com')100 .fillElement('[name="scmAccounts"]:first-child', 'scm5')101 .fillElement('[name="scmAccounts"]:last-child', 'scm6')102 .clickElement('#create-user-submit')103 .waitForDeletedByCssSelector('#create-user-form')104 .checkElementInclude('[data-login="smith"] .js-user-login', 'smith')105 .checkElementInclude('[data-login="smith"] .js-user-name', 'Mike')106 .checkElementInclude('[data-login="smith"] .js-user-email', 'mike@example.com');107 });108 bdd.it('should change user\'s password', function () {109 return this.remote110 .open()111 .mockFromString('/api/l10n/index', '{}')112 .mockFromFile('/api/users/search', 'users-spec/search.json')113 .startAppBrowserify('users')114 .clickElement('[data-login="smith"] .js-user-change-password')115 .checkElementCount('#change-user-password-form', 1)116 .clearMocks()117 .mockFromString('/api/users/change_password', '{}')118 .fillElement('#change-user-password-password', 'secret')119 .fillElement('#change-user-password-password-confirmation', 'another')120 .clickElement('#change-user-password-submit')121 .checkElementCount('.alert.alert-danger', 1)122 .fillElement('#change-user-password-password', 'secret')123 .fillElement('#change-user-password-password-confirmation', 'secret')124 .clickElement('#change-user-password-submit')125 .waitForDeletedByCssSelector('#change-user-password-form');126 });127 bdd.it('should deactivate a user', function () {128 return this.remote129 .open()130 .mockFromString('/api/l10n/index', '{}')131 .mockFromFile('/api/users/search', 'users-spec/search.json')132 .startAppBrowserify('users')133 .clickElement('[data-login="smith"] .js-user-deactivate')134 .checkElementCount('#deactivate-user-form', 1)135 .clearMocks()136 .mockFromString('/api/users/deactivate', '{}')137 .clickElement('#deactivate-user-submit')138 .waitForDeletedByCssSelector('[data-login="smith"]');139 });140 });...

Full Screen

Full Screen

groups.spec.js

Source:groups.spec.js Github

copy

Full Screen

...26 .checkElementCount('#groups-list li[data-id]', 2)27 .clearMocks()28 .mockFromFile('/api/user_groups/search', 'groups-spec/search-filtered.json', { data: { q: 'adm' } })29 .fillElement('#groups-search-query', 'adm')30 .clickElement('#groups-search-submit')31 .checkElementInclude('#groups-list-footer', '1/1')32 .checkElementCount('#groups-list li[data-id]', 1)33 .clearMocks()34 .mockFromFile('/api/user_groups/search', 'groups-spec/search.json')35 .fillElement('#groups-search-query', '')36 .clickElement('#groups-search-submit')37 .checkElementInclude('#groups-list-footer', '2/2')38 .checkElementCount('#groups-list li[data-id]', 2);39 });40 bdd.it('should show more', function () {41 return this.remote42 .open()43 .mockFromFile('/api/user_groups/search', 'groups-spec/search-big-1.json')44 .startAppBrowserify('groups')45 .checkElementInclude('#content', 'sonar-users')46 .checkElementCount('#groups-list li[data-id]', 1)47 .checkElementInclude('#groups-list-footer', '1/2')48 .clearMocks()49 .mockFromFile('/api/user_groups/search', 'groups-spec/search-big-2.json', { data: { p: 2 } })50 .clickElement('#groups-fetch-more')51 .checkElementInclude('#groups-list-footer', '2/2')52 .checkElementCount('#groups-list li[data-id]', 2);53 });54 bdd.it('should show users', function () {55 return this.remote56 .open()57 .mockFromFile('/api/user_groups/search', 'groups-spec/search.json')58 .mockFromFile('/api/user_groups/users*', 'groups-spec/users.json')59 .startAppBrowserify('groups')60 .checkElementInclude('#content', 'sonar-users')61 .checkElementNotInclude('#content', 'Bob')62 .clickElement('[data-id="1"] .js-group-users')63 .checkElementInclude('#groups-users', 'Bob')64 .checkElementInclude('#groups-users', 'John');65 });66 bdd.it('should create new group', function () {67 return this.remote68 .open()69 .mockFromFile('/api/user_groups/search', 'groups-spec/search.json')70 .mockFromFile('/api/user_groups/create', 'groups-spec/error.json', { status: 400 })71 .startAppBrowserify('groups')72 .checkElementInclude('#content', 'sonar-users')73 .checkElementCount('#groups-list li[data-id]', 2)74 .clickElement('#groups-create')75 .checkElementExist('#create-group-form')76 .fillElement('#create-group-name', 'name')77 .fillElement('#create-group-description', 'description')78 .clickElement('#create-group-submit')79 .checkElementExist('.alert.alert-danger')80 .clearMocks()81 .mockFromFile('/api/user_groups/search', 'groups-spec/search-created.json')82 .mockFromString('/api/user_groups/create', '{}', { data: { name: 'name', description: 'description' } })83 .fillElement('#create-group-name', 'name')84 .fillElement('#create-group-description', 'description')85 .clickElement('#create-group-submit')86 .checkElementCount('#groups-list li[data-id]', 3)87 .checkElementInclude('#groups-list .js-group-name', 'name')88 .checkElementInclude('#groups-list .js-group-description', 'description');89 });90 bdd.it('should update group', function () {91 return this.remote92 .open()93 .mockFromFile('/api/user_groups/search', 'groups-spec/search.json')94 .mockFromFile('/api/user_groups/update', 'groups-spec/error.json', { status: 400 })95 .startAppBrowserify('groups')96 .checkElementInclude('#content', 'sonar-users')97 .clickElement('[data-id="2"] .js-group-update')98 .checkElementExist('#create-group-form')99 .fillElement('#create-group-name', 'guys')100 .fillElement('#create-group-description', 'cool guys')101 .clickElement('#create-group-submit')102 .checkElementExist('.alert.alert-danger')103 .clearMocks()104 .mockFromFile('/api/user_groups/search', 'groups-spec/search-updated.json')105 .mockFromString('/api/user_groups/update', '{}', { data: { id: '2' } })106 .fillElement('#create-group-name', 'guys')107 .fillElement('#create-group-description', 'cool guys')108 .clickElement('#create-group-submit')109 .checkElementInclude('[data-id="2"] .js-group-name', 'guys')110 .checkElementInclude('[data-id="2"] .js-group-description', 'cool guys');111 });112 bdd.it('should delete group', function () {113 return this.remote114 .open()115 .mockFromFile('/api/user_groups/search', 'groups-spec/search.json')116 .mockFromFile('/api/user_groups/delete', 'groups-spec/error.json', { status: 400 })117 .startAppBrowserify('groups')118 .checkElementInclude('#content', 'sonar-users')119 .clickElement('[data-id="1"] .js-group-delete')120 .checkElementExist('#delete-group-form')121 .clickElement('#delete-group-submit')122 .checkElementExist('.alert.alert-danger')123 .clickElement('.js-modal-close')124 .checkElementNotExist('#delete-group-form')125 .clickElement('[data-id="1"] .js-group-delete')126 .checkElementExist('#delete-group-form')127 .clearMocks()128 .mockFromString('/api/user_groups/delete', '{}', { data: { id: '1' } })129 .clickElement('#delete-group-submit')130 .checkElementNotExist('[data-id="1"]');131 });132 });...

Full Screen

Full Screen

sanpdeal.page.js

Source:sanpdeal.page.js Github

copy

Full Screen

...3const util = require('../../util/element.util')4class SnapdealPage{5 addUsingSearch(){6 util.doSetValue(snapdealElements.searchBox, 'Zebronics ZEB-COROLLA') // put value in the search Box7 util.clickElement(snapdealElements.searchButton)8 util.clickElement(snapdealElements.zebronicsEarphone)9 browserUtil.switchToTab('Zebronics ZEB-COROLLA') // switch to the child window10 this.addToCart()11 this.goToCart()12 }13 addUsingMenu(){14 util.moveToElement(snapdealElements.computersOption)15 //util.moveToElement(snapdealElements.hpLink)16 util.moveToElement(snapdealElements.LenovoLink)17 util.clickElement(snapdealElements.LenovoLink)18 util.clickElement(snapdealElements.lenovoLaptop)19 browserUtil.switchToTab('Lenovo Ideapad 330s')20 this.addToCart()21 this.goToCart() 22 }23 addMultiple(){24 util.doSetValue(snapdealElements.searchBox, 'Redmi 8 ( 64GB , 4 GB ) Red') // put value in the search Box25 util.clickElement(snapdealElements.searchButton)//click the searchButton26 util.clickElement(snapdealElements.redmiPhone)//click the searchItem27 browserUtil.switchToTab('Redmi 8 ( 64GB , 4 GB ) Red') // switch to the child window28 this.addToCart()//add to the cart29 util.moveToElement(snapdealElements.menuIconLoader)30 util.moveToElement(snapdealElements.computersOption)31 util.clickElement(snapdealElements.hpLink)32 util.clickElement(snapdealElements.laptopLink)33 browserUtil.switchToTab('HP Pavilion 14 14-ce3024TX')34 this.addToCart()35 util.doSetValue(snapdealElements.searchBox, 'Columbus TB-1012 Navy Running Shoes') // put value in the search Box36 util.clickElement(snapdealElements.searchButton)//click the searchButton37 util.clickElement(snapdealElements.columbus)38 browserUtil.switchToTab("Columbus TB-1012 Navy Running Shoes")39 this.addToCart()40 util.doSetValue(snapdealElements.searchBox, 'Hangup Navy Silk Blend Kurta Pyjama Set') // put value in the search Box41 util.clickElement(snapdealElements.searchButton)42 util.clickElement(snapdealElements.pyjama)43 browserUtil.switchToTab('Hangup Navy Silk Blend Kurta Pyjama Set')44 this.addToCart()45 this.goToCart()46 }47 checkingValidPin(pin){48 util.doSetValue(snapdealElements.searchBox, snapdealElements.searchText) // put value in the search Box49 util.clickElement(snapdealElements.searchButton)//click the searchButton50 util.clickElement(snapdealElements.searchItem)//click the searchItem51 browserUtil.switchToTab('AgroShan Quinoa flour') // switch to the child window52 util.doSetValue(snapdealElements.pincodeCheck, pin)//setting the value for pincode53 util.clickElement(snapdealElements.pincodeButton)//clicking on check button54 }55 checkingInvalidPin(pin){56 util.doSetValue(snapdealElements.searchBox, 'Pedigree Adult Dog Food') // put value in the search Box57 util.clickElement(snapdealElements.searchButton)//click the searchButton58 util.clickElement(snapdealElements.pedigree)59 browserUtil.switchToTab("Pedigree Adult Dog Food (High Protein variant)")60 util.doSetValue(snapdealElements.pincodeCheck, pin)//setting the value for pincode61 util.clickElement(snapdealElements.pincodeButton)//clicking on check button62 }63 isPresent(element, itemName){64 var str = element.getText()65 if(str.includes(itemName))66 return true67 else68 return false69 }70 isPresentInCart(elements, itemName){71 var listOfElements = elements.map(link=>link.getText())72 for(var i in listOfElements){73 var str = listOfElements[i]74 if(str.includes(itemName))75 return true76 }77 return false78 }79 addToCart(){80 util.clickElement(snapdealElements.addToCart)81 }82 goToCart(){83 util.clickElement(snapdealElements.cartButton)84 }85}...

Full Screen

Full Screen

commonPageObjects.js

Source:commonPageObjects.js Github

copy

Full Screen

...42 urlPage(url) {43 cy.url().should('include', url);44 }45 clickOnboardStepButton(nameOnboardButton) {46 cy.contains(nameOnboardButton).clickElement(onboardingCreateProjectButton);47 }48 onboardingCompleteIsVisible() {49 cy.get(".cq-onboarding-info-header").contains("Onboarding completed!").should("be.visible");50 }51 waitLoaderNotBeVisible() {52 cy.get(loader_selector).should('not.be.visible')53 }54 // Dashboard menu55 clickDashboardSettingsMenu() {56 cy.clickElement(dashboardMenu_selector);57 cy.wait(3000);58 cy.clickElement(dashboardSetting_selector);59 }60 selectDashboardDevelopersPage() {61 cy.clickElement(dashboardMenu_selector);62 cy.clickElement(dashboardDev_selector);63 }64 selectDashboardCommitsPage() {65 cy.clickElement(dashboardMenu_selector);66 cy.clickElement(dashboardCommits_selector);67 }68 selectDashboardViolationsPage() {69 cy.clickElement(dashboardMenu_selector);70 cy.clickElement(dashboardViolations_selector);71 }72 selectDashboardOverviewPage() {73 cy.clickElement(dashboardMenu_selector);74 cy.clickElement(dashboardOverview_selector);75 }76 // Date Filter77 selectOverAllDate() {78 cy.get(dateFilterButton_selector).should('be.visible').click();79 cy.wait(3000);80 cy.get(overallDate_button_selector).contains('Overall').should('be.visible').click();81 cy.get(closeFilterDate_selector).contains('Close').should('be.visible').click();82 }83 // Pricing page84 goToPricingPageSignIn() {85 cy.get(link_pricingPage_selector).contains('Pricing').should('be.visible');86 cy.clickElement(link_pricingPage_selector);87 }88 // Account settings page89 goToAccountSettingsPage() {90 cy.get(gravatarUser_selector).should('be.visible').click();91 cy.get(dropdownMenu_accountSettings_selector).contains('Account Settings').should('be.visible').click();92 }93}...

Full Screen

Full Screen

clickElement.spec.js

Source:clickElement.spec.js Github

copy

Full Screen

...20 toHaveLength: expectToHaveLengthOf,21 }));22 });23 it('should fail if the given element does not exist', async () => {24 await clickElement('click', 'element', 'element0');25 _expect(global.$).toHaveBeenCalledWith('element0');26 _expect(clickMock).toHaveBeenCalled();27 _expect(expectToHaveLengthOfAtLeast).toHaveBeenCalledTimes(1);28 _expect(expectToHaveLengthOfAtLeast).toHaveBeenCalledWith(29 1,30 'Element with selector "element0" should exist on the page'31 );32 });33 it('should call click on the browser', async () => {34 await clickElement('click', 'element', 'element1');35 _expect(global.$).toHaveBeenCalledWith('element1');36 _expect(clickMock).toHaveBeenCalled();37 _expect(expectToHaveLengthOfAtLeast).toHaveBeenCalledTimes(1);38 _expect(expectToHaveLengthOfAtLeast).toHaveBeenCalledWith(39 1,40 'Element with selector "element1" should exist on the page'41 );42 });43 it('should call doubleClick on the browser', async () => {44 await clickElement('doubleClick', 'element', 'element2');45 _expect(global.$).toHaveBeenCalledWith('element2');46 _expect(doubleClickMock).toHaveBeenCalled();47 _expect(expectToHaveLengthOfAtLeast).toHaveBeenCalledTimes(1);48 _expect(expectToHaveLengthOfAtLeast).toHaveBeenCalledWith(49 1,50 'Element with selector "element2" should exist on the page'51 );52 });53 it('should click a link when type is `link`', async () => {54 await clickElement('click', 'link', 'element3');55 _expect(global.$).toHaveBeenCalledWith('=element3');56 _expect(clickMock).toHaveBeenCalled();57 _expect(expectToHaveLengthOfAtLeast).toHaveBeenCalledTimes(1);58 _expect(expectToHaveLengthOfAtLeast).toHaveBeenCalledWith(59 1,60 'Element with selector "=element3" should exist on the page'61 );62 });...

Full Screen

Full Screen

show-sensitive-data.js

Source:show-sensitive-data.js Github

copy

Full Screen

1/*!2 * Matomo - free/libre analytics platform3 *4 * @link https://matomo.org5 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later6 */7/**8 * Handles visibility of sensitive data. By default data will be shown replaced with stars (*)9 * On click on the element the full data will be shown10 *11 * Configuration attributes:12 * data-show-characters number of characters to show in clear text (defaults to 6)13 * data-click-element-selector selector for element that will show the full data on click (defaults to element)14 *15 * Example:16 * <div piwik-show-sensitive-date="some text"></div>17 */18(function () {19 angular.module('piwikApp.directive').directive('piwikShowSensitiveData', piwikShowSensitiveData);20 function piwikShowSensitiveData(){21 return {22 restrict: 'A',23 link: function(scope, element, attr) {24 var sensitiveData = attr.piwikShowSensitiveData || (attr.text ? attr.text() : '');25 var showCharacters = attr.showCharacters || 6;26 var clickElement = attr.clickElementSelector || element;27 var protectedData = '';28 if (showCharacters > 0) {29 protectedData += sensitiveData.substr(0, showCharacters);30 }31 protectedData += sensitiveData.substr(showCharacters).replace(/./g, '*');32 element.html(protectedData);33 function onClickHandler(event) {34 element.html(sensitiveData);35 $(clickElement).css({36 cursor: ''37 });38 $(clickElement).tooltip("destroy");39 }40 $(clickElement).tooltip({41 content: _pk_translate('CoreHome_ClickToSeeFullInformation'),42 items: '*',43 track: true44 });45 $(clickElement).one('click', onClickHandler);46 $(clickElement).css({47 cursor: 'pointer'48 });49 }50 };51 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder()3 .withCapabilities({4 })5 .build();6driver.executeScript('mobile: click', {element: 'id'})7 .then(function() {8 console.log('click done');9 })10 .catch(function(err) {11 console.log(err);12 });13driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { remote } = require('webdriverio');2(async () => {3 const browser = await remote({4 capabilities: {5 }6 });7 const element = await browser.$('#tsf > div:nth-child(2) > div.A8SBwf.emcav > div.RNNXgb > div > div.a4bIc > input');8 await browser.clickElement(element.elementId);9})();10{11 "scripts": {12 },13 "dependencies": {14 }15}

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder()3.forBrowser('selenium')4.build();5driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');6driver.findElement(webdriver.By.name('btnG')).click();7driver.quit();8var webdriver = require('selenium-webdriver');9var driver = new webdriver.Builder()10.forBrowser('selenium')11.build();12driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');13driver.findElement(webdriver.By.name('btnG')).click();14driver.quit();15var webdriver = require('selenium-webdriver');16var driver = new webdriver.Builder()17.forBrowser('selenium')18.build();19driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');20driver.findElement(webdriver.By.name('btnG')).click();21driver.quit();22var webdriver = require('selenium-webdriver');23var driver = new webdriver.Builder()24.forBrowser('selenium')25.build();26driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');27driver.findElement(webdriver.By.name('btnG')).click();28driver.quit();29var webdriver = require('selenium-webdriver');30var driver = new webdriver.Builder()31.forBrowser('selenium')32.build();33driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');34driver.findElement(webdriver.By.name('btnG')).click();35driver.quit();36var webdriver = require('selenium-webdriver');37var driver = new webdriver.Builder()38.forBrowser('selenium')

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var driver = new webdriver.Builder().forBrowser('selenium').build();3var By = webdriver.By;4driver.findElement(By.name('q')).sendKeys('webdriver');5driver.findElement(By.name('btnG')).click();6driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2}).build();3var webdriver = require('selenium-webdriver');4}).build();5var webdriver = require('selenium-webdriver');6}).build();7var webdriver = require('selenium-webdriver');8}).build();9var webdriver = require('selenium-webdriver');10}).build();11driver.clickElement('xpath',

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('XCUITestDriver - clickElement', function() {2 it('should click on an element', async function() {3 let driver = await wd.promiseChainRemote({4 });5 await driver.init({6 });7 });8});9info: [debug] [JSONWP Proxy] Got response with status 200: {"value":{"ELEMENT":"2"},"sessionId":"2F2C1D11-6E0B-4D7C-9C3E-3E6C2D5F5F6C","status":0}10info: [debug] [MJSONWP] Responding to client with driver.clickElement() result: null

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.clickElement('id', 'button');2driver.clickElement('id', 'button');3driver.clickElement('id', 'button');4driver.clickElement('id', 'button');5driver.clickElement('id', 'button');6driver.clickElement('id', 'button');7driver.clickElement('id', 'button');8driver.clickElement('id', 'button');9driver.clickElement('id', 'button');10driver.clickElement('id', 'button');11driver.clickElement('id', 'button');12driver.clickElement('id', 'button');

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful