Skip to content

Commit

Permalink
Adds support for Windows (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijetmahabaleshwar-okta authored and jmelberg-okta committed Feb 13, 2018
1 parent 2e403c4 commit 5296266
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 47 deletions.
File renamed without changes.
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,48 @@ If you do not see an exact emoji match, use the best matching emoji.
Updates Contributing.md with new template

Resolves: OKTA-12345

## Running E2E Tests locally

> **NOTE:** Due to some dependencies in the shell script, the E2E tests will not run on windows. You can test your code on *nix based machines before commiting.
E2E Tests will be run against the Custom Login and Okta-Hosted Login servers.

In addition to running npm install in the root of the project (to install the dev dependencies for testing), you will also need to install the dependencies of each sample app. This can be performed via the `npm install` command:

```bash
# At project root
npm install
```

Next, setup the following environment variables:

```bash
export CLIENT_ID={yourAppClientId}
export OKTA_DOMAIN={yourOktaOrgDomain}
```

> **NOTE:** Use only the domain part of your org url while setting `OKTA_DOMAIN` environment.
* E.g - If your org url is https://example.oktapreview.com, your `OKTA_DOMAIN` should be `example.oktapreview`.

After setting up the environment variables, run a script to update the configuration:

```bash
sh scripts/setup-env.sh
```

Finally, update the following environment variables with a username & password of any user you want to use in your tests:

```bash
# The {userName} should be of the form "username@email.com"

export USERNAME={userName}
export PASSWORD={password}
```

To perform the E2E test, simply run:

```bash
npm test
```
43 changes: 0 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,4 @@ Please find the sample that fits your use-case from the table below.
| [Okta-Hosted Login](/okta-hosted-login) | A Vue application that will redirect the user to the Okta-Hosted login page for authentication. The user is redirected back to the Vue application after authenticating. |
| [Custom Login Page](/custom-login) | A Vue application that uses the Okta Sign-In Widget within the Vue application to authenticate the user. |

## Running E2E Tests locally

E2E Tests will be run against the Custom Login and Okta-Hosted Login servers.

In addition to running npm install in the root of the project (to install the dev dependencies for testing), you will also need to install the dependencies of each sample app. This can be performed via the `npm install` command:

```bash
# At project root
npm install
```

Next, setup the following environment variables:

```bash
export CLIENT_ID={yourAppClientId}
export OKTA_DOMAIN={yourOktaOrgDomain}
```

**NOTE:** Use only the domain part of your org url while setting `OKTA_DOMAIN` environment.

* E.g - If your org url is https://example.oktapreview.com, your `OKTA_DOMAIN` should be `example.oktapreview`.

After setting up the environment variables, run a script to update the configuration:

```bash
sh scripts/setup-env.sh
```

Finally, update the following environment variables with a username & password of any user you want to use in your tests:

```bash
# The {userName} should be of the form "username@email.com"

export USERNAME={userName}
export PASSWORD={password}
```

To perform the E2E test, simply run:

```bash
npm test
```

[Okta Vue Library]: https://github.com/okta/okta-oidc-js/tree/master/packages/okta-vue
5 changes: 4 additions & 1 deletion custom-login/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@ Now start the app server:
npm start
```

> **Note:** If you are on a windows machine, you might get an error related to `browserslist`.
> It is a [known issue](https://github.com/angular/angular-cli/issues/5075) on windows due to one of the dependencies we use. To resolve the issue, search for `browserslist` and `browserslist.cmd` files in your node_modules. Delete the files and start the app server again.
Now navigate to http://localhost:8080 in your browser.

If you see a home page that prompts you to login, then things are working! Clicking the **Log in** button will render a custom login page component that uses the Okta Sign-In Widget to perform authentication.

You can login with the same account that you created when signing up for your Developer Org, or you can use a known username and password from your Okta Directory.

**Note:** If you are currently using your Developer Console, you already have a Single Sign-On (SSO) session for your Org. You will be automatically logged into your application as the same user that is using the Developer Console. You may want to use an incognito tab to test the flow from a blank slate.
> **Note:** If you are currently using your Developer Console, you already have a Single Sign-On (SSO) session for your Org. You will be automatically logged into your application as the same user that is using the Developer Console. You may want to use an incognito tab to test the flow from a blank slate.

## Integrating The Resource Server
Expand Down
5 changes: 4 additions & 1 deletion okta-hosted-login/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ Now start the app server:
npm start
```

> **Note:** If you are on a windows machine, you might get an error related to `browserslist`.
> It is a [known issue](https://github.com/angular/angular-cli/issues/5075) on windows due to one of the dependencies we use. To resolve the issue, search for `browserslist` and `browserslist.cmd` files in your node_modules. Delete the files and start the app server again.
Now navigate to http://localhost:8080 in your browser.

If you see a home page that prompts you to login, then things are working! Clicking the **Log in** button will redirect you to the Okta hosted sign-in page.

You can login with the same account that you created when signing up for your Developer Org, or you can use a known username and password from your Okta Directory.

**Note:** If you are currently using your Developer Console, you already have a Single Sign-On (SSO) session for your Org. You will be automatically logged into your application as the same user that is using the Developer Console. You may want to use an incognito tab to test the flow from a blank slate.
> **Note:** If you are currently using your Developer Console, you already have a Single Sign-On (SSO) session for your Org. You will be automatically logged into your application as the same user that is using the Developer Console. You may want to use an incognito tab to test the flow from a blank slate.

## Integrating The Resource Server
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
"scripts": {
"lint": "npm run --prefix okta-hosted-login/ lint && npm run --prefix custom-login/ lint",
"test": "npm run lint && npm run test:e2e",
"postinstall": "npm install --prefix okta-hosted-login && npm install --prefix custom-login",
"okta-hosted-login-server": "npm start --prefix okta-hosted-login/",
"test:okta-hosted-login": "protractor okta-oidc-tck/e2e-tests/okta-hosted-login/conf.js",
"custom-login-server": "npm start --prefix custom-login/",
"test:custom-login": "protractor okta-oidc-tck/e2e-tests/custom-login/conf.js",
"resource-server": "node samples-nodejs-express-4/resource-server/server.js",
"test:e2e": "export TEST_TYPE=implicit && npm run get-oidc-tck && npm run test:okta-hosted-login && npm run test:custom-login",
"get-oidc-tck": "[ ! -d okta-oidc-tck/ ] && git clone https://github.com/okta/okta-oidc-tck.git || echo \"TCK already cloned\"",
"pretest": "webdriver-manager update --gecko false"
"pretest": "webdriver-manager update --gecko false",
"postinstall": "npm run install-custom-login && npm run install-okta-hosted-login",
"install-custom-login": "cd custom-login && npm install",
"install-okta-hosted-login": "cd okta-hosted-login && npm install"
},
"license": "Apache-2.0",
"repository": {
Expand Down

0 comments on commit 5296266

Please sign in to comment.