Skip to content

Commit 58a880c

Browse files
authored
Merge pull request #64 from topcoder-platform/dev
Promote to prod
2 parents 7050eb1 + 169bc31 commit 58a880c

11 files changed

+303
-47
lines changed

.yo-rc.json

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"generator-gulp-angular": {
3+
"version": "1.0.0",
4+
"props": {
5+
"angularVersion": "~1.4.2",
6+
"angularModules": [
7+
{
8+
"key": "animate",
9+
"module": "ngAnimate"
10+
},
11+
{
12+
"key": "cookies",
13+
"module": "ngCookies"
14+
},
15+
{
16+
"key": "touch",
17+
"module": "ngTouch"
18+
},
19+
{
20+
"key": "sanitize",
21+
"module": "ngSanitize"
22+
},
23+
{
24+
"key": "messages",
25+
"module": "ngMessages"
26+
},
27+
{
28+
"key": "aria",
29+
"module": "ngAria"
30+
}
31+
],
32+
"jQuery": {
33+
"key": "jqLite"
34+
},
35+
"resource": {
36+
"key": "$http",
37+
"module": null
38+
},
39+
"router": {
40+
"key": "angular-route",
41+
"module": "ngRoute"
42+
},
43+
"ui": {
44+
"key": "angular-material",
45+
"module": "ngMaterial"
46+
},
47+
"cssPreprocessor": {
48+
"key": "node-sass",
49+
"extension": "scss"
50+
},
51+
"jsPreprocessor": {
52+
"key": "noJsPrepro",
53+
"extension": "js",
54+
"srcExtension": "js"
55+
},
56+
"htmlPreprocessor": {
57+
"key": "noHtmlPrepro",
58+
"extension": "html"
59+
},
60+
"bootstrapComponents": {
61+
"name": null,
62+
"version": null,
63+
"key": null,
64+
"module": null
65+
},
66+
"foundationComponents": {
67+
"name": null,
68+
"version": null,
69+
"key": null,
70+
"module": null
71+
},
72+
"paths": {
73+
"src": "src",
74+
"dist": "dist",
75+
"e2e": "e2e",
76+
"tmp": ".tmp"
77+
}
78+
}
79+
}
80+
}

README.md

+76-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,81 @@
11
# support-admin-app
2-
Support application <br>
2+
Support application
33

44
Internal application used to administer specific support tasks related to the Topcoder platform.
55

6-
User Management
7-
Submission Management
8-
Tag Management
6+
## Software Requirements
97

8+
- node.js v6+
9+
- npm v3+
10+
- Google Chrome browser version >= 55.0.2883.0
11+
12+
## Installation
13+
14+
To install npm and bower dependencies run:
15+
16+
> npm install
17+
18+
Bower is set to run as a npm postinstall script.
19+
20+
## Configuration
21+
22+
The configuration is provided in `config.json` in the base directory.
23+
It contains four environments (`local`, `dev`, `qa`, `prod`) which are controlled by the BUILD_ENV environment variable,
24+
it defaults to the `dev` environment if BUILD_ENV is empty.
25+
26+
The following configuration parameters are available:
27+
28+
| Name | Description |
29+
|--------------------------|---------------------------------|
30+
| ES_PROJECT_API_URL | URL of the ES project API |
31+
| API_URL | URL of the topcoder API |
32+
| WORK_API_URL | URL of the topcoder work API |
33+
| ADMIN_TOOL_URL | URL of the admin tool API |
34+
| API_VERSION_PATH | Version of the API |
35+
| AUTH0_CLIENT_ID | Client ID for Auth0 |
36+
| AUTH0_DOMAIN | Domain for Auth0 authentication |
37+
| AUTH0_TOKEN_NAME | Auth0 token name |
38+
| AUTH0_REFRESH_TOKEN_NAME | Auth0 refresh token name |
39+
40+
## Start the Application
41+
42+
Simply execute the following command to start the app in development mode (with browsersync)
43+
```
44+
npm install
45+
npm start
46+
```
47+
Application will be hosted and running at http://locahost:3000
48+
49+
To build the application to be hosted on a real webserver run:
50+
```
51+
npm run build
52+
```
53+
54+
## Execute E2E Tests
55+
56+
```npm test```
57+
58+
## Fallback instruction in case the npm scripts fail
59+
60+
### Install global dependencies
61+
62+
```npm install -g gulp@3.8.10 bower```
63+
64+
### Install project dependencies
65+
66+
```
67+
npm install
68+
bower install
69+
```
70+
71+
### Start the Application
72+
73+
```gulp serve```
74+
75+
### Build the Application
76+
77+
```gulp build```
78+
79+
### Execute E2E Tests
80+
81+
```gulp protractor```

circle.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
##Set Node Js Version (Could be set to needed version)
2+
machine:
3+
node:
4+
version: 6.8.1
5+
6+
# Add some environment variables
7+
environment:
8+
CIRCLE_ENV: dev
9+
10+
## Customize dependencies
11+
dependencies:
12+
pre:
13+
- curl -s https://raw.githubusercontent.com/chronogolf/circleci-google-chrome/master/use_chrome_stable_version.sh | bash
14+
15+
override:
16+
- npm install
17+
18+
compile:
19+
override:
20+
- npm run build
21+
22+
test:
23+
override:
24+
- npm run test

