Drupal Planet

Subscribe to Drupal Planet feed
Drupal.org - aggregated feeds in category Planet Drupal
Updated: 5 hours 15 min ago

Kristof De Jaeger: First stable release of the IndieWeb module for Drupal 8

March 14, 2019 - 15:48

About a year ago, I only just learned about the principles of IndieWeb, which in a way is a bit of a shame. Fast forward to now, and I'm proud to announce the first stable release for Drupal 8. Together with this milestone, I also pushed a new version of Indigenous so that both are aligned feature wise.

It's been a great journey so far, and while there's still a lot to do for both projects, the stability and feature set warrants a stable tag. It has changed the way I interact with (social) media day to day now since the last half year, both in reading and posting, being in full control of every aspect. It's great, everyone should try it!

What's next?

I've been thinking the last few weeks to raise funding, but after much consideration, I'm not going forward on that path. Even though my public GitHub profile lists over 1300 contributions the last year (about 3.5 per day), which somehow is simply crazy, I still have more than enough spirit and motivation to keep on going. Just a little slower from now on, since many features for both projects are not mission critical - even though they are awesome. Of course, I won't mind if someone would suddenly feel the urge to sponsor me.

Slowing down now you think, that can't be true ? Right. As already announced a few weeks ago, the next focus will be writing an Activitypub module for Drupal so you can communicate with your site on the Fediverse. I'm currently using Bridgy Fed for this, but, in the IndieWeb spirit, it's time to bring this home!

But first, time to make sure I don't mess up my tryouts of the Moonlight sonata. No commits until after March 31st - I promise :)

Agiledrop.com Blog: Top Drupal blog posts from February 2019

March 14, 2019 - 14:39

We’re back with an overview of the top Drupal blog posts from last month. Have a read and get yourself up to speed on the most recent goings-on within the Drupal community!

READ MORE

Promet Source: Top 12 Accessibility Issues

March 14, 2019 - 07:41
Are you concerned about web accessibility issues that might be hidden within your pages? We recently gathered input from the Promet accessibility team concerning digital accessibility issues that are most often in need of remediation, and we came up with a Top 12 List of web accessibility mistakes and oversights. They pertain to:  

Drupal blog: The Open Web can still win

March 14, 2019 - 05:46

This blog has been re-posted and edited with permission from Dries Buytaert's blog.

Three stars will align and the Open Web will win.

Today, the world wide web celebrates its 30th birthday. In 1989, Sir Tim Berners-Lee invented the world wide web and changed the lives of millions of people around the globe, including mine.

Tim Berners-Lee, inventor of the World Wide Web, in front of the early web.

Milestones like this get me thinking about the positive impact a free and Open Web has had on society. Without the web, billions of people would not have been able to connect with one another, be entertained, start businesses, exchange ideas, or even save lives. Open source communities like Drupal would not exist.

As optimistic as I am about the web's impact on society, there have been many recent events that have caused me to question the Open Web's future. Too much power has fallen into the hands of relatively few platform companies, resulting in widespread misinformation, privacy beaches, bullying, and more.

However, I'm optimistic that the Open Web has a chance to win in the future. I believe we'll see three important events happen in the next five years.

First, the day will come when regulators will implement a set of laws that govern the ownership and exchange of data online. It's already starting to happen with GDPR in the EU and various state data privacy laws taking shape in the US. These regulations will require platforms like Facebook to give users more control over their data, and when that finally happens, it will be a lot easier for users to move their data between services and for the Open Web to innovate on top of these data platforms.

Second, at some point, governments globally will disempower large platform companies. We can't leave it up to a handful of companies to judge what is false and true, or have them act as our censors. While I'm not recommending governments split up these companies, my hope is that they will institute some level of algorithmic oversight. This will offer an advantage to the Open Web and Open Source.

