Просмотр исходного кода

refs 116147: add questionnaire settings tests

Futa Arai 3 лет назад
Родитель
Сommit
4323fc22e3

+ 2 - 2
packages/app/src/components/Admin/App/QuestionnaireSettings.tsx

@@ -70,7 +70,7 @@ const QuestionnaireSettings = (): JSX.Element => {
       {!isLoading && (
         <>
           <div className="row my-3">
-            <div className="custom-control custom-switch custom-checkbox-primary col-md-5 offset-md-5">
+            <div className="custom-control custom-switch custom-checkbox-info col-md-5 offset-md-5">
               <input
                 type="checkbox"
                 className="custom-control-input"
@@ -85,7 +85,7 @@ const QuestionnaireSettings = (): JSX.Element => {
           </div>
 
           <div className="row my-4">
-            <div className="custom-control custom-checkbox custom-checkbox-primary col-md-5 offset-md-5">
+            <div className="custom-control custom-checkbox custom-checkbox-info col-md-5 offset-md-5">
               <input
                 type="checkbox"
                 className="custom-control-input"

+ 6 - 5
packages/app/src/components/Me/OtherSettings.tsx

@@ -26,7 +26,7 @@ const OtherSettings = (): JSX.Element => {
       await apiv3Put('/personal-setting/questionnaire-settings', {
         isQuestionnaireEnabled,
       });
-      toastSuccess(t('toaster.update_successed', { target: 'アンケート設定', ns: 'commons' }));
+      toastSuccess(t('toaster.update_successed', { target: t('questionnaire.settings'), ns: 'commons' }));
     }
     catch (err) {
       toastError(err);
@@ -52,7 +52,7 @@ const OtherSettings = (): JSX.Element => {
         <div className="offset-md-3 col-md-6 text-left">
           {!isLoadingCurrentUser && (
             <div className="custom-control custom-switch custom-checkbox-primary">
-              <span id="personal-questionnaire-settings-toggle">
+              <span id="grw-questionnaire-settings-toggle-wrapper">
                 <input
                   type="checkbox"
                   className="custom-control-input"
@@ -68,7 +68,7 @@ const OtherSettings = (): JSX.Element => {
               <p className="form-text text-muted small">
                 {t('questionnaire.personal_settings_explanation')}
               </p>
-              {!growiIsQuestionnaireEnabled && <UncontrolledTooltip placement="bottom" target="personal-questionnaire-settings-toggle">
+              {!growiIsQuestionnaireEnabled && <UncontrolledTooltip placement="bottom" target="grw-questionnaire-settings-toggle-wrapper">
                 {t('questionnaire.disabled_by_admin')}
               </UncontrolledTooltip> }
             </div>
@@ -78,8 +78,9 @@ const OtherSettings = (): JSX.Element => {
 
       <div className="row my-3">
         <div className="offset-4 col-5">
-          <span className="d-inline-block" id="personal-questionnaire-settings-btn">
+          <span className="d-inline-block" id="grw-questionnaire-settings-update-btn-wrapper">
             <button
+              data-testid="grw-questionnaire-settings-update-btn"
               type="button"
               className="btn btn-primary"
               onClick={onClickUpdateIsQuestionnaireEnabledHandler}
@@ -89,7 +90,7 @@ const OtherSettings = (): JSX.Element => {
               {t('Update')}
             </button>
           </span>
-          {!growiIsQuestionnaireEnabled && <UncontrolledTooltip placement="bottom" target="personal-questionnaire-settings-btn">
+          {!growiIsQuestionnaireEnabled && <UncontrolledTooltip placement="bottom" target="grw-questionnaire-settings-update-btn-wrapper">
             {t('questionnaire.disabled_by_admin')}
           </UncontrolledTooltip>}
         </div>

+ 3 - 1
packages/app/test/cypress/integration/40-admin/40-admin--access-to-admin-page.spec.ts

@@ -33,7 +33,9 @@ context('Access to Admin page', () => {
     cy.visit('/admin/app');
     cy.getByTestid('admin-app-settings').should('be.visible');
     cy.getByTestid('v5-page-migration').should('be.visible');
-    cy.get('#cbFileUpload').should('be.checked')
+    cy.get('#cbFileUpload').should('be.checked');
+    cy.get('#isQuestionnaireEnabled').should('be.checked');
+    cy.get('#isAppSiteUrlHashed').should('be.checked');
     cy.screenshot(`${ssPrefix}-admin-app`);
   });
 

+ 9 - 0
packages/app/test/cypress/integration/60-home/60-home--home.spec.ts

@@ -126,4 +126,13 @@ context('Access User settings', () => {
     cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
     cy.screenshot(`${ssPrefix}-in-app-notification-setting-2`);
   });
+
+  it.only('Access Other setting', () => {
+    cy.getByTestid('grw-personal-settings').find('.nav-title.nav li:eq(6) a').click();
+    cy.scrollTo('top');
+    cy.screenshot(`${ssPrefix}-other-setting-1`);
+    cy.getByTestid('grw-questionnaire-settings-update-btn').click();
+    cy.get('.toast').should('be.visible').invoke('attr', 'style', 'opacity: 1');
+    cy.screenshot(`${ssPrefix}-other-setting-2`);
+  });
 });