Skip to content

Promote to prod #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"generator-gulp-angular": {
"version": "1.0.0",
"props": {
"angularVersion": "~1.4.2",
"angularModules": [
{
"key": "animate",
"module": "ngAnimate"
},
{
"key": "cookies",
"module": "ngCookies"
},
{
"key": "touch",
"module": "ngTouch"
},
{
"key": "sanitize",
"module": "ngSanitize"
},
{
"key": "messages",
"module": "ngMessages"
},
{
"key": "aria",
"module": "ngAria"
}
],
"jQuery": {
"key": "jqLite"
},
"resource": {
"key": "$http",
"module": null
},
"router": {
"key": "angular-route",
"module": "ngRoute"
},
"ui": {
"key": "angular-material",
"module": "ngMaterial"
},
"cssPreprocessor": {
"key": "node-sass",
"extension": "scss"
},
"jsPreprocessor": {
"key": "noJsPrepro",
"extension": "js",
"srcExtension": "js"
},
"htmlPreprocessor": {
"key": "noHtmlPrepro",
"extension": "html"
},
"bootstrapComponents": {
"name": null,
"version": null,
"key": null,
"module": null
},
"foundationComponents": {
"name": null,
"version": null,
"key": null,
"module": null
},
"paths": {
"src": "src",
"dist": "dist",
"e2e": "e2e",
"tmp": ".tmp"
}
}
}
}
80 changes: 76 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,81 @@
# support-admin-app
Support application <br>
Support application

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

User Management
Submission Management
Tag Management
## Software Requirements

- node.js v6+
- npm v3+
- Google Chrome browser version >= 55.0.2883.0

## Installation

To install npm and bower dependencies run:

> npm install

Bower is set to run as a npm postinstall script.

## Configuration

The configuration is provided in `config.json` in the base directory.
It contains four environments (`local`, `dev`, `qa`, `prod`) which are controlled by the BUILD_ENV environment variable,
it defaults to the `dev` environment if BUILD_ENV is empty.

The following configuration parameters are available:

| Name | Description |
|--------------------------|---------------------------------|
| ES_PROJECT_API_URL | URL of the ES project API |
| API_URL | URL of the topcoder API |
| WORK_API_URL | URL of the topcoder work API |
| ADMIN_TOOL_URL | URL of the admin tool API |
| API_VERSION_PATH | Version of the API |
| AUTH0_CLIENT_ID | Client ID for Auth0 |
| AUTH0_DOMAIN | Domain for Auth0 authentication |
| AUTH0_TOKEN_NAME | Auth0 token name |
| AUTH0_REFRESH_TOKEN_NAME | Auth0 refresh token name |

## Start the Application

Simply execute the following command to start the app in development mode (with browsersync)
```
npm install
npm start
```
Application will be hosted and running at http://locahost:3000

To build the application to be hosted on a real webserver run:
```
npm run build
```

## Execute E2E Tests

```npm test```

## Fallback instruction in case the npm scripts fail

### Install global dependencies

```npm install -g gulp@3.8.10 bower```

### Install project dependencies

```
npm install
bower install
```

### Start the Application

```gulp serve```

### Build the Application

```gulp build```

### Execute E2E Tests

```gulp protractor```
24 changes: 24 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
##Set Node Js Version (Could be set to needed version)
machine:
node:
version: 6.8.1

# Add some environment variables
environment:
CIRCLE_ENV: dev

## Customize dependencies
dependencies:
pre:
- curl -s https://raw.githubusercontent.com/chronogolf/circleci-google-chrome/master/use_chrome_stable_version.sh | bash

override:
- npm install

compile:
override:
- npm run build

test:
override:
- npm run test
22 changes: 22 additions & 0 deletions e2e/dashboard.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