Third, I think we're on the verge of having a new set of building blocks that enable us to build a better, next-generation web. Thirty years into the web, our data architectures still use a client-server model; data is stored centrally on one computer, so to speak. The blockchain is turning that into a more decentralized web that operates on top of a distributed data layer and offers users control of their own data. Similar to building a traditional website, distributed applications (dApps) require file storage, payment systems, user data stores, etc. All of these components are being rebuilt on top of the blockchain. While we have a long way to go, it is only a matter of time before a tipping point is reached.

In the past, I've publicly asked the question: Can we save the Open Web? I believe we can. We can't win today, but we can keep innovating and get ready for these three events to unfold. The day will come!

With that motivation in mind, I want to wish a special happy birthday to the world wide web!

WeKnow: We’re Going to Seattle!

March 13, 2019 - 21:36
We’re Going to Seattle! We are a month away from flying out to Seattle for the one thing we have all been waiting for here at weKnow… DrupalCon 2019! Our team is beyond excited to be a part of this event once more as attendees and special conference guests. nchanto Wed, 03/13/2019 - 14:36

Drupal core announcements: Coding standards announcement for March 13, 2019

March 13, 2019 - 18:31

The TWG coding standards committee is announcing an issue for final discussion. Feedback will be reviewed on March 20, 2019.

To help the initiative to update all deprecated code for Drupal 9 we need a standardized format for deprecation messages.

New issue for discussion:
  • Issue #3024461: Adopt consistent format for deprecation messages.
    Having a machine readable format for deprecation messages will allow us to develop tools on api.drupal.org to keep track of the current status of deprecated code in Drupal core and contributed modules. This will help drive the initiative to update all deprecated code before the release of Drupal 9.
Interested in helping out?

You can get started quickly by helping us to update an issue summary or two or dive in and check out the full list of open proposals and see if there's anything you'd like to champion!

Flocon de toile | Freelance Drupal: Customizing the breadcrumb trail with Drupal 8

March 13, 2019 - 16:54
By default, Drupal 8 has two methods for building the breadcrumb trail. For content, this method is based on the URL of the page, and for taxonomy terms this method is based on the vocabulary hierarchy. Let's explore in more detail the construction of the breadcrumb for content.

Phase2: The Big, Bad Layout Builder Explainer

March 13, 2019 - 08:10

Buckle up!

Layout Builder is here.

Chances are you’ve heard about Drupal 8’s Layout Builder, and maybe even seen one of those fancy demos. If 2018 was the year of promises for Layout Builder and other exciting Drupal 8 improvements, then 2019 is the year those improvements get into the hands of Drupal developers and content editors. 2019 is the year these features are live.  

Hook 42: Florida Drupal Camp: Sunglasses, Alligators, Community, and Connection

March 13, 2019 - 00:07

Every year community members from across the globe meet in Orlando for Florida Drupal Camp. This year Adam, Ryan, and Jonathan from Hook 42 attended. It was a fantastic time to connect with people, to learn, and enjoy some warmer weather. Plus, alligators!

Jacob Rockowitz: A request for a Webform logo and possibly a logo kit for Drupal contributed projects

March 11, 2019 - 21:14

Thank you for backing the Webform module's Open Collective

First off, I want to thank the backers of the Webform module's Open Collective. After my last blog post, Open email asking organizations to back the Webform module and Drupal-related Open Collectives, we have 14 backers and a current balance of $908.44 that needs to be spent.

I also received a comment and an email about the need for some process for paid support. It’s worth noting that the Drupal Association is exploring a paid support model for assisting with security releases. We should recognize that Drupal 8 was a major software change and it is one that is still changing the Drupal community. And while I am thinking about how the Drupal community is changing and how we can develop better support around the Webform module, one of my more immediate concerns is improving the Webform module's Open Collective, and brand is the first thing I want to address.

Improving the Webform module's Open Collective

There are some useful tips and guides for building and maintaining an Open Collective. I appreciate Pia Mancini’s statement that "A collective is not a sprint," which makes me feel comfortable taking time to build out the Webform module's Open Collective.

Defining and strengthening the Webform module's mission will help clarify to backers what they are supporting and getting from the Webform module. The product summary for the...Read More

