Skip to content

Commit 4a66ad4

Browse files
committed
Merge pull request #123 from mulesoft/chores/adding-more-automation-tests
Add more tests
2 parents c1bfe43 + e7049e5 commit 4a66ad4

File tree

11 files changed

+258
-6
lines changed

11 files changed

+258
-6
lines changed

dist/scripts/api-console.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,20 +405,24 @@
405405
return jQuery.trim(path.toString().replace(/\W/g, ' ')).replace(/\s+/g, '_');
406406
};
407407

408-
var $inactiveElements = jQuery('.raml-console-tab').add('.raml-console-resource').add('li');
408+
var $inactiveElements = jQuery('.raml-console-tab').add('.raml-console-resource')
409+
.add('li')
410+
.add('.raml-console-tab');
409411

410412
$scope.$on('openMethod', function(event, $currentScope) {
411413
if ($scope.$id !== $currentScope.$id) {
412-
$inactiveElements.removeClass('is-active');
414+
$inactiveElements.removeClass('raml-console-is-active');
413415
$scope.showPanel = false;
414416
}
415417
});
416418

417419
$scope.showResource = function ($event, $index) {
418420
var $this = jQuery($event.currentTarget);
419421
var $resource = $this.closest('.raml-console-resource');
420-
var $inactiveElements = jQuery('.raml-console-tab').add('.raml-console-resource').add('li');
421422
var methodInfo = $scope.resource.methods[$index];
423+
var $inactiveElements = jQuery('.raml-console-tab').add('.raml-console-resource')
424+
.add('li')
425+
.add('.raml-console-tab');
422426

423427
$scope.methodInfo = methodInfo;
424428
$scope.responseInfo = getResponseInfo();

src/app/directives/method-list.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,24 @@
7777
return jQuery.trim(path.toString().replace(/\W/g, ' ')).replace(/\s+/g, '_');
7878
};
7979

80-
var $inactiveElements = jQuery('.raml-console-tab').add('.raml-console-resource').add('li');
80+
var $inactiveElements = jQuery('.raml-console-tab').add('.raml-console-resource')
81+
.add('li')
82+
.add('.raml-console-tab');
8183

8284
$scope.$on('openMethod', function(event, $currentScope) {
8385
if ($scope.$id !== $currentScope.$id) {
84-
$inactiveElements.removeClass('is-active');
86+
$inactiveElements.removeClass('raml-console-is-active');
8587
$scope.showPanel = false;
8688
}
8789
});
8890

