Skip to content
This repository was archived by the owner on Jun 10, 2021. It is now read-only.

Commit 0f126fc

Browse files
committed
Improve environment redirects
1 parent a5ef339 commit 0f126fc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

tests/project.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const expect = require('chai').expect;
33
const helpers = require('./helpers');
44

55
const byId = helpers.byTestID;
6+
const url = `http://localhost:${process.env.PORT || 8080}`;
67

78
module.exports = {
89
'[Project Tests] - Create environment': function (browser) {
@@ -29,6 +30,8 @@ module.exports = {
2930
.waitForElementVisible("[name='confirm-env-name']")
3031
.setValue("[name='confirm-env-name']", 'StagingInternal')
3132
.click('#confirm-delete-env-btn')
33+
.waitForElementVisible(byId('features-page'));
34+
browser.url(`${url}/projects`)
3235
.waitForElementVisible('#project-select-page');
3336
},
3437
'[Project Tests] - View project': function (browser) {

web/components/pages/EnvironmentSettingsPage.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ const EnvironmentSettingsPage = class extends Component {
4848
};
4949

5050
onRemoveEnvironment = () => {
51-
this.context.router.history.replace('/projects');
51+
const envs = ProjectStore.getEnvs();
52+
if (envs && envs.length) {
53+
this.context.router.history.replace(`/project/${this.props.match.params.projectId}/environment` + `/${envs[0].api_key}/features`);
54+
} else {
55+
this.context.router.history.replace(`/project/${this.props.match.params.projectId}/environment/create`);
56+
}
5257
};
5358

5459
saveEnv = (e) => {

0 commit comments

Comments
 (0)