Skip to content
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

Fix local integration tests #3627

Merged
merged 7 commits into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 14 additions & 39 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,6 @@ If you want to add a new npm package to 'node_modules' you will need to `--save-
npm install [your package] --save-dev --save-exact
```

2. Create a synced npm-shrinkwrap.json with devDependencies included by running

```
npm run build-shrinkwrap
```

We have a fixShrinkwrap script wich runs when you run `npm run build-shrinkwrap`, which takes care of the extra fsevents. You only need to manually remove it if shrinkwrap runs automatically. <br>
For more info https://github.com/npm/npm/issues/2679

3. Commit to repository

## ReactJS Components
Expand Down Expand Up @@ -397,42 +388,34 @@ We use cypress to drive a browser and run the unit tests for DC/OS UI. This is
because we want to integrate our system as close as possible to the environment
it will run, the user browser.

To setup cypress you need to follow the following steps:
### Running Integration Tests

1. Install Cypress CLI.
1.1 Without Plugins

Cypress is a dev dependency, if you have not installed those yet, run:
Run DC/OS UI in testing mode (you have to close `npm start`).

```sh
npm install --only=dev
npm config delete externalplugins
npm run start:testing
```

2. Open Cypress.
1.1 With Plugins

```sh
./node_modules/.bin/cypress open
npm config set externalplugins <path>
npm run test:integration:plugins:setup
npm run start:testing
```

3. The following window should open. Login via GitHub.
NOTE: `npm run test:integration:plugins:setup` will copy plugins test over. Don't forged removing them. This is a workaround since Cypress can't run tests in multiple directories.

![img](docs/images/cypress-login.png?raw=true)

4. Add project to Cypress.

Once you've logged in click on the Add Project + button and add the `dcos-ui`
folder.

![img](docs/images/cypress-no-projects.png?raw=true)

### Running Integration Tests

1. Run DC/OS UI in testing mode (you have to close npm start).
2. Open Cypress app

```sh
npm run testing
npx cypress open
```

2. Open the project and click on "Run All Tests" or in one of the test files,
3. Click on "Run All Tests" or in one of the test files,
e.g. (PackageTab-cy.js).

![img](docs/images/cypress-run-tests.png?raw=true)
Expand Down Expand Up @@ -464,14 +447,6 @@ that, among other things, include:

For more information, we recommend [cypress documentation](https://docs.cypress.io/guides/overview/why-cypress.html).

#### Run cypress on the command line

Alternatively you can run cypress from the command line.

```sh
npm run cypress
```

### Debugging flaky integration tests

We have tooling to check if a test case (or the implementation) is flaky.
Expand Down Expand Up @@ -543,7 +518,7 @@ When formatting a string containing multiple pieces of logic and/or translation

Keep in mind that lingui follows the React pattern where everything is a component that way making it easier to compose and reason about the application.

Ensure that `npm run lingui-extract-with-plugins` is run with every update to dcos-ui, and that any updates to `messages.json` are committed.
Ensure that `npm run util:lingui:extract-with-plugins` is run with every update to dcos-ui, and that any updates to `messages.json` are committed.

### New translation files

Expand Down
8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ pipeline {
sh "git fetch"
sh "git checkout \"\$([ -z \"\$CHANGE_BRANCH\" ] && echo \$BRANCH_NAME || echo \$CHANGE_BRANCH )\""

// jenkins seem to have this variable set for no reason, explicitly remiving it…
// jenkins seem to have this variable set for no reason, explicitly removing it…
sh "npm config delete externalplugins"
sh "npm run test:validate"
sh "npm --unsafe-perm ci"
sh "npm run validate-tests"
sh "npm run build"
}
}
Expand All @@ -57,7 +57,7 @@ pipeline {
}

steps {
sh 'npm run commitlint -- --from "${CHANGE_TARGET}"'
sh 'npm run lint:commits -- --from "${CHANGE_TARGET}"'
}
}

Expand All @@ -74,7 +74,7 @@ pipeline {
]) {
sh "./scripts/ci/createDatadogConfig.sh"
}
sh "npm run integration-tests"
sh "npm run test:integration"
}

