From f16f295290c3f1a6fbc3b9a4ffeb2d262f1dcec9 Mon Sep 17 00:00:00 2001 From: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com> Date: Tue, 25 Jul 2023 12:45:27 -0700 Subject: [PATCH] =?UTF-8?q?test:=20=F0=9F=92=8D=20add=20create=20acceptanc?= =?UTF-8?q?e=20test=20for=20ldap=20auth=20method=20(#1788)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: 💍 add create acceptance test for ldap auth method ✅ Closes: ICU-10076 * refactor: 💡 change client cert field to textarea and fix test * test: 💍 add additional test case --- .../form/auth-method/ldap/index.hbs | 48 +++-- .../acceptance/auth-methods/create-test.js | 168 ++++++++++++++---- 2 files changed, 157 insertions(+), 59 deletions(-) diff --git a/ui/admin/app/components/form/auth-method/ldap/index.hbs b/ui/admin/app/components/form/auth-method/ldap/index.hbs index 7516ed675..ca40e6a7f 100644 --- a/ui/admin/app/components/form/auth-method/ldap/index.hbs +++ b/ui/admin/app/components/form/auth-method/ldap/index.hbs @@ -160,32 +160,30 @@ {{/if}} - {{#if @model.isNew}} - - {{t - 'resources.auth-method.form.client_certificate.label' - }} - {{t - 'resources.auth-method.form.client_certificate.help' - }} - {{#if @model.errors.client_certificate}} - - {{#each @model.errors.client_certificate as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - + + {{t + 'resources.auth-method.form.client_certificate.label' + }} + {{t + 'resources.auth-method.form.client_certificate.help' + }} + {{#if @model.errors.client_certificate}} + + {{#each @model.errors.client_certificate as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + {{#if @model.isNew}} { + return new Response( + 400, + {}, + { + status: 400, + code: 'invalid_argument', + message: 'The request was invalid.', + details: { + request_fields: [ + { + name: 'name', + description: 'Name is required.', + }, + ], + }, + } + ); + }); + await visit(urls.authMethods); + + await click(NEW_DROPDOWN_SELECTOR); + await click(`[href="${urls.newLdapAuthMethod}"]`); + await fillIn(NAME_INPUT_SELECTOR, 'new account'); + await click(SAVE_BTN_SELECTOR); + + assert.dom(ERROR_MSG_SELECTOR).hasText('The request was invalid.'); + assert.dom(FIELD_ERROR_TEXT_SELECTOR).hasText('Name is required.'); + }); });