mardi 8 novembre 2016

Cucumber-js test showing as 'pending' when they should pass or fail

I am a new programmer. I am trying to set up a cucumber.io suite. I read the docs and set up the example from http://ift.tt/2fAC0RL. When I run the test provided, the example test passes, as expected.

Scenario: Reading documentation

✔ Given I am on the Cucumber.js GitHub repository

✔ When I click on "CLI"

✔ Then I should see "Running specific features"

1 scenario (1 passed)

3 steps (3 passed)

0m03.724s

Using the example as a starting point, when I add another .feature and .js file and run the test, all the actions for my new test are shown as 'pending'. Additionally, the first test no longer passes:

3 scenarios (1 ambiguous, 2 undefined)

10 steps (2 ambiguous, 7 undefined, 1 passed)

0m03.743s

Can anyone tell me what I need to do to have my tests run? What do I need to do to remove the ambiguous and undefined tests?

I checked my regex and it matches. I know my indenting is off here, but I am new to posting code!

My .feature file:

Feature: Sign In
As a returning user of examples
I want to log in the site
So that I can use the site

Scenario: Getting to the Sign in page via "Log In"
    Given I am on example.com
    When I click the "Sign In" button 
    Then I am taken to the login screen

Scenario: Entering my information 
    Given I am on the login and I am the landing tab "Log In" 
    When I enter my credentials
    And click the arrow
    Then I am successfully logged in 

My test:

var seleniumWebdriver = require('selenium-webdriver');
module.exports = function () {
this.Given(/^I am on I am on example.com$/, function() {
  return this.driver.get('https://example.com');
});

this.When(/^I click on "([^"]*)"$/, function (text) {
  return this.driver.findElement({linkText: text}).then(function(element) {
    return element.click();
  });
});

this.Then(/^I should see "([^"]*)"$/, function (text) {
  var xpath = "//*[contains(text(),'" + text + "')]";
  var condition = seleniumWebdriver.until.elementLocated({xpath: xpath});
   return this.driver.wait(condition, 5000);
  });
 };

Aucun commentaire:

Enregistrer un commentaire