Skip to content

Commit

Permalink
Add e2e framework and initial spec
Browse files Browse the repository at this point in the history
  • Loading branch information
alisman committed Oct 4, 2021
1 parent 287e198 commit 6e82833
Show file tree
Hide file tree
Showing 6 changed files with 3,284 additions and 43 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# testing
/coverage
/tmp

# next.js
/.next/
Expand All @@ -27,4 +28,5 @@ yarn-error.log*
.idea/*
*.iml

.now
.now

13 changes: 13 additions & 0 deletions e2e/lib/spec_utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import assert from 'assert';

export function assertScreenshotMatch(obj) {
return assert(
obj[obj.length - 1].isWithinMisMatchTolerance,
`screenshot mismatch ${obj[obj.length - 1].misMatchPercentage}`
);
}

export function getUrl(path) {
const host = process.env.HTAN_PORTAL_URL || 'http://localhost:3000';
return `${host}${path}`;
}
9 changes: 9 additions & 0 deletions e2e/specs/main.e2e.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { assertScreenshotMatch, getUrl } from '../lib/spec_utils.mjs';

describe('explore page', () => {
it('render initial unfiltered state of explore page', async () => {
await browser.url(getUrl('/explore'));
const result = await browser.checkElement('body', [{}]);
assertScreenshotMatch(result);
});
});
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"e2e": "npx wdio run wdio.conf.js",
"processSynapseJSON": "npx ncc run data/processSynapseJSON.ts",
"prettierPreCommit": "STAGED_AND_CHANGED_FILES=$(git diff HEAD --name-only --cached --diff-filter=d) && ([ -z \"$STAGED_AND_CHANGED_FILES\" ] && echo \"Nothing to prettify\" || (yarn run prettier --write $(echo $STAGED_AND_CHANGED_FILES) && git add -f $(echo $STAGED_AND_CHANGED_FILES)))",
"prettierAll": "yarn run prettier --write $(git ls-files | grep '\\(.js\\|.ts\\|.scss\\|.css\\)')"
Expand Down Expand Up @@ -70,8 +71,18 @@
"@types/node-fetch": "^2.5.5",
"@types/react": "^16.9.23",
"@vercel/ncc": "^0.28.6",
"@wdio/cli": "^7.14.1",
"@wdio/junit-reporter": "^7.14.1",
"@wdio/local-runner": "^7.14.1",
"@wdio/mocha-framework": "^7.14.1",
"@wdio/spec-reporter": "^7.14.1",
"chromedriver": "^94.0.0",
"fork-ts-checker-webpack-plugin": "^6.1.0",
"pre-commit": "^1.2.2",
"typescript": "^3.8.3"
"ts-node": "^10.2.1",
"typescript": "^4.4.3",
"wdio-chromedriver-service": "^7.2.2",
"wdio-json-reporter": "^2.0.0",
"wdio-novus-visual-regression-service": "^1.2.5"
}
}
Loading

0 comments on commit 6e82833

Please sign in to comment.