Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e framework and initial spec #326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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