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

[CMSP-459] Updates behat tests and behaviors. #430

Merged
merged 5 commits into from
Jun 23, 2023
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
3 changes: 2 additions & 1 deletion behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ default:
suites:
default:
paths:
- tests/behat
- tests/behat/
contexts:
- Behat\MinkExtension\Context\MinkContext
- PantheonSystems\PantheonWordPressUpstreamTests\Behat\AdminLogIn
- behat\features\bootstrap\WpRedisFeatureContext
extensions:
Behat\MinkExtension:
# base_url set by ENV
Expand Down
3 changes: 0 additions & 3 deletions bin/behat-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ set -ex
terminus env:create $TERMINUS_SITE.dev $TERMINUS_ENV
terminus env:wipe $SITE_ENV --yes

# Enable Redis
terminus redis:enable $TERMINUS_SITE

###
# Get all necessary environment details.
###
Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"autoload": {
"psr-4": { "behat\\features\\bootstrap\\": "tests/behat/features/bootstrap/" }
}

}
35 changes: 35 additions & 0 deletions tests/behat/features/bootstrap/WpRedisFeatureContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
// features/bootstrap/WPRedisFeatureContext.php

namespace behat\features\bootstrap;

use Behat\Behat\Context\Context;

class WpRedisFeatureContext implements Context
{

/**
* Initializes context.
*
* Every scenario gets its own context instance.
* You can also pass arbitrary arguments to the
* context constructor through behat.yml.
*/
public function __construct()
{
}

/**
* Waits a certain number of seconds.
*
* @param int $seconds
* How long to wait.
*
* @When I wait :seconds second(s)
*/
public function wait($seconds)
{
sleep($seconds);
}

}
1 change: 1 addition & 0 deletions tests/behat/load-wp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Feature: Load WordPress
When I go to "/wp-admin/options-general.php"
And I fill in "blogname" with "Pantheon WordPress Site"
And I press "submit"
When I wait "1" second
Then print current URL
And I should see "Settings saved."

Expand Down
8 changes: 7 additions & 1 deletion tests/behat/wp-redis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ Feature: WP Redis
Then I should see "Redis Calls:"
And I should see "Cache Hits:"
And I should see "Cache Misses:"
And I should see "- get:"
And I should see "Redis Calls:"

# We call the same page twice to give Redis an opportunity to cache
# something so that `get` actually fires.
When I am on "/?redis_debug"
Then I should see "Group:"
Then I should see "- get"