|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the Elastic License; |
| 4 | + * you may not use this file except in compliance with the Elastic License. |
| 5 | + */ |
| 6 | +import { serviceNowConnector } from '../objects/case'; |
| 7 | + |
| 8 | +import { TOASTER } from '../screens/configure_cases'; |
| 9 | + |
| 10 | +import { goToEditExternalConnection } from '../tasks/all_cases'; |
| 11 | +import { |
| 12 | + addServiceNowConnector, |
| 13 | + openAddNewConnectorOption, |
| 14 | + saveChanges, |
| 15 | + selectLastConnectorCreated, |
| 16 | +} from '../tasks/configure_cases'; |
| 17 | +import { loginAndWaitForPageWithoutDateRange } from '../tasks/login'; |
| 18 | + |
| 19 | +import { CASES } from '../urls/navigation'; |
| 20 | + |
| 21 | +describe('Cases connectors', () => { |
| 22 | + before(() => { |
| 23 | + cy.server(); |
| 24 | + cy.route('POST', '**/api/action').as('createConnector'); |
| 25 | + cy.route('POST', '**/api/cases/configure').as('saveConnector'); |
| 26 | + }); |
| 27 | + |
| 28 | + it('Configures a new connector', () => { |
| 29 | + loginAndWaitForPageWithoutDateRange(CASES); |
| 30 | + goToEditExternalConnection(); |
| 31 | + openAddNewConnectorOption(); |
| 32 | + addServiceNowConnector(serviceNowConnector); |
| 33 | + |
| 34 | + cy.wait('@createConnector') |
| 35 | + .its('status') |
| 36 | + .should('eql', 200); |
| 37 | + cy.get(TOASTER).should('have.text', "Created 'New connector'"); |
| 38 | + |
| 39 | + selectLastConnectorCreated(); |
| 40 | + saveChanges(); |
| 41 | + |
| 42 | + cy.wait('@saveConnector', { timeout: 10000 }) |
| 43 | + .its('status') |
| 44 | + .should('eql', 200); |
| 45 | + cy.get(TOASTER).should('have.text', 'Saved external connection settings'); |
| 46 | + }); |
| 47 | +}); |
0 commit comments