Skip to content

Commit

Permalink
Merge branch 'preprod' into feat/attendance
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarobidy-23 committed Dec 12, 2024
2 parents 27aa80b + 13e83a4 commit a997e21
Showing 99 changed files with 6,920 additions and 6,199 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/health-hei-admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: health-hei-admin

on:
push:
branches:
- main
schedule:
- cron: "*/5 6-15 * * 1-5" # Exécuter toutes les 5 minutes de 8h à 17h (UTC+3) pendant les jours ouvrables

env:
REACT_APP_TEST_STUDENT1_PASSWORD: ${{ secrets.STUDENT1_PASSWORD }}
REACT_APP_AWS_REGION: eu-west-3
REACT_APP_USERPOOL_ID: ${{ vars.PREPROD_USERPOOL_ID }}
REACT_APP_WEBCLIENT_ID: ${{ vars.PREPROD_WEBCLIENT_ID }}
REACT_APP_OAUTH_DOMAIN: ${{ vars.PREPROD_OAUTH_DOMAIN }}

jobs:
auth-check:
timeout-minutes: 4
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm

- name: Install dependencies
run: npm install

- name: Configure prod AWS credentials
uses: aws-actions/configure-aws-credentials@v4.0.1
with:
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.REACT_APP_AWS_REGION }}
- run: sh ./initNpmrc.sh hei-store npm-hei-school 088312068315

- name: Run authentification tests
uses: cypress-io/github-action@v6
with:
spec: "./cypress/e2e/hei-admin/authentification.cy.tsx"

update-status:
needs: [auth-check]
runs-on: ubuntu-latest
steps:
- name: Set trigger value based on job status
id: set-trigger
run: echo "trigger=$(if [ '${{ job.status }}' == 'failure' ]; then echo 'down'; else echo 'up'; fi)" >> $GITHUB_ENV

