diff --git a/App/Heure.ts b/App/Heure.ts new file mode 100644 index 0000000000000000000000000000000000000000..fbebe871132e6673ee654a9b39c4d3f86b0e29a8 --- /dev/null +++ b/App/Heure.ts @@ -0,0 +1,27 @@ +class Heure { + private static _instance: Heure; + private _heure: number =0; + + private constructor(heure :number) { + this._heure = heure; + } + + public get heure(): number { + return this._heure; + } + + public set heure(value: number) { + this._heure = value; + } + + public static getInstance(heure: number = 0): Heure { + if (!Heure._instance) { + Heure._instance = new Heure(heure); + } + else { + Heure._instance._heure =heure + } + return Heure._instance; + } + +} \ No newline at end of file diff --git a/App/Minutes.ts b/App/Minutes.ts new file mode 100644 index 0000000000000000000000000000000000000000..719394fbb3dabbfa7b5fd6352337da0518e70fc6 --- /dev/null +++ b/App/Minutes.ts @@ -0,0 +1,31 @@ +class Minutes { + private _minutes: number=0; + private static instance: Minutes; + + + public get minutes(): number { + return this._minutes; + } + public set minutes(value: number) { + this._minutes = value; + } + private constructor(minutes) { + this.minutes = minutes; + } + + public static getInstance(minutes: number = 0): Minutes { + if (!Minutes.instance) { + Minutes.instance = new Minutes(minutes); + } + else { + Minutes.instance._minutes =minutes + } + return Minutes.instance; + } + incrementMinutes(){ + while(this.minutes<=59){ + this._minutes++ + } + +} +} \ No newline at end of file diff --git a/App/main.ts b/App/main.ts new file mode 100644 index 0000000000000000000000000000000000000000..2e4f52141935b922cf3009553bad3d5a126ce8f5 --- /dev/null +++ b/App/main.ts @@ -0,0 +1,12 @@ +function main(){ + let s1 = Heure.getInstance(23); +console.log("Heure" + s1.heure) + +while(s1.heure<24){ +let s2 = Minutes.getInstance(25); +console.log("s1 : Texte : " + Minutes); +s2.incrementMinutes +console.log("s2 : Texte : " + s2.minutes); +} +} +main() \ No newline at end of file diff --git a/cypress/e2e/spec.cy.js b/cypress/e2e/spec.cy.js index a36ac34b31d685d0a64ed854b28d4a118a3ba8bb..973a0a9f7c0f8b2bdf9ebb767a1163edd75520a1 100644 --- a/cypress/e2e/spec.cy.js +++ b/cypress/e2e/spec.cy.js @@ -1,9 +1,21 @@ describe('template spec', () => { beforeEach(() => { - cy.visit('tests_cypress.html') + cy.visit('https://dptinfo.iutmetz.univ-lorraine.fr/applis/stages/login.php'); }); - it('passes', () => { - cy.visit('https://example.cypress.io') - }) - -}) \ No newline at end of file + + + it('Test alert connexion', () => { + cy.get('#login').type('wrongUsername'); + cy.get('#psw').type('wrongPassword'); + cy.get('button[type="submit"]').click(); + cy.get('.alert').should('contain.text', 'Couple Identifiant/mot de passe inconnu'); + }); + it('Test connexion reussi', () => { + cy.get('#login').type('Yparviz'); // Je ne me rappelle plus de mon pswd + cy.get('#psw').type('32216049'); + cy.get('button[type="submit"]').click() + cy.url().should('include', '/portail.php'); + }); + + +});