-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
598 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Playwright Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
name: 🧪 ${{ matrix.project }} E2E Tests | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 20 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- project: chromium | ||
os: ubuntu-latest | ||
cache_dir: ~/.cache/ms-playwright | ||
|
||
- project: firefox | ||
os: ubuntu-latest | ||
cache_dir: ~/.cache/ms-playwright | ||
|
||
- project: webkit | ||
os: macos-latest | ||
cache_dir: ~/Library/Caches/ms-playwright | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
cache: "yarn" | ||
|
||
- name: Install dependencies | ||
run: yarn install --immutable | ||
|
||
- name: Write out playwright version | ||
run: yarn --silent playwright --version > .playwright-version | ||
|
||
- name: ⚡️ Cache playwright binaries | ||
uses: actions/cache@v3 | ||
id: playwright-cache | ||
with: | ||
path: ${{ matrix.cache_dir }} | ||
key: ${{ runner.os }}-${{ matrix.project }}-pw-${{ hashFiles('**/.playwright-version') }} | ||
|
||
- name: Install Playwright Browsers | ||
if: steps.playwright-cache.outputs.cache-hit != 'true' | ||
run: yarn playwright install --with-deps ${{ matrix.project }} | ||
|
||
- name: Run Playwright tests | ||
run: yarn test --project=${{ matrix.project }} | ||
|
||
- name: Upload test results | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: playwright-report | ||
path: playwright-report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* eslint-disable testing-library/prefer-screen-queries */ | ||
import { test, expect } from '@playwright/test'; | ||
import mockData from '../playwright/mock-data/simpsons/simpsons_data.json'; | ||
import mockAnnotations from '../playwright/mock-data/simpsons/simpsons_annotations.json'; | ||
import mockAltText from '../playwright/mock-data/simpsons/simpsons_alttxt.json'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.route('*/**/api/**', async (route) => { | ||
const url = route.request().url(); | ||
let json; | ||
|
||
if (url) { | ||
if (url.includes('workspaces/Upset%20Examples/tables/simpsons/rows/?limit=9007199254740991')) { | ||
json = mockData; | ||
await route.fulfill({ json }); | ||
} else if (url.includes('workspaces/Upset%20Examples/tables/simpsons/annotations/')) { | ||
json = mockAnnotations; | ||
await route.fulfill({ json }); | ||
} else if (url.includes('alttxt')) { | ||
json = mockAltText; | ||
await route.fulfill({ json }); | ||
} else if (url.includes('workspaces/Upset%20Examples/sessions/table/193/state/')) { | ||
await route.fulfill({ status: 200 }); | ||
} else { | ||
await route.continue(); | ||
} | ||
} else { | ||
await route.abort(); | ||
} | ||
}); | ||
}); | ||
|
||
test('Alt Text', async ({ page }) => { | ||
await page.goto('http://localhost:3000/?workspace=Upset+Examples&table=simpsons&sessionId=193'); | ||
|
||
const altTextSidebarButton = page.getByLabel('Open alt text sidebar'); | ||
await altTextSidebarButton.click(); | ||
|
||
const altTextSidebar = page.getByLabel('Alt Text Sidebar', { exact: true }); | ||
await expect(altTextSidebar).toBeVisible(); | ||
|
||
const altTextHeading = page.getByRole('heading', { name: 'Alt Text' }); | ||
await expect(altTextHeading).toBeVisible(); | ||
|
||
/// ///////////////// | ||
// Plot Information | ||
/// ///////////////// | ||
const plotInformation = page.getByRole('button', { name: 'Plot Information' }); | ||
await expect(plotInformation).toBeVisible(); | ||
await plotInformation.click(); | ||
|
||
const editPlotInformationButton = page.getByLabel('Toggle editable descriptions'); | ||
await expect(editPlotInformationButton).toBeVisible(); | ||
await editPlotInformationButton.click(); | ||
|
||
const datasetDescriptionInput = page.getByPlaceholder('eg: movie genres and ratings'); | ||
await expect(datasetDescriptionInput).toBeVisible(); | ||
await expect(datasetDescriptionInput).toBeEditable(); | ||
await datasetDescriptionInput.click(); | ||
await datasetDescriptionInput.fill('Test dataset description'); | ||
|
||
const setsInput = page.getByPlaceholder('eg: movie genres (dataset'); | ||
await expect(setsInput).toBeVisible(); | ||
await expect(setsInput).toBeEditable(); | ||
await setsInput.click(); | ||
await setsInput.fill('Test sets value'); | ||
|
||
const itemsInput = page.getByPlaceholder('eg: movies (dataset rows)'); | ||
await expect(itemsInput).toBeVisible(); | ||
await expect(itemsInput).toBeEditable(); | ||
await itemsInput.click(); | ||
await itemsInput.fill('Test items value'); | ||
|
||
const plotInformationOutput = page.getByText('This UpSet plot shows test'); | ||
await expect(plotInformationOutput).toBeVisible(); | ||
await expect(plotInformationOutput).toHaveText('This UpSet plot shows Test dataset description. The sets are Test sets value. The items are Test items value.'); | ||
|
||
await page.getByRole('button', { name: 'Save' }).click(); | ||
await plotInformation.click(); | ||
|
||
/// ///////////////// | ||
// Alt Text Output | ||
/// ///////////////// | ||
const UpSetIntroduction = { | ||
heading: page.getByRole('heading', { name: 'UpSet Introduction' }), | ||
content: page.getByText('This is an UpSet plot that'), | ||
}; | ||
await expect(UpSetIntroduction.heading).toBeVisible(); | ||
await expect(UpSetIntroduction.content).toBeVisible(); | ||
await expect(UpSetIntroduction.content).toHaveText('This is an UpSet plot that visualizes set intersection. To learn about UpSet plots, visit https://upset.app.'); | ||
|
||
const datasetProperties = { | ||
heading: page.getByRole('heading', { name: 'Dataset Properties' }), | ||
content: page.getByText('The dataset contains 6 sets'), | ||
}; | ||
|
||
await expect(datasetProperties.heading).toBeVisible(); | ||
await expect(datasetProperties.content).toBeVisible(); | ||
await expect(datasetProperties.content).toHaveText('The dataset contains 6 sets, and 44 elements, of which 6 are shown in the plot.'); | ||
|
||
const setProperties = { | ||
heading: page.getByRole('heading', { name: 'Set Properties', exact: true }), | ||
content: page.getByText('The largest set is Male with'), | ||
}; | ||
await expect(setProperties.heading).toBeVisible(); | ||
await expect(setProperties.content).toBeVisible(); | ||
await expect(setProperties.content).toHaveText('The largest set is Male with 18 elements, followed by School with 6, Duff Fan with 6, Evil with 6, Power Plant with 5, and Blue Hair with 3.'); | ||
|
||
const intersectionProperties = { | ||
heading: page.getByRole('heading', { name: 'Intersection Properties' }), | ||
content: page.getByText('The plot is sorted by size.'), | ||
}; | ||
await expect(intersectionProperties.heading).toBeVisible(); | ||
await expect(intersectionProperties.content).toBeVisible(); | ||
await expect(intersectionProperties.content).toHaveText('The plot is sorted by size. There are 12 non-empty intersections, all of which are shown in the plot. The largest 5 intersections are School Male (3), the empty intersection (3), Just Male (3), Duff_Fan Male Power_Plant (3), and Evil Male (2).'); | ||
|
||
const statisticalInformation = { | ||
heading: page.getByRole('heading', { name: 'Statistical Information' }), | ||
content: page.getByText('The average intersection size'), | ||
}; | ||
await expect(statisticalInformation.heading).toBeVisible(); | ||
await expect(statisticalInformation.content).toBeVisible(); | ||
await expect(statisticalInformation.content).toHaveText('The average intersection size is 2, and the median is 2. The 90th percentile is 3, and the 10th percentile is 1. The largest set, Male, is present in 75.0% of all non-empty intersections. The smallest set, Blue Hair, is present in 0.0% of all non-empty intersections.'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: './e2e-tests', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
reporter: 'html', | ||
use: { | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: 'yarn dev', | ||
url: 'http://localhost:3000', | ||
reuseExistingServer: !process.env.CI, | ||
stdout: 'ignore', | ||
stderr: 'pipe', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"alttxt": { | ||
"techniqueDescription": "This is an UpSet plot that visualizes set intersection. To learn about UpSet plots, visit https://upset.app.", | ||
"shortDescription": "This is an UpSet plot which shows set intersection of 6 sets out of 6 sets and the largest intersection is School Male (3). The plot is sorted by size and 12 non-empty intersections are shown.", | ||
"longDescription": "# UpSet Introduction\nThis is an UpSet plot that visualizes set intersection. To learn about UpSet plots, visit https://upset.app.\n\n# Dataset Properties\nThe dataset contains 6 sets, and 44 elements, of which 6 are shown in the plot.\n\n# Set Properties\nThe largest set is Male with 18 elements, followed by School with 6, Duff Fan with 6, Evil with 6, Power Plant with 5, and Blue Hair with 3.\n\n# Intersection Properties\nThe plot is sorted by size. There are 12 non-empty intersections, all of which are shown in the plot. The largest 5 intersections are School Male (3), the empty intersection (3), Just Male (3), Duff_Fan Male Power_Plant (3), and Evil Male (2).\n\n# Statistical Information\nThe average intersection size is 2, and the median is 2. The 90th percentile is 3, and the 10th percentile is 1. The largest set, Male, is present in 75.0% of all non-empty intersections. The smallest set, Blue Hair, is present in 0.0% of all non-empty intersections.\n\n" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"Name": "label", | ||
"School": "boolean", | ||
"Blue Hair": "boolean", | ||
"Duff Fan": "boolean", | ||
"Evil": "boolean", | ||
"Male": "boolean", | ||
"Power Plant": "boolean", | ||
"Age": "number" | ||
} |
Oops, something went wrong.