question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Programmatical API

See original GitHub issue

Hi,

Thank you for the great lib! If you could point me in the right direction, if there is a programmatical api for the same. I can use execSync but it seems like in most of the CI’, it just hangs. I am using something like this:

const exec = require('sync-exec'); // using lib here because execSync was somtimes acting funny.
const res = exec(`${nwPath} -c ${nwConfig}`, { stdio: [0, 1, 2] });

      if (!res.stderr) {
        return res.status;
      }

      throw res.stderr;

Any ideas?

Thanks a lot 😃

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
mucsi96commented, Oct 25, 2016

Hi Jeremy!

I think I found the problem. I could reproduce the issue with the following code:

Scenario: Basic site health check
    Given I open the url "https://www.1112.com/"
    Then I expect the title to contain "เดอะ พิซซ่า คอมปะนี 1111"
    Then I again expect the title to contain "เดอะ พิซซ่า คอมปะนี 1112"
this.Then(/^I expect the title to contain "([^"]*)"$/, function (checkTitle) {
    this
      .getTitle(function (t) {
        expect(t.value).to.eql(checkTitle);
      });
  });

  this.Then(/^I again expect the title to contain "([^"]*)"$/, function (checkTitle) {
    this
      .getTitle(function (t) {
        expect(t.value).to.eql(checkTitle);
      });
  });

The first title check step hangs. The problem is that you use chai. chai assertions are throwing errors if the assertion fails. If the chai assertion is in a callback nobody can catch it. This is the bad part of the callbacks. You are allowed only to use nightwatch assertions as they are not thowing errors but adding an extra step to the async task tree what nightwatch is building. So the fixed code look like this:

this.Then(/^I expect the title to contain "([^"]*)"$/, function (checkTitle) {
    this
      .getTitle(function (t) {
        this.assert.equal(t.value, checkTitle);
      });
  });

  this.Then(/^I again expect the title to contain "([^"]*)"$/, function (checkTitle) {
    this
      .getTitle(function (t) {
        this.assert.equal(t.value, checkTitle);
      });
  });
1reaction
mucsi96commented, Oct 18, 2016

Thank you! I will check it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invoking services and standard APIs programmatically - IBM
API and service transactions that are inbound to Sterling Order Management Software can be invoked through the following protocols: EJB; HTTP and HTTPS;...
Read more >
Amazon Connect launches an API to programmatically ...
Amazon Connect now provides a TransferContact API to programmatically transfer tasks to another flow, to an agent queue, or to a shared ...
Read more >
Introduction to APIs - Earth Data Science
In this module, you learn various ways to access, download and work with data programmatically. These methods include downloading text files ...
Read more >
Programmatically Retrieve Results with Optimizely's REST API
The Optimizely REST API now has a new endpoint for results. With this new functionality, developers can programmatically retrieve experiment ...
Read more >
How can I access resources on this website programmatically?
Related terms: programmatic access, program, script, wget, curl, web services, API, id-mapping. Page last modified: Mon Jul 18 2022 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found