Chromatic: Chromatic at DrupalCon Seattle 2019

March 11, 2019 - 20:00

DrupalCon Seattle is about a month away, and we're putting the finishing touches on this year's plans. Drupal's biggest annual conference affords us the opportunity to support the project, share our expertise, and connect with our colleagues from far and wide. We love DrupalCon. Here's what we've got in store this year.

Agiledrop.com Blog: Our blog posts from February 2019

March 11, 2019 - 17:09

Here's a quick recap of our blog posts from February - we hope you enjoy them!

READ MORE

Vardot: The 7 Best Drupal Themes to Use in 2019

March 11, 2019 - 16:55
Firas Ghunaim March 11, 2019

Few things are as good for a business as a website that looks great and runs well. When you’ve established a strong digital presence and rank well on Google, then you’re set to chase and convert leads to your heart’s delight.

Before any of those gains materialize, however, there’s the tricky task of building that website.

If you’ve chosen to use the Drupal CMS, then congratulations: you’ve made the right choice. Drupal is agile, powerful, and home to a wide community of developers and entrepreneurs.

Moreover, Drupal makes it possible to choose themes: templates that do most of the legwork of designing a site so you need only worry about the parts that matter (ex. your lead magnets, SEO, and copy).

 

Since not all themes are created equal... we’ve compiled a rundown of the 7 best Drupal themes to use in 2019:

 

1. Progressive by NikaDevs

Progressive is a theme that offers great value for money.

Its creators have packaged it with over 200 interactive elements, meaning you’ll be sure to find a function that lets your site move and behave just the way you envisioned it. It comes with video hosting, unique slider effects, and visual features that are guaranteed to capture an audience’s attention.

Our favorite thing about the theme is the set of four homepages offered at entry. While other themes force you into a single aesthetic mode, Progressive offers its solutions without placing implicit restrictions on your design options.

Price: $59

Compatibility: Drupal 7 & 8

Best used for: Businesses of all shapes and sizes.

 

Case Study: Time Center

 

2. TheMAG by PinkDexo

 

Today’s marketing is all about content that informs, entertains, or intrigues. It’s for this reason that TheMAG by PinkDexo ranks on our list of the best Drupal themes for 2019: it’s built to house content and house it well.

TheMAG is ideal for sites that want to rake in ad revenue, profit from content, or showcase products. It comes with a wide range of layout options and interactive elements, but it shines the most when used to present content in the style of a --you guessed it-- magazine.

We recommend taking a look at the theme before getting too excited. It’s a perfect fit for certain niches (blogging, journalism, entertainment) but other types of businesses would do best to continue reading through our list.

Price: $54

Compatibility: Drupal 7, Drupal 8, Drupal Thunder, & Drupal Commerce

Best used for: Media and Entertainment.  Businesses that lean on blogging activity.

 

Case Study: Afaq Online Magazine

 

3. Winnex by gavias

 

Winnex perfects soft and professional design through its clean look and implicit geometry. It took the best lessons out of the adage, “less is more,” and used them to create an intuitive theme for professionals looking to market their services.

The theme gives users an easy time of site development thanks to its block-based, drag-and-drop interface, its support staff, and the numerous video tutorials they’ve produced.

Winnex gets all the basics right, but our favorite feature is how effortless it is to upload and display videos. After all, when it comes to pitching a service, it pays to set your site up with content that builds user trust.

Price: $48

Compatibility: Drupal 8

Best used for: Consultancy and other B2B services.

 

Case Study: Amman Stock Exchange (ASE)

 

4. Porto by refaktor

 

Part of a CMS’ job is to simplify the job of web design. In this regard, Porto is a theme that surpasses expectations. We’re hard-pressed to think of any other theme that can get so much done in so simple a way.

Porto features an unparalleled level of customization, with nearly endless options for page layout, header design, color mixing, and media hosting. This means that any business -- from consultants to home repair services, to e-commerce businesses -- can build their dream site using the theme.

Price: $59

Compatibility: Drupal 7, Drupal 8, Drupal Commerce, & Bootstrap 3.x

Best used for: E-Commerce. Businesses of all shapes and sizes.

 

Case Study: ProEquest - The Premier Equestrian E-Commerce Platform

 

5. Jango by NikaDevs

 

NikaDevs is back on the list with another highly versatile theme. Like Progressive, Jango offers endless potential for web design. Unlike Progressive, however, Jango presents itself as a theme for more timeless web design.

You’ll see fewer colors and gimmicks in their marketing, which can work well to favor businesses that need a site that keeps things simple. As with all themes on this list, Jango is structured, responsive, and offers support for its users.

Jango is a straightforward Drupal theme in the sense that it performs as needed, with minimal flash and maximum impact.

Price: $59

Compatibility: Drupal 7, Drupal 8, Drupal Commerce, & Bootstrap 3.x

Best used for: Any business that wants a simple and effective website.

 

Case Study: United Nations Relief and Works Agency (UNRWA)

 

6. OWL by gavias

 

Cafe and restaurant owners can breathe easy knowing there’s a Drupal theme specially designed for them. OWL is a quick and easy to use theme that knows the needs and demands of the food industry.

Our favorite feature of OWL is its capacity to host high resolution, Retina-ready images that food photographers are sure to appreciate. Coupled this with a simple interface and support for all kinds of modern programming tools (ex. Bootstrap, Custom CSS, SASS, etc.) and you have the perfect theme for restaurateurs.

Price: $48

Compatibility: Drupal 8, Bootstrap 3.x

Best used for: Hospitality. Restaurants and Cafes

 

Case Study: Makarem Hotels

 

7. Edmix by gavias

 

Our final entry, and our third from developer gavias, is a theme that caters to educational sites and businesses that offer online courses or tutorials. Edmix appears to take the best design features from of popular sites like Coursera and Udemy, giving its users the ability to shine a spotlight on their courses and videos.

As is the standard for gavias themes, the interface is easy to use and comes with assistance in the form of their support team, and library of tutorial videos.

Price: $56

Compatibility: Drupal 8, Drupal Commerce, & Bootstrap 3.x

Best used for: Online universities, masterclass services, etc.

 

Case Study: Georgetown University

 

This list covers what we think to be the best Drupal themes for a business operating in 2019. As you’ll notice, the best themes are versatile, and they allow for a high degree of customization to let businesses present the best sides of themselves without sacrificing style.

If you’ve had luck with any of the themes above, or if you know of a theme that you feel deserves a place on the list, feel free to write to us or leave a comment below.

Likewise, if you need help using Drupal or deploying any of the themes we’ve listed, Varbase is a powerful website builder platform that empowers businesses to build fast, reliable, and search optimized websites in record time.

 

Lullabot: Behind the Screens: Behind the Screens with Jim Smith

March 11, 2019 - 14:00

From Drupal experimentalist, to migrating the Oak Ridge National Laboratory's website, to thru-hiking the Appalachian Trail, Jim Smith is bridging communities and sharing his story.

Evolving Web: Cludo + Drupal = Instant User-Friendly Search

March 11, 2019 - 03:14

Search is a key feature in web experience, and for a lot of people, it's the go-to method to find content. We use search countless times a day on our smartphones in various contexts. And yet, when we're building out websites, search is often an afterthought that we don't spend much time on. Search gets added to the laundry list of site features, like meta tags and social media links.

Drupal Core Search

Drupal is fantastic at managing content. It gives you loads of flexibility when it comes to building out your information architecture and categorizing content. But we often don't set aside a lot of time to build out a customized search UI to find that content. At the end of a project, you might just turn on the core search module and call it done. And then we find out that people use Google to search our website.

Drupal's core search functionality hasn't changed much in the last 10 years, and is lacking features that users expect. It can be slow, and it doesn't correct for misspellings or allow you to prioritize results. Search should make your content easy to find, and make your site more engaging for users. Over the years, we've worked on lots of websites that integrate with Solr, to provide an enterprise-level search engine on top of Drupal. But setting up Solr takes time, and can be tricky if you don't have a lot of time to set it up, or the know-how to configure your server.

