From 0bad5f275f5a02e3e4fd3e845723c51a6bf0b351 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Tue, 19 Jul 2022 11:57:39 +0200 Subject: [PATCH] testing --- .github/workflows/test.yaml | 36 +++++++++++++++++++++++++++ README.md | 4 ++- frontend/src/lib/ui/NoteResult.svelte | 1 + frontend/src/lib/ui/ShowNote.svelte | 28 +++++++++++---------- frontend/src/routes/note/[id].svelte | 2 +- package.json | 6 ++++- playwright.config.ts | 18 ++++++++++++++ pnpm-lock.yaml | 21 ++++++++++++++++ test/text.ts | 36 +++++++++++++++++++++++++++ 9 files changed, 136 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/test.yaml create mode 100644 playwright.config.ts create mode 100644 test/text.ts diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..340e0a2 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,36 @@ +on: + push: + +jobs: + test: + runs-on: ubuntu-latest + services: + redis: + image: redis:7-alpine + ports: + - 6379:6379 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: "16" + - uses: pnpm/action-setup@v2 + with: + version: 7 + - uses: actions-rs/toolchain@v1 + with: + toolchain: 1.61 + - name: Prepare + run: | + pnpm install + pnpm run ci:prepare + # - name: Install Playwright + # run: npx playwright install --with-deps + # - name: Run your tests + # run: npm test + # - name: Upload test results + # if: always() + # uses: actions/upload-artifact@v2 + # with: + # name: playwright-report + # path: playwright-report diff --git a/README.md b/README.md index 6771579..5175cc5 100644 --- a/README.md +++ b/README.md @@ -167,4 +167,6 @@ You can see the app under [localhost:1234](http://localhost:1234). ###### Attributions -Icons made by freepik from www.flaticon.com +- Text for tests [Nietzsche Ipsum](https://nietzsche-ipsum.com/) +- Loading animation by [Nikhil Krishnan](https://codepen.io/nikhil8krishnan/pen/rVoXJa) +- Icons made by freepik from www.flaticon.com diff --git a/frontend/src/lib/ui/NoteResult.svelte b/frontend/src/lib/ui/NoteResult.svelte index b1d1b41..2569052 100644 --- a/frontend/src/lib/ui/NoteResult.svelte +++ b/frontend/src/lib/ui/NoteResult.svelte @@ -24,6 +24,7 @@ label={$t('common.share_link')} value="{window.location.origin}/note/{result.id}#{result.password}" copy + data-testid="share-link" />

diff --git a/frontend/src/lib/ui/ShowNote.svelte b/frontend/src/lib/ui/ShowNote.svelte index 96793b6..ad96153 100644 --- a/frontend/src/lib/ui/ShowNote.svelte +++ b/frontend/src/lib/ui/ShowNote.svelte @@ -44,20 +44,22 @@

{@html $t('show.warning_will_not_see_again')}

-{#if note.meta.type === 'text'} -
- {@html contentWithLinks(note.contents)} -
- -{:else} - {#each files as file} -
- downloadFile(file)}>↓ {file.name} - {file.type} - {prettyBytes(file.size)} +
+ {#if note.meta.type === 'text'} +
+ {@html contentWithLinks(note.contents)}
- {/each} - -{/if} + + {:else} + {#each files as file} +
+ downloadFile(file)}>↓ {file.name} + {file.type} - {prettyBytes(file.size)} +
+ {/each} + + {/if} +