Skip to content

Commit ac9309b

Browse files
committed
Integration
1 parent 59faebe commit ac9309b

5 files changed

Lines changed: 124 additions & 0 deletions

File tree

.circleci/config.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Environment variables to be defined in the build configuration:
2+
# AUTH0_TEST_CLIENT_ID = Client id to use in test
3+
# AUTH0_TEST_DOMAIN = Domain to use in test
4+
# AUTH0_TEST_API_IDENTIFIER = API Audience to use in test
5+
6+
# Common logic
7+
defaults: &defaults
8+
steps:
9+
- attach_workspace:
10+
at: ~/
11+
- run:
12+
name: Replace Auth0 test credentials
13+
command: |
14+
echo "var AUTH0_CLIENT_ID='$AUTH0_TEST_CLIENT_ID';" >> $AUTH0_CFG
15+
echo "var AUTH0_DOMAIN='$AUTH0_TEST_DOMAIN';" >> $AUTH0_CFG
16+
echo "var AUTH0_AUDIENCE='$AUTH0_TEST_AUDIENCE';" >> $AUTH0_CFG
17+
echo "var AUTH0_CALLBACK_URL='http://localhost:3000/callback';" >> $AUTH0_CFG
18+
19+
- run:
20+
name: Build pull request
21+
command: |
22+
docker build -t $CIRCLE_JOB ./$SAMPLE_PATH
23+
docker run -d -p 3000:3000 --name $CIRCLE_SHA1 -e AUTH0_DOMAIN=$AUTH0_TEST_DOMAIN -e AUTH0_AUDIENCE=$AUTH0_TEST_API_IDENTIFIER $CIRCLE_JOB
24+
- run:
25+
name: Wait for app to be available
26+
command: |
27+
sleep 10
28+
docker run --network host --rm appropriate/curl --retry 8 --retry-connrefused -v localhost:3000
29+
- run:
30+
name: Run tests
31+
command: |
32+
docker create --network host --name tester codeception/codeceptjs codeceptjs run-multiple --all --steps --verbose
33+
docker cp $(pwd)/lock_login_test.js tester:/tests/lock_login_test.js
34+
docker cp $(pwd)/codecept.conf.js tester:/tests/codecept.conf.js
35+
docker start -i tester
36+
working_directory: scripts
37+
- run:
38+
name: Copy app container logs
39+
command: |
40+
mkdir -p /tmp/out
41+
docker logs $CIRCLE_SHA1 > /tmp/out/app_logs.log
42+
docker cp tester:/tests/out /tmp/
43+
when: on_fail
44+
- store_artifacts:
45+
path: /tmp/out
46+
47+
# Jobs and Workflows
48+
version: 2
49+
jobs:
50+
checkout:
51+
machine: true
52+
steps:
53+
- checkout
54+
- run: git clone https://github.com/auth0-samples/spa-quickstarts-tests scripts
55+
- persist_to_workspace:
56+
root: ~/
57+
paths:
58+
- project
59+
- scripts
60+
01-login:
61+
machine: true
62+
environment:
63+
- AUTH0_CFG: 01-Login/auth0-variables.js
64+
- SAMPLE_PATH: 01-Login
65+
<<: *defaults
66+
02-user-profile:
67+
machine: true
68+
environment:
69+
- AUTH0_CFG: 02-User-Profile/auth0-variables.js
70+
- SAMPLE_PATH: 02-User-Profile
71+
<<: *defaults
72+
03-calling-an-api:
73+
machine: true
74+
environment:
75+
- AUTH0_CFG: 03-Calling-an-API/auth0-variables.js
76+
- SAMPLE_PATH: 03-Calling-an-API
77+
<<: *defaults
78+
04-authorization:
79+
machine: true
80+
environment:
81+
- AUTH0_CFG: 04-Authorization/auth0-variables.js
82+
- SAMPLE_PATH: 04-Authorization
83+
<<: *defaults
84+
05-token-renewal:
85+
machine: true
86+
environment:
87+
- AUTH0_CFG: 05-Token-Renewal/auth0-variables.js
88+
- SAMPLE_PATH: 05-Token-Renewal
89+
<<: *defaults
90+
91+
workflows:
92+
version: 2
93+
quickstarts_login:
94+
jobs:
95+
- checkout:
96+
context: Quickstart SPA Test
97+
- 01-login:
98+
context: Quickstart SPA Test
99+
requires:
100+
- checkout
101+
- 02-user-profile:
102+
context: Quickstart SPA Test
103+
requires:
104+
- checkout
105+
- 03-calling-an-api:
106+
context: Quickstart SPA Test
107+
requires:
108+
- checkout
109+
- 04-authorization:
110+
context: Quickstart SPA Test
111+
requires:
112+
- checkout
113+
- 05-token-renewal:
114+
context: Quickstart SPA Test
115+
requires:
116+
- checkout

02-User-Profile/src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class App extends Component {
3535
{
3636
!isAuthenticated() && (
3737
<Button
38+
id="qsLoginBtn"
3839
bsStyle="primary"
3940
className="btn-margin"
4041
onClick={this.login.bind(this)}
@@ -57,6 +58,7 @@ class App extends Component {
5758
{
5859
isAuthenticated() && (
5960
<Button
61+
id="qsLogoutBtn"
6062
bsStyle="primary"
6163
className="btn-margin"
6264
onClick={this.logout.bind(this)}

03-Calling-an-API/src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class App extends Component {
3535
{
3636
!isAuthenticated() && (
3737
<Button
38+
id="qsLoginBtn"
3839
bsStyle="primary"
3940
className="btn-margin"
4041
onClick={this.login.bind(this)}
@@ -68,6 +69,7 @@ class App extends Component {
6869
{
6970
isAuthenticated() && (
7071
<Button
72+
id="qsLogoutBtn"
7173
bsStyle="primary"
7274
className="btn-margin"
7375
onClick={this.logout.bind(this)}

04-Authorization/src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class App extends Component {
3535
{
3636
!isAuthenticated() && (
3737
<Button
38+
id="qsLoginBtn"
3839
bsStyle="primary"
3940
className="btn-margin"
4041
onClick={this.login.bind(this)}
@@ -79,6 +80,7 @@ class App extends Component {
7980
{
8081
isAuthenticated() && (
8182
<Button
83+
id="qsLogoutBtn"
8284
bsStyle="primary"
8385
className="btn-margin"
8486
onClick={this.logout.bind(this)}

05-Token-Renewal/src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class App extends Component {
3838
</Button>
3939
{!isAuthenticated() &&
4040
<Button
41+
id="qsLoginBtn"
4142
bsStyle="primary"
4243
className="btn-margin"
4344
onClick={this.login.bind(this)}
@@ -62,6 +63,7 @@ class App extends Component {
6263
</Button>}
6364
{isAuthenticated() &&
6465
<Button
66+
id="qsLogoutBtn"
6567
bsStyle="primary"
6668
className="btn-margin"
6769
onClick={this.logout.bind(this)}

0 commit comments

Comments
 (0)