Exploring test suite pathways while utilizing ArcGIS JSAPI as an alternative loader within the Intern framework

I have been developing an application using the ArcGIS Javascript API and incorporating tests with Intern. While working on Windows 7 under IIS, I encountered some challenges but managed to overcome them by following the Intern tutorial and referring to solutions like altering loaders for Intern. By setting the loader in client.html to

<script src="http://js.arcgis.com/3.7/"></script>
, I was able to run my tests successfully after adjusting paths in both the query string and intern.js to include the parent path defined in IIS.

For instance, assuming my app is hosted at http://localhost/testApp/mySite with folders such as js, css, tests, and node_modules within it, running tests would require altering the path to something like

http://localhost/testApps/mySite/node_modules/intern/client.html?config=mySite/tests/intern
by adding mySite to the config location. Similarly, suites had to be defined accordingly in my configuration:

suites: [
    'mySite/tests/suite1',
    'mySite/tests/suite2',
    'mySite/tests/suite3'
],

If sticking to the default loader script tag without changing to a different loader in client.html, which uses the version of Dojo from node_modules, no additional path modification is needed (although the esri library might not be found).

In addition, I came across the esri jsapi version of the Intern tutorial, where loader changes were not required. The difference lies in utilizing intern-geezer instead of the regular Intern due to compatibility issues with Dojo 1.8.3. However, since I am using esri jsapi 3.7 with Dojo 1.9.1 and do not need support for older IE versions, I prefer avoiding geezer if possible. Despite specifying packages in intern.js similarly to the tutorial, one test did not pass, probably due to chai discrepancies between regular Intern and geezer. Nonetheless, utilizing intern-geezer did not necessitate any path modifications, unlike with Intern.

Is there a way to make Intern work with esri jsapi without modifying the loader in client.html? It would be ideal to have automated command line execution for these tests as well.

Answer №1

Starting with Intern 1.3, users have the option to specify alternative loaders, such as the one provided by Esri, in the useLoader configuration property. To use the Esri loader, you can include the following:

// intern.js
define({
    /* … other configuration options … */
    useLoader: { 'host-browser': 'http://js.arcgis.com/3.7/' }
    /* … */
});

It is important to note that Esri utilizes the old Dojo 1 loader; if additional criteria like async: true need to be specified in the dojoConfig, you can add the dojoConfig global object within your configuration file:

define([], function () {
    this.dojoConfig = { async: 1 };

    return {
        /* … configuration … */
    };
});

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

Issue occurred while trying to set the value from an API call response in the componentDidMount lifecycle method

There is a boolean variable disableButton: boolean; that needs to be set based on the response received from this API call: async getDocStatus(policy: string): Promise<boolean> { return await ApiService.getData(this.apiUrl + policy + this.myEndpo ...

SyntaxError in ExpressJS: Encountered an unexpected token "C"

I'm having trouble saving my string to a comma-separated array. When I attempt to use the JSON.parse method, I encounter an error while sending a post request and trying to save a record: SyntaxError: Unexpected token c at Object.parse (native) ...

Navigate to the middle of a DIV container in Angular 7

Is there a way to programmatically scroll to the center of my element on both the Y and X axes when a specific function is executed? My HTML structure includes the following (I am aiming to scroll to the middle of #viewport): </div> <div # ...

Using Boolean as a prop in Vue.js

Creating a Vue form to ask a question involves making a component: <template> <div class="flex flex-col items-center justify-center gap-2"> <div class="flex w-[80%] items-center justify-center gap-2 rounded-3xl p-2" ...

Access the child element of a span by targeting a specific attribute value using Protractor

Trying to check if a popover appears using protractor. Below is the snippet of HTML code with the popover in the last child span: <span tariff-popover="views/popovers/c2g/airport.html" class="ng-isolate-scope"> <span ng-transclude=""> ...

Ways to change the chart type in ApexCharts

I'm seeking a way to change the chart type of an existing ApexCharts that has already been rendered. After reviewing the methods, I attempted to use the updateOptions() method, but encountered the error: Uncaught TypeError: Cannot read property &apos ...

Why is my React Native button's onPress event not functioning correctly?

I am encountering an issue with the onPress event handler. I have tried multiple solutions but none seem to work with the handleClick function. Here are the different approaches I attempted: onPress={this.handleClick} onPress={this.handleClick()} onPress= ...

What could be causing the TypeError that is preventing my code from running smoothly?

I can't seem to figure out why I'm constantly encountering the error message Cannot destructure property 'id' of 'this.props.customer' as it is undefined.. Despite double-checking my code and making sure everything looks corre ...

What could be causing my jQuery code to not function properly?

I wrote a small piece of code in jQuery, but I am having trouble executing it. Can someone help me figure out what I'm doing wrong? <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"> & ...

What could be the reason behind TypeScript ignoring a variable's data type?

After declaring a typed variable to hold data fetched from a service, I encountered an issue where the returned data did not match the specified type of the variable. Surprisingly, the variable still accepted the mismatched data. My code snippet is as fol ...

Interference in the output of .innerHTML leads to disruption

I have been working on a feature to display a calculated price based on the selected quantity for each individual product. I attempted to duplicate the code and modify variable names, but encountered issues with the increase/decrease buttons triggering mul ...

Invalid file name detected during the download process

Below is the Javascript code I currently use to download a pdf: var link = document.createElement('a'); link.innerHTML = 'Download PDF file'; link.download = "Report.pdf"; link.href = 'data:application/octet-stream;base64 ...

Unlocking the secrets of integrating Vuex store with JavaScript/TypeScript modules: A comprehensive guide

I am working on a vue application and I have a query. How can I access the store from javascript/typescript modules files using import/export? For example, if I create an auth-module that exports state, actions, mutations: export const auth = { namesp ...

Tips for incorporating MUI into your Redwood JS project

Trying to integrate MUI into Redwood JS has been a challenge for me. I attempted to run the following command in the project directory: yarn add @mui/material Unfortunately, an error message appeared in the console stating: An error Running this command w ...

Accessing an element by its ID with the help of a looping

Looking to retrieve a string from my database and insert it into my paragraphs: <p id="q_1"></p> <p id="q_2"></p> The following code works correctly: $.get("bewertung/get/1", function (data) { document.getElementById("q_1") ...

Tips for adjusting column positions in a table while maintaining a fixed header and utilizing both horizontal and vertical scrolling

Is there a way to display a table that scrolls both horizontally and vertically, with the header moving horizontally but not vertically while the body moves in both directions? I have been able to shift the position of the columns, however, I am struggling ...

Incorporate a customizable month option within a flexible calendar design

I'm working on creating a calendar that adjusts to different screen sizes for my website. The script I've implemented is as follows: <script type="text/javascript"> $(document).ready(function () { $(".responsive-calendar").responsiv ...

Encountered an issue while attempting to retrieve the access token from Azure using JavaScript, as the response data could

Seeking an Access token for my registered application on Azure, I decided to write some code to interact with the REST API. Here is the code snippet: <html> <head> <title>Test</title> <script src="https://ajax.google ...

What is the best way to incorporate multiple functions within a React button?

I need to implement a functionality where the startClick function is triggered on BackButton click before executing the dispatch (giveForm2PreviousStep(props.currentStep, props.goToStep)) method. How can this be achieved? Inquiry JS const Inquiry = props ...

Using the window.setInterval() method to add jQuery/AJAX scripts to elements at regular intervals of 60 seconds

I'm having trouble with automatically updating a div. I have a script that refreshes the page content (similar to Facebook) every minute. The issue is that this div is newly added to the page and contains some ajax/jQuery elements for effects. functi ...