<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AmiraArafa</title>
    <description>The latest articles on DEV Community by AmiraArafa (@amiraarafa).</description>
    <link>https://dev.to/amiraarafa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F577218%2F7ff72229-b5e3-40fb-b11e-f8961eafaa32.jpeg</url>
      <title>DEV Community: AmiraArafa</title>
      <link>https://dev.to/amiraarafa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amiraarafa"/>
    <language>en</language>
    <item>
      <title>Front End Testing Types And Tools</title>
      <dc:creator>AmiraArafa</dc:creator>
      <pubDate>Thu, 24 Jun 2021 17:27:40 +0000</pubDate>
      <link>https://dev.to/amiraarafa/front-end-testing-types-and-tools-4a0l</link>
      <guid>https://dev.to/amiraarafa/front-end-testing-types-and-tools-4a0l</guid>
      <description>&lt;h3&gt;
  
  
  What is Front End Testing?
&lt;/h3&gt;

&lt;p&gt;Front End Testing is a testing technique in which Graphical User Interface (GUI), functionality and usability of web applications or a software are tested. The goal of Front end testing is testing overall functionalities to ensure the presentation layer of web applications or a software is defect free with successive updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Front End Testing Is Needed
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Detecting Client-Side Performance Issues.&lt;/li&gt;
&lt;li&gt;Validating Application Behavior on Different Browsers and Systems.&lt;/li&gt;
&lt;li&gt;Improving Quality of User Interaction and Experience.&lt;/li&gt;
&lt;li&gt;Detect changing in features which depends on each other.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Types Of Front End Testing
&lt;/h3&gt;

&lt;p&gt;Essentially, testing Front-End testing can be divided into 3 categories:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0x3b1ftucnpi75xamsr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe0x3b1ftucnpi75xamsr.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1) E2E Testing
&lt;/h3&gt;

&lt;p&gt;E2E Testing or end-to-end testing, is the practice of testing if the execution of an application is performing as designed from start to finish. The entire application is tested in real-world scenarios, which includes testing the communication between components such as the database, network, APIs etc. and executing your code in a diversity of browsers. Basically testing everything. It takes a lot of time to set up and costs the most.&lt;/p&gt;

&lt;h3&gt;
  
  
  2) Integration Testing
&lt;/h3&gt;

&lt;p&gt;Integration Testing consists of testing the interaction between elements of your application, for example, communication between your UI and an API. It takes a shorter amount of time to set up, and isn't too expensive.&lt;/p&gt;

&lt;h3&gt;
  
  
  3) Unit Testing
&lt;/h3&gt;

&lt;p&gt;Unit Testing is different as it consists of testing isolated parts of the code, as units. These units usually take the form of methods, properties, UI element actions etc. It is the fastest and cheapest to implement.&lt;/p&gt;

&lt;p&gt;You've probably noted that the higher you go in our pyramid, the more time and money it takes to set up our tests. That's why a lot of projects tend to focus on unit tests as they can help you know if your code truly works by covering most scenarios, save time, and simplify deployment processes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recommended Testing Tools
&lt;/h3&gt;

&lt;p&gt;There are many types of testing tools , We can refer to two of most important types of testing in React.&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Jest
&lt;/h3&gt;

&lt;p&gt;Jest is a JavaScript test runner that lets you access the DOM via jsdom. While jsdom is only an approximation of how the browser works, it is often good enough for testing React components. Jest provides a great iteration speed combined with powerful features like mocking modules and timers so you can have more control over how the code executes.&lt;/p&gt;

&lt;h3&gt;
  
  
  2) React Testing Library
&lt;/h3&gt;

&lt;p&gt;React Testing Library is a set of helpers that let you test React components without relying on their implementation details. This approach makes refactoring a breeze and also nudges you towards best practices for accessibility. Although it doesn’t provide a way to “shallowly” render a component without its children.&lt;/p&gt;

&lt;h3&gt;
  
  
  How To Create A Frontend Website Testing Plan?
&lt;/h3&gt;

&lt;p&gt;Creating Frontend testing plan is a simple 4 step process.&lt;/p&gt;

&lt;p&gt;Step 1) Find out tools for Managing Your Test Plan.&lt;/p&gt;

&lt;p&gt;Step 2) Decide the budget for Front End Testing.&lt;/p&gt;

&lt;p&gt;Step 3) Set the timeline for the entire process.&lt;/p&gt;

&lt;p&gt;Step 4) Decide the entire scope of the project. The scope includes the following items.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OS and browsers used by users ISP plans of your audience.&lt;/li&gt;
&lt;li&gt;Popular devices used by audience.&lt;/li&gt;
&lt;li&gt;Proficiency of your audience.&lt;/li&gt;
&lt;li&gt;Internet correction speed of the audience.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/testing.html" rel="noopener noreferrer"&gt;https://reactjs.org/docs/testing.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.guru99.com/frontend-testing.html#1" rel="noopener noreferrer"&gt;https://www.guru99.com/frontend-testing.html#1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/christopherkade/introduction-to-front-end-unit-testing-510n"&gt;https://dev.to/christopherkade/introduction-to-front-end-unit-testing-510n&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.testim.io/blog/front-end-testing-complete-overview/" rel="noopener noreferrer"&gt;https://www.testim.io/blog/front-end-testing-complete-overview/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.perfecto.io/blog/comprehensive-guide-front-end-testing#frontendtestingchallenges" rel="noopener noreferrer"&gt;https://www.perfecto.io/blog/comprehensive-guide-front-end-testing#frontendtestingchallenges&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>testing</category>
      <category>react</category>
      <category>test</category>
      <category>testdev</category>
    </item>
    <item>
      <title>Styling in React</title>
      <dc:creator>AmiraArafa</dc:creator>
      <pubDate>Wed, 10 Feb 2021 23:16:34 +0000</pubDate>
      <link>https://dev.to/amiraarafa/styling-in-react-1830</link>
      <guid>https://dev.to/amiraarafa/styling-in-react-1830</guid>
      <description>&lt;p&gt;Choosing the right method for styling components isn’t an absolute truth. It’s a relative choice that should serve your use case, it depends on your personal preferences and the specific complexity of your application.&lt;/p&gt;

