mirror of
https://github.com/silverstripe/silverstripe-externallinks.git
synced 2024-10-22 15:05:44 +00:00
MNT Add behat tests
This commit is contained in:
parent
b4c210f211
commit
3da3567a7a
@ -1,4 +1,8 @@
|
|||||||
version: ~> 1.0
|
version: ~> 1.0
|
||||||
|
|
||||||
import:
|
import:
|
||||||
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-range.yml
|
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-range-behat.yml
|
||||||
|
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- REQUIRE_EXTRA="symbiote/silverstripe-queuedjobs:^4"
|
||||||
|
29
behat.yml
Normal file
29
behat.yml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
default:
|
||||||
|
suites:
|
||||||
|
externallinks:
|
||||||
|
paths:
|
||||||
|
- "%paths.modules.externallinks%/tests/behat/features"
|
||||||
|
contexts:
|
||||||
|
- SilverStripe\Admin\Tests\Behat\Context\AdminContext
|
||||||
|
- SilverStripe\BehatExtension\Context\BasicContext
|
||||||
|
- SilverStripe\BehatExtension\Context\EmailContext
|
||||||
|
- SilverStripe\BehatExtension\Context\LoginContext
|
||||||
|
- SilverStripe\Framework\Tests\Behaviour\CmsFormsContext
|
||||||
|
- SilverStripe\Framework\Tests\Behaviour\CmsUiContext
|
||||||
|
- SilverStripe\ExternalLinks\Tests\Behat\Context\FeatureContext
|
||||||
|
- SilverStripe\ExternalLinks\Tests\Behat\Context\FixtureContext
|
||||||
|
-
|
||||||
|
SilverStripe\ExternalLinks\Tests\Behat\Context\FixtureContext:
|
||||||
|
- "%paths.modules.externallinks%/tests/behat/files/"
|
||||||
|
|
||||||
|
extensions:
|
||||||
|
SilverStripe\BehatExtension\MinkExtension:
|
||||||
|
default_session: facebook_web_driver
|
||||||
|
javascript_session: facebook_web_driver
|
||||||
|
facebook_web_driver:
|
||||||
|
browser: chrome
|
||||||
|
wd_host: "http://127.0.0.1:9515"
|
||||||
|
|
||||||
|
SilverStripe\BehatExtension\Extension:
|
||||||
|
screenshot_path: "%paths.base%/artifacts/screenshots"
|
||||||
|
bootstrap_file: vendor/silverstripe/framework/tests/behat/serve-bootstrap.php
|
@ -18,12 +18,13 @@
|
|||||||
"squizlabs/php_codesniffer": "^3.0"
|
"squizlabs/php_codesniffer": "^3.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"silverstripe/queuedjobs": "Provides a more efficient method of generating/updating the report"
|
"ssymbiote/silverstripe-queuedjobs": "Provides a more efficient method of generating/updating the report"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"SilverStripe\\ExternalLinks\\": "src/",
|
"SilverStripe\\ExternalLinks\\": "src/",
|
||||||
"SilverStripe\\ExternalLinks\\Tests\\": "tests/"
|
"SilverStripe\\ExternalLinks\\Tests\\": "tests/",
|
||||||
|
"SilverStripe\\ExternalLinks\\Tests\\Behat\\Context\\": "tests/behat/src/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
|
0
tests/behat/_manifest_exclude
Normal file
0
tests/behat/_manifest_exclude
Normal file
34
tests/behat/features/external-links.feature
Normal file
34
tests/behat/features/external-links.feature
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
Feature: External links report
|
||||||
|
As a website user
|
||||||
|
I want to use the external links report
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the "group" "EDITOR group" has permissions "CMS_ACCESS_LeftAndMain"
|
||||||
|
# Need to use single quotes rather than escaped double quotes when defining the fixture otherwise
|
||||||
|
# it'll end up saved as " and the hyperlink will be wrong
|
||||||
|
# When the page is published it should be converted by tinymce to double quotes
|
||||||
|
Given a "page" "My page" has the "Content" "<p>My <a href='http://fsdjoifidsohfiohfsoifhiodshfhdosi.com'>link</a> content</p>"
|
||||||
|
|
||||||
|
Scenario: Operate the external links report
|
||||||
|
Given I am logged in with "ADMIN" permissions
|
||||||
|
|
||||||
|
# Publish page
|
||||||
|
When I go to "/admin/pages"
|
||||||
|
And I follow "My page"
|
||||||
|
And I press the "Publish" button
|
||||||
|
|
||||||
|
# Run report
|
||||||
|
When I go to "/admin/reports"
|
||||||
|
And I follow "External broken links"
|
||||||
|
And I press the "Create new report" button
|
||||||
|
|
||||||
|
# Run queuedjob, new job will be the first row
|
||||||
|
When I go to "/admin/queuedjobs"
|
||||||
|
When I click on the ".gridfield-button-jobexecute" element
|
||||||
|
And I wait for 15 seconds
|
||||||
|
|
||||||
|
# Assert report
|
||||||
|
When I go to "/admin/reports"
|
||||||
|
And I follow "External broken links"
|
||||||
|
Then I should see "http://fsdjoifidsohfiohfsoifhiodshfhdosi.com"
|
||||||
|
And I should see "My page"
|
0
tests/behat/files/blank.txt
Normal file
0
tests/behat/files/blank.txt
Normal file
9
tests/behat/src/FeatureContext.php
Normal file
9
tests/behat/src/FeatureContext.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\ExternalLinks\Tests\Behat\Context;
|
||||||
|
|
||||||
|
use SilverStripe\BehatExtension\Context\SilverStripeContext;
|
||||||
|
|
||||||
|
class FeatureContext extends SilverStripeContext
|
||||||
|
{
|
||||||
|
}
|
9
tests/behat/src/FixtureContext.php
Normal file
9
tests/behat/src/FixtureContext.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace SilverStripe\ExternalLinks\Tests\Behat\Context;
|
||||||
|
|
||||||
|
use SilverStripe\BehatExtension\Context\FixtureContext as BaseFixtureContext;
|
||||||
|
|
||||||
|
class FixtureContext extends BaseFixtureContext
|
||||||
|
{
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user