8991
$scope.showResource = function ($event, $index) {
9092
var $this = jQuery($event.currentTarget);
9193
var $resource = $this.closest('.raml-console-resource');
92-
var $inactiveElements = jQuery('.raml-console-tab').add('.raml-console-resource').add('li');
9394
var methodInfo = $scope.resource.methods[$index];
95+
var $inactiveElements = jQuery('.raml-console-tab').add('.raml-console-resource')
96+
.add('li')
97+
.add('.raml-console-tab');
9498

9599
$scope.methodInfo = methodInfo;
96100
$scope.responseInfo = getResponseInfo();
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'use strict';
2+
3+
var factory = require('../page_objects');
4+
5+
function DisplaySettings (poName) {
6+
this.po = factory.create(poName);
7+
8+
this.ifThemeSwitcherIsDisabled = function () {
9+
expect(this.po.count()).toBe(1);
10+
this.po.getButtonAt(0).then(function (value) {
11+
expect(value.trim()).toBe('Download API Client');
12+
});
13+
};
14+
15+
this.ifDownloadApiClientIsDisabled = function () {
16+
expect(this.po.count()).toBe(1);
17+
this.po.getButtonAt(0).then(function (value) {
18+
expect(value.trim()).toBe('Switch Theme');
19+
});
20+
};
21+
22+
this.ifMetaButtonGroupIsDisabled = function () {
23+
expect(this.po.count()).toBe(0);
24+
};
25+
26+
this.ifTitleIsDisabled = function () {
27+
expect(this.po.title.isPresent()).toBe(false);
28+
};
29+
30+
this.ifDisplayingInSingleViewMode = function () {
31+
var button = this.po.getMethodButton();
32+
33+
button.click();
34+
35+
expect(this.po.getCollepsedForm().isPresent()).toBe(true);
36+
};
37+
38+
this.ifResourcesAreCollapsed = function () {
39+
expect(this.po.resourceToggler.getAttribute('class')).toContain('raml-console-is-active');
40+
};
41+
}
42+
43+
module.exports = DisplaySettings;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>API Console</title>
7+
<link href="styles/api-console-light-theme.css" rel="stylesheet" class="theme">
8+
</head>
9+
<body ng-app="ramlConsoleApp" ng-cloak class="raml-console-body">
10+
<raml-console src="raml/resources.raml" single-view></raml-console>
11+
<script src="scripts/api-console-vendor.js"></script>
12+
<script src="scripts/api-console.js"></script>
13+
<script type="text/javascript">
14+
$.noConflict();
15+
</script>
16+
</body>
17+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>API Console</title>
7+
<link href="styles/api-console-light-theme.css" rel="stylesheet" class="theme">
8+
</head>
9+
<body ng-app="ramlConsoleApp" ng-cloak class="raml-console-body">
10+
<raml-console src="raml/resources.raml" resources-collapsed></raml-console>
11+
<script src="scripts/api-console-vendor.js"></script>
12+
<script src="scripts/api-console.js"></script>
13+
<script type="text/javascript">
14+
$.noConflict();
15+
</script>
16+
</body>
17+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>API Console</title>
7+
<link href="styles/api-console-light-theme.css" rel="stylesheet" class="theme">
8+
</head>
9+
<body ng-app="ramlConsoleApp" ng-cloak class="raml-console-body">
10+
<raml-console src="raml/minimum.raml" disable-raml-client-generator></raml-console>
11+
<script src="scripts/api-console-vendor.js"></script>
12+
<script src="scripts/api-console.js"></script>
13+
<script type="text/javascript">
14+
$.noConflict();
15+
</script>
16+
</body>
17+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>API Console</title>
7+
<link href="styles/api-console-light-theme.css" rel="stylesheet" class="theme">
8+
</head>
9+
<body ng-app="ramlConsoleApp" ng-cloak class="raml-console-body">
10+
<raml-console src="raml/minimum.raml" disable-raml-client-generator disable-theme-switcher></raml-console>
11+
<script src="scripts/api-console-vendor.js"></script>
12+
<script src="scripts/api-console.js"></script>
13+
<script type="text/javascript">
14+
$.noConflict();
15+
</script>
16+
</body>
17+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>API Console</title>
7+
<link href="styles/api-console-light-theme.css" rel="stylesheet" class="theme">
8+
</head>
9+
<body ng-app="ramlConsoleApp" ng-cloak class="raml-console-body">
10+
<raml-console src="raml/minimum.raml" disable-theme-switcher></raml-console>
11+
<script src="scripts/api-console-vendor.js"></script>
12+
<script src="scripts/api-console.js"></script>
13+
<script type="text/javascript">
14+
$.noConflict();
15+
</script>
16+
</body>
17+
</html>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>API Console</title>
7+
<link href="styles/api-console-light-theme.css" rel="stylesheet" class="theme">
8+
</head>
9+
<body ng-app="ramlConsoleApp" ng-cloak class="raml-console-body">
10+
<raml-console src="raml/minimum.raml" disable-title></raml-console>
11+
<script src="scripts/api-console-vendor.js"></script>
12+
<script src="scripts/api-console.js"></script>
13+
<script type="text/javascript">
14+
$.noConflict();
15+
</script>
16+
</body>
17+
</html>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
'use strict';
2+
3+
var basePO = require('./basePO');
4+
5+
function InitializerPO () {
6+
this.container = element(by.css('.raml-console-meta-button-group'));
7+
this.title = element(by.css('.raml-console-title'));
8+
this.resourceToggler = element(by.css('.raml-console-resource-root-toggle'));
9+
10+
this.count = function () {
11+
return this.container.all(by.css('.raml-console-meta-button')).count();
12+
};
13+
14+
this.getButtonAt = function (index) {
15+
return this.container.all(by.css('.raml-console-meta-button')).get(index).getInnerHtml();
16+
};
17+
18+
this.getCollepsedForm = function () {
19+
return element(by.css('.raml-console-is-collapsed'));
20+
};
21+
22+
this.getMethodButton = function () {
23+
return element.all(by.css('.raml-console-resource-list-item'))
24+
.get(1)
25+
.all(by.css('.raml-console-tab'))
26+
.get(0)
27+
.element(by.css('.raml-console-tab-label'));
28+
};
29+
}
30+
31+
InitializerPO.prototype = basePO;
32+
33+
module.exports = InitializerPO;

0 commit comments

Comments
 (0)