Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

[terra-functional-testing] Updated specPath in BaseCompare. #644

Merged
merged 5 commits into from
Apr 30, 2021

Conversation

pranav300
Copy link
Contributor

Summary

This PR replace node_modules in specPath in BaseCompare with tests/wdio/__snapshots__.

Closes #643

Additional Details

This is required as all the specs in clinical-theme are present in node_modules, And upgrading it to terra-functional-testing causes the snapshots to be created in the root directory.

@cerner/terra

@@ -105,7 +105,7 @@ class BaseCompare {

// Added to allow for test reusability from terra repositories
if (specPath.includes('node_modules')) {
[, specPath] = specPath.split('node_modules');
specPath = specPath.replace('node_modules', 'tests/wdio/__snapshots__');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use path.join to handle platform specific separator?
E.g. : path.join('test, 'wdio', '__snapshots__')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated here 1f7eecf

@mjhenkes mjhenkes temporarily deployed to terra-toolki-update-spe-rxvddj April 28, 2021 19:19 Inactive
@mjhenkes mjhenkes temporarily deployed to terra-toolki-update-spe-rxvddj April 28, 2021 19:22 Inactive
Copy link
Contributor

@yuderekyu yuderekyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also add a verification pull request for the clinical theme that pulls this in

@pranav300
Copy link
Contributor Author

@yuderekyu,
I have a test-branch with same changes getting consumed in clinical-theme PR 275. But that is also failing due to some accessibility violations.

You can still view the structure in which the snapshots are getting generated.

@@ -105,7 +105,7 @@ class BaseCompare {

// Added to allow for test reusability from terra repositories
if (specPath.includes('node_modules')) {
[, specPath] = specPath.split('node_modules');
specPath = specPath.replace('node_modules', path.join('tests', 'wdio', '__snapshots__'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets remove the snapshots path to avoid adding snapshots to the path twice.

Suggested change
specPath = specPath.replace('node_modules', path.join('tests', 'wdio', '__snapshots__'));
specPath = specPath.replace('node_modules', path.join('tests', 'wdio'));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here b4c3235

@mjhenkes mjhenkes temporarily deployed to terra-toolki-update-spe-rxvddj April 29, 2021 04:30 Inactive
@@ -105,7 +105,7 @@ class BaseCompare {

// Added to allow for test reusability from terra repositories
if (specPath.includes('node_modules')) {
[, specPath] = specPath.split('node_modules');
specPath = specPath.replace('node_modules', path.join('tests', 'wdio'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are no longer using Array.split() can we change specPath definition to

let specPath;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this.baseScreenshotDir as that is being used to add process.cwd(), which we are removing at the specPath definition using Array.split()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was doing the pretty much the same thing as in terra-toolkit-boneyard. I wonder where the difference is between the two.

@mjhenkes mjhenkes merged commit 8ea1a43 into main Apr 30, 2021
@mjhenkes mjhenkes deleted the update-specPath branch April 30, 2021 17:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[terra-functional-testing] Update specPath in BaseCompare to handle spec files in node_modules.
5 participants