Write feature files for Manage Documentation at http://drupal.org/documentation/manage.
This View is for Docs maintainers / admins to check status of pages.

Comments

kssundar’s picture

Status: Active » Needs review

Have written scenarios and committed the same to repo.

I am facing a problem with Scenario Outline and dropdown values. The following scenario fails and not able to figure out why :(

Scenario Outline: Search records by Page status
    When I select "<value>" from "Page status"
    And I press "Apply"
    Then I should see at least "2" records
    Examples:
    | value |
    | No known problems |
    | Incomplete |

I have similar scenarios for other dropdowns in the same page as well. All are failing.
Only the first value from the dropdown gets passes and the rest fail.

kssundar’s picture

I found the problem. This is what happens:

"Background:" gets called before every Scenario. In background, I am currently checking whether "Access denied" message is visible or not when user is on "/documentation/manage". For every scenario the following happens:
1. Check for "Access denied" text
2. Click on login / register link
3. user sees login page
4. enters login credentials
5. gets redirected to "/documentation/manage" page

Because the user sessions do not persist on every scenario, the above 5 steps pass out.

But in case of "Scenario Outline", even though each "Example" is executed as a Scenario, user session does not get cleared and it persists. When the user session persists, the check in "Background:" fails and the rest of the steps gets skipped.

Hope I am clear :)

kssundar’s picture

This issue is fixed now! This is what i did according to the suggestion by Ryan:

We modified the current login logic to something that was suggested in yesterdays training.

Feature file: docs_management.feature

Given I am on "/documentation/manage"
And I login to the site

FeatureContext.php

/**
   * @Then /^I login to the site$/
   */
  public function iLoginToTheSite()
  {
    // before login, check if he is already logged in
    $element = $this->getSession()->getPage();
    $result = $element->findLink("Log out");
    if (empty($result)) {
      return array(
        new When('I follow "Log in / Register"'),
        new Then(sprintf('I fill in "%s" for "%s"', $this->basic_auth['username'], 'Username')),
        new Then(sprintf('I fill in "%s" for "%s"', $this->basic_auth['password'], 'Password')),
        new Then('I press "Log in"'),
      );
    }
  }

The above code will first check if the user is already logged in and if not then it will go to Login page and login the user.
As we are going to follow "Log in / Register" link, the link itself contains the 'destination' variable and hence we need not navigate back to the source page.

The updated code is in repo now.

eliza411’s picture

Issue tags: +sprint 1

Sweet. Let's review this for best practices and submit to doobie.

kssundar’s picture

Updated with minor modifications.

kssundar’s picture

Title: Write feature files for Manage Documentation » Write feature files for Manage Documentation (docs_management.feature)
Status: Needs review » Fixed

Updated the title to include feature file name.

Feature submitted to Doobie and can be seen here #1699794: Write feature files for Manage Documentation (docs_management.feature).

Marking fixed and we will follow up in Doobie.

Automatically closed -- issue fixed for 2 weeks with no activity.