Skip to content

Commit

Permalink
Update test script for storybook testing, comment out cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melvin-chen committed Feb 26, 2024
1 parent f3e55fe commit 50e3aab
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- name: Install the Cypress binary
run: npx cypress install

- name: Cypress run
run: pnpm run test:ci-with-server
# - name: Cypress run
# run: pnpm run test:ci-with-server

- uses: actions/upload-artifact@v3
if: failure()
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/storybook-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'Storybook Tests'
on: push
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: yarn
- name: Install Playwright
run: npx playwright install --with-deps
- name: Build Storybook
run: pnpm build:storybook --quiet
- name: Serve Storybook and run tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server packages/nuka/storybook-static --port 6006" \
"npx wait-on tcp:6006 && pnpm test:storybook"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"test": "pnpm run -r test",
"test:ci": "pnpm run -r test:ci",
"test:ci-with-server": "start-server-and-test start:website http://localhost:3000 test:ci",
"test:storybook-with-server": "start-server-and-test start:storybook http://localhost:3000 test:storybook",
"test:storybook": "pnpm run --filter nuka-carousel test:storybook",
"check": "pnpm run lint",
"check:ci": "pnpm run check",
Expand Down
2 changes: 1 addition & 1 deletion packages/nuka/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test:unit:watch": "pnpm run test:unit --watchAll",
"test:e2e": "cypress open",
"test:e2e:ci": "cypress run",
"test:storybook": "test-storybook --watch",
"test:storybook": "test-storybook",
"package": "pnpm pack",
"prepublishOnly": "shx cp ../../README.md ./README.md && shx cp ../../LICENSE ./LICENSE && pnpm run build",
"postpack": "shx rm ./README.md && shx rm ./LICENSE",
Expand Down
30 changes: 15 additions & 15 deletions packages/nuka/src/Carousel/Carousel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
* @jest-environment jsdom
*/

import { render } from '@testing-library/react';
import { Carousel } from './Carousel';
import { ExampleSlide } from './ExampleSlide';
// import { render } from '@testing-library/react';
// import { Carousel } from './Carousel';
// import { ExampleSlide } from './ExampleSlide';

describe('Carousel', () => {
it('renders', () => {
render(
<Carousel>
<ExampleSlide index={0} />
</Carousel>
);
});
it.todo('passes a className and ref for the parent');
it.todo('passes the same className for each of the children');
// it('renders', () => {
// render(
// <Carousel>
// <ExampleSlide index={0} />
// </Carousel>
// );
// });
// it.todo('passes a className and ref for the parent');
// it.todo('passes the same className for each of the children');
it.todo('is draggable through touch controls');
it.todo('has a next and previous function that is callable from its parent');
it.todo('can slide');
// it.todo('has a next and previous function that is callable from its parent');
// it.todo('can slide');
it.todo('omits slides whose children are falsy');

it.todo('autoplays at the right rate');
// it.todo('autoplays at the right rate');

it.todo('returns the right number of page dots');
});

0 comments on commit 50e3aab

Please sign in to comment.