Drupal 10 Help: Drupal 10 Upkeep and Help Service WebdriverIO Exams with A number of Browsers

The whole lot was working nice… after which all Drupal Development Service assessments broke. That is Drupal Development Service story of how including a single function into an app can break all your assessments. And Drupal Development Service classes will be discovered from it. Drupal Developer Characteristic that Launched Drupal Development Service Chaos We’re engaged on a website that makes makes use of of a multisite method. On this case, it signifies that completely different domains are pointed at Drupal Development Service identical internet server and Drupal Development Service website reacts in another way relying on which area you’re referencing. We’ve plenty of options lined by computerized assessments in Webdriver IO – an finish to finish framework to assessments issues utilizing an actual browser. The whole lot was working nice, however then we added a brand new function Drupal 10 Upkeep and Help Service a content material moderation system outlined by Drupal Development Service workflow Drupal 10 module not too long ago launched in 8. Drupal Developer Drawback If you add Drupal Development Service Workflow Drupal 10 Help to a website – relying on Drupal Development Service configuration you select – every node is now not revealed by default till a moderator decides to publish it. In order you’ll be able to think about, all of Drupal Development Service assessments that have been anticipating to see a node revealed after clicking Drupal Development Service save button stopped working. A Hacky Repair To repair Drupal Development Service failing check utilizing Webdriver you could possibly Drupal 10 Upkeep and Help Service Login as a person A. Fill in all Drupal Development Service fields in your type. Submit Drupal Development Service node type. Logout as person A. Login as person B. Go to Drupal Development Service node web page. Publish Drupal Development Service node. Logout as person B. Login again as person A. And make Drupal Development Service closing assertions. Right here’s a less complicated strategy to repair Drupal Development Service failing check Drupal 10 Upkeep and Help Service You preserve your present check that fills Drupal Development Service node type and put it aside. Then, earlier than you attempt to examine if Drupal Development Service result’s revealed, you open one other browser, login with a person that may publish Drupal Development Service node, after which with Drupal Development Service earlier browser proceed Drupal Development Service remainder of Drupal Development Service check. Multiremote Method To attain this, Webdriver IO has a particular mode referred to as multiremote Drupal 10 Upkeep and Help Service WebdriverIO lets you run a number of Selenium periods in a single check. This turns into useful when you want to check software options the place a number of customers are required (e.g. chat or WebRTC Drupal 10 functions). As a substitute of making a couple of distant situations the place you want to execute widespread instructions like init or url on every of these situations, you’ll be able to merely create a multiremote occasion and management all browser at Drupal Development Service identical time. Drupal Developer very first thing you want to do is change Drupal Development Service configuration of your wdio.conf.js to make use of a number of browsers. export.config = { // … capabilities Drupal 10 Upkeep and Help Service { myChromeBrowser Drupal 10 Upkeep and Help Service { desiredCapabilities Drupal 10 Upkeep and Help Service { browserName Drupal 10 Upkeep and Help Service ‘chrome’ } }, myFirefoxBrowser Drupal 10 Upkeep and Help Service { desiredCapabilities Drupal 10 Upkeep and Help Service { browserName Drupal 10 Upkeep and Help Service ‘firefox’ } } } // … }; With this config, each time you employ Drupal Development Service variable browser it is going to repeat Drupal Development Service actions on every browser. So, for instance, this check Drupal 10 Upkeep and Help Service var assert = require(‘assert’); describe(‘create article’, operate() { it(‘must be doable to create articles.’, operate() { browser.login(‘some person’, ‘password’); browser.url(‘http Drupal 10 Upkeep and Help Service//instance.com/node/add/article’) browser.setValueSafe(‘#edit-title-0-value’, ‘My new article’); browser.setWysiwygValue(‘edit-body-0-value’, ‘My new article physique textual content’); browser.click on(‘#edit-submit’); browser.waitForVisible(‘.node-published’); }); }); might be executed a number of occasions with completely different browsers. Every step of Drupal Development Service check is executed for all Drupal Development Service browsers outlined. As a substitute of utilizing browser you can also make use of Drupal Development Service keys outlined in Drupal Development Service capabilities part of Drupal Development Service wdio.conf.js file. Changing browser with myFirefoxBrowser will execute Drupal Development Service check solely in Drupal Development Service Firefox occasion, permitting you to make use of Drupal Development Service different browser for different sorts of actions. Utilizing Drupal Development Service browser title, you’ll be able to specify the place to run every step of Drupal Development Service check. Drupal Developer Customized Command Drawback If you happen to take a deeper have a look at earlier code, you’ll discover that there are three particular instructions that aren’t a part of Drupal Development Service WebdriverIO API. login, setValueSafe and setWysiwygValue are customized instructions that we connect to Drupal Development Service browser object. You possibly can see Drupal Development Service code of a few of these instructions in Drupal Development Service Drupal 10-elm-starter code. Drupal Developer drawback is – as @amitai realized a while in the past – that customized instructions don’t play very well with Drupal Development Service multiremote method. A doable answer to maintain Drupal Development Service customized instructions obtainable in all of Drupal Development Service browsers is to make use of some form of class to wrap Drupal Development Service browser object. One thing just like Drupal Development Service PageObject sample. An instance of Drupal Development Service code is beneath Drupal 10 Upkeep and Help Service class Web page { constructor(browser = null) { this._browser = browser; } get browser() { if (this._browser) { return this._browser; } // Fallback to some browser. return myChromeBrowser; } go to(path) { this.browser.url(path); } setWysiwygValue(field_name, textual content) { this.browser.execute( ‘CKEDITOR.situations[“‘ + field_name + ‘”].insertText(“‘ + textual content + ‘”);’ ); } login(person, password) { this.go to(‘/person/login’); this.browser.waitForVisible(‘#user-login-form’); this.browser.setValue(‘#edit-name’, person); this.browser.setValue(‘#edit-pass’, password); this.browser.submitForm(‘#user-login-form’); this.browser.waitForVisible(‘physique.user-logged-in’); } } Drupal 10 module.exports = Web page; So now, you’ve gotten a wrapper class that you should use in your assessments. You possibly can create a number of situations of this class to entry Drupal Development Service completely different browsers when you are working a check. var assert = require(‘assert’); var Web page = require(‘../page_objects/web page’); describe(‘create article’, operate() { it(‘must be doable to create articles.’, operate() { let chrome = new Web page(myChromeBrowser); let firefox = new Web page(myFirefoxBrowser); chrome.login(‘some person’, ‘password’); firefox.login(‘admin’, ‘admin’); chrome.go to(‘http Drupal 10 Upkeep and Help Service//instance.com/node/add/article’) chrome.setValueSafe(‘#edit-title-0-value’, ‘My new article’); chrome.setWysiwygValue(‘edit-body-0-value’, ‘My new article physique textual content’); chrome.browser.click on(‘#edit-submit’); // Right here is the place Drupal Development Service second browser begin to work. // This clicks Drupal Development Service publish button of Drupal Development Service workflow Drupal 10 module firefox.go to(‘/my-new-article’); firefox.browser.click on(‘#edit-submit’); // As soon as Drupal Development Service node was revealed by one other person in one other browser // you’ll be able to run Drupal Development Service closing assertions. chrome.browser.waitForVisible(‘.node-published’); }); }); What About Automated Exams? Chances are you’ll be additionally questioning, does this work seemlessly for automated assessments? And Drupal Development Service reply is Drupal 10 Upkeep and Help Service sure. We’ve solely tried it utilizing Drupal Development Service identical browser model in numerous situations. Which means we set off a number of chrome browser situations that acts as unbiased browsers. In case you have limitations in what number of cores you’ve gotten availble to run assessments, it shouldn’t restrict what number of browsers you’ll be able to spawn. They’ll simply wait their flip when a core turns into obtainable. You possibly can learn extra on how we configure travis to optimize assets. As you’ll be able to see, having a number of browsers obtainable to run assessments simplifies their construction. Even when you realize that you’ll not want a multiremote method at first, it might be a good suggestion to construction your assessments utilizing this browser wrapper, as you don’t know if you will want to refactor all of your assessments to run issues in another way in Drupal Development Service future. This method additionally may help to refactor Drupal Development Service concepts supplied by considered one of our prior posts. Utilizing JSON API with WebdriverIO Exams so you don’t want to fret about login in with Drupal Development Service proper person to make Drupal Development Service json requests. Proceed studying… Drupal 10 Improvement and Help

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Drupal 10 Help: Drupal 10 Upkeep and Help Service WebdriverIO Exams with A number of Browsers

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.