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

Test blackbox scenarios against a static HTML site #334

Merged
merged 1 commit into from
Jan 1, 2017
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
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ before_script:
- test ${DRUPAL_VERSION} -eq 8 && export PROJECT_NAME='drupal-8.1.x' || export PROJECT_NAME="drupal-${DRUPAL_VERSION}.x"
# Set sendmail so drush doesn't throw an error during site install.
- echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`
# Setup a stack Drupal 6 install to test api abilities.
# Download and install Drupal so we can test API abilities.
- mysql -e 'create database drupal'
- drush --quiet dl ${PROJECT_NAME} --all --drupal-project-rename=drupal
- drush --yes --root=$PWD/drupal site-install --db-url=mysql://travis:@127.0.0.1/drupal
# Copy the static HTML that is used for blackbox testing in the web root.
- cp -r fixtures/blackbox $PWD/drupal
# Copy our test module to the correct location.
- cp -r fixtures/drupal${DRUPAL_VERSION}/modules/behat_test ${MODULE_PATH}
- cd drupal
- drush --yes en behat_test
Expand Down
2 changes: 1 addition & 1 deletion behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ default:
Behat\MinkExtension:
goutte: ~
zombie: ~
base_url: http://drupal.org
base_url: http://127.0.0.1:8888/blackbox
javascript_session: zombie
Drupal\DrupalExtension:
blackbox: ~
Expand Down
4 changes: 2 additions & 2 deletions features/blackbox.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: Test DrupalContext
Then I should see the heading "Download" in the "content" region

Scenario: Clicking content in a region
Given I am at "community"
Given I am at "community.html"
When I click "IRC" in the "content" region
Then I should see "Page status" in the "right sidebar"
And I should see the link "Drupal News" in the "footer" region
Expand Down Expand Up @@ -62,7 +62,7 @@ Feature: Test DrupalContext
Then I should see "Drupal" in the "h1" element with the "id" attribute set to "site-name" in the "left header" region

Scenario: Error messages
Given I am on "/user"
Given I am on "user.html"
When I press "Log in"
Then I should see the error message "Password field is required"
And I should not see the error message "Sorry, unrecognized username or password"
Expand Down
10 changes: 10 additions & 0 deletions fixtures/blackbox/community.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<title>Where is the Drupal community? | Drupal.org</title>
</head>
<body>
<div id="content">
<a href="irc.html">IRC</a>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions fixtures/blackbox/download.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html>
<head>
<title>Download &amp; Extend | Drupal.org</title>
</head>
<body>
<div id="content">
<h2>Download</h2>
<a href="index.html">Distributions</a>
</div>
</body>
</html>
17 changes: 17 additions & 0 deletions fixtures/blackbox/form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>
<head>
<title>Search results | Drupal.org</title>
</head>
<body>
</div>
<div id="aside-region">
<a href="index.html">Search again</a>
</div>
<div class="messages error">
<ul>
<li>Username or email field is required.</li>
<li>Password field is required.</li>
</ul>
</div>
</body>
</html>
23 changes: 23 additions & 0 deletions fixtures/blackbox/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<html>
<head>
<title>Drupal - Open Source CMS | Drupal.org</title>
</head>
<body>
<div id="nav-header">
<div id="header-left">
<h1 id="site-name">Drupal</h1>
<p>Build something amazing.</p>
<form action="form.html">
<label for="search">Search&hellip;</label>
<input id="search" name="search" type="text"/>
<input type="submit" value="Search"/>
</form>
</div>
<div id="header-right">
<a href="download.html">Download &amp; Extend</a>
</div>
</div>
<div id="footer">
</div>
</body>
</html>
13 changes: 13 additions & 0 deletions fixtures/blackbox/irc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<html>
<head>
<title>Chat with the Drupal community on IRC | Drupal.org</title>
</head>
<body>
<div id="aside-region">
<p>Page status"</p>
</div>
<div id="footer">
<a href="index.html">Drupal News</a>
</div>
</body>
</html>
12 changes: 12 additions & 0 deletions fixtures/blackbox/user.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>
<head>
<title>Log in | Drupal.org</title>
</head>
<body>
<div id="content">
<form action="form.html">
<input type="submit" value="Log in"/>
</form>
</div>
</body>
</html>