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

Update acceptance tests #376

Open
wants to merge 4 commits into
base: main
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
3 changes: 3 additions & 0 deletions .yarn/versions/7317afeb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declined:
- showwhy
- "@showwhy/acceptance-tests"
14 changes: 0 additions & 14 deletions javascript/acceptance-tests/config/default.json

This file was deleted.

7 changes: 3 additions & 4 deletions javascript/acceptance-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
"install_playwright_os_deps:": "playwright install-deps",
"playwright_report:": "playwright show-report",
"playwright_test:": "yarn acceptance_test",
"acceptance_test": "playwright test"
"acceptance_test": "playwright test",
"debug": "playwright test --debug"
},
"devDependencies": {
"@essex/scripts": "^24.0.2",
"@essex/tsconfig-base": "^1.0.2",
"@playwright/test": "^1.30.0",
"@types/config": "^3",
"@types/node": "^18.11.18",
"config": "^3.3.9"
"@types/node": "^18.11.18"
}
}
11 changes: 5 additions & 6 deletions javascript/acceptance-tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
import type { PlaywrightTestConfig } from '@playwright/test'
import { devices } from '@playwright/test'
import config from 'config'

const isCI = Boolean(process.env['CI'])

Expand All @@ -20,28 +19,28 @@ const isCI = Boolean(process.env['CI'])
const testConfig: PlaywrightTestConfig = {
testDir: './tests',
/* Maximum time one test can run for. */
timeout: config.get<number>('test.timeout'),
timeout: 30000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: config.get<number>('test.expect.timeout'),
timeout: 5000,
},
/* Run tests in files in parallel */
fullyParallel: config.get<boolean>('test.parallel'),
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: isCI,
/* Retry on CI only */
retries: isCI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: isCI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: config.get<string>('test.reporter'),
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
actionTimeout: config.get<number>('test.action.timeout'),
actionTimeout: 0,
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://localhost:3000',

Expand Down
9 changes: 0 additions & 9 deletions javascript/acceptance-tests/tests/example.spec.ts

This file was deleted.

32 changes: 32 additions & 0 deletions javascript/acceptance-tests/tests/front_page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { expect, test } from '@playwright/test'

const TEST_URL = 'http://localhost:3000'

test.describe('The front page', () => {
test.beforeEach(async ({ page }, testInfo) => {
console.log(`Running ${testInfo.title}`)
await page.goto(TEST_URL)
})

test('has has a title', async ({ page }) => {
await expect(page).toHaveTitle(/ShowWhy Causal Platform/)
})

test('can create a new Discovery app by clicking the discovery box', async ({
page,
}) => {
await page.click('#homepage-card-showwhy-discover')
})

test('can create a new Events app by clicking the events box', async ({
page,
}) => {
await page.click('#homepage-card-showwhy-events')
})

test('can create a new Exposure app by clicking the exposure box', async ({
page,
}) => {
await page.click('#homepage-card-showwhy-model-exposure')
})
})
1 change: 1 addition & 0 deletions javascript/webapp/src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const HomePage: React.FC<HomePageProps> = memo(function HomePage({ profiles }) {
return (
<DocumentCard
key={d.key}
id={`homepage-card-${d.key}`}
onClick={() => {
void profile
.createInstance?.()
Expand Down
20 changes: 1 addition & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3858,9 +3858,7 @@ __metadata:
"@essex/scripts": ^24.0.2
"@essex/tsconfig-base": ^1.0.2
"@playwright/test": ^1.30.0
"@types/config": ^3
"@types/node": ^18.11.18
config: ^3.3.9
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -5865,13 +5863,6 @@ __metadata:
languageName: node
linkType: hard

"@types/config@npm:^3":
version: 3.3.0
resolution: "@types/config@npm:3.3.0"
checksum: d9485041cfa05864d3b8095cf7b44fae910887f6782dc43ab1ba4ea78d9cdf4a8c9d697557318ede2b4b63a05b7f91e8571b8dbe048ad024e709d9e51e0487d8
languageName: node
linkType: hard

"@types/connect-history-api-fallback@npm:^1.3.5":
version: 1.3.5
resolution: "@types/connect-history-api-fallback@npm:1.3.5"
Expand Down Expand Up @@ -10067,15 +10058,6 @@ __metadata:
languageName: node
linkType: hard

"config@npm:^3.3.9":
version: 3.3.9
resolution: "config@npm:3.3.9"
dependencies:
json5: ^2.2.3
checksum: 2c29e40be22274462769670a4b69fcbcad2d3049eb15030073e410d32c892ef29e0c879a3d68ef92ddd572c516e4f65a11bb6458f680a44ceb0f051bcd3d97ff
languageName: node
linkType: hard

"confusing-browser-globals@npm:^1.0.11":
version: 1.0.11
resolution: "confusing-browser-globals@npm:1.0.11"
Expand Down Expand Up @@ -16179,7 +16161,7 @@ __metadata:
languageName: node
linkType: hard

"json5@npm:^2.1.2, json5@npm:^2.1.3, json5@npm:^2.2.2, json5@npm:^2.2.3":
"json5@npm:^2.1.2, json5@npm:^2.1.3, json5@npm:^2.2.2":
version: 2.2.3
resolution: "json5@npm:2.2.3"
bin:
Expand Down