ys9693 | 16a9fce | 2020-01-19 13:50:02 +0200 | [diff] [blame] | 1 | import {initCommonFixtures} from "../common/init"; |
| 2 | |
| 3 | describe('General Screen', () => { |
| 4 | |
| 5 | beforeEach(() => { |
| 6 | cy.server(); |
| 7 | initCommonFixtures(cy); |
| 8 | |
| 9 | // Service Metadata Fixture for General Page |
| 10 | cy.fixture('general-page/service-metadata').as('service-metadata'); |
| 11 | cy.route('GET', '**/catalog/services/*/filteredDataByParams?include=metadata', '@service-metadata'); |
| 12 | cy.route({ method: 'PUT', url: '**/catalog/services/*/metadata'}, '@service-metadata-update-response').as('updateService'); |
| 13 | }); |
| 14 | |
| 15 | it('Test that metadata fields are populated', function () { |
| 16 | const generalPageUrl = '#!/dashboard/workspace/035ca9eb-ab9a-4e03-9bfb-e051a6c47a82/service/general'; |
| 17 | cy.visit(generalPageUrl); |
| 18 | |
| 19 | cy.get('[data-tests-id="serviceFunction"]').should('be.visible'); |
| 20 | cy.get('[data-tests-id="serviceFunction"]').should('have.value', 'serviceFunction1'); |
| 21 | cy.get('[data-tests-id="create/save"]').click(); |
| 22 | |
| 23 | // Assert that the request body includes the serviceFunction parameter |
| 24 | cy.wait('@updateService').then((xhr) => { |
| 25 | assert.equal(xhr.request.body.serviceFunction, 'serviceFunction1'); |
| 26 | }); |
| 27 | }); |
| 28 | }); |