Skip to content

Commit

Permalink
Merge pull request #611 from LINCnil/feature/add-editmode-checking-on…
Browse files Browse the repository at this point in the history
…-attachment-and-revision

Feature/add editmode checking on attachment and revision
  • Loading branch information
syl-p authored Nov 26, 2021
2 parents 11a6636 + 5c417ec commit f3774c9
Show file tree
Hide file tree
Showing 29 changed files with 346 additions and 208 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Cypress
uses: cypress-io/github-action@v2
Expand All @@ -14,3 +14,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 }}
1 change: 0 additions & 1 deletion cypress/fixtures/pia.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"evaluator_name": "Prénom Nom",
"validator_name": "Prénom Nom",
"updated_at": "2021-02-15T14:30:23.108Z",
"id": 1,
"progress": 67.5,
"structure_id": ""
},
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/pia-angular/client_serveur.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("Client-Server", () => {
it("Click on save", () => {
cy.get(".btn-green").click();
cy.wait(5000);
cy.get(".btn-green")
cy.get("button[type=button]")
.eq(1)
.click();

Expand Down
31 changes: 31 additions & 0 deletions cypress/integration/pia-angular/dpo_and_pia_refuse.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
describe("Validation", () => {
before(() => {
cy.init();
});

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

context("Prepare data with import", () => {
// 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", () => {
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,41 +14,34 @@ 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.go_edited_pia(1, 4, 3).then(() => {
cy.validateDPO();
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/1"]').click();
cy.get("a.btn.pia-previewBlock").click();

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

cy.get(".pia-fullPreviewBlock-data").should("exist");
});
});

context("Refuse or ask pia signature", () => {
it("Upload file", () => {
cy.init();
cy.disable_onboarding();
cy.import_pia();
});

it("should refuse pia", () => {
cy.go_edited_pia(1, 4, 3).then(() => {
cy.validateDPO();
});
cy.refusePia();
});
});
});
12 changes: 7 additions & 5 deletions cypress/integration/pia-angular/entries_card.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ describe("Entries_card", () => {
// Redirect into entries
cy.visit(`/#/entries`);
cy.wait(3000);
cy.get("#pia-edit-1-name").type("pia edited");
cy.get("#pia-edit-1-author-name")
cy.get("#pia-edit-2-name")
.clear()
.type("pia edited");
cy.get("#pia-edit-2-author-name")
.clear()
.type("author edited");
cy.get("#pia-edit-1-evaluator-name")
cy.get("#pia-edit-2-evaluator-name")
.clear()
.type("evaluator edited");
cy.get("#pia-edit-1-validator-name")
cy.get("#pia-edit-2-validator-name")
.clear()
.type("validator edited");
});
Expand Down Expand Up @@ -75,7 +77,7 @@ describe("Entries_card", () => {
// Redirect into entries
cy.visit(`/#/entries`);
cy.get(".pia-cardsBlock-toolbar-export a")
.eq(1)
.eq(2)
.click();
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/pia-angular/entries_table.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,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 Down
12 changes: 5 additions & 7 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ module.exports = (on, config) => {
}
});

return Object.assign({}, config, {
env: {
URL: process.env.CYPRESS_URL,
ID: process.env.CYPRESS_ID,
SECRET: process.env.CYPRESS_SECRET
}
});
config.env.URL = process.env.CYPRESS_URL;
config.env.ID = process.env.CYPRESS_ID;
config.env.SECRET = process.env.CYPRESS_SECRET;

return config;
};
Loading

0 comments on commit f3774c9

Please sign in to comment.