Skip to content

Commit

Permalink
FOIA-345: Add agency name in back-end title. (#502)
Browse files Browse the repository at this point in the history
* FOIA-345: Add agency name in back-end title.

* FOIA-345: Add Behat testing script.

* FOIA-345: Add Behat testing script.

* FOIA-345: Update Behat testing script.

* FOIA-345: Update Behat testing script2.

* FOIA-345: Update Behat testing script3.

* FOIA-345: Update Behat testing script4.

* FOIA-345: Update Behat testing script5.

* FOIA-345: Update Behat testing script6.

---------

Co-authored-by: brockfanning <[email protected]>
  • Loading branch information
ychen-doj and brockfanning authored Apr 6, 2023
1 parent 0b6228c commit e6378c4
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
uuid: 84d90416-aef6-414e-8a2e-8461d169cf8f
langcode: en
status: true
dependencies: { }
id: node__agency_component
label: 'Content: Agency Component'
tags:
description: '[node:summary]'
title: '[node:title] | [node:field_agency] | [site:name]'
27 changes: 27 additions & 0 deletions tests/behat/features/AgencyComponent.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@agency_component
Feature: Agency Component Feature
In order to create Agency Component
As an Administrator
I should be able to create and edit an Agency Component entity.

Background:
Given agency terms:
| name | field_agency_abbreviation | description |format | language |
| Federal Testing Agency | FTA | description |plain_text| en |

@api
Scenario: Agency Component name in title tag for Agency Component node.
Given I am logged in as a user with the 'Administrator' role
And I am at '/node/add/agency_component'
And for 'Agency Component Name' I enter 'My agency name'
And for 'Agency' I enter 'Federal Testing Agency'
And for 'Abbreviation' I enter 'FTA'
And for 'Street address' I enter 'testing'
And for 'City' I enter 'Rockville'
And for 'Zip code' I enter "20857'
And I select "Maryland" from "State"
And I select "Email" from "Portal Submission Format"
And for 'Submission Email' I enter '[email protected]'
When I press the 'Save' button
Then the page title should be "My agency name | Federal Testing Agency | National FOIA Portal"
18 changes: 18 additions & 0 deletions tests/behat/features/bootstrap/Drupal/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,22 @@ public function iWaitSeconds($num)
sleep($num);
}

/**
* Check if the given title is expected or not.
*
* @Then the page title should be :expectedTitle
*/
public function thePageTitleShouldBe($expectedTitle) {
$titleElement = $this->getSession()->getPage()->find('css', 'head title');
if ($titleElement === null) {
throw new \Exception('Page title element was not found!');
}
else {
$title = $titleElement->getText();
if ($expectedTitle !== $title) {
throw new \Exception("Incorrect title! Expected:$expectedTitle | Actual:$title ");
}
}
}

}

0 comments on commit e6378c4

Please sign in to comment.