Why Cludo?

We recently decided to add search to evolvingweb.ca, and decided to try out Cludo. It's a "search as a service" tool that allows you to add on a search interface to an existing site. Kind of like you'd add Disqus, or Google Analytics. It was pretty easy for our developers to set up Cludo. Besides some challenges setting up search of the French language side of our site, particularly searches with UTF8 characters, the setup was straight-forward and only took a few hours to add.

The immediate advantage is that you don't have a lot of setup time for a search that just works how users expect. But after it was all set up, I realized that there are a lot of extra features that you get that we wouldn't normally take the time to configure for a basic search:

  • Autocomplete - start typing the title of a node and it'll autocomplete
  • Customize the index - you can pick and choose what's searchable and what's not
  • Analytics - you can see who searches for what, giving non-technical users visibility on how users search for content
  • Boosting - you get nice defaults for results ordering, but you can also customize the criteria to prioritize certain types of pages or certain criteria
  • Machine learning - an add-on feature that does the boosting and changes the autocomplete ordering for you based on user behaviour
  • Easy-to-use interface - non-technical users can update all the settings through Cludo's UI

Before you ask, yes there's a module for that! The Cludo module was released a couple weeks ago. It's still in development, but you can try it out. You just have to add your Cludo account number and key, and it provides a search form block that you can place on the page.

Here are some examples of websites using Drupal:

Open Source vs. Paid Third-Party Service

So what's the catch? Cludo isn't a free service, it comes with a $200/month price tag for most websites. And it will cost more than that if your site has more than 20,000 pages or you want bells and whistles like document search, machine learning or searching private content. There are discounts for non-profits and educational organizations.

There's a trend towards using third-party services for everything from marketing automation tools to comments and now search. I know a lot of Drupal developers prefer to use open source tools as much as possible. I think the great thing about third-party tools is that it gives us another option. We can offer our clients a way to get a search interface up-and-running quickly, without a lot of up-front development time. It gives the end-user something that's easier to configure.

On the other hand, for a large website with a lot of content, we might want more control over the functionality and costs. And for an intranet, we might want more control over where the data is stored. If we have a lot of site installs, Cludo could start to become very pricey. In these cases, using Search API would be a better option. But for lots of use cases, when that "instant" quality is the priority, Cludo is a great option, to make sure your content is discoverable and that your users can find it.

+ more awesome articles by Evolving Web

DrupalEasy: Drupal 8 Migrate - importing clean data via .csv file

March 10, 2019 - 20:33

One of the pillars of the consulting side of the work we do here at DrupalEasy is data migration into Drupal sites. Over the past few years, we've been focused on migrating data into Drupal 8 using the most excellent core migrate modules along with contrib modules like Migrate Tools, Migrate Plus, and Migrate Source CSV

If there's one thing I've learned over the years is that data to be migrated is never, ever, ever, ever, never as clean as it is claimed to be. There's always something that has to be massaged during the migration process in order to get things working.

One of the most common things I see when migrating data from a .csv is strings with trailing spaces. If you take a cursory look at the data in a spreadsheet, you might see something like "Bread", but if you look at the same data in a text .csv file, you'll see that the string is actually "Bread " (trailing space). If you're migrating this field to a vocabulary using the entity_lookup process plugin, that trailing space will cause the term to not be found, and therefore not migrated.

The solution? Well, you could clean up the data, but there's actually a much easier solution that I use by default on almost all string data being migrated - I use the "callback" plugin to in-turn call the PHP trim() function on incoming strings in the "process" section of the migration configuration. Here's an example:

field_topics:
  -
    plugin: callback
    callable: trim
    source: Topic
  -
    plugin: entity_lookup
    entity_type: taxonomy_term
    bundle: topics
    bundle_key: vid
    value_key: name
    ignore_case: true

Using this method allows for the incoming data to be a little dirty without affecting the migration.