e2e/dashboard.spec.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
describe('The dashboard view', function () {
4+
var page;
5+
var mainPage;
6+
7+
beforeEach(function () {
8+
browser.get('http://localhost:3000/');
9+
page = require('./login.po');
10+
mainPage = require('./main.po');
11+
page.usernameInput.sendKeys('amy_admin');
12+
page.passwordInput.sendKeys('topcoder1');
13+
page.loginButton.click();
14+
});
15+
16+
it('should find members', function() {
17+
mainPage.searchHandleInput.sendKeys('sah2ed');
18+
mainPage.searchButton.click();
19+
expect(mainPage.users.count()).toBe(1);
20+
expect(mainPage.users.get(0).element(by.cssContainingText('td', 'sah2ed')).getText()).toBe('sah2ed');
21+
});
22+
});

e2e/login.po.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* This file uses the Page Object pattern to define the main page for tests
3+
* https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
4+
*/
5+
6+
'use strict';
7+
8+
var LoginPage = function() {
9+
/*this.jumbEl = element(by.css('.jumbotron'));
10+
this.h1El = this.jumbEl.element(by.css('h1'));
11+
this.imgEl = this.jumbEl.element(by.css('img'));
12+
this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in awesomeThings'));*/
13+
this.loginForm = element(by.css('form'));
14+
this.loginHeader = this.loginForm.element(by.css('h3'));
15+
const inputs = this.loginForm.all(by.css('input'));
16+
this.usernameInput = inputs.get(0);
17+
this.passwordInput = inputs.get(1);
18+
this.loginButton = this.loginForm.element(by.css('button'));
19+
this.alerts = element(by.css('body')).all(by.repeater('alert in alerts'));
20+
};
21+
22+
module.exports = new LoginPage();

e2e/login.spec.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
'use strict';
2+
3+
describe('The login view', function () {
4+
var page;
5+
var mainPage;
6+
7+
beforeEach(function () {
8+
browser.get('http://localhost:3000/');
9+
page = require('./login.po');
10+
mainPage = require('./main.po');
11+
});
12+
13+
it('should display the correct form heading', function() {
14+
expect(page.loginHeader.getText()).toBe('ADMIN APP LOGIN');
15+
//expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/);
16+
//expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman');
17+
});
18+
19+
it('login should fail for wrong credentials', function () {
20+
//expect(page.thumbnailEls.count()).toBeGreaterThan(5);
21+
page.usernameInput.sendKeys('wrong');
22+
page.passwordInput.sendKeys('wrong');
23+
page.loginButton.click();
24+
expect(page.alerts.count()).toBe(1);
25+
expect(page.alerts.get(0).getText()).toBe('Wrong username or password.');
26+
});
27+
28+
it('login should succeed for correct credentials', function () {
29+
//expect(page.thumbnailEls.count()).toBeGreaterThan(5);
30+
page.usernameInput.sendKeys('amy_admin');
31+
page.passwordInput.sendKeys('topcoder1');
32+
page.loginButton.click();
33+
expect(mainPage.isUserLoggedIn.isDisplayed()).toBeTruthy();
34+
expect(mainPage.loggedInUser.getText()).toBe('amy_admin');
35+
});
36+
37+
it('logout should work after login', function () {
38+
//expect(page.thumbnailEls.count()).toBeGreaterThan(5);
39+
page.usernameInput.sendKeys('amy_admin');
40+
page.passwordInput.sendKeys('topcoder1');
41+
page.loginButton.click();
42+
expect(mainPage.isUserLoggedIn.isDisplayed()).toBeTruthy();
43+
expect(mainPage.loggedInUser.getText()).toBe('amy_admin');
44+
mainPage.logout.click();
45+
expect(page.loginHeader.getText()).toBe('ADMIN APP LOGIN');
46+
});
47+
48+
});

e2e/main.po.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55

66
'use strict';
77

8-
var MainPage = function() {
9-
this.jumbEl = element(by.css('.jumbotron'));
8+
var MainPage = function() {
9+
/*this.jumbEl = element(by.css('.jumbotron'));
1010
this.h1El = this.jumbEl.element(by.css('h1'));
1111
this.imgEl = this.jumbEl.element(by.css('img'));
12-
this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in awesomeThings'));
12+
this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in awesomeThings'));*/
13+
this.isUserLoggedIn = element(by.css('li[ng-show="authorized()"]'));
14+
this.loggedInUser = this.isUserLoggedIn.element(by.css('strong'));
15+
this.searchHandleInput = element(by.css('#search-condition-handle'));
16+
this.searchButton = element(by.css('button[ng-click="search()"]'));
17+
this.users = element(by.css('body')).all(by.repeater('user in users'));
18+
this.logout = element(by.css('a[ng-click="logout()"]'));
1319
};
1420

1521
module.exports = new MainPage();

e2e/main.spec.js

-21
This file was deleted.

gulp/server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ gulp.task('serve:dist', ['build'], function () {
4949
browserSyncInit(paths.dist);
5050
});
5151

52-
gulp.task('serve:e2e', ['inject'], function () {
52+
gulp.task('serve:e2e', ['inject', 'ng-config'], function () {
5353
browserSyncInit([paths.tmp + '/serve', paths.src], null, []);
5454
});
5555

0 commit comments

Comments
 (0)