Skip to content

Commit c89740d

Browse files
rwagner00Ryan Wagnerjazzsequence
committed
[CMSP-459] Updates behat tests and behaviors. (#430)
* Updates behat tests and behaviors. * Updates behat tests and behaviors. * port diff from #426 * tabs to spaces * don't enable redis as part of the prepare step we end up making a dozen differnet enable redis requests and inevitably a lot of those fail because there are so many happening simultaneously (assumption). It's okay to just enable it and leave it on, rather than turning it on and off. --------- Co-authored-by: Ryan Wagner <ryan.wagner@pantheon.io> Co-authored-by: Chris Reynolds <chris@jazzsequence.com>
1 parent b38d97c commit c89740d

File tree

6 files changed

+49
-5
lines changed

6 files changed

+49
-5
lines changed

behat.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ default:
33
suites:
44
default:
55
paths:
6-
- tests/behat
6+
- tests/behat/
77
contexts:
88
- Behat\MinkExtension\Context\MinkContext
99
- PantheonSystems\PantheonWordPressUpstreamTests\Behat\AdminLogIn
10+
- behat\features\bootstrap\WpRedisFeatureContext
1011
extensions:
1112
Behat\MinkExtension:
1213
# base_url set by ENV

bin/behat-prepare.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ set -ex
3030
terminus env:create $TERMINUS_SITE.dev $TERMINUS_ENV
3131
terminus env:wipe $SITE_ENV --yes
3232

33-
# Enable Redis
34-
terminus redis:enable $TERMINUS_SITE
35-
3633
###
3734
# Get all necessary environment details.
3835
###

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@
2828
"allow-plugins": {
2929
"dealerdirect/phpcodesniffer-composer-installer": true
3030
}
31+
},
32+
"autoload": {
33+
"psr-4": { "behat\\features\\bootstrap\\": "tests/behat/features/bootstrap/" }
3134
}
35+
3236
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
// features/bootstrap/WPRedisFeatureContext.php
3+
4+
namespace behat\features\bootstrap;
5+
6+
use Behat\Behat\Context\Context;
7+
8+
class WpRedisFeatureContext implements Context
9+
{
10+
11+
/**
12+
* Initializes context.
13+
*
14+
* Every scenario gets its own context instance.
15+
* You can also pass arbitrary arguments to the
16+
* context constructor through behat.yml.
17+
*/
18+
public function __construct()
19+
{
20+
}
21+
22+
/**
23+
* Waits a certain number of seconds.
24+
*
25+
* @param int $seconds
26+
* How long to wait.
27+
*
28+
* @When I wait :seconds second(s)
29+
*/
30+
public function wait($seconds)
31+
{
32+
sleep($seconds);
33+
}
34+
35+
}

tests/behat/load-wp.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Feature: Load WordPress
2222
When I go to "/wp-admin/options-general.php"
2323
And I fill in "blogname" with "Pantheon WordPress Site"
2424
And I press "submit"
25+
When I wait "1" second
2526
Then print current URL
2627
And I should see "Settings saved."
2728

tests/behat/wp-redis.feature

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ Feature: WP Redis
1515
Then I should see "Redis Calls:"
1616
And I should see "Cache Hits:"
1717
And I should see "Cache Misses:"
18-
And I should see "- get:"
18+
And I should see "Redis Calls:"
19+
20+
# We call the same page twice to give Redis an opportunity to cache
21+
# something so that `get` actually fires.
22+
When I am on "/?redis_debug"
23+
Then I should see "Group:"
24+
Then I should see "- get"

0 commit comments

Comments
 (0)