dojo / dojo/cli-test-intern

Functional tests do not default to local config

Open
#114 0 comments 0 reactions 0 assignees View on GitHub
bug good first issue Hacktoberfest help wanted
Dominant language
TypeScript
Stars
2
Forks
17
PR merge metrics
No merged PRs in 30d

Description

**Bug**
Running the tests with the `dojo test -f` command fails because it does not use the local config.

Package Version: 3.0.0

**Code**
`/tests/functional/main.ts`
```typescript

const {registerSuite} = intern.getInterface('object');
const {assert} = intern.getPlugin('chai');

import * as css from '../../src/widgets/styles/helloWorld.m.css';

import {Remote} from 'intern/lib/executors/Node';

function getPage(remote: Remote) {
return remote
.get('http://localhost:9999')
.setFindTimeout(5000);
}

registerSuite('Logo', {
'logo should be visible'() {
return getPage(this.remote)
.findByCssSelector(`${css.logo}`)
.getSize()
.then(({height, width}: { height: number; width: number; }) => {
assert.isAbove(height, 0, 'The logo height should be greater than zero.');
assert.isAbove(width, 0, 'The logo width should be greater than zero.');
})
.end();
}
});
```

**Expected behavior:**
The `dojo test -f` command should use the local config by default. In the above case the test should fail.

**Actual behavior:**
The `dojo test -f` command runs successfully but does not find any tests. Running `dojo test -f -c local` does run the test.

```bash
➜ issue-demo dojo build app --mode test

ℹ cli-build-app: 1.0.0
ℹ typescript: 2.6.2
✔ hash: 87b7f427ceb77be4b429
✖ errors: 0
⚠ warnings: 0

chunks:
functional unit
assets:
2ho78oCW.svg (10.98kb) / (3.89kb gz) functional.js (65.66kb) / (21.11kb gz) unit.js (1526.95kb) / (403.61kb gz)
output at: file:////Users/username/Documents/issue-demo/output/test

The build completed successfully.

➜ issue-demo dojo test -f

testing "issue-demo"...

TOTAL: tested 0 platforms, 0 passed, 0 failed

testing completed successfully

These tests were run using Dojo JIT compilation. The test suite may also be run against the built application with dojo test -c local
➜ issue-demo dojo test -f -c local

testing "issue-demo"...

Listening on localhost:9000 (ws 9001)
Tunnel started

‣ Created remote session chrome 68.0.3440.106 on Mac OS X (36b8c62ce9abe4911de3046e6e03f806)
× chrome 68.0.3440.106 on Mac OS X - Logo - logo should be visible (5.312s)
NoSuchElement: [POST http://localhost:4444/wd/hub/session/36b8c62ce9abe4911de3046e6e03f806/element / {"using":"css selector","value":"SNEWwkH3"}] no such element: Unable to locateelement: {"method":"css selector","selector":"SNEWwkH3"}
(Session info: chrome=68.0.3440.106)
(Driver info: chromedriver=2.39.562713 (dd642283e958a93ebf6891600db055f1f1b4f3b2),platform=Mac OS X 10.13.6 x86_64)
at Server.post
at runRequest
at
at new Task
at InitializedProxiedSession.Session._delegateToServer
at InitializedProxiedSession.Session.serverPost
at InitializedProxiedSession.Session.find
at Command.
at
at handler
at Command._callFindElementMethod
at Command.find
at Command.Locator.findByCssSelector
at Test.logo should be visible [as test]
at
at
at handler
at process._tickCallback

TOTAL: tested 1 platforms, 0 passed, 1 failed
Stopped
testing failed

If the project directory is hosted on a local server, unit tests can also be run in browser by navigating to http://localhost/node_modules/intern/?config=node_modules/@dojo/cli-test-intern/intern/intern.json@local
Tests did not complete successfully
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.