DrupalEasy: Importing large databases to a Pantheon environment

March 10, 2019 - 20:17

Code flows up, data flows down.

I repeat this phrase in just about every workshop I teach - it is one of the basic principles of being a professional web developer. The idea is that we should be working locally, then pushing our changes (using Git) up to the project's dev, then QA, the live environments. As for the project's data (database and files directory for Drupal sites), the direction is opposite, we should only be moving data "down" - from live to QA, or live to dev, or live to local.

There are, of course, exceptions to every rule, and certainly in this case as well.

One exception is when the project is just getting started. Consider the example where you've started a new project on your local, you've reached the first milestone of development and are ready to move everything to a shared development environment where the client can catch their first glimpse of the project. In this case, you'll likely be moving everything "up" - code, database, and files. 

I had this exact scenario recently, I was migrating a rather large site to Drupal and had the initial migration looking good, and was in the process of getting it up-and-running on Pantheon. I successfully pushed the code as well as SFTPd the 1.6GB files directory to the Pantheon dev environment. The database was a bit larger than the 100MB maximum Pantheon allows to be uploaded through the browser, so I was using their "URL" method.

My plan was to put the database dump in a public Dropbox folder, then copy/paste the URL of the file in the Pantheon Dashboard interface. Unfortunately, it didn't work. I tried both .sql and .sql.gz formats, I tried doing the database import using Terminus (Pantheon's command-line interface) - each time I was provided with either no error message, or one that wasn't very helpful.

The solution? Turns out it is a bit of a DropBox issue, albeit one that is pretty easy to fix.

When copying/pasting the URL for a public file on DropBox, the URL ends in dl=0 - turns out that this prevents Pantheon from being able to import the file. Simply change it to dl=1 and the problem is solved (this works in both the Dashboard and Terminus)!

Hook 42: We’re Following the Yellow Brick Road...to Emerald City

March 9, 2019 - 03:58
Look out for Hook 42 at DrupalCon 2019 in Seattle!

It’s that time again, another DrupalCon is fast approaching and our team couldn’t be more excited for this year’s Seattle event. We’ve got a lot in store for you this year, from presentations, BOFs, sponsorships, partnership collaborations, and using our listening ears. You’ll find our team distributed all about.

We’re bringing a stacked line-up of knowledge and experiences to drop on 'ya this year. Not only that, we’re looking forward to hearing all the ups and downs you’ve had this past year, and how we’re all growing together within the Drupal community. 

Let’s get to sharing!

OpenSense Labs: Attention Drupal site owners: Here are reasons to switch to Cypress Testing!

March 8, 2019 - 23:52
Attention Drupal site owners: Here are reasons to switch to Cypress Testing! Vasundhra Fri, 03/08/2019 - 22:22

When I say that a decade ago, the web wasn’t the same as it is today, would you agree?

Yes, you might, or you might not.

But when we examine the statistics a conclusion can be made: Web is changing all the time and testing has accompanied the change with it. 

Testing is one of the critical processes in application development. The success or the failure of the application entirely depends on it. 

Cypress is one such framework which helps you conquer any type of web testing and is the best option for your website. 

Yeah, you must be wondering that why out of all the testing software in the market I enlighted Cypress. 

Well, let’s find out why. 

Why Cypress? Cypress is a javascript based end to end testing framework that does not use selenium at all. 

Now, What is selenium?

Well, Selenium automates browsers. What the user does with that power is entirely up to them. Primarily, it is used for automating web applications for testing purposes. It is the core technology in countless other browser automation tools, APIs and frameworks.

So coming back to Cypress, the testing tool is a modular, integrated document assembly and delivery system that improves the management, accessibility, and distribution of content throughout an enterprise. This system can swiftly deploy and it requires little or no user training.

