Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion tests/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function iSeeAdministratorDashboard()
*
* @return void
*/
public function waitForPageTitle($title, $timeout = 60)
public function waitForPageTitle($title, $timeout = 20)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
$I = $this;
$I->waitForText($title, $timeout, AdminPage::$pageTitle);
Expand Down Expand Up @@ -235,4 +235,19 @@ public function doAdministratorLogout()
$I->waitForText('Log in', 60, ['xpath' => "//fieldset[@class='loginform']//button"]);

}

/**
* Selects an option in a Joomla Radio Field based on its label
*
* @return void
*/
public function selectOptionInRadioField($label, $option)
{
$I = $this;
$I->comment("Trying to select the $option from the $label");
$label = $webDriver->findField(['xpath' => "//label[contains(normalize-space(string(.)), '" . $label . "')]"]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findField() method is not working. I was also try to use webDriver Module but it's not work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll investigate more, but probably we will have to create a helper to deal with joomla Chosen JS. Have a look at http://codeception.com/docs/06-ModulesAndHelpers.

We can also check the Locator Util http://codeception.com/docs/reference/Locator maybe we can make it work using it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related to issue #28

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does $I->click('Yes', '#jform_allowUserRegistration'); not work?

screenshot 2016-06-28 19 50 24

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try this but it's not working.

$radioId = $label->getAttribute('for');

$I->click(['xpath' => "//fieldset[@id='$radioId']/label[contains(normalize-space(string(.)), '$option')]"]);
}
}
24 changes: 12 additions & 12 deletions tests/_support/Step/Acceptance/Administrator/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ public function iSaveAnArticle()
}

/**
* @Then I should see the :arg1 message
* @Then I wait for the title :title and see the message :message
*/
public function iShouldSeeTheMessage($message)
public function iShouldSeeTheMessage($title, $message)
{
$I = $this;
$I->waitForPageTitle('Articles');
$I->waitForPageTitle($title);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to do atomic steps when possible with single or minimum responsibilities.

In the present case, I see here two steps instead of one:

  • wait for a title
  • see a message

Why do you prefer it over, having just the responsibility of seeing a message?:

    /**
     * @Then I should see the :arg1 message
     */
    public function iShouldSeeTheMessage($message)
    {
        $I = $this;
        $I->waitForText($message, 60, AdminPage::$systemMessageContainer);
        $I->see($message, AdminPage::$systemMessageContainer);
    }

Copy link
Contributor Author

@pritalpatel pritalpatel Jun 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Thanks Javi. Getting you. I misunderstood it before. I will do it in two steps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created issue #37

$I->see($message, AdminPage::$systemMessageContainer);
}

Expand Down Expand Up @@ -70,12 +70,12 @@ public function iFeatureTheContentWithTitle()
/**
* @Then I save and see the :arg1 message
*/
public function iSaveAndSeeTheMessage($message)
/*public function iSaveAndSeeTheMessage($message)
{
$I = $this;
$I->waitForPageTitle('Articles');
$I->waitForPageTitle($message, AdminPage::$systemMessageContainer);
$I->see($message, AdminPage::$systemMessageContainer);
}
}*/

/**
* @Given I select the content article with title :arg1
Expand Down Expand Up @@ -129,12 +129,12 @@ public function iUnpublish()
$I->clickToolbarButton('unpublish');
}
/**
* @Then I see article unpublish message :arg1
* @Then I wait for title :title and see the unpublish message :message
*/
public function iSeeArticleUnpublishMessage($message)
public function iSeeArticleUnpublishMessage($title, $message)
{
$I = $this;
$I->waitForPageTitle('Articles');
$I->waitForPageTitle($title);
$I->see($message, AdminPage::$systemMessageContainer);
}

Expand All @@ -161,12 +161,12 @@ public function iTrashTheArticleWithName()
}

/**
* @Then I see article trash message :arg1
* @Then I wait for the title :title and see article trash message :message
*/
public function iSeeArticleTrashMessage($message)
public function iSeeArticleTrashMessage($title, $message)
{
$I = $this;
$I->waitForPageTitle('Articles');
$I->waitForPageTitle($title);
$I->see($message, AdminPage::$systemMessageContainer);
}
}
Loading