diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bf65eb6..06619946 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Tous les changements notables de Ara sont documentés ici avec leur date, leur c ### Autres changements ⚙️ - Ajoute une information pour préciser la nature des contenus dans l’onglet "Points d’améliorations" ([#764](https://github.com/DISIC/Ara/pull/764)) +- Simplifie l’ajout d’environnements de test personnalisés ([#765](https://github.com/DISIC/Ara/pull/765)) ## 11/07/2024 diff --git a/confiture-rest-api/prisma/migrations/20240717150619_remove_environment_version_fields/migration.sql b/confiture-rest-api/prisma/migrations/20240717150619_remove_environment_version_fields/migration.sql new file mode 100644 index 00000000..02483d0f --- /dev/null +++ b/confiture-rest-api/prisma/migrations/20240717150619_remove_environment_version_fields/migration.sql @@ -0,0 +1,47 @@ +/* + Warnings: + + - You are about to drop the column `assistiveTechnologyVersion` on the `TestEnvironment` table. All the data in the column will be lost. + - You are about to drop the column `browserVersion` on the `TestEnvironment` table. All the data in the column will be lost. + - You are about to drop the column `operatingSystemVersion` on the `TestEnvironment` table. All the data in the column will be lost. + - A unique constraint covering the columns `[platform,operatingSystem,assistiveTechnology,browser,auditUniqueId]` on the table `TestEnvironment` will be added. If there are existing duplicate values, this will fail. + +*/ + +-- DropIndex +DROP INDEX "TestEnvironment_platform_operatingSystem_operatingSystemVer_key"; + +/* + Merge: + - "operatingSystem" and "operatingSystemVersion" + - "browser" and "browserVersion" + - "assistiveTechnology" and "assistiveTechnologyVersion" +*/ +UPDATE + "TestEnvironment" +SET + "operatingSystem" = + CASE + WHEN "operatingSystemVersion" IS NOT NULL + THEN "operatingSystem" || ' ' || "operatingSystemVersion" + END, + + "browser" = + CASE + WHEN "browserVersion" IS NOT NULL + THEN "browser" || ' ' || "browserVersion" + END, + + "assistiveTechnology" = + CASE + WHEN "assistiveTechnologyVersion" IS NOT NULL + THEN "assistiveTechnology" || ' ' || "assistiveTechnologyVersion" + END; + +-- AlterTable +ALTER TABLE "TestEnvironment" DROP COLUMN "assistiveTechnologyVersion", +DROP COLUMN "browserVersion", +DROP COLUMN "operatingSystemVersion"; + +-- CreateIndex +CREATE UNIQUE INDEX "TestEnvironment_platform_operatingSystem_assistiveTechnolog_key" ON "TestEnvironment"("platform", "operatingSystem", "assistiveTechnology", "browser", "auditUniqueId"); diff --git a/confiture-rest-api/prisma/schema.prisma b/confiture-rest-api/prisma/schema.prisma index 0f0041d5..7edb012f 100644 --- a/confiture-rest-api/prisma/schema.prisma +++ b/confiture-rest-api/prisma/schema.prisma @@ -96,16 +96,13 @@ model TestEnvironment { id Int @id @default(autoincrement()) platform String operatingSystem String - operatingSystemVersion String? assistiveTechnology String - assistiveTechnologyVersion String? browser String - browserVersion String? audit Audit? @relation(fields: [auditUniqueId], references: [editUniqueId], onDelete: Cascade) auditUniqueId String? - @@unique([platform, operatingSystem, operatingSystemVersion, assistiveTechnology, assistiveTechnologyVersion, browser, browserVersion, auditUniqueId]) + @@unique([platform, operatingSystem, assistiveTechnology, browser, auditUniqueId]) } model AuditedPage { diff --git a/confiture-rest-api/src/audits/audit.service.ts b/confiture-rest-api/src/audits/audit.service.ts index 7a200192..a95c8c10 100644 --- a/confiture-rest-api/src/audits/audit.service.ts +++ b/confiture-rest-api/src/audits/audit.service.ts @@ -248,51 +248,27 @@ export class AuditService { notIn: data.environments.map((e) => e.operatingSystem) } }, - { - operatingSystemVersion: { - notIn: data.environments.map( - (e) => e.operatingSystemVersion - ) - } - }, { assistiveTechnology: { notIn: data.environments.map((e) => e.assistiveTechnology) } }, - { - assistiveTechnologyVersion: { - notIn: data.environments.map( - (e) => e.assistiveTechnologyVersion - ) - } - }, { browser: { notIn: data.environments.map((e) => e.browser) } - }, - { - browserVersion: { - notIn: data.environments.map((e) => e.browserVersion) - } } ] }, upsert: data.environments.map((environment) => ({ where: { - platform_operatingSystem_operatingSystemVersion_assistiveTechnology_assistiveTechnologyVersion_browser_browserVersion_auditUniqueId: + platform_operatingSystem_assistiveTechnology_browser_auditUniqueId: { auditUniqueId: uniqueId, platform: environment.platform, operatingSystem: environment.operatingSystem, - operatingSystemVersion: - environment.operatingSystemVersion, assistiveTechnology: environment.assistiveTechnology, - assistiveTechnologyVersion: - environment.assistiveTechnologyVersion, - browser: environment.browser, - browserVersion: environment.browserVersion + browser: environment.browser } }, create: environment, @@ -895,26 +871,12 @@ export class AuditService { auditorName: audit.auditorName, auditorEmail: null, auditorOrganisation: audit.auditorOrganisation, - desktopEnvironments: audit.environments - .filter((e) => e.platform === "desktop") - .map((e) => ({ - operatingSystem: e.operatingSystem, - operatingSystemVersion: e.operatingSystemVersion, - assistiveTechnology: e.assistiveTechnology, - assistiveTechnologyVersion: e.assistiveTechnologyVersion, - browser: e.browser, - browserVersion: e.browserVersion - })), - mobileEnvironments: audit.environments - .filter((e) => e.platform === "mobile") - .map((e) => ({ - operatingSystem: e.operatingSystem, - operatingSystemVersion: e.operatingSystemVersion, - assistiveTechnology: e.assistiveTechnology, - assistiveTechnologyVersion: e.assistiveTechnologyVersion, - browser: e.browser, - browserVersion: e.browserVersion - })), + environments: audit.environments.map((e) => ({ + platform: e.platform, + operatingSystem: e.operatingSystem, + assistiveTechnology: e.assistiveTechnology, + browser: e.browser + })), referencial: "RGAA Version 4.1", samples: audit.pages .map((p, i) => ({ diff --git a/confiture-rest-api/src/audits/dto/audit-report.dto.ts b/confiture-rest-api/src/audits/dto/audit-report.dto.ts index 9593ddbe..7e70d9a9 100644 --- a/confiture-rest-api/src/audits/dto/audit-report.dto.ts +++ b/confiture-rest-api/src/audits/dto/audit-report.dto.ts @@ -127,8 +127,7 @@ class ReportContext { tools: string[]; - desktopEnvironments: Environment[]; - mobileEnvironments: Environment[]; + environments: Environment[]; } class PageSample { @@ -141,34 +140,23 @@ class PageSample { class Environment { /** - * @example "Windows" + * @example "Mobile" */ - operatingSystem: string; - + platform: string; /** - * @example "11" + * @example "Windows" */ - operatingSystemVersion: string; + operatingSystem: string; /** * @example "JAWS" */ assistiveTechnology: string; - /** - * @example "14.2" - */ - assistiveTechnologyVersion: string; - /** * @example "Firefox" */ browser: string; - - /** - * @example "104" - */ - browserVersion: string; } class ReportCriterionResult { diff --git a/confiture-rest-api/src/audits/dto/update-audit.dto.ts b/confiture-rest-api/src/audits/dto/update-audit.dto.ts index 83295937..e1a45481 100644 --- a/confiture-rest-api/src/audits/dto/update-audit.dto.ts +++ b/confiture-rest-api/src/audits/dto/update-audit.dto.ts @@ -22,38 +22,17 @@ class UpdateAuditEnvironment { @IsString() operatingSystem: string; - /** - * @example "11" - */ - @IsString() - @IsOptional() - operatingSystemVersion?: string; - /** * @example "JAWS" */ @IsString() assistiveTechnology: string; - /** - * @example "14.2" - */ - @IsString() - @IsOptional() - assistiveTechnologyVersion?: string; - /** * @example "Firefox" */ @IsString() browser: string; - - /** - * @example "104" - */ - @IsString() - @IsOptional() - browserVersion?: string; } // class CreateAuditRecipients { diff --git a/confiture-web-app/src/components/audit/AuditEnvironmentCheckbox.vue b/confiture-web-app/src/components/audit/AuditEnvironmentCheckbox.vue index 6a293b8d..6d4f71c1 100644 --- a/confiture-web-app/src/components/audit/AuditEnvironmentCheckbox.vue +++ b/confiture-web-app/src/components/audit/AuditEnvironmentCheckbox.vue @@ -69,7 +69,7 @@ function onInput() { Couples navigateur et technologie d’assistance sur {{ - platform === Platform.DESKTOP ? "ordinateur" : "mobile" + platform }} diff --git a/confiture-web-app/src/components/audit/TestEnvironmentSelection/TestEnvironmentSelection.vue b/confiture-web-app/src/components/audit/TestEnvironmentSelection/TestEnvironmentSelection.vue index d8699f85..a469dad2 100644 --- a/confiture-web-app/src/components/audit/TestEnvironmentSelection/TestEnvironmentSelection.vue +++ b/confiture-web-app/src/components/audit/TestEnvironmentSelection/TestEnvironmentSelection.vue @@ -2,12 +2,7 @@ import { uniqWith } from "lodash-es"; import { nextTick, ref, watch } from "vue"; -import { - AssistiveTechnology, - Browsers, - OperatingSystem, - Platform -} from "../../../enums"; +import { Platform } from "../../../enums"; import { AuditEnvironment } from "../../../types"; import DsfrField from "../../ui/DsfrField.vue"; import AuditEnvironmentCheckbox from "../AuditEnvironmentCheckbox.vue"; @@ -45,11 +40,8 @@ const customEnvironments = ref([ { platform: "", operatingSystem: "", - operatingSystemVersion: "", assistiveTechnology: "", - assistiveTechnologyVersion: "", - browser: "", - browserVersion: "" + browser: "" } ] : []) @@ -74,105 +66,33 @@ watch( } ); -function availableOs(platform: string) { - switch (platform) { - case Platform.DESKTOP: - return [OperatingSystem.WINDOWS, OperatingSystem.MAC_OS]; - case Platform.MOBILE: - return [OperatingSystem.ANDROID, OperatingSystem.I_OS]; - } -} - -function availableAT(os: string) { - switch (os) { - case OperatingSystem.WINDOWS: - return [AssistiveTechnology.NVDA, AssistiveTechnology.JAWS]; - case OperatingSystem.MAC_OS: - case OperatingSystem.I_OS: - return [AssistiveTechnology.VOICE_OVER]; - case OperatingSystem.ANDROID: - return [AssistiveTechnology.TALKBACK]; - default: - return [Browsers.FIREFOX, Browsers.CHROME, Browsers.EDGE]; - } -} - -function availableBrowsers(os: string) { - switch (os) { - case OperatingSystem.WINDOWS: - return [Browsers.FIREFOX, Browsers.CHROME, Browsers.EDGE]; - case OperatingSystem.MAC_OS: - return [ - Browsers.FIREFOX, - Browsers.CHROME, - Browsers.EDGE, - Browsers.SAFARI - ]; - case OperatingSystem.I_OS: - return [Browsers.SAFARI, Browsers.CHROME]; - case OperatingSystem.ANDROID: - return [Browsers.FIREFOX, Browsers.CHROME]; - default: - return [ - Browsers.FIREFOX, - Browsers.CHROME, - Browsers.EDGE, - Browsers.SAFARI - ]; - } -} - -const envSupportRefs = ref([]); +const envPlatformRefs = ref[]>([]); /** - * Create a new environment and focus its support field. + * Create a new environment and focus its platform field. */ async function addEnvironment() { customEnvironments.value.push({ platform: "", operatingSystem: "", - operatingSystemVersion: "", assistiveTechnology: "", - assistiveTechnologyVersion: "", - browser: "", - browserVersion: "" + browser: "" }); await nextTick(); - const lastInput = envSupportRefs.value[envSupportRefs.value.length - 1]; - lastInput.focus(); + const lastInput = envPlatformRefs.value[envPlatformRefs.value.length - 1]; + lastInput.inputRef?.focus(); } /** - * Delete environment at index and focus previous or first support field. + * Delete environment at index and focus previous or first platform field. * @param {number} i */ async function deleteEnvironment(i: number) { customEnvironments.value.splice(i, 1); await nextTick(); const previousInput = - i === 0 ? envSupportRefs.value[0] : envSupportRefs.value[i - 1]; - previousInput.focus(); -} - -const forceShowEnvFields = ref(false); - -async function onPlatformChange(env: Omit) { - if (!env.operatingSystem && !env.browser && !env.assistiveTechnology) return; - if (env.operatingSystem && env.browser && env.assistiveTechnology) { - forceShowEnvFields.value = true; - } - if (env.operatingSystem) env.operatingSystem = ""; - if (env.assistiveTechnology) env.assistiveTechnology = ""; - if (env.browser) env.browser = ""; -} - -async function onOsChange(env: Omit) { - if (!env.browser && !env.assistiveTechnology) return; - if (env.browser && env.assistiveTechnology) { - forceShowEnvFields.value = true; - } - if (env.assistiveTechnology) env.assistiveTechnology = ""; - if (env.browser) env.browser = ""; + i === 0 ? envPlatformRefs.value[0] : envPlatformRefs.value[i - 1]; + previousInput.inputRef?.focus(); } /** @@ -262,7 +182,7 @@ function combineEnvironments( /> -
+
-
+

