Protractor troubleshooting: Issues preventing execution of protractor tests

My tests suddenly started throwing an error. Everything was working fine before this. Any advice on how to fix it?

Here is my Config file:

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  allScriptsTimeout: 20000,
  baseUrl: 'https://mylink/#/',

   // frameworks to use
    frameworks: ['jasmine'],

// Capabilities to be passed to the webdriver instance.

  multiCapabilities: [{
    'browserName': 'chrome'
 //}, {
   // 'browserName': 'firefox'
    //
   }],

 // Spec patterns are relative to the current working directory.
  specs: [
    'tests/HomePage.js'
  ],


  onPrepare: function() {
    browser.driver.manage().window().maximize();
    require('jasmine-reporters');
    jasmine.getEnv().addReporter(
      new jasmine.JUnitXmlReporter('xmloutput', true, true));
  },

  jasmineNodeOpts: {
    showColors: true
  }

}

And here is my Spec file:

// spec.js
describe('MyTest homepage', function() {
   var ptor;
   require('protractor-linkuisref-locator')(protractor);

  beforeEach(function() {
    browser.ignoreSynchronization = true;
    ptor = protractor.getInstance();
    browser.rootEl = 'div';
    //browser.driver.manage().window().setSize(1280, 1024);
    browser.debugger();
  });


  it('Should enter homepage url and credentials', function() {
     browser.get('/#/');
     element(by.name('userName')).sendKeys('');
     element(by.name('password')).sendKeys('');
     element(by.xpath("//button[@class=' btn orange small wide']")).click();
  });

  it('Should the title contain', function() {
    expect(browser.getTitle()).toEqual('');

  });

  it('Should click on the PowerGuide', function() {
     element(by.linkUiSref('locator')).click();
     ptor.sleep(100); 
     //expect(ptor.getCurrentUrl(locator)).toEqual('');
    });

   it('Should click on Month', function() {
     element(by.id('month-tab')).click();
     ptor.sleep(100);

    });


   //it('Should load the images', function() {
   // element(by.css('.pure-u-1-2')).click();
    //var icons = element.all(by.css('.pure-u-1-2')).click();
    //icons.first().click();
   //});


});

I am encountering the following error:

        seleniumProcess.pid: 1380
14:43:45.163 INFO - Launching a standalone server
Setting system property webdriver.chrome.driver to C:\Users\sramamoorthy\AppData\Roaming\npm\node_modules\protractor\sel
enium\chromedriver.exe
...
(Error details truncated for brevity)

Specifically, this is the error message I'm seeing related to Conf.js:

Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
[launcher] Error: TypeError: undefined is not a function
...
(Error details truncated for brevity)

Answer №1

There seems to be a small error in the code snippet for onPrepare():

onPrepare: function() {
    browser.driver.manage().window().maximize();
    require('jasmine-reporters');
    jasmine.getEnv().addReporter(
      new jasmine.JUnitXmlReporter('xmloutput', true. true));
    //                                          MISTAKE FOUND^
},

The corrected version should look like this:

jasmine.getEnv().addReporter(
    new jasmine.JUnitXmlReporter('xmloutput', true, true));

Answer №2

