diff --git a/CHANGELOG.md b/CHANGELOG.md index 97a9e0f4f..c13091144 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ All notable changes to AET will be documented in this file. - [PR-338](https://github.com/Cognifide/aet/pull/338) Enable creating new dbs by default - [PR-345](https://github.com/Cognifide/aet/pull/345) Deprecate AET maven plugin - [PR-301](https://github.com/Cognifide/aet/pull/301) New versions of virtualization tools used with new AET cookbook +- [PR-360](https://github.com/Cognifide/aet/pull/360) Keyboard shortcuts for 'Accept/Revert url/test' buttons ([#317](https://github.com/Cognifide/aet/issues/317)) ## Version 2.1.6 diff --git a/documentation/src/main/wiki/SuiteReportFeatures.md b/documentation/src/main/wiki/SuiteReportFeatures.md index a01c59c9e..8924275e3 100644 --- a/documentation/src/main/wiki/SuiteReportFeatures.md +++ b/documentation/src/main/wiki/SuiteReportFeatures.md @@ -63,6 +63,9 @@ Blue version means that it is a rebased version of previous suite - this is also * use **[** / **]** to navigate between test's urls * press **m** to show/hide layout mask (when available) * press **←** / **→** to navigate between url's tabs +* press **a** for accepting suite/test/url +* press **r** for reverting suite/test/url +* **shift** modifier that will define that the specific opened test case should be accepted/reverted (shift + A - accepts opened test case ; shift + R - reverts opened test case ) #### Rerun @@ -76,4 +79,4 @@ Or just one url: ![Url rerun](assets/suiteReport/rerun-url.png) After scheduling task from the report progress bar will be presented. -When the task is finished, result will be presented on the report. \ No newline at end of file +When the task is finished, result will be presented on the report. diff --git a/report/src/main/webapp/app/components/keyboardShortcuts.directive.js b/report/src/main/webapp/app/components/keyboardShortcuts.directive.js index 9da4dcf47..5ce688f88 100644 --- a/report/src/main/webapp/app/components/keyboardShortcuts.directive.js +++ b/report/src/main/webapp/app/components/keyboardShortcuts.directive.js @@ -29,45 +29,41 @@ define(['angularAMD', 'userSettingsService'], function (angularAMD) { function linkFunc(scope) { - /* - code 37 - arrow left - code 39 - arrow right - code 69 - e - code 77 - m - code 81 - q - code 219 - [ - code 221 - ] - */ - var shortcuts = { - '37': function () { - goToTab('prev'); - }, - '39': function () { - goToTab('next'); + 'ArrowLeft': goToTab, + 'ArrowRight': goToTab, + 'e': toggleErrors, + 'm': toggleMask, + 'q': toggleAll, + '[': function () { + scope.traverseTree('up'); }, - '69': function () { - toggleErrors(); + ']': function () { + scope.traverseTree('down'); }, - '77': function () { - toggleMask(); + 'a': function () { + clickById('#accept-test'); }, - '81': function () { - toggleAll(); + 'r': function () { + clickById('#revert-test'); }, - '219': function () { - scope.traverseTree('up'); + 'A': function (event) { + if (!event.ctrlKey) {} { + clickById('#accept-test-case'); + } }, - '221': function () { - scope.traverseTree('down'); + 'R': function (event) { + if (!event.ctrlKey) {} { + clickById('#revert-test-case'); + } } }; $(document).on('keydown', function (e) { - if ($('body').hasClass('modal-open')) { + if ($('body').hasClass('modal-open') || $(e.target).hasClass('search-input')) { return true; - } else if (shortcuts[e.keyCode]) { - shortcuts[e.keyCode](); + } else if (shortcuts[e.key]) { + shortcuts[e.key](e); } }); @@ -86,11 +82,15 @@ define(['angularAMD', 'userSettingsService'], function (angularAMD) { } }; - function goToTab(direction) { + function clickById(id) { + $(id).click(); + } + + function goToTab(event) { var $tabs = $('.test-tabs'), $active = $tabs.find('.active'); - if (direction === 'prev') { + if (event.key === 'ArrowLeft') { $active.prev().find('a').click(); } else { $active.next().find('a').click(); @@ -251,7 +251,7 @@ define(['angularAMD', 'userSettingsService'], function (angularAMD) { var $nextTestTabs = $('.nav-tabs').children(); $nextTestTabs.each(function() { if($(this).text().replace(/\s/g, '') === currentTabLabel) { - $(this).find('a').click(); + $(this).find('a').click(); currentTabLabel = null; } }); @@ -260,7 +260,7 @@ define(['angularAMD', 'userSettingsService'], function (angularAMD) { //MutationObserver fires a callback every time something changes on the page //and here it's used to click a tab before the page is actually rendered to get rid of flickering effect var mutationObserver = new MutationObserver(callback); - + function callback(mutList) { function findElement(element) { if($(element.target).hasClass('nav-tabs')) { @@ -268,7 +268,7 @@ define(['angularAMD', 'userSettingsService'], function (angularAMD) { return true; } } - mutList.find(findElement); + mutList.find(findElement); } mutationObserver.observe(document, { diff --git a/report/src/main/webapp/app/layout/main/url/navigation/navigation.patternButtons.html b/report/src/main/webapp/app/layout/main/url/navigation/navigation.patternButtons.html index 4a4a92e6b..344c0a0ef 100644 --- a/report/src/main/webapp/app/layout/main/url/navigation/navigation.patternButtons.html +++ b/report/src/main/webapp/app/layout/main/url/navigation/navigation.patternButtons.html @@ -30,12 +30,12 @@
-
Accept test case
-
Revert test case diff --git a/report/src/main/webapp/app/layout/toolbar/toolbarBottom.view.html b/report/src/main/webapp/app/layout/toolbar/toolbarBottom.view.html index df62283a7..73377e355 100644 --- a/report/src/main/webapp/app/layout/toolbar/toolbarBottom.view.html +++ b/report/src/main/webapp/app/layout/toolbar/toolbarBottom.view.html @@ -138,13 +138,13 @@
Accept {{toolbarBottom.viewMode}} - Accept {{toolbarBottom.viewMode}} - diff --git a/report/src/main/webapp/report.html b/report/src/main/webapp/report.html index 17cd6e5e7..6fd9e9b5a 100644 --- a/report/src/main/webapp/report.html +++ b/report/src/main/webapp/report.html @@ -67,6 +67,9 @@ available)
  • press ← / → to navigate between url's tabs
  • +
  • press a for accepting suite/test/url
  • +
  • press r for reverting suite/test/url
  • +
  • shift modifier that will define that the specific opened test case should be accepted/reverted (shift + A - accepts opened test case ; shift + R - reverts opened test case)