Skip to content

Commit 6dc5d25

Browse files
authored
Sprint3 Finished (#27)
* Create LICENSE (#19) * Added home page (#21) * resources page finished (#22) * resources page finished * Missing stub creation for unit tests * Add angular-cli-pages automation * Added formatting to chart page, including spinner * Fixed styling resources page * Fixed styling settings component * Fixed footer styling * Update barchart.component.spec.ts Fixes bug with unit tests after renaming HTML element * Added Run Benchmark button to the navbar * Updated angular packages. Fixed failing unit tests * added automated deployment to GH_PAGES using CI * fixed travis command * Fixes #23: Checkboxes are now selectable * Closes #6: Added missing code comments and completed readme credits * Closes #5: Deployment documentation added * Fixes #25 and closes #26 * Closes #3: Added technologies to documentation * minor additions to #3: corrected badges and project scope * Closes #4: Manual and automated testing added to docs
1 parent 7b1de96 commit 6dc5d25

26 files changed

+769
-565
lines changed

.angulardoc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"repoId": "a282706b-c598-4485-aa79-9610c0b1ea11",
3+
"lastSync": 0
4+
}

README.md

Lines changed: 117 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Algorithm Benchmarks
22

3-
[![Build Status](https://travis-ci.com/Narshe1412/Code-Institute-User-Centric-Algorithms.svg?branch=master)](https://travis-ci.com/Narshe1412/Code-Institute-User-Centric-Algorithms) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Narshe1412_Code-Institute-User-Centric-Algorithms&metric=alert_status)](https://sonarcloud.io/dashboard?id=Narshe1412_Code-Institute-User-Centric-Algorithms)
3+
[![Build Status](https://travis-ci.com/Narshe1412/Code-Institute-Interactive-Frontend-Algorithms.svg?branch=master)](https://travis-ci.com/Narshe1412/Code-Institute-Interactive-Frontend-Algorithms) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Narshe1412_Code-Institute-Interactive-Frontend-Algorithms&metric=alert_status)](https://sonarcloud.io/dashboard?id=Narshe1412_Code-Institute-Interactive-Frontend-Algorithms) [![Project Version](https://img.shields.io/github/package-json/v/Narshe1412/Code-Institute-Interactive-Frontend-Algorithms?color=gree)](https://github.com/Narshe1412/Code-Institute-Interactive-Frontend-Algorithms)
4+
[![License](https://img.shields.io/github/license/Narshe1412/Code-Institute-Interactive-Frontend-Algorithms?color=g)](https://github.com/Narshe1412/Code-Institute-Interactive-Frontend-Algorithms/blob/master/LICENSE)
45

56
As a programmer you need to always leverage between several possible different solutions the one that would be most efficient. One common problem is the sorting, inserting or accessing data. To solve this problem, along programming history, several algorithms have been created. This project attempts to help a fellow programmer to choose which algorithm shall be used by providing a benchmarking operationg and plotting the results in a variety of graphs.
67

@@ -18,13 +19,12 @@ It is also expected that the website will be desktop-first, as the main audience
1819

1920
- As a user, I want to be able to see different tables of algorithm efficiency, so I can pick the best suited to my project.
2021
- As a user, I want to be able to run different benchmarks for predefined algorithms, so I can be certain that the results adjust to my specific use case.
21-
- As a user, I would like to be able to use my very own data sets or algorithms so I can compare with the predefined ones and have a clearer picture of my options.
2222

2323
### Wireframes
2424

2525
Basic Wireframe Setup for Mobile view and Desktop View
26-
![Desktop first design](docs/img/desktop.png 'Desktop design')
27-
![Mobile design](docs/img/mobile.png 'Mobile design')
26+
![Desktop first design](docs/img/Desktop.png 'Desktop design')
27+
![Mobile design](docs/img/Mobile.png 'Mobile design')
2828

2929
## Features
3030

@@ -39,74 +39,143 @@ Basic Wireframe Setup for Mobile view and Desktop View
3939
- Other type of algorithms (accessors, indexing, data structures, etc...)
4040
- Option to run the algorithms out of the browser using the full capabilities of the computer's processors.
4141
- Option to run algorithms in a VM on a cloud provider, to obtain a best-case computer setups.
42+
- Option to be able to use my very own data sets or algorithms.
4243

4344
## Technologies Used
4445

45-
In this section, you should mention all of the languages, frameworks, libraries, and any other tools that you have used to construct this project. For each, provide its name, a link to its official site and a short sentence of why it was used.
46+
### Libraries
4647

47-
- This project was scaffolded by [Angular CLI](https://github.com/angular/angular-cli) version 8.0.2.
48-
- Project organization and task management provided by [GitHub and GitHub Projects](https://github.com)
49-
50-
## Testing
51-
52-
In this section, you need to convince the assessor that you have conducted enough testing to legitimately believe that the site works well. Essentially, in this part you will want to go over all of your user stories from the UX section and ensure that they all work as intended, with the project providing an easy and straightforward way for the users to achieve their goals.
53-
54-
Whenever it is feasible, prefer to automate your tests, and if you've done so, provide a brief explanation of your approach, link to the test file(s) and explain how to run them.
55-
56-
For any scenarios that have not been automated, test the user stories manually and provide as much detail as is relevant. A particularly useful form for describing your testing process is via scenarios, such as:
48+
- This project was scaffolded by [Angular CLI](https://github.com/angular/angular-cli) version 8.0.2 which installs the following technologies (among others):
49+
- [rxjs](https://github.com/ReactiveX/rxjs): Introduces the concept of reactive programming and observables with the ReactiveX library.
50+
- [Typescript](https://www.npmjs.com/package/typescript): Adds typing and additional constructs not present on the JavaScript language but common to other languages to increase resilience to your code.
51+
- [Jasmine](https://jasmine.github.io/) and [Karma](https://www.npmjs.com/package/karma) for testing
52+
- The angular cli tooling itself which provides compilation, bundling and minification of the JavaScript code, as well as support to older browsers via Polyfills.
53+
- [Bootstrap 4](https://getbootstrap.com/) was used for styling and providing page structure and responsiveness
54+
- [Highcharts](https://www.highcharts.com/) library for generating graphs and plotting data.
55+
- [Highlight.js](https://highlightjs.org/) library to convert preformatted text into code with syntax highlighting.
5756

58-
1. Contact form:
59-
1. Go to the "Contact Us" page
60-
2. Try to submit the empty form and verify that an error message about the required fields appears
61-
3. Try to submit the form with an invalid email address and verify that a relevant error message appears
62-
4. Try to submit the form with all inputs valid and verify that a success message appears.
57+
### Other tools
6358

64-
In addition, you should mention in this section how your project looks and works on different browsers and screen sizes.
65-
66-
You should also mention in this section any interesting bugs or problems you discovered during your testing, even if you haven't addressed them yet.
59+
- This project has been created using [Visual Studio Code](https://code.visualstudio.com/) IDE in a [Node v.10.13](https://nodejs.org/en/) environment
60+
- Project organization and task management provided by [GitHub and GitHub Projects](https://github.com)
61+
- Continuous Integration/Development automation provided by [Travis CI](http://travis-ci.com)
62+
- Code quality and analysis provided by [SonarQube](https://www.sonarqube.org/) via its cloud service [SonarCloud](https://sonarcloud.io/)
6763

68-
If this section grows too long, you may want to split it off into a separate file and link to it from here.
64+
Click on the badges at the top of this file to check the build status and quality metrics.
6965

70-
### Running unit tests
66+
## Testing
7167

72-
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
68+
The services and algoritms implementations have been automated and can be run by following the instructions below. The UI interaction is not automated, please follow the Test Cases described in the appropriate section.
69+
70+
### Running automated unit tests
71+
72+
Run `npm run test` to obtain a report of the tests with the no-watch option enabled.
73+
74+
The command `ng test` is also available just to execute the unit tests via [Karma](https://karma-runner.github.io) with the watch option enabled, useful for development purposes.
75+
76+
A Code Coverage report is also available in [SonarCloud](https://sonarcloud.io/component_measures?id=Narshe1412_Code-Institute-Interactive-Frontend-Algorithms&metric=coverage&view=list)
77+
78+
### Manual Test Plan
79+
80+
1. Running Benchmarks:
81+
1. Go to the "Benchmarks" page
82+
2. Click on the "Run Benchmark" button below the graph
83+
3. Verify a spinning icon appears and the previous chart gets unloaded
84+
4. Verify that after a few seconds it will start populating data points
85+
5. Verify that when the spinning icon stops, all data points have been drawn and made a line per algorithm out of them
86+
2. Run Benchmark button:
87+
1. Go to the "Benchmarks" page
88+
2. Try to click on the "Run Benchmark" button on the navigation bar.
89+
3. Verify this button is not available on the Benchmarks page (greyed out).
90+
4. Nagivate to "Setup" or "Resources"
91+
5. Verify than clicking the button the steps from Test 1 execute
92+
3. Resetting the chart:
93+
1. Go to the "Benchmarks" page
94+
2. Verify that clicking the "Reset Chart" button resets the chart
95+
3. Click on "Run Benchmark"
96+
4. Verify that the "Reset Chart" button is not available while the simulation is executing.
97+
4. Benchmark configuration:
98+
1. List of Algorithms:
99+
1. Go to "Setup" page
100+
2. Modify the list of algorithms
101+
3. Click on Run Benchmark
102+
4. Verify that only the marked algorithms are running by checking the chart legend and results
103+
2. Collection Size:
104+
1. Go to "Setup" page
105+
2. Add or delete items from the collection list
106+
3. Click on Run Benchmark
107+
4. Verify that there's a data point per algorithm and item in the collection list drawn on the chart
108+
3. List of Repetitions:
109+
1. Go to "Setup" page
110+
2. Modify the number of repetitions to a bigger number
111+
3. Click on Run Benchmark
112+
4. Verify that the simulation takes longer and the numbers are more accurate than previous runs.
113+
4. Sad path testing:
114+
1. Go to "Setup" page
115+
2. Delete all items on the simulation list
116+
3. Click on Run Benchmark
117+
4. Verify that no results are displayed.
118+
5. Refresh the page
119+
6. Uncheck all algorithms from the list
120+
7. Click on Run Benchmark
121+
8. Verify no results are displayed
122+
9. Refresh the page
123+
10. Verify that no input below 1 can be entered in the Repetitions field
124+
5. Responsiveness:
125+
1. Pages Resources and Home are static and fully responsive but no test case is necessary
126+
2. Nagivate to any of the routes "Home", "Benchmarks", "Setup", "Resources"
127+
3. Verify by using different devices or your browser sizing feature that all pages are responsive and redimension correctly for different sizes
128+
129+
### Browser Compatibility
130+
131+
The application should be compatible with the latest versions in all browsers thanks to the use of polyfills. Due to memory limitations, the Benchmark runner may block the UI in Internet Explorer or mobile browsers.
132+
133+
| Vendor | Version | Compatibility status |
134+
| ----------------- | ------------- | ------------------------------------------------------------------------ |
135+
| Google Chrome | 76.0.3809.100 | Full |
136+
| Mozilla Firefox | 68.0 | Full |
137+
| Microsoft Edge | 42.17134.1.0 | Full |
138+
| Opera | 52.0 | Full |
139+
| Internet Explorer | 11.885.17134 | Not Recommended: Blocks the UI while running big simulations. Very slow. |
73140

74-
### Running end-to-end tests
141+
## Deployment
75142

76-
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
143+
This project was created using the Angular CLI which implements webpack under the hood to bundle all the files and create several JS files that contain the whole project structure.
77144

78-
## Deployment
145+
I used TravisCI to automate the deployment process. On each push and pull request, Travis will create a container where it will do a fresh deployment of my app, run all the tests, create a production build and deploy it to the gh-pages branch. This is all configured on the file `.travis.yml`.
79146

80-
This section should describe the process you went through to deploy the project to a hosting platform (e.g. GitHub Pages or Heroku).
147+
As no environment variables are needed there's no need to host this project in a SaaS provider like Heroku.
81148

82-
In particular, you should provide all details of the differences between the deployed version and the development version, if any, including:
149+
### Local Deployment
83150

84-
- Different values for environment variables (Heroku Config Vars)?
85-
- Different configuration files?
86-
- Separate git branch?
151+
In order to run your project locally, assuming you have the latest version of Node or NPM just do:
152+
`npm install`
153+
`npm start`
154+
This will run the project in **development mode**. To get a production build after `npm install` run:
155+
`npm run build`
87156

88-
In addition, if it is not obvious, you should also describe how to run your code locally.
157+
Further configuration can be done in terms of building and deploying. See the [Angular Documentation](https://angular.io/) for more details.
89158

90159
## Credits
91160

92161
### Content
93162

94-
- The text for section Y was copied from the [Wikipedia article Z](https://en.wikipedia.org/wiki/Z)
163+
- The algorithm implementations in Javascript was obtained from the following articles:
164+
- [JS: Interview Questions by thatJSDude](https://khan4019.github.io/front-end-Interview-Questions/sort.html)
165+
- Sorting Algorithms with Javascript by Kinyanjui Wangonya
166+
- <https://dev.to/wangonya/sorting-algorithms-with-javascript-part-1-4aca>
167+
- <https://dev.to/wangonya/sorting-algorithms-with-javascript-part-2-3g51>
168+
- [JavaScript exercises for Shell Sort by W3Resource](https://www.w3resource.com/javascript-exercises/searching-and-sorting-algorithm/searching-and-sorting-algorithm-exercise-6.php)
169+
- [Radix Sort implementation by Lior Elrom (Stackoverflow)](https://stackoverflow.com/a/52236574/5866637)
170+
- [Fisher-Yates shuffle algorithm posted by CoolAJ86 in Stackoverflow](https://stackoverflow.com/a/2450976/5866637)
171+
- I have also used the following libraries to implement Introsort and Timsort into the application:
172+
- [Javascript Introsort by Arnohs](https://github.com/arnorhs/js-introsort)
173+
- [TimSort implementation by LXSMNSYC](https://github.com/LXSMNSYC/TimSort)
95174

96175
### Media
97176

98-
- The photos used in this site were obtained from ...
177+
- Home and Favicon Icons made by Good Ware from www.flaticon.com under CC 3.0 BY license
99178

100179
### Acknowledgements
101180

102-
- I received inspiration for this project while assisting some students I tutor through GrindsCentre.
103-
104-
- Algorithm Implementations: https://khan4019.github.io/front-end-Interview-Questions/sort.html
105-
- https://dev.to/wangonya/sorting-algorithms-with-javascript-part-1-4aca
106-
- https://dev.to/wangonya/sorting-algorithms-with-javascript-part-2-3g51
107-
- http://bigocheatsheet.com/
108-
- https://www.w3resource.com/javascript-exercises/searching-and-sorting-algorithm/searching-and-sorting-algorithm-exercise-6.php
109-
- https://github.com/arnorhs/js-introsort
110-
- https://stackoverflow.com/a/52236574/5866637
111-
- https://github.com/LXSMNSYC/TimSort
112-
- https://stackoverflow.com/a/2450976/5866637
181+
- I received inspiration for this project while assisting some students I tutor through GrindsCentre and the research and resources found in [BigOCheatsheet page](http://bigocheatsheet.com/)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "code-institute-user-centric-algorithms",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",
7-
"build": "ng build",
7+
"build": "ng build --prod",
88
"test": "ng test --watch=false --browsers=ChromeHeadless",
99
"coverage": "ng test --no-watch --code-coverage",
1010
"lint": "ng lint",

src/app/app-routing.module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { SetupComponent } from './setup/setup.component';
55
import { HomeComponent } from './home/home.component';
66
import { ResourcesComponent } from './resources/resources.component';
77

8+
/**
9+
* Establish the routes for the Angular SPA
10+
*/
811
const routes: Routes = [
912
{ path: 'chart', component: BarchartComponent },
1013
{ path: 'setup', component: SetupComponent },

src/app/app.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ describe('AppComponent', () => {
2020
expect(app).toBeTruthy();
2121
});
2222

23-
it(`should have as title 'Code-Institute-User-Centric-Algorithms'`, () => {
23+
it(`should have as title 'Algorithm Benchmarking App'`, () => {
2424
const fixture = TestBed.createComponent(AppComponent);
2525
const app = fixture.debugElement.componentInstance;
26-
expect(app.title).toEqual('Code-Institute-User-Centric-Algorithms');
26+
expect(app.title).toEqual('Algorithm Benchmarking App');
2727
});
2828
});

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import { Component } from '@angular/core';
66
styleUrls: ['./app.component.scss']
77
})
88
export class AppComponent {
9-
title = 'Code-Institute-User-Centric-Algorithms';
9+
title = 'Algorithm Benchmarking App';
1010
}
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
<div class="container-fluid">
1+
<!-- The chart container -->
2+
<div class="container-fluid" role="figure">
23
<div id="chart-container"></div>
34
</div>
5+
<!-- Button bar -->
46
<div class="container">
57
<div class="row">
68
<div class="mx-auto">
9+
<!-- Run Benchmark button with loading spinner -->
710
<button class="btn btn-primary text-center" (click)="runBenchmark()">
811
Run Benchmark
9-
<span
10-
*ngIf="isRunningBenchmark"
11-
class="spinner-border spinner-border-sm"
12-
role="status"
13-
aria-hidden="true"
14-
></span>
12+
<span *ngIf="isRunningBenchmark" class="spinner-border spinner-border-sm" role="status"
13+
aria-hidden="true"></span>
1514
<span *ngIf="isRunningBenchmark" class="sr-only">Loading...</span>
1615
</button>
16+
<!-- Reset button -->
17+
<button class="btn btn-primary text-center" (click)="resetChart()">
18+
Reset Chart
19+
</button>
1720
</div>
1821
</div>
1922
</div>

0 commit comments

Comments
 (0)