From f078b99429b9be42e1185ca515b40902c1c9b5c5 Mon Sep 17 00:00:00 2001
From: Demetriad Sinzeanu <demetriad.sinzeanu@thinslices.com>
Date: Wed, 17 Oct 2018 09:52:15 +0300
Subject: [PATCH] feat: Add data-test for automation testing

---
 packages/component-faraday-ui/src/ActionLink.js    |  1 -
 packages/component-faraday-ui/src/AuthorTagList.js |  2 +-
 .../src/manuscriptDetails/ManuscriptAssignHE.js    |  2 +-
 .../src/manuscriptDetails/ManuscriptHeader.js      |  4 ++--
 .../src/manuscriptDetails/ManuscriptMetadata.js    | 10 +++-------
 .../src/components/SignUp/SignUpStep0.js           | 14 +++++++-------
 .../src/components/SignUp/SignUpStep1.js           | 10 +++++-----
 7 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/packages/component-faraday-ui/src/ActionLink.js b/packages/component-faraday-ui/src/ActionLink.js
index 2f61672b3..9f27cec30 100644
--- a/packages/component-faraday-ui/src/ActionLink.js
+++ b/packages/component-faraday-ui/src/ActionLink.js
@@ -69,7 +69,6 @@ const ExternalLink = styled.a`
     text-decoration: underline;
   }
 `