describe('The dashboard view', function () {
var page;
var mainPage;

beforeEach(function () {
browser.get('http://localhost:3000/');
page = require('./login.po');
mainPage = require('./main.po');
page.usernameInput.sendKeys('amy_admin');
page.passwordInput.sendKeys('topcoder1');
page.loginButton.click();
});

it('should find members', function() {
mainPage.searchHandleInput.sendKeys('sah2ed');
mainPage.searchButton.click();
expect(mainPage.users.count()).toBe(1);
expect(mainPage.users.get(0).element(by.cssContainingText('td', 'sah2ed')).getText()).toBe('sah2ed');
});
});
22 changes: 22 additions & 0 deletions e2e/login.po.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* This file uses the Page Object pattern to define the main page for tests
* https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
*/

'use strict';

var LoginPage = function() {
/*this.jumbEl = element(by.css('.jumbotron'));
this.h1El = this.jumbEl.element(by.css('h1'));
this.imgEl = this.jumbEl.element(by.css('img'));
this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in awesomeThings'));*/
this.loginForm = element(by.css('form'));
this.loginHeader = this.loginForm.element(by.css('h3'));
const inputs = this.loginForm.all(by.css('input'));
this.usernameInput = inputs.get(0);
this.passwordInput = inputs.get(1);
this.loginButton = this.loginForm.element(by.css('button'));
this.alerts = element(by.css('body')).all(by.repeater('alert in alerts'));
};

module.exports = new LoginPage();
48 changes: 48 additions & 0 deletions e2e/login.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
'use strict';

describe('The login view', function () {
var page;
var mainPage;

beforeEach(function () {
browser.get('http://localhost:3000/');
page = require('./login.po');
mainPage = require('./main.po');
});

it('should display the correct form heading', function() {
expect(page.loginHeader.getText()).toBe('ADMIN APP LOGIN');
//expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/);
//expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman');
});

it('login should fail for wrong credentials', function () {
//expect(page.thumbnailEls.count()).toBeGreaterThan(5);
page.usernameInput.sendKeys('wrong');
page.passwordInput.sendKeys('wrong');
page.loginButton.click();
expect(page.alerts.count()).toBe(1);
expect(page.alerts.get(0).getText()).toBe('Wrong username or password.');
});

it('login should succeed for correct credentials', function () {
//expect(page.thumbnailEls.count()).toBeGreaterThan(5);
page.usernameInput.sendKeys('amy_admin');
page.passwordInput.sendKeys('topcoder1');
page.loginButton.click();
expect(mainPage.isUserLoggedIn.isDisplayed()).toBeTruthy();
expect(mainPage.loggedInUser.getText()).toBe('amy_admin');
});

it('logout should work after login', function () {
//expect(page.thumbnailEls.count()).toBeGreaterThan(5);
page.usernameInput.sendKeys('amy_admin');
page.passwordInput.sendKeys('topcoder1');
page.loginButton.click();
expect(mainPage.isUserLoggedIn.isDisplayed()).toBeTruthy();
expect(mainPage.loggedInUser.getText()).toBe('amy_admin');
mainPage.logout.click();
expect(page.loginHeader.getText()).toBe('ADMIN APP LOGIN');
});

});
12 changes: 9 additions & 3 deletions e2e/main.po.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@

'use strict';

var MainPage = function() {
this.jumbEl = element(by.css('.jumbotron'));
var MainPage = function() {
/*this.jumbEl = element(by.css('.jumbotron'));
this.h1El = this.jumbEl.element(by.css('h1'));
this.imgEl = this.jumbEl.element(by.css('img'));
this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in awesomeThings'));
this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in awesomeThings'));*/
this.isUserLoggedIn = element(by.css('li[ng-show="authorized()"]'));
this.loggedInUser = this.isUserLoggedIn.element(by.css('strong'));
this.searchHandleInput = element(by.css('#search-condition-handle'));
this.searchButton = element(by.css('button[ng-click="search()"]'));
this.users = element(by.css('body')).all(by.repeater('user in users'));
this.logout = element(by.css('a[ng-click="logout()"]'));
};

module.exports = new MainPage();
21 changes: 0 additions & 21 deletions e2e/main.spec.js

This file was deleted.

2 changes: 1 addition & 1 deletion gulp/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ gulp.task('serve:dist', ['build'], function () {
browserSyncInit(paths.dist);
});

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

Expand Down
Loading