Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accessing an element within an iframe #15

Open
wants to merge 2 commits into
base: testing
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion tests/functional/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/features/CodeView.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions tests/functional/features/contexts/AMainPageUITrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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$/
Expand Down
19 changes: 19 additions & 0 deletions tests/functional/features/contexts/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]'));



}
}