Create a test trait to abstract repetitive UI checks/asserts

Created on 8 April 2023, about 1 year ago
Updated 17 April 2023, about 1 year ago

Problem/Motivation

As we add more tests, we're going to create a lot of checks for the Config Enforce/Config Enforce Devel container in page output, which results in more and more places that hard code a CSS class or selector. This creates a problem if we want to change the Config Enforce output structure because we then have to fix a whole bunch of test classes. An example is that we already have multiple tests doing this:

$this->assertSession()->elementExists('css', '.config-enforce-container');

Steps to reproduce

An example of where this was a problem was in Improve usability of Config Enforce UI Postponed ; fixing that was relatively trivial, but demonstrated how brittle hard coding this can be.

Proposed resolution

We should create a trait that provides methods that abstract the checks for the presence of the Config Enforce container and whatever other repetitive checks we find we're doing in our tests. This trait should be named something fairly generic/broad to indicate this, e.g. ConfigEnforceAssertTestTrait

Remaining tasks

Do the above.

User interface changes

None.

API changes

Not really unless adding a trait counts but I don't think it does?

Data model changes

Nope.

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇦Canada Ambient.Impact Toronto

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024