Issue: TypeError: undefined is not a function
    at
  at Object.exports.run (C:\Users\AppData\Roaming\npm\node_modules\protractor\lib\frameworks\jasmine.js:6

The issue seems to be coming from the library you are using. It is possible that there are some dependencies missing that the library relies on.

Answer №3

After removing the following line, I was able to resolve a similar issue:

seleniumAddress: 'http://localhost:4444/wd/hub',

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Guide on implementing jQuery Validation plugin with server-side validation at the form level

Does anyone have a suggestion for how to handle server-side validation errors that occur after passing the initial client-side validation on a form? $("#contact_form").validate({ submitHandler: function(form) { $.ajax({ type: 'POST', ...

Assigning information to a button within a cell from a dynamically generated row in a table

I've been diligently searching through numerous code samples but have yet to find a solution to my current dilemma: My HTML table is dynamically generated based on mustache values and follows this structure: <tbody> {{#Resul ...

Bootstrap 3 and Angular UI.Bootstrap Accordion working together

Although I am aware that ui.bootstrap is not fully adapted to Bootstrap 3 yet, my app is mostly built using it and reverting back to version 2.3 just for this component is not an option. Therefore, I am currently exploring my options. Here's what I ...

What is the best way to include and control persistent URL parameters when making Ajax requests?

Imagine having two different resource lists on your website: one for users and the other for groups. As you navigate through each list in increments of 10, it's important to preserve the state of the list so that when you share the URL with someone el ...

I'm experiencing some challenges with setting up my sequelize relationships

After tirelessly searching for a solution to my problem and coming up empty-handed, I decided to reach out here. Every Google search result seems unhelpful and every link I click on is disappointingly pink. Hello everyone! I'm facing difficulties est ...

Material-UI web application experiencing crashes due to worn-out cards, resulting in element type being declared as invalid and raising an error

After reviewing numerous similar SO questions, it appears that the issue always comes down to problems with imports. Typically, these involve mistyped import destinations or missing braces, but I have double-checked and found no such issues in my code. ht ...

Capture data from ajax effectively by extracting and executing manipulations seamlessly

I have a project where I need to retrieve images from a database using Ajax and display them using a carousel plugin. This is the process: An image URL is saved to the database by an admin The frontend script makes an Ajax call to a PHP file and retrieve ...

Utilizing jQuery in your webpack configuration for optimal performance

I encountered some issues while trying to test a simple project that involves using a jQuery function with webpack. The errors occurred during the bundling process and are as follows: ERROR in ./~/jQuery/lib/node-jquery.js Module not found: Error: Cannot ...

Encountered an issue when choosing a dependent drop-down and clicking on the designated option within a

I am working on a project that involves extracting links from various combinations of dropdown elements. My code is provided below, but unfortunately, I encounter an error when attempting to run it. url = "https://www.ford.co.uk/owner/my-vehicle/download- ...

Angular Datatables unable to locate DataTables with Webpack Encore configuration

As I've been updating a Symfony application from version 3.4 to 4.2.2, everything has been going smoothly until I encountered an issue with getting DataTables to work through yarn installation and webpack encore using angular-datatables. The Setup Pr ...

When using TouchableWithoutFeedback, I encountered the following error message: "Error: React.Children.only expected to receive a single React element child."

I am encountering the following issue: Error: React.Children.only expected to receive a single React element child. Whenever I incorporate the 'TouchableWithoutFeedback' component in my ReactNative project: return ( <TouchableWithoutFeed ...

Is HTML5 Device Orientation the answer to a dependable compass system?

I am currently developing a project for mobile web that requires access to the compass direction of the user's device. At the moment, my code is quite basic, but here is what I have: var updateDirection = function (evt) { $("#dire ...

Adding a number repeatedly and showing the result

I have been searching for a solution to this particular problem for quite some time now, but unfortunately, I haven't been able to find one yet. It would be incredibly helpful if someone could guide me in the right direction. Let's say we start ...

Executing JavaScript POST Requests Based on User Input Changes

Hey there! I'm working on a feature where the input value is populated based on the selection in a dropdown menu. The idea is that when the user picks a code, the corresponding amount will be displayed. However, I want the select box to retain its or ...

Generating a fresh array of unique objects by referencing an original object without any duplicates

I can't seem to figure out how to achieve what I want, even though it doesn't seem too complicated. I have an array of objects: { "year": 2016, "some stuff": "bla0", "other stuff": 20 }, "year": 2017, "some stuff": "bla1", ...

Convert JSON data into an HTML table with custom styling

If you have a set of JSON data that you want to convert into an HTML table, you can use the following code: $.each(data, function(key, val) { var tr=$('<tr></tr>'); $.each(val, function(k, v){ $('<td>' ...

Learn how to subscribe to Azure Event Grid using Angular without the need for a backend service layer

I am currently working on an Angular project and I am looking to set up Azure Event Grid subscription directly from the client-side without the need for a backend service. After exploring different options, I have not yet found a straightforward solution. ...

Experimenting with Chai in JavaScript to test an incorrect argument

Background: I recently delved into JavaScript and have been experimenting with it. It's possible that my question may sound silly, but I am eager to learn. I have developed a function called `getDayOfTheWeekFromDate` which returns the day of the week ...

React Native - Implementing a dynamic form that adapts based on the answer given by its parent

My JavaScript Object has a simple state structure as follows: pertanyaan: [{ label: "label1", type: 'dropdown', key: 'keyFoo1', option: [{ value: "foo1" }, { value: "foo2", additional ...

Is it possible to implement smooth scrolling in HTML without using anchor animation?

Is it feasible to implement a more seamless scrolling experience for a website? I'm referring to the smooth scrolling effect seen in MS Word 2013, but I haven't come across any other instances of this. I've heard that AJAX can make such th ...