diff --git a/tests/functional/config/behat.yml b/tests/functional/config/behat.yml index fc14b92dc..300918bf3 100644 --- a/tests/functional/config/behat.yml +++ b/tests/functional/config/behat.yml @@ -4,7 +4,7 @@ default: pretty: true extensions: Behat\MinkExtension: - base_url: 'http://localhost/' + base_url: 'http://blockly.codebender.cc/' files_path: %paths.base%/../../fixtures/ javascript_session: selenium_session browser_name: firefox diff --git a/tests/functional/features/CodeView.feature b/tests/functional/features/CodeView.feature index 7974057aa..64655d1bb 100644 --- a/tests/functional/features/CodeView.feature +++ b/tests/functional/features/CodeView.feature @@ -14,7 +14,7 @@ Feature: Viewing code or blocks When I click on the "Arduino" button Then I should see code - @wip + @wip @john Scenario: Block view blocks menu displays Given I am on the homepage When I click on the "Blocks" button diff --git a/tests/functional/features/contexts/AMainPageUITrait.php b/tests/functional/features/contexts/AMainPageUITrait.php index d11b85dc4..718c2d1fd 100644 --- a/tests/functional/features/contexts/AMainPageUITrait.php +++ b/tests/functional/features/contexts/AMainPageUITrait.php @@ -47,13 +47,15 @@ public function theCodeOnThePageShouldBeReset() \PHPUnit_Framework_Assert::assertTrue(strcmp($pageCode, $defaultCode) == 0, $errorMsg); } - /** - * @Then /^the blocks menu displays$/ - */ - public function theBlocksMenuDisplays() - { - throw new PendingException('- Figure out how to get the Blocks Menu via XPath.'); - } +// /** +// * @Then /^the blocks menu displays$/ +// */ +// public function theBlocksMenuDisplays() +// { +// +// \PHPUnit_Framework_Assert::ass +// throw new PendingException('- Figure out how to get the Blocks Menu via XPath.'); +// } /** * @When /^I place a block$/ diff --git a/tests/functional/features/contexts/FeatureContext.php b/tests/functional/features/contexts/FeatureContext.php index 9540c78bd..f2f80f6c1 100644 --- a/tests/functional/features/contexts/FeatureContext.php +++ b/tests/functional/features/contexts/FeatureContext.php @@ -143,5 +143,24 @@ public function cleanupNewlinesAndWhitespace($file) { protected function jqueryWait($duration = 1000) { $this->getSession()->wait($duration, "(0 === jQuery.active && 0 === jQuery(':animated').length)"); + } + /** + * @Then /^the blocks menu displays$/ + */ + public function theBlocksMenuDisplays() + { +// var iframe = document.getElementsByTagName("iframe")[0]; +// var theFirstSpan = document.evaluate('//span', iframe.contentDocument, +// null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue + +// selenium web driver + $driver = $this->getSession()->getDriver(); + $iframe = $driver->find('//*[@id="content_blocks"]')[0]; + $driver->switchToIFrame('//*[@id="content_blocks"]'); +// $iframe = $this->getXPath('//*[@id="content_blocks"]'); + $this->assertElementOnPage($this->getXPath('//html/body/svg/g[2]/g[2]')); + + + } }