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

Commit

Permalink
[terra-functional-testing] Updated specPath in BaseCompare. (#644)
Browse files Browse the repository at this point in the history
* Added replace for node_modules

* updated cheangelog

* updated jest test

* comments

* minor changes
  • Loading branch information
pranav300 authored Apr 30, 2021
1 parent 008cc1b commit 8ea1a43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions packages/terra-functional-testing/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Fixed
* Update specPath in BaseCompare to replace `node_modules` with `tests/wdio`.

## 1.2.0 - (April 23, 2021)

* Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

const baseScreenshotPath = path.join(this.baseScreenshotDir, specPath, '__snapshots__');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ describe('BaseCompare', () => {
...context,
test: {
...context.test,
file: path.join(process.cwd(), 'node_modules', 'test', 'wdio', 'test-spec.js'),
file: path.join(process.cwd(), 'node_modules', 'packageName', 'test', 'wdio', 'test-spec.js'),
},
};
const result = baseCompare.getScreenshotPaths(updatedContext);
expect(result.referencePath).toEqual(path.join(process.cwd(), 'test', 'wdio', '__snapshots__', 'reference', 'screenshotDir', 'screenshotName.png'));
expect(result.latestPath).toEqual(path.join(process.cwd(), 'test', 'wdio', '__snapshots__', 'latest', 'screenshotDir', 'screenshotName.png'));
expect(result.diffPath).toEqual(path.join(process.cwd(), 'test', 'wdio', '__snapshots__', 'diff', 'screenshotDir', 'screenshotName.png'));
expect(result.referencePath).toEqual(path.join(process.cwd(), 'tests', 'wdio', 'packageName', 'test', 'wdio', '__snapshots__', 'reference', 'screenshotDir', 'screenshotName.png'));
expect(result.latestPath).toEqual(path.join(process.cwd(), 'tests', 'wdio', 'packageName', 'test', 'wdio', '__snapshots__', 'latest', 'screenshotDir', 'screenshotName.png'));
expect(result.diffPath).toEqual(path.join(process.cwd(), 'tests', 'wdio', 'packageName', 'test', 'wdio', '__snapshots__', 'diff', 'screenshotDir', 'screenshotName.png'));
});
});

Expand Down

0 comments on commit 8ea1a43

Please sign in to comment.