Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjmaclean committed May 12, 2022
2 parents c93dabc + 0f74cdd commit c9a5f18
Show file tree
Hide file tree
Showing 132 changed files with 11,721 additions and 11,479 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ To run the cypress tests in development (watch mode), start the dev server in on

npm run cypress

### Accessibility tests (development)

To run the accessibility tests:

npm run test:accessibility

## Deploy

We use jenkins to deploy. Make sure you can access [https://jenkins.eanadev.org/](https://jenkins.eanadev.org/) and use the following jobs:
Expand Down
40 changes: 33 additions & 7 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
"root": "",
"sourceRoot": "src",
"prefix": "app",
"i18n": {
"sourceLocale": "en-GB",
"locales": {
"en": {
"translation": "src/locale/messages.en-GB.xlf",
"baseHref": "/en/"
},
"it": {
"translation": "src/locale/messages.it.xlf",
"baseHref": "/it/"
}
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
Expand All @@ -27,12 +40,21 @@
"polylabel",
"raf",
"xlsx",
"@babel/runtime"
"@babel/runtime",
"pdfmake"
],
"aot": true,
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": []
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": [],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
Expand Down Expand Up @@ -70,7 +92,8 @@
}
]
}
}
},
"defaultConfiguration": ""
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
Expand Down Expand Up @@ -98,9 +121,12 @@
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"karmaConfig": "karma.conf.cjs",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": [],
"codeCoverageExclude": ["src/app/_mocked/*.ts"]
}
Expand Down
75 changes: 75 additions & 0 deletions cypress/integration/a11y.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import 'cypress-axe'

context('Statistics Dashboard Accessibility', () => {

const checkZone = (selector: string): void => {
cy.get(selector).should('have.length', 1);
cy.checkA11y(selector);
};

const injectAxe = (): void => {
// cy.injectAxe();
// cy.injectAxe is currently broken. https://github.com/component-driven/cypress-axe/issues/82
// (so use custom injection logic)

cy.readFile('node_modules/axe-core/axe.min.js').then((source) => {
return cy.window({ log: false }).then((window) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(window as any).eval(source);
});
});
};

beforeEach(() => {
cy.server();
});

describe('Landing Page', () => {

beforeEach(() => {
cy.visit('/');
injectAxe();
});

it('Has an accessible header', () => {
checkZone('header');
});

it('Has an accessible footer', () => {
checkZone('footer');
});

it('Has an accessible main', () => {
checkZone('main');
});

it('Has no detectable a11y violations ()', () => {
cy.checkA11y();
})
});

describe('Data Page', () => {

beforeEach(() => {
cy.visit(`/data/contentTier`);
injectAxe();
});

it('Has an accessible header', () => {
checkZone('header');
});

it('Has an accessible footer', () => {
checkZone('footer');
});

it('Has an accessible main', () => {
checkZone('main');
});

it('Has no detectable a11y violations', () => {
cy.checkA11y();
})

});
});
88 changes: 88 additions & 0 deletions cypress/integration/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
context('Statistics Dashboard', () => {
describe('App Routes', () => {
const selCTZero = '#ctZero';
const selLinkDataContentTier = '[data-e2e=link-entry-ct]';
const selLinkHeader = '[data-e2e=link-home-header]';
const urlContentTier = '/data/contentTier';
const urlParamCTZero = 'content-tier-zero=';
const urlParamCTZeroTrue = `?${urlParamCTZero}true`;

const checkCTZeroChangesUrl = (): void => {
cy.get(selCTZero).should('have.length', 1);
cy.get(selCTZero).should('not.be.checked');
cy.url().should('not.contain', urlParamCTZero);

cy.get(selCTZero).click({force: true});
cy.get(selCTZero).should('be.checked');
cy.url().should('contain', urlParamCTZero);
};

it('the url should reflect content-tier-zero visibility (landing page)', () => {
cy.visit('/');
checkCTZeroChangesUrl();
});

it('the url should reflect content-tier-zero visibility (data page)', () => {
cy.visit(urlContentTier);
checkCTZeroChangesUrl();
});

it('the content-tier-zero should be remembered between pages (click test)', () => {
cy.visit('/');
cy.get(selCTZero).click({force: true});
cy.get(selCTZero).should('be.checked');
cy.url().should('contain', urlParamCTZero);

const goBackAndForth = () => {
cy.url().should('not.contain', '/data');
cy.get(selLinkDataContentTier).click({force: true});

cy.get(selCTZero).should('be.checked');
cy.url().should('contain', urlParamCTZero);

cy.get(selLinkHeader).click({force: true});

cy.get(selCTZero).should('be.checked');
cy.url().should('contain', urlParamCTZero);
};
goBackAndForth();
goBackAndForth();
});

it('the content-tier-zero should be remembered between pages (history test)', () => {

const host = 'http://localhost:4280';
cy.visit('/')
const expectedHistory = ['/', `/${urlParamCTZeroTrue}`, `${urlContentTier}${urlParamCTZeroTrue}`, `${urlContentTier}`, '/'];

cy.location('search').should('equal', '');
cy.location('pathname').should('equal', '/');
cy.location('href').should('equal', `${host}${expectedHistory[0]}`);

cy.get(selCTZero).click({force: true});
cy.location('href').should('equal', `${host}${expectedHistory[1]}`);

cy.get(selLinkDataContentTier).click({force: true});
cy.location('href').should('equal', `${host}${expectedHistory[2]}`);

cy.get(selCTZero).click({force: true});
cy.location('href').should('equal', `${host}${expectedHistory[3]}`);

cy.get(selLinkHeader).click({force: true});
cy.location('href').should('equal', `${host}${expectedHistory[4]}`);

// browser back
for(let i = 0; i < expectedHistory.length -1; i++) {
const historyIndex = expectedHistory.length - (i + 1);
cy.location('href').should('equal', `${host}${expectedHistory[historyIndex]}`);
cy.go('back');
}

// browser forward
for(let i = 0; i < expectedHistory.length -1; i++) {
cy.location('href').should('equal', `${host}${expectedHistory[i]}`);
cy.go('forward');
}
});
});
});
2 changes: 1 addition & 1 deletion cypress/integration/ct-zero.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DimensionName } from '../../src/app/_models';

context('statistics-dashboard', () => {
context('Statistics Dashboard', () => {

const ctZeroParam = 'content-tier-zero=true';
const ctZeroFilterParam = DimensionName.contentTier;
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/export.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DimensionName } from '../../src/app/_models';

context('statistics-dashboard', () => {
context('Statistics Dashboard', () => {

const force = { force : true };
const selExports = '.export.active';
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/filter-removal.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DimensionName } from '../../src/app/_models';

context('statistics-dashboard', () => {
context('Statistics Dashboard', () => {
describe('filter removal', () => {
const force = { force: true };
const selFilterRemove = '.rm-filter';
Expand Down
Loading

0 comments on commit c9a5f18

Please sign in to comment.