Skip to content

Commit 39045ff

Browse files
authored
Merge pull request #864 from jsonwebtoken/gh-actions-testing-stale-pr
Github Actions - Run tests and stale PR
2 parents 1d8ca39 + 232ac3d commit 39045ff

File tree

7 files changed

+226
-101
lines changed

7 files changed

+226
-101
lines changed

.github/workflows/production.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,37 @@ on:
88
- master
99
- production
1010
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '22'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Run Vitest
25+
run: npx vitest run
26+
27+
- name: Install Playwright Browsers
28+
run: npx playwright install --with-deps
29+
30+
- name: Run Playwright Tests
31+
run: npx playwright test
32+
33+
- name: Upload Playwright Traces
34+
if: failure()
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: playwright-traces
38+
path: playwright-report/**/trace.zip
39+
1140
Deploy-Production:
41+
needs: test
1242
runs-on:
1343
labels: ubuntu-latest
1444
steps:

.github/workflows/tests.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '22'
19+
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Run Vitest
24+
run: npx vitest run
25+
26+
- name: Install Playwright Browsers
27+
run: npx playwright install --with-deps
28+
29+
- name: Run Playwright Tests
30+
run: npx playwright test
31+
32+
- name: Upload Playwright Traces
33+
if: failure()
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: playwright-traces
37+
path: playwright-report/**/trace.zip
38+
39+

e2e/decoder.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ test.describe("Can interact with JWT Decoder JWT editor", () => {
5353
await expect(jwtEditorInput).toHaveValue(inputValue);
5454
});
5555

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

6162
const lang = await getLang(page);
6263
expectToBeNonNull(lang);

playwright.config.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ export default defineConfig({
4444
use: { ...devices['Desktop Firefox'] },
4545
},
4646

47-
{
48-
name: 'webkit',
49-
use: { ...devices['Desktop Safari'] },
50-
},
51-
5247
/* Test against mobile viewports. */
5348
// {
5449
// name: 'Mobile Chrome',
@@ -71,9 +66,10 @@ export default defineConfig({
7166
],
7267

7368
/* Run your local dev server before starting the tests */
74-
// webServer: {
75-
// command: 'npm run start',
76-
// url: 'http://127.0.0.1:3000',
77-
// reuseExistingServer: !process.env.CI,
78-
// },
69+
webServer: {
70+
command: 'npm run dev',
71+
port: 1234,
72+
timeout: 60 * 1000,
73+
reuseExistingServer: !process.env.CI,
74+
},
7975
});

src/features/common/services/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export const safeJsonStringify = fromThrowable(JSON.stringify, (e) => {
9090
});
9191

9292
export const safeNewUint8ArrayFromBuffer = fromThrowable(
93-
(buffer: ArrayBufferLike) => new Uint8Array(buffer),
93+
(buffer: Buffer) => new Uint8Array(buffer),
9494
(e) => {
9595
if (e instanceof Error) {
9696
return e.message;

0 commit comments

Comments
 (0)