forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: keep modal open when saving database failed (apache#11618)
- Loading branch information
Showing
10 changed files
with
142 additions
and
44 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
superset-frontend/cypress-base/cypress/integration/database/helper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
export const DATABASE_LIST = '/databaseview/list'; |
73 changes: 73 additions & 0 deletions
73
superset-frontend/cypress-base/cypress/integration/database/modal.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { DATABASE_LIST } from './helper'; | ||
|
||
describe('Add database', () => { | ||
beforeEach(() => { | ||
cy.server(); | ||
cy.login(); | ||
}); | ||
|
||
it('should keep create modal open when error', () => { | ||
cy.visit(DATABASE_LIST); | ||
|
||
// open modal | ||
cy.get('[data-test="btn-create-database"]').click(); | ||
|
||
// type values | ||
cy.get('[data-test="database-modal"] input[name="database_name"]') | ||
.focus() | ||
.type('cypress'); | ||
cy.get('[data-test="database-modal"] input[name="sqlalchemy_uri"]') | ||
.focus() | ||
.type('bad_db_uri'); | ||
|
||
// click save | ||
cy.get('[data-test="modal-confirm-button"]:not(:disabled)').click(); | ||
|
||
// should show error alerts and keep modal open | ||
cy.get('.toast').contains('error'); | ||
cy.wait(1000); // wait for potential (incorrect) closing annimation | ||
cy.get('[data-test="database-modal"]').should('be.visible'); | ||
|
||
// should be able to close modal | ||
cy.get('[data-test="modal-cancel-button"]').click(); | ||
cy.get('[data-test="database-modal"]').should('not.be.visible'); | ||
}); | ||
|
||
it('should keep update modal open when error', () => { | ||
// open modal | ||
cy.get('[data-test="database-edit"]:last').click(); | ||
|
||
cy.get('[data-test="database-modal"]:last input[name="sqlalchemy_uri"]') | ||
.focus() | ||
.dblclick() | ||
.type('{selectall}{backspace}bad_uri'); | ||
|
||
// click save | ||
cy.get('[data-test="modal-confirm-button"]:not(:disabled)').click(); | ||
|
||
// should show error alerts | ||
cy.get('.toast').contains('error').should('be.visible'); | ||
|
||
// modal should still be open | ||
cy.wait(1000); // wait for potential (incorrect) closing annimation | ||
cy.get('[data-test="database-modal"]').should('be.visible'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters