From 6feead51853d8319b5df11af13fd2765cb510723 Mon Sep 17 00:00:00 2001 From: RyotaK <49341894+Ry0taK@users.noreply.github.com> Date: Tue, 7 Mar 2023 16:07:13 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=99=BB=E9=8C=B2=E6=99=82=E3=81=AE?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=BC=E3=83=A0=E3=81=AB=E3=81=8A=E3=81=84?= =?UTF-8?q?=E3=81=A6=E9=80=81=E4=BF=A1=E3=81=A7=E3=81=8D=E3=82=8B=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E3=82=92=E4=BF=AE=E6=AD=A3=20(#10238)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 登録時のフォームにおいて送信できる条件を修正 * テストを追加 --- cypress/e2e/basic.cy.js | 13 +++++++++++++ packages/frontend/src/components/MkSignup.vue | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/basic.cy.js b/cypress/e2e/basic.cy.js index b1b856119c..5a0a767ed5 100644 --- a/cypress/e2e/basic.cy.js +++ b/cypress/e2e/basic.cy.js @@ -52,12 +52,25 @@ describe('After setup instance', () => { cy.intercept('POST', '/api/signup').as('signup'); cy.get('[data-cy-signup]').click(); + cy.get('[data-cy-signup-submit]').should('be.disabled'); cy.get('[data-cy-signup-username] input').type('alice'); + cy.get('[data-cy-signup-submit]').should('be.disabled'); cy.get('[data-cy-signup-password] input').type('alice1234'); + cy.get('[data-cy-signup-submit]').should('be.disabled'); cy.get('[data-cy-signup-password-retype] input').type('alice1234'); + cy.get('[data-cy-signup-submit]').should('not.be.disabled'); cy.get('[data-cy-signup-submit]').click(); cy.wait('@signup'); + + cy.visitHome(); + + // ユーザー名が重複している場合の挙動確認 + cy.get('[data-cy-signup]').click(); + cy.get('[data-cy-signup-username] input').type('alice'); + cy.get('[data-cy-signup-password] input').type('alice1234'); + cy.get('[data-cy-signup-password-retype] input').type('alice1234'); + cy.get('[data-cy-signup-submit]').should('be.disabled'); }); }); diff --git a/packages/frontend/src/components/MkSignup.vue b/packages/frontend/src/components/MkSignup.vue index 62ada6b736..fa69481394 100644 --- a/packages/frontend/src/components/MkSignup.vue +++ b/packages/frontend/src/components/MkSignup.vue @@ -117,7 +117,9 @@ const shouldDisableSubmitting = $computed((): boolean => { instance.enableHcaptcha && !hCaptchaResponse || instance.enableRecaptcha && !reCaptchaResponse || instance.enableTurnstile && !turnstileResponse || - passwordRetypeState === 'not-match'; + instance.emailRequiredForSignup && emailState !== 'ok' || + usernameState !== 'ok' || + passwordRetypeState !== 'match'; }); function onChangeUsername(): void {