Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/DepartureBoardWeb/…
Browse files Browse the repository at this point in the history
…ClientApp/nanoid-3.3.4
  • Loading branch information
benfl3713 committed Oct 23, 2022
2 parents 9e1dca5 + 9e3fb83 commit 25dc229
Show file tree
Hide file tree
Showing 161 changed files with 31,319 additions and 1,386 deletions.
27 changes: 24 additions & 3 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,41 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup dotnet
uses: actions/setup-dotnet@v1
- name: Build Departure Board with dotnet
run: dotnet build --configuration Release
- name: Run Departure Board Unit Tests
run: dotnet test

cypress-run:
name: Cypress Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v4
with:
build: npm run ngcc
start: npm start
wait-on: 'http://localhost:4200'
browser: chrome
record: true
working-directory: ./DepartureBoardWeb/ClientApp
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Build_Docker_Image:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
with:
fetch-depth: 1

Expand Down Expand Up @@ -53,7 +74,7 @@ jobs:
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Create Lambda Zip
run: |
Expand Down
6 changes: 3 additions & 3 deletions BusDataAPI/BusDataAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.39"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
<PackageReference Include="RestSharp" Version="106.15.0"/>
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="RestSharp" Version="106.15.0" />
</ItemGroup>

<ItemGroup>
Expand Down
17 changes: 1 addition & 16 deletions DepartureBoardCore/ConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,7 @@ public static string TflApiToken
return _tflApiToken;
}
}

public static string MoesifApplicationId
{
get
{
if(string.IsNullOrEmpty(_moesifApplicationId))
LoadConfig();
return _moesifApplicationId;
}
}


#endregion

private static string _realTimeTrainsToken;
Expand All @@ -149,7 +139,6 @@ public static string MoesifApplicationId
private static string _deutscheBahnToken;
private static int? _prometheusPort;
private static string _tflApiToken;
private static string _moesifApplicationId;

private static void LoadConfig()
{
Expand All @@ -171,7 +160,6 @@ private static void LoadConfig()
_transportApi_app_key = rootElement.Element("TransportAPI")?.Element("app_key")?.Value;
_deutscheBahnToken = rootElement.Element("DeutscheBahnToken")?.Value;
_tflApiToken = rootElement.Element("TflApiToken")?.Value;
_moesifApplicationId = rootElement.Element("MoesifApplicationId")?.Value;
if (!string.IsNullOrEmpty(rootElement.Element("PrometheusPort")?.Value) && int.TryParse(rootElement.Element("PrometheusPort")?.Value, out int port))
_prometheusPort = port;
if (_realTimeTrainsToken == "[INSERT_REALTIMETRAINS_TOKEN_HERE]"){
Expand Down Expand Up @@ -219,9 +207,6 @@ private static void CheckEnviornmentVariableConfig()
if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TflApiToken")))
_tflApiToken = Environment.GetEnvironmentVariable("TflApiToken");

if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MoesifApplicationId")))
_moesifApplicationId = Environment.GetEnvironmentVariable("MoesifApplicationId");

if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PrometheusPort")) && int.TryParse(Environment.GetEnvironmentVariable("PrometheusPort"), out int port))
_prometheusPort = port;
}
Expand Down
1 change: 1 addition & 0 deletions DepartureBoardWeb/ClientApp/.browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
last 2 versions
Firefox ESR
not dead
not IE 11
11 changes: 7 additions & 4 deletions DepartureBoardWeb/ClientApp/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"progress": false,
"progress": true,
"aot": true,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
Expand All @@ -31,8 +32,6 @@
}
],
"styles": [
"node_modules/@taiga-ui/core/styles/taiga-ui-global.less",
"node_modules/@taiga-ui/core/styles/taiga-ui-theme.less",
"src/default.theme.scss",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css",
Expand All @@ -45,7 +44,11 @@
"./node_modules/angular-notifier/styles/types/type-success.css",
"./node_modules/angular-notifier/styles/types/type-warning.css"
],
"scripts": [],
"scripts": [
"./node_modules/@popperjs/core/dist/umd/popper-lite.js",
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js"
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
Expand Down
11 changes: 11 additions & 0 deletions DepartureBoardWeb/ClientApp/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from "cypress";

export default defineConfig({
projectId: 'soessr',
e2e: {
baseUrl: "http://localhost:4200",
viewportHeight: 1080,
viewportWidth: 1920,
scrollBehavior: "center",
},
});
2 changes: 2 additions & 0 deletions DepartureBoardWeb/ClientApp/cypress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
videos/
downloads/
31 changes: 31 additions & 0 deletions DepartureBoardWeb/ClientApp/cypress/e2e/home.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
describe('Home Page Tests', () => {
beforeEach(() => cy.visit('/'))

it('Visits the Home Page', () => {
cy.get('h1').should('have.text', " Led Departure Board ")
})

it('Clicks Find your station', () => {
cy.get("#find-your-station").click({scrollBehavior: "center"})
cy.url().should('eq', Cypress.config().baseUrl + '/#search')
})

it('How to User button has correct link', () => {
cy.get('#how-to-use-button')
})

it('Search and Navigate to EUS. Should hide navbar after 3 seconds', () => {
cy.get('[data-placeholder="Station Name"]')
.focus()
.type("Euston")


cy.get('mat-option').contains(" London Euston - (EUS) - [GB] ").click()
cy.get('#btnSearch').click()

cy.url().should('contain', '/EUS')
cy.get('#nav-menu-title').should('exist')
cy.wait(3000)
cy.get('#nav-menu-title').should('not.exist')
})
})
5 changes: 5 additions & 0 deletions DepartureBoardWeb/ClientApp/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
37 changes: 37 additions & 0 deletions DepartureBoardWeb/ClientApp/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
24 changes: 24 additions & 0 deletions DepartureBoardWeb/ClientApp/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
beforeEach(() => {
cy.setCookie("CookieScriptConsent", "{\"action\":\"reject\",\"categories\":\"[]\"}")
})

Loading

0 comments on commit 25dc229

Please sign in to comment.