Cypress comes with many handy advantages which would make you choose the software at one go. 

  • Automatic waiting: Cypress has the ability to automatically wait for the DOM (document object model) to load, make the elements visible, allow the animation to be completed, and much more. 
     
  • Real-time Reloads: Cypress is smart enough to understand that after saving a test file the user is going to run it again, so it automatically triggers the run next to the browser as soon as the user presses to save the file. 
     
  • Debuggability: The testing framework provides the user with the ability to directly debug a particular app under test from chrome Dev-tools. It presents a straightforward error message and recommends the user on how they should approach it.
     
  • Architecture: There are many testing tools which work by running outside of the browser and it executes remote commands across the network, but Cypress is the exact opposite. This testing tool is executed in the same run loop as the application.
     
  • Works on the network layer: Cypress runs at the network layer by reading and changing web traffic. This allows the testing tool to not only change everything that is coming in and out of the browser but also allows to change the code that may interfere with its ability to automate the browser. 
     
  • It is a new kind of testing: Cypress has ultimate control over the applications, the network traffic, and native access to each host object that unlocks a new way of testing ( this has never been possible before)
     

How is Cypress different from Selenium?   Cypress Selenium Installation No configuration is needed. All the dependencies and drivers are automatically installed with .exe Installation of  the language binding and configuring of the drivers is required Running Against Browser Cypress only supports chrome 
You can run your text against any browser  Architecture Runs inside the browser and executes in the same loop Runs outside the browser and executes remote commands  Speed Test code runs alongside application code. Therefore generates an extremely fast test. Automation scripts are slow in selenium Wait for the Elements Cypress runs in the browser and knows what is happening. Thus you don’t have to wait when you are using Cypress In order to do effective automation waiting for an element, it is an important task Documentation The team of Cypress has invested a lot of time in documentation hence it is seamless and complete.   The documentation is not complete and difficult to understand. Limitations and challenges faced in Cypress 

While Cypress does a really great job of giving developers and QA engineers the thing they want in an automation tool, it does have some limitations.

  • Since the structure is very different from selenium end to end tool, the user first needs to understand the structure and then find the best way to create the scripts.
     
  • As the testing framework is comparatively new, the community is small. It becomes really challenging to find the answers to the problems. 
     
  • No file upload is supported by this software and Cypress does not support cross-browser testing also. Nobody knows that when these things would be covered, and for what big projects, these features are really important. 
     
  • Cypress follows the approach that is related to the Page Object Model and this has been proven with time. 
     
  • The entire framework is only available for one client and i.e javascript. Thus, to work with it, it is important for the user to know the framework.
Can end to end testing deliver quality benefits?

Yes, end-to-end testing is really important it helps ensure accurate functioning of the application by testing it at every layer, right from the front end. Several other benefits of choosing and performing end-to-end testing can be because:

  • It ensures complete correctness as well as the health of an application: In end-to-end testing, the application is tested and validated at all the layers. The layers include-data layer, business layer, integration layer and presentation layer which guarantees the well-being of an application.  
     
  • It increases the reliance of an application: End-to-end testing increases the reliance and the performance of an application before its releases as the application is tested across different endpoints from different devices.
     
  • Decreases the future risks that might accompany the process: End-to-end testing presents the user with rigorous iteration and sprint. Thus, there are lesser chances of risks and failures that may come in the near future. 
     
  • It decreases the repetitive effort: The application is tested thoroughly, thus there is no looking back. The testing reduces the chances of frequent breakdowns and repetitive testing efforts 
End to end testing with Drupal

Cypress makes it easy to add new tests to the website as the user iterates the codes. Here are some of the few concepts that can help you with your Drupal Website. Let’s start the concept with: 

Setting up 

With the help of the standard installation profile and Drupal 8 distribution, the installation can take place along with JSON API. Drupal 8 comes with RESTful Web services which can serve many purposes and facilitates things such as querying nodes by field. 

There are few options for installing Cypress, out of which one of the preferred option is through NPM pacakage.json. The first step is to create your own file in the root of the project. Once the file has been placed, install it by running npm i from the project route. 

The first Test 

After installing cypress with the help of NPM pacakage.json installed, it is the time to test if it is working properly or not.

