Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Programmatic API: test didn't get executed #821

Closed
ganlanyuan opened this issue Oct 9, 2017 · 2 comments
Closed

Programmatic API: test didn't get executed #821

ganlanyuan opened this issue Oct 9, 2017 · 2 comments

Comments

@ganlanyuan
Copy link

ganlanyuan commented Oct 9, 2017

Output of gemini --version:
5.0.0-alpha.8

Contents of .gemini.yml file:

rootUrl: 'http://localhost:8888'
compositeImage: true

system:
  plugins:
    browserstack:
      username: xxx
      accessKey: xxx
    'html-reporter':
      enabled: true
      path: 'gemini/gemini-reports'
      errorsOnly: false
      baseHost: 'http://localhost:8888'
 
browsers:
  ie11:
    windowSize: 600x400
    desiredCapabilities:
      os: 'WINDOWS'
      os_version: '7'
      browserName: 'internet explorer'
      version: '11'
 
  chrome43:
    windowSize: 1024x768
    desiredCapabilities:
      os: 'WINDOWS'
      os_version: '10'
      browserName: 'chrome'
      version: '43'

sets:
  desktop:
    files:
      - 'gemini/tests/desktop'
    browsers:
      - ie11
      - chrome43

Test source code:

gemini.suite('jumbotron', (suite) => {
  suite.setUrl('/')
    .setCaptureElements('html')
    .capture('plain');
});

Gulpfile.js:

const Gemini = require('gemini/api'),
      gemini = new Gemini('./.gemini.yml');

var collection = gemini.readTests();
// var collection = gemini.readTests('gemini/tests/desktop');

gulp.task('default', () => {

  // gemini.readTests()
  //   .done(function(collection) {
  //     collection.topLevelSuites().forEach(function(suite) {
  //       console.log(suite.name);
  //     });
  //   });

  // console.log() works as expected

  return gemini.test(collection);
});

Command used to run the test:

gulp

Publically accessible URL of the page you are testing against:

https://ganlanyuan.github.io/myCoolProject/

Result:

[22:49:22] Using gulpfile ~/Documents/xxx/gulpfile.js
[22:49:22] Starting 'default'...
Opening BrowserStack tunnel.
Closing BrowserStack tunnel.
Your HTML report is here: file:///Users/xxx/gemini/gemini-reports/index.html
[22:49:49] Finished 'default' after 27 s

Expected behaviour:
The test was expected to be executed, but did not.
With command line, gemini test works well.

@ganlanyuan ganlanyuan changed the title TypeError: Cannot read property 'diff' of undefined Programmatic API: test didn't get executed Oct 12, 2017
@j0tunn
Copy link
Contributor

j0tunn commented Oct 28, 2017

@ganlanyuan gemini.readTests is the async method, take a look at example.
You should write something like this:

return gemini.readTests()
    .then((collection) => gemini.test(collection));

@ganlanyuan
Copy link
Author

Thanks @j0tunn

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants