Skip to content

Solid UI integration test #16

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

Open
wants to merge 7 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
10 changes: 7 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@ jobs:
steps:
- name: Checkout commit
uses: actions/checkout@v2
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7.1.0
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install Dependencies
run: npm ci
run: pnpm install
- name: Install Playwright
run: npx playwright install --with-deps
run: pnpm exec playwright install --with-deps
- name: Run E2E tests
run: npm run test:e2e:run
run: pnpm test:e2e:run
env:
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.target_url }}
- name: Save Test Results
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ jobs:
steps:
- name: Checkout commit
uses: actions/checkout@v2
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7.1.0
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 14
cache: 'npm'
cache: 'pnpm'
- name: Install Dependencies
run: npm ci
- name: Check for linting issues
run: npm run lint
run: pnpm install
# - name: Check for linting issues
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chore: fix types

# run: pnpm lint
- name: Run functional tests
run: npm run test:func:run
run: pnpm test:func:run
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ coverage
.DS_Store
test-results/
playwright-report/
*.yaml
29 changes: 19 additions & 10 deletions e2e/command-palette-basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ test.describe('Test basic interactions of Command Palette', () => {

await page.keyboard.type('GitHub');

const searchLocator = page.locator('input[type="search"]');
const searchLocator = page.locator('role=searchbox[name*="Search for an action"]');
await expect(searchLocator).toHaveValue('GitHub');

const optionLocator = page.locator('[role="combobox"] >> [role="option"]');
const optionLocator = page.locator(
'role=combobox[name*="Search for an action"] >> role=option'
);

const optionsNum = await optionLocator.count();
expect(optionsNum).toBe(1);
Expand All @@ -45,7 +47,9 @@ test.describe('Test basic interactions of Command Palette', () => {
await page.keyboard.press('ArrowDown');
await page.keyboard.press('ArrowDown');

const optionLocator = page.locator('[role="combobox"] >> [role="option"]');
const optionLocator = page.locator(
'role=combobox[name*="Search for an action"] >> role=option'
);
let isThirdOptionSelected = await optionLocator.nth(2).getAttribute('aria-selected');

expect(isThirdOptionSelected).toEqual('true');
Expand All @@ -64,15 +68,18 @@ test.describe('Test basic interactions of Command Palette', () => {
await page.goto('/demo');
await triggerCommandPaletteOpen(page);

await expect(page.locator('[role="combobox"]')).not.toContainText('Unmute');
const paletteLocator = page.locator('role=combobox[name*="Search for an action"]');
await expect(paletteLocator).not.toContainText('Unmute');

await page.keyboard.press('Escape');
await page.check('label >> text=Audible');
const unmuteLabelLocator = page.locator('label >> text=Audible');
await unmuteLabelLocator.check();
await triggerCommandPaletteOpen(page);
await page.click('[role="combobox"] >> text=Unmute');
await paletteLocator.locator('text=Unmute').click();

const isUnmuted = await page.isChecked('label >> text=Audible');
expect(isUnmuted).toBeFalsy();
await expect(unmuteLabelLocator).toBeChecked({
checked: false,
});
});

test('should be able to run nested actions', async ({ page }) => {
Expand All @@ -81,11 +88,13 @@ test.describe('Test basic interactions of Command Palette', () => {

await page.keyboard.type('Profile');

const optionLocator = page.locator('[role="combobox"] >> [role="option"]');
const optionLocator = page.locator(
'role=combobox[name*="Search for an action"] >> role=option'
);

await optionLocator.locator('text=Set profile').click();

const searchLocator = page.locator('input[type="search"]');
const searchLocator = page.locator('role=searchbox[name*="Search for an action"]');
await expect(searchLocator).toHaveValue('');

const optionsNum = await optionLocator.count();
Expand Down
13 changes: 13 additions & 0 deletions fix-jest-dom.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import fs from 'fs';
import path from 'path';

const typesPath = path.resolve('node_modules', '@types', 'testing-library__jest-dom', 'index.d.ts');
const refMatcher = /[\r\n]+\/\/\/ <reference types="jest" \/>/;

fs.readFile(typesPath, 'utf8', (err, data) => {
if (err) throw err;

fs.writeFile(typesPath, data.replace(refMatcher, ''), 'utf8', function (err) {
if (err) throw err;
});
});
Loading