post {
Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile.reruns
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ pipeline {
stage("Build") {
steps {
sh "npm --unsafe-perm ci"
sh "npm run build-assets"
sh "npm run build:assets"
}
}

stage("Tests") {
steps {
sh "REPORT=false RERUN=100 npm run rerun:integration-tests"
sh "REPORT=false RERUN=100 npm run test:integration:rerun"
}

post {
Expand Down
72 changes: 40 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,76 @@ The User Interface for The Datacenter Operating System.

The DC/OS UI is used by datacenter operators to administer and manage a datacenter. Developers use DC/OS UI to manage, deploy and debug their applications. The DC/OS UI sits at the top of the [DC/OS stack](https://dcos.io/docs/latest/overview/architecture/) along with the [CLI](github.com/dcos/dcos-cli).

* [Issue tracker](https://jira.dcos.io). Use component `dcos-ui`.
* [Documentation](https://dcos.io/docs/latest/usage/webinterface/)
* [Apache License v2](./LICENSE)
- [Issue tracker](https://jira.dcos.io). Use component `dcos-ui`.
- [Documentation](https://dcos.io/docs/latest/usage/webinterface/)
- [Apache License v2](./LICENSE)

![DC/OS UI](./.github/dcos-ui.gif)

## Usage

You can choose from two ways of developing this repository.

- Locally
- Docker

### Local Development

#### Requirements

Node 8.9.x and NPM 5.6.x (and above) are **required**. We suggest using [nvm](https://github.com/creationix/nvm) or [n](https://github.com/tj/n) to keep multiple Node versions on your system.

#### DC/OS Installation Instructions:
1. Clone this repo:

```sh
git clone [email protected]:dcos/dcos-ui.git && cd dcos-ui
```
1. Clone this repo:


2. Install dependencies:
```sh
git clone [email protected]:dcos/dcos-ui.git && cd dcos-ui
```

```sh
npm i
```
2. Install dependencies:

3. Add developer files for config overrides:

```sh
npm run scaffold
```
This will create `webpack/proxy.dev.js` and `src/js/config/Config.dev.ts`. These files aren't tracked by git and provide a place to override proxy and general dcos-ui configuration.
```sh
npm i
```

Edit `webpack/proxy.dev.js` to point to the cluster address.
3. Add developer files for config overrides:

4. (optional) Using External Plugins:

DC/OS UI comes bundled with some internal plugins within the `/plugins` directory. You can also load more plugins from another directory and they will be loaded into DC/OS UI along with the internal plugins. To set a directory for external plugins run:
```sh
npm run util:scaffold
```

```sh
# for dcos-ui-plugins-private
npm config set externalplugins ../dcos-ui-plugins-private
This will create `webpack/proxy.dev.js` and `src/js/config/Config.dev.ts`. These files aren't tracked by git and provide a place to override proxy and general dcos-ui configuration.

# for your own plugins
npm config set externalplugins ../path/to/plugins
```
Edit `webpack/proxy.dev.js` to point to the cluster address.

Note that `dcos-ui-plugins-private` currently *must* be set up at `../dcos-ui-plugins-private`. You also might want to copy its `Config.template.js` to `src/js/config/Config.dev.ts` to enable the enterprise edition.
4. (optional) Using External Plugins:

5. Start the development server:
DC/OS UI comes bundled with some internal plugins within the `/plugins` directory. You can also load more plugins from another directory and they will be loaded into DC/OS UI along with the internal plugins. To set a directory for external plugins run:

```sh
npm start
```
```sh
# for dcos-ui-plugins-private
npm config set externalplugins ../dcos-ui-plugins-private

# for your own plugins
npm config set externalplugins ../path/to/plugins
```

Note that `dcos-ui-plugins-private` currently _must_ be set up at `../dcos-ui-plugins-private`. You also might want to copy its `Config.template.js` to `src/js/config/Config.dev.ts` to enable the enterprise edition.

5. Start the development server:


```sh
npm start
```

6. Navigate to [http://localhost:4200](http://localhost:4200)
6. Navigate to [http://localhost:4200](http://localhost:4200)

*7. (optional, not suggested) Follow the instructions [here](https://github.com/dcos/dcos-vagrant) to install a local cluster.*
_7. (optional, not suggested) Follow the instructions [here](https://github.com/dcos/dcos-vagrant) to install a local cluster._

### Development with Docker

Expand Down
Binary file removed docs/images/cypress-login.png
Binary file not shown.
Binary file removed docs/images/cypress-no-projects.png
Binary file not shown.
11 changes: 0 additions & 11 deletions owners.json

This file was deleted.

Loading