Skip to content

Commit

Permalink
Merge pull request #580 from LINCnil/pia-v3-1_authentication_system
Browse files Browse the repository at this point in the history
Pia v3 1 authentication system
  • Loading branch information
brunto authored Apr 13, 2022
2 parents 8d42e8f + 8eec915 commit 983833f
Show file tree
Hide file tree
Showing 172 changed files with 11,959 additions and 5,701 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ jobs:
browser: chrome
headless: true
wait-on: http://localhost:4200
env: # Or as an environment variable
CYPRESS_URL: ${{ secrets.CYPRESS_URL }}
CYPRESS_ID: ${{ secrets.CYPRESS_ID }}
CYPRESS_SECRET: ${{ secrets.CYPRESS_SECRET }}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Pia [v.3.0.1](https://github.com/LINCnil/pia/releases/tag/v3.0.1)

# Le logiciel PIA / The PIA Software

## Présentation / Presentation
Expand All @@ -21,6 +23,7 @@ To translate the software, we invite you to visit the [related repository](https
![CI](https://github.com/lincnil/pia/workflows/integration-tests/badge.svg?branch=master)
[![CodeQL](https://github.com/LINCnil/pia/actions/workflows/codeql-analysis.yml/badge.svg?branch=3.0.0)](https://github.com/LINCnil/pia/actions/workflows/codeql-analysis.yml)


This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.1.

## Package Version
Expand Down
16 changes: 8 additions & 8 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"pia": {
"pia-angular": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
Expand All @@ -17,7 +17,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/pia",
"outputPath": "dist/pia-angular",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
Expand Down Expand Up @@ -92,18 +92,18 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "pia:build"
"browserTarget": "pia-angular:build"
},
"configurations": {
"production": {
"browserTarget": "pia:build:production"
"browserTarget": "pia-angular:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "pia:build"
"browserTarget": "pia-angular:build"
}
},
"test": {
Expand Down Expand Up @@ -136,11 +136,11 @@
"e2e": {
"builder": "ngx-cypress-builder:cypress",
"options": {
"devServerTarget": "pia:serve"
"devServerTarget": "pia-angular:serve"
},
"configurations": {
"production": {
"devServerTarget": "pia:serve:production"
"devServerTarget": "pia-angular:serve:production"
}
}
}
Expand Down Expand Up @@ -185,7 +185,7 @@
}
}
},
"defaultProject": "pia",
"defaultProject": "pia-angular",
"cli": {
"analytics": false
}
Expand Down
402 changes: 206 additions & 196 deletions cypress/fixtures/pia.json

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions cypress/integration/pia-angular/client_serveur.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
describe("Client-Server", () => {
before(() => {
// Clear datas
cy.init();
});

beforeEach(() => {
// Skip tutorial
cy.disable_onboarding();
});

/**
* Go to Entries page pia-navigationBlock-withsub pia-navigationBlock-dropdown
*/
context("Start", () => {
it("Go on serveur URL configuration", () => {
cy.visit("/");
cy.get(".pia-navigationBlock-dropdown")
.eq(0)
.trigger("mouseover");
cy.wait(500);
cy.get(".ng-untouched fieldset a")
.eq(0)
.click({ force: true });
cy.wait(500);
});
});

context("Write URL ID and SECRET", () => {
it("Write URL", () => {
cy.get("#server_url").type(Cypress.env("URL"));
});
it("Write ID", () => {
cy.get("#client_id").type(Cypress.env("ID"));
});
it("Write SECRET", () => {
cy.get("#client_secret").type(Cypress.env("SECRET"));
});
});

context("Redirection", () => {
it("Click on save", () => {
cy.get(".btn-green").click();
cy.wait(5000);
cy.get("button[type=button]")
.eq(1)
.click();

cy.url().should("include", "/");
});

it("Verify URL", () => {
cy.url().should("include", "/");
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,20 @@ describe("Validation", () => {
// TODO: Import pia with .json
it("File Upload using cypress-file-upload package", () => {
cy.import_pia();
cy.get("a.btn.btn-green")
.first()
.click();
});
});

context("Refuse or ask pia signature", () => {
it(
"should refuse pia",
{
retries: {
runMode: 2,
openMode: 2
}
},
() => {
cy.get_current_pia_id(id => {
cy.go_edited_pia(id, 4, 3).then(() => {
cy.validateDPO();
});
it("should refuse pia", () => {
cy.get_current_pia_id(id => {
cy.go_edited_pia(id, 4, 3).then(() => {
cy.validateDPO();
cy.refusePia();
});
}
);
});
});
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
describe("Validation", () => {
let visit_id = null;

before(() => {
cy.init();
});
Expand All @@ -12,26 +14,32 @@ describe("Validation", () => {
// TODO: Import pia with .json
it("File Upload using cypress-file-upload package", () => {
cy.import_pia();
cy.get("a.btn.btn-green")
.first()
.click();
});
});

context("Avis du DPD et des personnes concernées", () => {
it("should complete DPD", () => {
cy.get_current_pia_id(id => {
visit_id = id;
cy.go_edited_pia(id, 4, 3).then(() => {
cy.validateDPO();
});
});
});

it("should valid pia", () => {
cy.validatePia();
// cy.closeValidationEvaluationModal();
});

it("should show report", () => {
cy.closeValidationEvaluationModal();
cy.get('.pia-previewBlock[href="#/preview/2"]').click();
cy.get("a.btn.pia-previewBlock").click();

cy.url().should("include", "/preview/2");
cy.url().should("include", "/preview/" + visit_id);

cy.get(".pia-fullPreviewBlock-data").should("exist");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ describe("Entries_card", () => {
// Redirect into entries
cy.visit(`/#/entries`);
cy.wait(3000);
cy.get("#pia-edit-2-name").type("pia edited");
cy.get("#pia-edit-2-name")
.clear()
.type("pia edited");
cy.get("#pia-edit-2-author-name")
.clear()
.type("author edited");
Expand All @@ -59,13 +61,12 @@ describe("Entries_card", () => {
cy.visit(`/#/entries`);
cy.wait(3000);
cy.get(".pia-cardsBlock.pia").should("have.length", 1);
cy.get(".pia-cardsBlock-toolbar-export a")
.eq(1)
.click();
// Redirect into entries
cy.visit(`/#/entries`).then(() => {
cy.get(".pia-cardsBlock.pia").should("have.length", 2);
});
cy.get(".pia-cardsBlock-toolbar-export a:eq(0)")
.click()
.then(() => {
cy.wait(10000);
cy.get(".pia-cardsBlock.pia").should("have.length", 2);
});
});

/**
Expand All @@ -75,7 +76,7 @@ describe("Entries_card", () => {
// Redirect into entries
cy.visit(`/#/entries`);
cy.get(".pia-cardsBlock-toolbar-export a")
.eq(1)
.eq(2)
.click();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe("Entries_table", () => {
*/
context("entries_table", () => {
it("change display", () => {
cy.init();
cy.click_on_start();
cy.get(".pia-filtersBlock-switch").click();
});
Expand Down Expand Up @@ -54,7 +55,7 @@ describe("Entries_table", () => {
cy.get(".pia-list-table tbody tr td:eq(1) div")
.click()
.clear()
.type("pia edited");
.type("pia edited for table test");

//Edit author
cy.get(".pia-list-table tbody tr td:eq(3) div")
Expand All @@ -80,7 +81,12 @@ describe("Entries_table", () => {
*/
it("should duplicate pia", () => {
cy.get(".pia-list-table tbody tr").should("have.length", 1);
cy.get(".pia-list-table tbody tr td:eq(0) .fa-files-o")
// cy.get(".pia-list-table tbody tr) td:eq(0) .fa-files-o")
// .click()
// .then(() => {
// cy.get(".pia-list-table tbody tr").should("have.length", 2);
// });
cy.get(".app-list-item:eq(0) td:eq(0) a:eq(1)")
.click()
.then(() => {
cy.get(".pia-list-table tbody tr").should("have.length", 2);
Expand Down
24 changes: 15 additions & 9 deletions cypress/integration/pia-angular/risk/edit_eval.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,22 @@ export function risk_edit_eval() {
});

context("Accès illégitime à des données", () => {
it("should add tags and move gauges", () => {
cy.get_current_pia_id(id => {
// change section and item
cy.go_edited_pia(id, 3, 2).then(() => {
cy.test_add_tags();
cy.test_move_gauges();
cy.test_writing_on_textarea();
it(
"should add tags and move gauges",
{
retries: 1
},
() => {
cy.get_current_pia_id(id => {
// change section and item
cy.go_edited_pia(id, 3, 2).then(() => {
cy.test_add_tags();
cy.test_move_gauges();
cy.test_writing_on_textarea();
});
});
});
});
}
);

it("should valid evaluation", () => {
cy.validateEval();
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/pia-angular/risk/validation.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import risk_edit_eval from "./edit_eval.spec";
import risk_edit_eval from "./edit_eval.spec"; // DO NOT DELETE THIS LINE (launch test)
export function risk_validation() {
describe("Risques Validation", () => {
beforeEach(() => {
Expand Down
9 changes: 9 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
require("dotenv").config();

module.exports = (on, config) => {
// config = dotenvPlugin(config);

on("before:browser:launch", (browser, launchOptions) => {
const downloadDirectory = "../download";
// CHROME
Expand Down Expand Up @@ -43,4 +46,10 @@ module.exports = (on, config) => {
return launchOptions;
}
});

config.env.URL = process.env.CYPRESS_URL;
config.env.ID = process.env.CYPRESS_ID;
config.env.SECRET = process.env.CYPRESS_SECRET;

return config;
};
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 983833f

Please sign in to comment.