+ Ajouter un environnement de test personnalisé +

+ +

Environnement {{ i + 1 }}

@@ -291,138 +215,53 @@ function combineEnvironments( > Supprimer -
-
- - Support - -
-
- - -
-
- - -
-
-
-
-
- - -
+ -
- - -
+ + -
- - -
-
+ + -../../../enums../../../types diff --git a/confiture-web-app/src/components/audit/TestEnvironmentSelection/combinations.ts b/confiture-web-app/src/components/audit/TestEnvironmentSelection/combinations.ts index 51883941..43f25c79 100644 --- a/confiture-web-app/src/components/audit/TestEnvironmentSelection/combinations.ts +++ b/confiture-web-app/src/components/audit/TestEnvironmentSelection/combinations.ts @@ -15,27 +15,18 @@ export const desktopCombinations = [ environments: [ { operatingSystem: OperatingSystem.WINDOWS, - operatingSystemVersion: "", browser: Browsers.FIREFOX, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.NVDA, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.NVDA }, { operatingSystem: OperatingSystem.WINDOWS, - operatingSystemVersion: "", browser: Browsers.FIREFOX, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.JAWS, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.JAWS }, { operatingSystem: OperatingSystem.MAC_OS, - operatingSystemVersion: "", browser: Browsers.SAFARI, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.VOICE_OVER, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.VOICE_OVER } ] }, @@ -44,27 +35,18 @@ export const desktopCombinations = [ environments: [ { operatingSystem: OperatingSystem.WINDOWS, - operatingSystemVersion: "", browser: Browsers.FIREFOX, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.NVDA, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.NVDA }, { operatingSystem: OperatingSystem.WINDOWS, - operatingSystemVersion: "", browser: Browsers.EDGE, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.JAWS, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.JAWS }, { operatingSystem: OperatingSystem.MAC_OS, - operatingSystemVersion: "", browser: Browsers.SAFARI, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.VOICE_OVER, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.VOICE_OVER } ] }, @@ -73,27 +55,18 @@ export const desktopCombinations = [ environments: [ { operatingSystem: OperatingSystem.WINDOWS, - operatingSystemVersion: "", browser: Browsers.EDGE, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.NVDA, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.NVDA }, { operatingSystem: OperatingSystem.WINDOWS, - operatingSystemVersion: "", browser: Browsers.FIREFOX, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.JAWS, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.JAWS }, { operatingSystem: OperatingSystem.MAC_OS, - operatingSystemVersion: "", browser: Browsers.SAFARI, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.VOICE_OVER, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.VOICE_OVER } ] } @@ -106,11 +79,8 @@ export const mobileCombinations = [ environments: [ { operatingSystem: OperatingSystem.I_OS, - operatingSystemVersion: "", browser: Browsers.SAFARI, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.VOICE_OVER, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.VOICE_OVER } ] }, @@ -119,18 +89,15 @@ export const mobileCombinations = [ environments: [ { operatingSystem: OperatingSystem.ANDROID, - operatingSystemVersion: "", browser: Browsers.CHROME, - browserVersion: "", - assistiveTechnology: AssistiveTechnology.TALKBACK, - assistiveTechnologyVersion: "" + assistiveTechnology: AssistiveTechnology.TALKBACK } ] } ]; /** - * @returns true if same environment (ignoring version fields) + * @returns true if same environment */ function compareEnvironments( a: Partial, @@ -150,12 +117,7 @@ export function getDesktopCombinations( environments: Omit[] ): string[] { const candidateEnvs = environments.filter((env) => { - return ( - env.platform === Platform.DESKTOP && - !env.assistiveTechnologyVersion && - !env.operatingSystemVersion && - !env.browserVersion - ); + return env.platform === Platform.DESKTOP; }); return desktopCombinations @@ -174,12 +136,7 @@ export function getMobileCombinations( environments: Omit[] ): string[] { const candidateEnvs = environments.filter((env) => { - return ( - env.platform === Platform.MOBILE && - !env.assistiveTechnologyVersion && - !env.operatingSystemVersion && - !env.browserVersion - ); + return env.platform === Platform.MOBILE; }); return mobileCombinations @@ -210,14 +167,6 @@ export function getCustomEnvironments( .filter(Boolean); return environments.filter((env) => { - if ( - env.assistiveTechnologyVersion || - env.operatingSystemVersion || - env.browserVersion - ) { - return true; - } - return !( d.some((desktopEnv) => compareEnvironments(desktopEnv!, env)) || m.some((mobileEnv) => compareEnvironments(mobileEnv!, env)) diff --git a/confiture-web-app/src/enums.ts b/confiture-web-app/src/enums.ts index 0f11efaa..9a3d856c 100644 --- a/confiture-web-app/src/enums.ts +++ b/confiture-web-app/src/enums.ts @@ -1,6 +1,6 @@ export enum Platform { - DESKTOP = "desktop", - MOBILE = "mobile" + DESKTOP = "Ordinateur", + MOBILE = "Mobile" } export enum OperatingSystem { diff --git a/confiture-web-app/src/pages/StatementPage.vue b/confiture-web-app/src/pages/StatementPage.vue index 1091ef9b..29de0d45 100644 --- a/confiture-web-app/src/pages/StatementPage.vue +++ b/confiture-web-app/src/pages/StatementPage.vue @@ -301,60 +301,28 @@ const siteUrl = computed(() => { -
Environnement de test
-

- Les vérifications de restitution de contenus ont été réalisées sur - la base de la combinaison fournie par la base de référence du RGAA, - avec les versions suivantes : -

-
    - +
    Pages du site ayant fait l’objet de la vérification de conformité
    diff --git a/confiture-web-app/src/pages/audit/AuditDeclarationPage.vue b/confiture-web-app/src/pages/audit/AuditDeclarationPage.vue index 4d69dc92..2b26b9c1 100644 --- a/confiture-web-app/src/pages/audit/AuditDeclarationPage.vue +++ b/confiture-web-app/src/pages/audit/AuditDeclarationPage.vue @@ -244,20 +244,14 @@ function DEBUG_fillFields() { { platform: Platform.DESKTOP, operatingSystem: OperatingSystem.WINDOWS, - operatingSystemVersion: "11", assistiveTechnology: AssistiveTechnology.NVDA, - assistiveTechnologyVersion: "", - browser: Browsers.FIREFOX, - browserVersion: "104" + browser: Browsers.FIREFOX }, { platform: Platform.DESKTOP, operatingSystem: OperatingSystem.MAC_OS, - operatingSystemVersion: "12.5", assistiveTechnology: AssistiveTechnology.VOICE_OVER, - assistiveTechnologyVersion: "", - browser: Browsers.SAFARI, - browserVersion: "15.6" + browser: Browsers.SAFARI } ]; @@ -345,6 +339,7 @@ const isDevMode = useDevMode(); v-model="contactName" label="Nom et prénom du contact (optionnel)" type="text" + class="narrow-field" />

    @@ -362,6 +357,7 @@ const isDevMode = useDevMode(); ? 'Vous devez renseigner au moins 1 moyen de contact' : undefined " + class="narrow-field" /> - -

    Dérogations

    -

    - Ces informations doivent faire l’objet d’une discussion entre l’auditeur - ou l’auditrice et le responsable du site audité. C’est le responsable du - site audité qui accepte de prendre le risque juridique de mentionner des - contenus dérogés. Si aucun contenu n’est à déroger, laissez les deux - champs vides. -

    +

    Contenus non accessibles

    -
    +
    +

    Dérogations

    + +

    + Les contenus dérogés doivent faire l’objet d’une discussion entre + l’auditeur et le responsable du site audité. C’est le responsable du site + audité qui accepte de prendre le risque juridique de mentionner des + contenus dérogés. +

    +