From 5d8caaf7dc8a66c445ca8e0620d2d89dcb9f022c Mon Sep 17 00:00:00 2001 From: Alla Khintal Date: Wed, 15 Jan 2020 17:04:41 +0300 Subject: [PATCH] Cypress tests on uninitialized cluster (#456) Co-authored-by: Yaroslav Dynnikov --- test/cypress/basic_test.lua | 9 +++++++++ webui/cypress/integration/schema-editor.spec.js | 2 +- webui/cypress/integration/uninitialized.spec.js | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 webui/cypress/integration/uninitialized.spec.js diff --git a/test/cypress/basic_test.lua b/test/cypress/basic_test.lua index 2341a2002..ae3e1f6d2 100644 --- a/test/cypress/basic_test.lua +++ b/test/cypress/basic_test.lua @@ -130,3 +130,12 @@ end function g.test_schema_editor() cypress_run('schema-editor.spec.js') end + +function g.test_uninitialized() + local code = os.execute( + 'cd webui && npx cypress run' .. + ' --config baseUrl="http://localhost:8085"' .. + ' --spec cypress/integration/uninitialized.spec.js' + ) + t.assert_equals(code, 0) +end diff --git a/webui/cypress/integration/schema-editor.spec.js b/webui/cypress/integration/schema-editor.spec.js index 4f2243fc9..3ac8ea331 100644 --- a/webui/cypress/integration/schema-editor.spec.js +++ b/webui/cypress/integration/schema-editor.spec.js @@ -1,5 +1,5 @@ describe('Schema section', () => { - it('Empty', () => { + it('Schema with bootstrap', () => { const selectAllKeys = Cypress.platform == 'darwin' ? '{cmd}a' : '{ctrl}a'; const defaultText = '---\nspaces: []\n...\n'; diff --git a/webui/cypress/integration/uninitialized.spec.js b/webui/cypress/integration/uninitialized.spec.js new file mode 100644 index 000000000..90c18c7b9 --- /dev/null +++ b/webui/cypress/integration/uninitialized.spec.js @@ -0,0 +1,14 @@ +describe('Schema section', () => { + it('Schema without bootstrap', () => { + cy.visit(Cypress.config('baseUrl')+"/admin/cluster/schema"); + + cy.get('button[type="button"]:contains("Validate")').click(); + cy.get('#root').contains('Cluster isn\'t bootstrapped yet'); + + cy.get('button[type="button"]:contains("Reload")').click(); + cy.get('.monaco-editor textarea').should('have.value', ''); + + cy.get('button[type="button"]:contains("Apply")').click(); + cy.get('#root').contains('Cluster isn\'t bootstrapped yet'); + }); +});