Skip to content

Commit

Permalink
Fix tests (#991)
Browse files Browse the repository at this point in the history
  • Loading branch information
rosiel authored Nov 8, 2023
1 parent f29fef2 commit 4b2b9b2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-2.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
php-versions: ["8.1", "8.2"]
# test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver.
test-suite: ["kernel", "functional", "functional-javascript"]
drupal-version: ["10.0.x", "10.1.x"] # Fails on 10.2 until https://github.com/Islandora/islandora/issues/989 is resolved.
drupal-version: ["10.0.x", "10.1.x", "10.2.x-dev"]
mysql: ["8.0"]
allowed_failure: [false]

Expand Down
39 changes: 33 additions & 6 deletions tests/src/Functional/JsonldTypeAlterReactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,39 @@ public function testMappingReaction() {

// Add the typed predicate we will select in the reaction config.
// Taken from FieldUiTestTrait->fieldUIAddNewField.
$this->submitForm([
'new_storage_type' => 'string',
'label' => 'Typed Predicate',
'field_name' => 'type_predicate',
], 'Save and continue');
$this->submitForm([], $this->t('Save field settings'));
if (version_compare(\Drupal::VERSION, '10.2.x-dev', 'lt')) {
$this->submitForm([
'new_storage_type' => 'string',
'label' => 'Typed Predicate',
'field_name' => 'type_predicate',
], 'Save and continue');
$this->submitForm([], $this->t('Save field settings'));
}
else {
$this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text');
// First need to submit the form with the elements displayed
// on initial page load. The form is using AJAX to send a second element
// after we selected the radio button above
// we can instead get the second element by submitting the form
// and having it throw an error since the required field is missing.
// @todo refactor this as a functional javascript test.
$this->submitForm([
'new_storage_type' => 'plain_text',
'label' => 'Typed Predicate',
'field_name' => 'type_predicate',
], $this->t('Continue'));

// Now we can proceed, selecting the plain text (i.e. string)
// for the second element now that the element is displayed after
// the initial form submission.
$this->getSession()->getPage()->selectFieldOption('group_field_options_wrapper', 'string');
$this->submitForm([
'new_storage_type' => 'plain_text',
'label' => 'Typed Predicate',
'field_name' => 'type_predicate',
'group_field_options_wrapper' => 'string',
], $this->t('Continue'));
}
$this->submitForm([], $this->t('Save settings'));
$this->assertSession()->responseContains('field_type_predicate');

Expand Down

0 comments on commit 4b2b9b2

Please sign in to comment.