Skip to content

Commit 333721a

Browse files
Add E2E tests for @asgardeo/react SDK
1 parent a104e19 commit 333721a

49 files changed

Lines changed: 2302 additions & 125 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/wicked-doors-buy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@asgardeo/react': patch
3+
---
4+
5+
Add E2E tests for @asgardeo/react SDK

.github/workflows/e2e-tests.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# E2E tests for the React SDK using the teamspace-react sample app.
2+
3+
name: 🧪 E2E Tests
4+
5+
on:
6+
pull_request:
7+
branches: [main]
8+
paths:
9+
- 'packages/**'
10+
- 'samples/teamspace-react/**'
11+
- 'e2e/**'
12+
workflow_dispatch:
13+
inputs:
14+
idp_target:
15+
description: 'IDP target (is, thunder, both)'
16+
required: false
17+
default: 'both'
18+
19+
env:
20+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
22+
jobs:
23+
e2e-is:
24+
name: 🧪 E2E (WSO2 IS)
25+
if: >-
26+
github.event_name == 'pull_request' ||
27+
github.event.inputs.idp_target == 'is' ||
28+
github.event.inputs.idp_target == 'both'
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 30
31+
strategy:
32+
matrix:
33+
node-version: [lts/*]
34+
pnpm-version: [latest]
35+
steps:
36+
- name: ⬇️ Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: 🟢 Setup node
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: ${{ matrix.node-version }}
43+
44+
- name: 🥡 Setup pnpm
45+
uses: pnpm/action-setup@v4
46+
with:
47+
version: ${{ matrix.pnpm-version }}
48+
run_install: false
49+
50+
- name: 🎈 Get pnpm store directory
51+
id: get-pnpm-cache-dir
52+
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
53+
54+
- name: 🔆 Cache pnpm modules
55+
uses: actions/cache@v4
56+
with:
57+
path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }}
58+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
59+
restore-keys: |
60+
${{ runner.os }}-pnpm-store-
61+
62+
- name: 🧩 Install Dependencies
63+
run: pnpm install --frozen-lockfile
64+
65+
- name: 🏗️ Build SDK packages
66+
run: pnpm build
67+
68+
- name: 🎭 Install Playwright browsers
69+
run: pnpm e2e:install
70+
71+
- name: 🐳 Start WSO2 IS
72+
run: pnpm e2e:docker:up:is
73+
74+
- name: 🧪 Run E2E redirect tests against IS
75+
run: pnpm e2e -- --idp is --mode redirect
76+
env:
77+
CI: true
78+
79+
- name: 🧪 Run E2E embedded tests against IS
80+
run: pnpm e2e -- --idp is --mode embedded
81+
env:
82+
CI: true
83+
84+
- name: 📊 Upload redirect test report
85+
uses: actions/upload-artifact@v4
86+
if: always()
87+
with:
88+
name: e2e-is-redirect-report
89+
path: e2e/playwright-report/
90+
retention-days: 14
91+
92+
- name: 📊 Upload embedded test report
93+
uses: actions/upload-artifact@v4
94+
if: always()
95+
with:
96+
name: e2e-is-embedded-report
97+
path: e2e/playwright-report-embedded/
98+
retention-days: 14
99+
100+
- name: 🐳 Stop Docker containers
101+
if: always()
102+
run: pnpm e2e:docker:down
103+
104+
e2e-thunder:
105+
name: 🧪 E2E (Thunder)
106+
if: >-
107+
github.event_name == 'pull_request' ||
108+
github.event.inputs.idp_target == 'thunder' ||
109+
github.event.inputs.idp_target == 'both'
110+
runs-on: ubuntu-latest
111+
timeout-minutes: 20
112+
strategy:
113+
matrix:
114+
node-version: [lts/*]
115+
pnpm-version: [latest]
116+
steps:
117+
- name: ⬇️ Checkout
118+
uses: actions/checkout@v4
119+
120+
- name: 🟢 Setup node
121+
uses: actions/setup-node@v4
122+
with:
123+
node-version: ${{ matrix.node-version }}
124+
125+
- name: 🥡 Setup pnpm
126+
uses: pnpm/action-setup@v4
127+
with:
128+
version: ${{ matrix.pnpm-version }}
129+
run_install: false
130+
131+
- name: 🎈 Get pnpm store directory
132+
id: get-pnpm-cache-dir
133+
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
134+
135+
- name: 🔆 Cache pnpm modules
136+
uses: actions/cache@v4
137+
with:
138+
path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }}
139+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
140+
restore-keys: |
141+
${{ runner.os }}-pnpm-store-
142+
143+
- name: 🧩 Install Dependencies
144+
run: pnpm install --frozen-lockfile
145+
146+
- name: 🏗️ Build SDK packages
147+
run: pnpm build
148+
149+
- name: 🎭 Install Playwright browsers
150+
run: pnpm e2e:install
151+
152+
- name: 🐳 Start Thunder
153+
run: pnpm e2e:docker:up:thunder
154+
155+
- name: 🧪 Run E2E redirect tests against Thunder
156+
run: pnpm e2e -- --idp thunder --mode redirect
157+
env:
158+
CI: true
159+
160+
- name: 🧪 Run E2E embedded tests against Thunder
161+
run: pnpm e2e -- --idp thunder --mode embedded
162+
env:
163+
CI: true
164+
165+
- name: 📊 Upload redirect test report
166+
uses: actions/upload-artifact@v4
167+
if: always()
168+
with:
169+
name: e2e-thunder-redirect-report
170+
path: e2e/playwright-report/
171+
retention-days: 14
172+
173+
- name: 📊 Upload embedded test report
174+
uses: actions/upload-artifact@v4
175+
if: always()
176+
with:
177+
name: e2e-thunder-embedded-report
178+
path: e2e/playwright-report-embedded/
179+
retention-days: 14
180+
181+
- name: 🐳 Stop Docker containers
182+
if: always()
183+
run: pnpm e2e:docker:down

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ Thumbs.db
4747
.cursor/rules/nx-rules.mdc
4848
.github/instructions/nx.instructions.md
4949

50+
# E2E Test artifacts
51+
e2e/.auth/
52+
e2e/test-results/
53+
e2e/playwright-report/
54+
test-results/
55+
5056
# Experimental Samples
5157
# NOTE to Developers: Please use this samples folder for experimental code only and do not commit.
5258
samples/__experimental__/

README.md

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,55 @@
2424

2525
Follow these simple steps to get started with Asgardeo:
2626

27-
1. Create an account in Asgardeo 👉 [Sign Up](https://asgardeo.io/signup?visitor_id=685a48bc57b3b5.46411343&utm_source=site&utm_medium=organic)
27+
1. Create an account in Asgardeo 👉
28+
[Sign Up](https://asgardeo.io/signup?visitor_id=685a48bc57b3b5.46411343&utm_source=site&utm_medium=organic)
2829

2930
2. Refer to our **Quick Start Guides** and get started in minutes.
30-
- [React Quick Start](https://wso2.com/asgardeo/docs/quick-starts/react/)
31-
- [Next.js Quick Start](https://wso2.com/asgardeo/docs/quick-starts/nextjs/)
31+
32+
- [React Quick Start](https://wso2.com/asgardeo/docs/quick-starts/react/)
33+
- [Next.js Quick Start](https://wso2.com/asgardeo/docs/quick-starts/nextjs/)
3234

3335
## Packages
3436

35-
| Package | Description |
36-
| --- | --- |
37-
| [![@asgardeo/javascript](https://img.shields.io/npm/v/@asgardeo/javascript?color=%234B32C3&label=%40asgardeo%2Fjavascript&logo=javascript)](./packages/javascript/) | Framework-agnostic JavaScript Core SDK |
38-
| [![@asgardeo/browser](https://img.shields.io/npm/v/@asgardeo/browser?color=%234B32C3&label=%40asgardeo%2Fbrowser&logo=firefox)](./packages/browser/) | Browser-based JavaScript SDK |
39-
| [![@asgardeo/nextjs](https://img.shields.io/npm/v/@asgardeo/nextjs?color=%23000000&label=%40asgardeo%2Fnext&logo=next.js)](./packages/next/) | Next.js SDK for building applications with Asgardeo |
40-
| [![@asgardeo/node](https://img.shields.io/npm/v/@asgardeo/node?color=%23339933&label=%40asgardeo%2Fnode&logo=node.js)](./packages/node/) | Node.js SDK for server-side integration |
41-
| [![@asgardeo/express](https://img.shields.io/npm/v/@asgardeo/express?color=%23339933&label=%40asgardeo%2Fexpress&logo=express)](./packages/express/) | Express.js SDK for server-side integration |
42-
| [![@asgardeo/nuxt](https://img.shields.io/npm/v/@asgardeo/nuxt?color=%2300DC82&label=%40asgardeo%2Fnuxt&logo=nuxt)](./packages/nuxt/) | Nuxt.js SDK for building applications with Asgardeo |
43-
| [![@asgardeo/react](https://img.shields.io/npm/v/@asgardeo/react?color=%2361DAFB&label=%40asgardeo%2Freact&logo=react)](./packages/react/) | React SDK for building applications with Asgardeo |
44-
| [![@asgardeo/react-router](https://img.shields.io/npm/v/@asgardeo/react-router?color=%2361DAFB&label=%40asgardeo%2Freact-router&logo=react-router)](./packages/react-router/) | Supplementary React Router bindings |
45-
| [![@asgardeo/vue](https://img.shields.io/npm/v/@asgardeo/vue?color=%234FC08D&label=%40asgardeo%2Fvue&logo=vue.js)](./packages/vue/) | Vue.js SDK for building applications with Asgardeo |
37+
| Package | Description |
38+
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
39+
| [![@asgardeo/javascript](https://img.shields.io/npm/v/@asgardeo/javascript?color=%234B32C3&label=%40asgardeo%2Fjavascript&logo=javascript)](./packages/javascript/) | Framework-agnostic JavaScript Core SDK |
40+
| [![@asgardeo/browser](https://img.shields.io/npm/v/@asgardeo/browser?color=%234B32C3&label=%40asgardeo%2Fbrowser&logo=firefox)](./packages/browser/) | Browser-based JavaScript SDK |
41+
| [![@asgardeo/nextjs](https://img.shields.io/npm/v/@asgardeo/nextjs?color=%23000000&label=%40asgardeo%2Fnext&logo=next.js)](./packages/next/) | Next.js SDK for building applications with Asgardeo |
42+
| [![@asgardeo/node](https://img.shields.io/npm/v/@asgardeo/node?color=%23339933&label=%40asgardeo%2Fnode&logo=node.js)](./packages/node/) | Node.js SDK for server-side integration |
43+
| [![@asgardeo/express](https://img.shields.io/npm/v/@asgardeo/express?color=%23339933&label=%40asgardeo%2Fexpress&logo=express)](./packages/express/) | Express.js SDK for server-side integration |
44+
| [![@asgardeo/nuxt](https://img.shields.io/npm/v/@asgardeo/nuxt?color=%2300DC82&label=%40asgardeo%2Fnuxt&logo=nuxt)](./packages/nuxt/) | Nuxt.js SDK for building applications with Asgardeo |
45+
| [![@asgardeo/react](https://img.shields.io/npm/v/@asgardeo/react?color=%2361DAFB&label=%40asgardeo%2Freact&logo=react)](./packages/react/) | React SDK for building applications with Asgardeo |
46+
| [![@asgardeo/react-router](https://img.shields.io/npm/v/@asgardeo/react-router?color=%2361DAFB&label=%40asgardeo%2Freact-router&logo=react-router)](./packages/react-router/) | Supplementary React Router bindings |
47+
| [![@asgardeo/vue](https://img.shields.io/npm/v/@asgardeo/vue?color=%234FC08D&label=%40asgardeo%2Fvue&logo=vue.js)](./packages/vue/) | Vue.js SDK for building applications with Asgardeo |
48+
49+
## E2E Tests
50+
51+
Run End-to-end tests using Playwright. See the [E2E Test Guide](./e2e/README.md) for setup instructions and usage.
4652

4753
## Contribute
4854

49-
Please read [Contributing Guide](CONTRIBUTING.md) for details on how to contribute to Asgardeo JavaScript SDKs. Refer to [General Contribution Guidelines](http://wso2.github.io/) for details on our code of conduct, and the process for submitting pull requests to us.
55+
Please read [Contributing Guide](CONTRIBUTING.md) for details on how to contribute to Asgardeo JavaScript SDKs. Refer to
56+
[General Contribution Guidelines](http://wso2.github.io/) for details on our code of conduct, and the process for
57+
submitting pull requests to us.
5058

5159
### Contributors ❤️
5260

53-
Hats off to all the people who have contributed to this project, including those who created issues and participated in discussions. 🙌
61+
Hats off to all the people who have contributed to this project, including those who created issues and participated in
62+
discussions. 🙌
5463

5564
<a href="https://github.com/asgardeo/javascript/graphs/contributors">
5665
<img src="https://contrib.rocks/image?repo=asgardeo/javascript" />
5766
</a>
5867

5968
### Reporting issues
6069

61-
We encourage you to report issues, improvements, and feature requests creating [Github Issues](https://github.com/asgardeo/javascript/issues).
70+
We encourage you to report issues, improvements, and feature requests creating
71+
[Github Issues](https://github.com/asgardeo/javascript/issues).
6272

63-
**Important**: Please be advised that security issues MUST be reported to <a href="mailto:security@wso2.com">security@wso2.com</a>, not as GitHub issues, in order to reach the proper audience. We strongly advise following the WSO2 Security Vulnerability Reporting Guidelines when reporting the security issues.
73+
**Important**: Please be advised that security issues MUST be reported to
74+
<a href="mailto:security@wso2.com">security@wso2.com</a>, not as GitHub issues, in order to reach the proper audience.
75+
We strongly advise following the WSO2 Security Vulnerability Reporting Guidelines when reporting the security issues.
6476

6577
## License
6678

0 commit comments

Comments
 (0)