The test does two things:

  • It visits any website’s root address (that are configured by NPM script)
     
  • It verifies that the page has an element with “Cypress Testing” in it.

Creating the account 

The next step is to create user accounts. Depending on the environment, some option is more feasible than any other. Therefore, in order to do things, it is important to create Drupal entities. It is also important to access to an administrator account. You can do it manually create them in the database and pass the account credentials to Cypress through an environment variable, or you can let cypress create the account every time it runs the tests. This would reduce the chances of risks and issues that might occur during the procedure. 

The command that is there in cypress i.e cy.exec() provides the user with the access that is there in the system commands (Especially in Drush). The credentials are then decided for the test user. An object is added with the key values that are passed to the test as environmental variables.  Now add username and password to create the user admin account. Now that the credentials are available, it is possible to use them to create the user. 

Logging in 

To test any restricted or authentic users, it is important to log in first. The most obvious way to do this is the same way a user would log in, through the UI. In fact, the user should ensure that logging in through UI is possible. 

After each and every test, Cypress leaves the browser in a state it was in when it finished running the test. It is useful because it leaves a great position to discover the next steps. For this particular case, Cypress will come back to the browser with admin user logged in.
 
To keep tests independent from each other, Cypress removes the browser cookies before east of the test is operated. This prevents the side effects between tests, but it also means that the user needs to log in each time a test operates that needs authentication.
 
Now that the login codes have been placed, we need to write it. The user can reuse logs via UI test code, but if the same codes have to be operated before every test, there wouldn’t be much point in having the test, to begin with. Most important, logging in through the UI is slow. If the user has to log in before every test they run, a lot of time will be wasted on logging in. Drupal logs in simply by posting form data to the login URL. 

Seed the data 

It is important to look at how JSON API is used to seed the data which has to be tested and understand that API authenticates the requests. By default (for unsafe and non-read requests) JSON and the standard REST module requires a token request header to be presented. The tokens can then be used to create and delete data by posting the endpoints that are exposed by JSON API module. 

Note that Cypress presents an after hook. It is fascinating to delete the test nodes in the after hook since, at that point, the user has to access to the test node’s id and could delete the test content without having to query by the title. 

However, the approach can be troublesome in the event that needs a test runner to quit or refresh before running the after block. In this case, the test content would never get cleaned up since the user wouldn’t have access to the node’s id in future test runs. Once the test articles are seeded, the “displays published articles” test will visit the node’s page and confirm that the fields
 
Debugging using DevTools

As we can see that Cypress has grown out to be an excellent Test Runner that helps the user to understand what is happening in an application and in the tests, there’s simply no substituting all the amazing work that the browser has done on their built-in development tools.

Your Cypress test code runs in the same run loop as your application. This means you have access to the code running on the page, as well as the things the browser makes available to you, like document, window, and, of course, debugger

Running Cypress in continuous integration

If you want that automated testing and continuous integration should work together then it is important to have some sort of CI/CD server. These are the hosted servers, and for implementing it with Drupal 8 these tools must work together.

It is important to note that developers must ensure that all tests are passed on the local workstation. The Drupal configuration is exported where the system spins up a fresh installation

Conclusion

End-to-end testing shouldn’t be hard. Cypress makes integration testing pleasing and enjoyable. You can write the end to end tests without worrying about browsers, Selenium, and other scary stuff.

You would agree on the fact that the framework is so nice that planning to use nothing but Cypress for integration testing would be fruitful. Plus, the documentation is pure gold: Cypress Docs are filled up with best practices and examples.

At OpenSense Labs, we have quality Drupal experts who try to enable digital transformation to the enterprise with the services and assistance.  Contact us now at hello@opensenselabs.com 

blog banner blog image Drupal Drupal8 CMS Cypress End-to-End Testing Selenium Blog Type Articles Is it a good read ? On

Lullabot: Lullabot Podcast: Real Life Data Migrations

March 8, 2019 - 07:00

Mike and Matt gather the Lullabot team around the campfire to discuss real world data migrations into Drupal, and everything that goes into it.