Skip to content

Github Actions - Run tests and stale PR #864

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 13 commits into
base: master
Choose a base branch
from
Open
30 changes: 30 additions & 0 deletions .github/workflows/production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,37 @@ on:
- master
- production
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: npm ci

- name: Run Vitest
run: npx vitest run

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Run Playwright Tests
run: npx playwright test

- name: Upload Playwright Traces
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-traces
path: playwright-report/**/trace.zip

Deploy-Production:
needs: test
runs-on:
labels: ubuntu-latest
steps:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run Tests

on:
pull_request:
branches: [master]
push:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'

- name: Install dependencies
run: npm ci

- name: Run Vitest
run: npx vitest run

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Run Playwright Tests
run: npx playwright test

- name: Upload Playwright Traces
if: failure()
uses: actions/upload-artifact@v4
with:
name: playwright-traces
path: playwright-report/**/trace.zip


5 changes: 3 additions & 2 deletions e2e/decoder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ test.describe("Can interact with JWT Decoder JWT editor", () => {
await expect(jwtEditorInput).toHaveValue(inputValue);
});

test("can copy value in JWT editor", async ({ page, context }) => {
test("can copy value in JWT editor", async ({ page, context, browserName }) => {
const permissions = browserName === 'firefox' ? [] : ["clipboard-read", "clipboard-write"]
const inputValue = (TestJwts.RS512 as JwtSignedWithDigitalModel).withPemKey
.jwt;
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
await context.grantPermissions(permissions);

const lang = await getLang(page);
expectToBeNonNull(lang);
Expand Down
16 changes: 6 additions & 10 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ export default defineConfig({
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
Expand All @@ -71,9 +66,10 @@ export default defineConfig({
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
webServer: {
command: 'npm run dev',
port: 1234,
timeout: 60 * 1000,
reuseExistingServer: !process.env.CI,
},
});
2 changes: 1 addition & 1 deletion src/features/common/services/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const safeJsonStringify = fromThrowable(JSON.stringify, (e) => {
});

export const safeNewUint8ArrayFromBuffer = fromThrowable(
(buffer: ArrayBufferLike) => new Uint8Array(buffer),
(buffer: Buffer) => new Uint8Array(buffer),
(e) => {
if (e instanceof Error) {
return e.message;
Expand Down
Loading