&lt;p&gt;In this article, we’ll show useful ways to style your React components. The choice is yours, and please feel free to add your own experience, insights, and suggestions.&lt;/p&gt;

&lt;h3&gt;
  
  
  There seems to be a number of ways of styling React components, we will talk about some of them:
&lt;/h3&gt;

&lt;p&gt;1-inline CSS&lt;br&gt;
2-normal CSS&lt;br&gt;
3-CSS in JS &lt;br&gt;
4-CSS Modules&lt;/p&gt;

&lt;h3&gt;
  
  
  1. inline CSS
&lt;/h3&gt;

&lt;p&gt;React lets you add CSS inline, written as attributes and passed to elements.&lt;/p&gt;

&lt;p&gt;In React, inline styles are not specified as a string. Instead they are specified with an object whose key is the camelCased version of the style name, and whose value is the style’s value, usually a string.&lt;/p&gt;

&lt;p&gt;The style attribute accepts a JavaScript object with camelCased properties rather than a CSS string.&lt;/p&gt;

&lt;p&gt;You can pass the styling directly or create a variable that stores style properties and then pass it to the element. With inline styles, you also have the option to combine CSS syntax with JSX code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx4fo2tdfh9zy53elb05t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fx4fo2tdfh9zy53elb05t.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Regular CSS
&lt;/h3&gt;

&lt;p&gt;Regular CSS is a common approach, arguably one step better than inline CSS.&lt;/p&gt;

&lt;p&gt;The styles can be imported to any number of pages and elements unlike inline CSS, which is applied directly to the particular element.&lt;/p&gt;

&lt;p&gt;Normal CSS has several advantages, such as native browser support (it requires no dependencies).&lt;/p&gt;

&lt;p&gt;You can maintain any number of style sheets, and it can be easier to change or customize styles when needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh4a3pj943ghnwwteecm6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh4a3pj943ghnwwteecm6.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. CSS-in-JS
&lt;/h3&gt;

&lt;p&gt;CSS-in-JS is a technique which enables you to use JavaScript to style components. When this JavaScript is parsed, CSS is generated (usually as a style element) and attached into the DOM.&lt;/p&gt;

&lt;p&gt;There are several benefits to this approach. For example, the generated CSS is scoped by default, meaning that changes to the styles of a component won’t affect anything else outside that component.&lt;/p&gt;

&lt;p&gt;Another advantage is that you can leverage the power of JavaScript to interact with the CSS. For example, you can create your own helper functions in JavaScript and use them directly in your CSS to modify the code.&lt;/p&gt;

&lt;p&gt;react-jss is a library that implements the above-mentioned CSS-in-JS technique.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcf72n359o0fhtvvrruft.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcf72n359o0fhtvvrruft.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. CSS modules
&lt;/h3&gt;

&lt;p&gt;A CSS Module is a CSS file in which all class names are scoped locally by default.&lt;/p&gt;

&lt;p&gt;CSS class names are scoped globally by default. This can lead to conflict, especially in large stylesheets, one style can override another. This is the problem CSS Modules solves. CSS classes are only available within the component where they are used.&lt;/p&gt;

&lt;p&gt;A CSS module is basically a .css file that is compiled. When compiled, it produces two outputs. One is CSS that is a modified version of input CSS with the renamed class names. The other is a JavaScript object that maps the original CSS name with the renamed name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7ripdi40t5l577kxadf1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7ripdi40t5l577kxadf1.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftklbul2giczxb6pl9hmh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftklbul2giczxb6pl9hmh.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Result&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjxnaji3i9oxj0kcx2hk8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjxnaji3i9oxj0kcx2hk8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember that the main purpose of CSS Modules is to make CSS classes locally scoped and avoid conflicts in naming.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;All these ways of styling react components have pros and cons.&lt;/p&gt;

&lt;p&gt;It all boils down to both your own personal preferences and the specific complexity of your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://codeburst.io/4-four-ways-to-style-react-components-ac6f323da822" rel="noopener noreferrer"&gt;https://codeburst.io/4-four-ways-to-style-react-components-ac6f323da822&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://blog.bitsrc.io/5-ways-to-style-react-components-in-2019-30f1ccc2b5b" rel="noopener noreferrer"&gt;https://blog.bitsrc.io/5-ways-to-style-react-components-in-2019-30f1ccc2b5b&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://blog.logrocket.com/the-best-styling-in-react-tutorial-youve-ever-seen-676f1284b945/" rel="noopener noreferrer"&gt;https://blog.logrocket.com/the-best-styling-in-react-tutorial-youve-ever-seen-676f1284b945/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.sitepoint.com/react-components-styling-options/" rel="noopener noreferrer"&gt;https://www.sitepoint.com/react-components-styling-options/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://create-react-app.dev/docs/adding-a-css-modules-stylesheet/" rel="noopener noreferrer"&gt;https://create-react-app.dev/docs/adding-a-css-modules-stylesheet/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>css</category>
      <category>styling</category>
    </item>
  </channel>
</rss>