-
 const CustomLink = ExternalLink.withComponent(Link)
 
 const Root = styled.div`
diff --git a/packages/component-faraday-ui/src/AuthorTagList.js b/packages/component-faraday-ui/src/AuthorTagList.js
index afa4067c1..5aea50c28 100644
--- a/packages/component-faraday-ui/src/AuthorTagList.js
+++ b/packages/component-faraday-ui/src/AuthorTagList.js
@@ -69,7 +69,7 @@ const AuthorTagList = ({
     {withAffiliations && (
       <Item flex={0} ml={1}>
         <ActionLink
-          data-test-id="affiliations-id"
+          data-test-id="author-affiliations"
           icon={showAffiliation ? 'minus' : 'plus'}
           onClick={toggleAffiliation}
         >
diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.js
index 1aa83869b..ed9e04dfc 100644
--- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.js
+++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptAssignHE.js
@@ -11,7 +11,7 @@ const ManuscriptAssignHE = ({
 }) =>
   canAssignHE ? (
     <ContextualBox
-      data-test-id="assign-handling-editor-id"
+      data-test-id="assign-handling-editor"
       expanded={expanded}
       label="Assign Handling Editor"
       scrollIntoView
diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js
index 3d992b50e..268d7af50 100644
--- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js
+++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptHeader.js
@@ -30,7 +30,7 @@ const ManuscriptHeader = ({
     <Fragment>
       <Row
         alignItems="baseline"
-        data-test-id="manuscript-title-id"
+        data-test-id="manuscript-title"
         justify="space-between"
       >
         <H2 mb={1}>{title}</H2>
@@ -41,7 +41,7 @@ const ManuscriptHeader = ({
       {authors.length > 0 && (
         <Row
           alignItems="center"
-          data-test-id="authors-row-id"
+          data-test-id="authors-row"
           justify="flex-start"
           mb={1}
         >
diff --git a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptMetadata.js b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptMetadata.js
index 96df2724c..f86208b45 100644
--- a/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptMetadata.js
+++ b/packages/component-faraday-ui/src/manuscriptDetails/ManuscriptMetadata.js
@@ -19,7 +19,7 @@ const ManuscriptMetadata = ({
     {!!abstract && (
       <Item mb={1}>
         <ContextualBox
-          data-test-id="abstract-tab-id"
+          data-test-id="abstract-tab"
           label="Abstract"
           startExpanded
           transparent
@@ -33,7 +33,7 @@ const ManuscriptMetadata = ({
     {conflicts.hasConflicts === 'yes' && (
       <Item mb={1}>
         <ContextualBox
-          data-test-id="conflict-of-interest-tab-id"
+          data-test-id="conflict-of-interest-tab"
           label="Conflict of Interest"
           transparent
         >
@@ -45,11 +45,7 @@ const ManuscriptMetadata = ({
     )}
     {!isEmpty(files) && (
       <Item mb={1}>
-        <ContextualBox
-          data-test-id="files-tab-id"
-          label={filesLabel}
-          transparent
-        >
+        <ContextualBox data-test-id="files-tab" label={filesLabel} transparent>
           <ManuscriptFileList
             files={files}
             getSignedUrl={getSignedUrl}
diff --git a/packages/components-faraday/src/components/SignUp/SignUpStep0.js b/packages/components-faraday/src/components/SignUp/SignUpStep0.js
index 36116c1cb..f17aabd46 100644
--- a/packages/components-faraday/src/components/SignUp/SignUpStep0.js
+++ b/packages/components-faraday/src/components/SignUp/SignUpStep0.js
@@ -42,7 +42,7 @@ const Step0 = ({
   !isUndefined(initialValues) ? (
     <Fragment>
       <Row mb={2} mt={3}>
-        <Item data-test-id="sign-up-first-name-id" mr={1} vertical>
+        <Item data-test-id="sign-up-first-name" mr={1} vertical>
           <Label required>First Name</Label>
           <ValidatedField
             component={TextField}
@@ -50,7 +50,7 @@ const Step0 = ({
             validate={[requiredValidator]}
           />
         </Item>
-        <Item data-test-id="sign-up-last-name-id" ml={1} vertical>
+        <Item data-test-id="sign-up-last-name" ml={1} vertical>
           <Label required>Last Name</Label>
           <ValidatedField
             component={TextField}
@@ -61,7 +61,7 @@ const Step0 = ({
       </Row>
 
       <Row mb={2}>
-        <ItemOverrideAlert data-test-id="sign-up-title-id" mr={1} vertical>
+        <ItemOverrideAlert data-test-id="sign-up-title" mr={1} vertical>
           <Label required>Title</Label>
           <ValidatedField
             component={input => (
@@ -75,7 +75,7 @@ const Step0 = ({
             validate={[requiredValidator]}
           />
         </ItemOverrideAlert>
-        <ItemOverrideAlert data-test-id="sign-up-country-id" ml={1} vertical>
+        <ItemOverrideAlert data-test-id="sign-up-country" ml={1} vertical>
           <Label required>Country</Label>
           <ValidatedField
             component={input => (
@@ -92,7 +92,7 @@ const Step0 = ({
       </Row>
 
       <Row>
-        <Item data-test-id="sign-up-affiliation-id" vertical>
+        <Item data-test-id="sign-up-affiliation" vertical>
           <Label required>Affiliation</Label>
           <ValidatedField
             component={TextField}
@@ -102,7 +102,7 @@ const Step0 = ({
         </Item>
       </Row>
 
-      <ValidationRow data-test-id="sign-up-agree-TC-id" mb={2}>
+      <ValidationRow data-test-id="sign-up-agree-TC" mb={2}>
         <ValidatedField
           component={AgreeCheckbox}
           name="agreeTC"
@@ -124,7 +124,7 @@ const Step0 = ({
       </Row>
 
       <Button
-        data-test-id="sign-up-proceed-to-set-email-and-password-id"
+        data-test-id="sign-up-proceed-to-set-email-and-password"
         mt={4}
         onClick={handleSubmit}
       >
diff --git a/packages/components-faraday/src/components/SignUp/SignUpStep1.js b/packages/components-faraday/src/components/SignUp/SignUpStep1.js
index ef2404d87..2b704892b 100644
--- a/packages/components-faraday/src/components/SignUp/SignUpStep1.js
+++ b/packages/components-faraday/src/components/SignUp/SignUpStep1.js
@@ -12,7 +12,7 @@ const EmailField = input => <TextField {...input} type="email" />
 const SignUpForm = () => (
   <Fragment>
     <Row mb={2}>
-      <Item data-test-id="sign-up-email-id" vertical>
+      <Item data-test-id="sign-up-email" vertical>
         <Label required>Email</Label>
         <ValidatedField
           component={EmailField}
@@ -22,7 +22,7 @@ const SignUpForm = () => (
       </Item>
     </Row>
     <Row mb={2}>
-      <Item data-test-id="sign-up-password-id" vertical>
+      <Item data-test-id="sign-up-password" vertical>
         <Label required>Password</Label>
         <ValidatedField
           component={PasswordField}
@@ -32,7 +32,7 @@ const SignUpForm = () => (
       </Item>
     </Row>
     <Row mb={2}>
-      <Item data-test-id="sign-up-confirm-password-id" vertical>
+      <Item data-test-id="sign-up-confirm-password" vertical>
         <Label required>Confirm password</Label>
         <ValidatedField
           component={PasswordField}
@@ -107,12 +107,12 @@ const Step1 = ({
 
     <Row justify={!withoutBack.includes(type) ? 'space-between' : 'center'}>
       {!withoutBack.includes(type) && (
-        <Button data-test-id="sign-up-back-button-id" onClick={onBack}>
+        <Button data-test-id="sign-up-back-button" onClick={onBack}>
           BACK
         </Button>
       )}
       <Button
-        data-test-id="sign-up-confirm-button-id"
+        data-test-id="sign-up-confirm-button"
         disabled={submitting}
         onClick={handleSubmit}
         primary
-- 
GitLab