From f61e3d356a6bb66eb28e09e41df8cca3cbf3efc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr> Date: Wed, 6 Apr 2022 13:57:50 +0200 Subject: [PATCH] test: e2e check that cancel button is present in variable parameter edition dialog refs #507 --- .vscode/launch.json | 24 +++++++++++++-- e2e/variable-param-cancel.e2e-spec.ts | 30 +++++++++++++++++++ .../dialog-edit-param-values.component.html | 2 +- 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 e2e/variable-param-cancel.e2e-spec.ts diff --git a/.vscode/launch.json b/.vscode/launch.json index 560298a30..1d92791fc 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,10 @@ "name": "Launch Chrome (local webserver)", "url": "http://localhost:4200", "webRoot": "${workspaceFolder}", - "runtimeExecutable": "/usr/bin/chromium-browser" + "runtimeExecutable": "/usr/bin/chromium", + "runtimeArgs": [ + "--preserve-symlinks" + ] }, { "name": "Launch Firefox (local webserver)", @@ -19,6 +22,23 @@ "reAttach": true, "url": "http://localhost:4200", "webRoot": "${workspaceFolder}" + }, + { + "name": "Launch e2e current file", + "type": "node", + "request": "launch", + "stopOnEntry": false, + "program": "${workspaceRoot}/node_modules/protractor/bin/protractor", + "args": [ + "${workspaceRoot}/protractor.conf.js", + "--specs=${file}" + ], + "cwd": "${workspaceRoot}", + "sourceMaps": true, + "outFiles": [ + "${workspaceRoot}/dist/out-tsc-e2e/*.js" + ], + "skipSourceMapSupport": true } ] -} \ No newline at end of file +} diff --git a/e2e/variable-param-cancel.e2e-spec.ts b/e2e/variable-param-cancel.e2e-spec.ts new file mode 100644 index 000000000..750fdd160 --- /dev/null +++ b/e2e/variable-param-cancel.e2e-spec.ts @@ -0,0 +1,30 @@ +import { ListPage } from "./list.po"; +import { by, element } from "protractor"; + +/** + * Check that a cancel button is present in min/max/list edition dialog + * for variable parameters + */ +describe("ngHyd - check cancel button for variable parameters - ", () => { + let listPage: ListPage; + + beforeAll(async () => { + listPage = new ListPage(); + }); + + fit("when min/max/list values dialog opens, a cancel button should be present", async () => { + // start page + await listPage.navigateTo(); + + // open PAB chute + await listPage.clickMenuEntryForCalcType(12); + + // click "var" radio on Z1 parameter + const z1btn = element(by.id("mat-button-toggle-2-button")); + await z1btn.click(); + + // cancel button presence + const cancelbtn = element(by.id("btn-cancel")); + expect(await cancelbtn.isPresent() && await cancelbtn.isDisplayed()).toBeTruthy(); + }); +}); diff --git a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.html b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.html index e8dbbb2c9..5fc7c8482 100644 --- a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.html +++ b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.html @@ -121,7 +121,7 @@ <div mat-dialog-actions [attr.align]="'end'"> <div> - <button mat-raised-button color="primary" [mat-dialog-close]="true" cdkFocusInitial> + <button id="btn-cancel" mat-raised-button color="primary" [mat-dialog-close]="true" cdkFocusInitial> {{ uitextCancel }} </button> <button mat-raised-button color="warn" (click)="onValidate()" [disabled]=" !isFormValid"> -- GitLab