- name: Send update to hei admin webhook
uses: fjogeleit/http-request-action@v1.16.3
with:
url: ${{ secrets.HEI_ADMIN_WEBHOOK_URL }}
method: "POST"
customHeaders: '{"Content-Type": "application/json"}'
data: '{"trigger": "${{ env.trigger }}"}'
10 changes: 5 additions & 5 deletions cypress/e2e/letters.manager.cy.tsx
Original file line number Diff line number Diff line change
@@ -13,25 +13,25 @@ describe("Manager.Letters", () => {
cy.clearCookies();
cy.clearLocalStorage();
cy.login({role: "MANAGER"});
cy.intercept("GET", `letters/stats`, statsMocks).as("getStats");
cy.intercept("GET", `students/letters/stats`, statsMocks).as("getStats");
cy.intercept(
"GET",
`/letters?page=1&page_size=10`,
`/students/letters?page=1&page_size=10`,
lettersMocks.slice(0, ITEM_PER_LIST)
).as("getAllLetters");
cy.intercept(
"GET",
`/letters?page=1&page_size=10&name=${student1Mock.first_name}`,
`/students/letters?page=1&page_size=10&name=${student1Mock.first_name}`,
student1LettersMocks.slice(0, ITEM_PER_LIST)
).as("getLettersFilteredByfirstName");
cy.intercept(
"GET",
`/letters?page=1&page_size=10&ref=${newLetter2[0].ref}`,
`/students/letters?page=1&page_size=10&ref=${newLetter2[0].ref}`,
newLetter2
).as("getLettersFilteredByRef");
cy.intercept(
"GET",
`/letters?page=1&page_size=10&status=${newLetter2[0].status}`,
`/students/letters?page=1&page_size=10&status=${newLetter2[0].status}`,
newLetter2
).as("getLettersFilteredByStatus");
cy.intercept("PUT", `/letters`, (req) => {
13 changes: 6 additions & 7 deletions cypress/e2e/manager.fees.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {FeeTypeEnum} from "@haapi/typescript-client";

import {assertFeeMatchesTemplate} from "./utils";
import {
annual1xTemplate,
@@ -10,9 +9,10 @@ import {student1Mock, studentsMock} from "../fixtures/api_mocks/students-mocks";
import {fee1Mock, feesMock} from "../fixtures/api_mocks/fees-mocks";
import {createPaymentMock} from "../fixtures/api_mocks/payments-mocks";

import {renderMoney} from "../../src/operations/common/utils/money";
import {getFeesStatusInFr} from "../../src/operations/common/utils/typo_util";
import {get27thOfMonth} from "../../src/utils/date";
/*Added this to make the test blackbox */
const get27thOfMonth = (year: number, month: number) => {
return new Date(year, month, 27);
};

describe("Manager.Fee", () => {
beforeEach(() => {
@@ -83,10 +83,9 @@ describe("Manager.Fee", () => {
cy.get("#main-content tbody tr").first().click();
cy.wait("@getFee1");
cy.get("#main-content")
.should("contain", renderMoney(interceptedFeeMock!.remaining_amount!))
.and("contain", renderMoney(interceptedFeeMock!.total_amount!))
.should("contain", `${interceptedFeeMock!.remaining_amount!} Ar`)
.and("contain", `${interceptedFeeMock!.total_amount!} Ar`)
.and("contain", interceptedFeeMock!.comment!)
.and("contain", getFeesStatusInFr(interceptedFeeMock!.status))
.and("contain", "Paiements");
});

2 changes: 1 addition & 1 deletion cypress/e2e/manager.fees.import.cy.tsx
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ describe("Manager import fees for one students", () => {
cy.intercept("GET", `/students/${student1Mock.id}`, student1Mock).as(
"getStudent1"
);
cy.intercept("GET", `letters/stats`, statsMocks).as("getStats");
cy.intercept("GET", `students/letters/stats`, statsMocks).as("getStats");
cy.intercept(
"GET",
`/students/${student1Mock.id}/fees?page=1&page_size=10`,
27 changes: 13 additions & 14 deletions cypress/e2e/manager.fees.mpbs.cy.tsx
Original file line number Diff line number Diff line change
@@ -12,11 +12,10 @@ describe("Mobile payment by student", () => {
});

it("can list fees transactions", () => {
cy.intercept(
"GET",
`/fees?page=1&page_size=10&isMpbs=true`,
feesMpbsMock
).as("getFees");
cy.intercept("GET", `/fees?page=1&page_size=10&isMpbs=true`, {
data: feesMpbsMock,
statistics: {},
}).as("getFees");

cy.get(`[href="#/transactions"]`).click();

@@ -27,9 +26,9 @@ describe("Mobile payment by student", () => {
});

it("shows success status icon when the status is SUCCESS", () => {
cy.intercept("GET", `/fees?page=1&page_size=10&isMpbs=true`, [
succeedMpbs1,
]).as("getFees");
cy.intercept("GET", `/fees?page=1&page_size=10&isMpbs=true`, {
data: [succeedMpbs1],
}).as("getFees");

cy.get(`[href="#/transactions"]`).click();

@@ -41,9 +40,9 @@ describe("Mobile payment by student", () => {
});

it("shows pending status icon when the status is PENDING", () => {
cy.intercept("GET", `/fees?page=1&page_size=10&isMpbs=true`, [
pendingMpbs,
]).as("getFees");
cy.intercept("GET", `/fees?page=1&page_size=10&isMpbs=true`, {
data: [pendingMpbs],
}).as("getFees");

cy.get(`[href="#/transactions"]`).click();

@@ -55,9 +54,9 @@ describe("Mobile payment by student", () => {
});

it("shows failed status icon when the status is FAILED", () => {
cy.intercept("GET", `/fees?page=1&page_size=10&isMpbs=true`, [
failedMpbs,
]).as("getFees");
cy.intercept("GET", `/fees?page=1&page_size=10&isMpbs=true`, {
data: [failedMpbs],
}).as("getFees");

cy.get(`[href="#/transactions"]`).click();

2 changes: 1 addition & 1 deletion cypress/e2e/manager.multiple.students.cy.tsx
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ describe("Manager create multiple students", () => {
[student1Mock]
).as("getStudentsByName");
cy.intercept("GET", `/students/${student1Mock.id}`, student1Mock);
cy.intercept("GET", `letters/stats`, {}).as("getStats");
cy.intercept("GET", `students/letters/stats`, {}).as("getStats");
cy.wait("@getWhoami", {timeout: 10000});
cy.wait("@getStats");
cy.getByTestid("students-menu").click();
9 changes: 4 additions & 5 deletions cypress/e2e/manager.payments.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {renderMoney} from "../../src/operations/common/utils/money";
import {
UpdateFeeWithPaymentMock,
feesMock,
@@ -61,7 +60,7 @@ describe("Manager.Payment", () => {
cy.getByTestid("fees-list-tab").click();

cy.contains(unpaidFeeMock.comment as string).click();
cy.contains("En attente");
cy.contains("En cours");
cy.getByTestid("AddIcon").click();
cy.intercept(
"GET",
@@ -81,7 +80,7 @@ describe("Manager.Payment", () => {
cy.get("#comment").click().type(createPayment.comment!);
cy.contains("Enregistrer").click();
cy.contains("Élément créé");
cy.get(`.MuiTableCell-alignRight:contains(${renderMoney(amount)})`).should(
cy.get(`.MuiTableCell-alignRight:contains(${amount} Ar)`).should(
"have.length",
1
);
@@ -94,7 +93,7 @@ describe("Manager.Payment", () => {
cy.get("#comment").click().type(createPayment.comment!);
cy.contains("Enregistrer").click();
cy.contains("Élément créé");
cy.get(`.MuiTableCell-alignRight:contains(${renderMoney(amount)})`).should(
cy.get(`.MuiTableCell-alignRight:contains(${amount} Ar)`).should(
"have.length",
1
);
@@ -116,7 +115,7 @@ describe("Manager.Payment", () => {
cy.get("#creation_datetime").click().type("2023-11-24");
cy.contains("Enregistrer").click();
cy.contains("Élément créé");
cy.get(`.MuiTableCell-alignRight:contains(${renderMoney(amount)})`).should(
cy.get(`.MuiTableCell-alignRight:contains(${amount} Ar)`).should(
"have.length",
1
);
2 changes: 1 addition & 1 deletion cypress/e2e/manager.teachers.import.cy.tsx
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ describe("Manager create multiple teachers", () => {
cy.intercept("GET", `/teachers?page=2&page_size=10`, teachersMock).as(
"getTeachersPage2"
);
cy.intercept("GET", `letters/stats`, {}).as("getStats");
cy.intercept("GET", `students/letters/stats`, {}).as("getStats");
cy.intercept(
"GET",
`/teachers?page=1&page_size=10&last_name=${teacherNameToBeCheckedMock}`,
4 changes: 2 additions & 2 deletions cypress/e2e/student.fees.mpbs.cy.tsx
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ describe("Mobile payment by student", () => {
).should("exist");
});

it.only("can create a mpbs", () => {
it.skip("can create a mpbs", () => {
const [fee1Mock, ...fees] = feesMock;

cy.intercept(
@@ -51,7 +51,7 @@ describe("Mobile payment by student", () => {
`addMobileMoney-${fee1Mock.student_id}--${fee1Mock.id}`
).click({force: true});

cy.get("#psp_id").click().type("MP240726.1541.D88425");
cy.get("#psp_id").click().type("MP240726.1541.D88429");
cy.contains("Enregistrer").click();

cy.contains("Frais créés avec succès");
Loading

0 comments on commit a997e21

Please sign in to comment.