|
| 1 | +const expectedNamespace = "finos" |
| 2 | +const expectedArchitectureId = 1; |
| 3 | +const expectedArchitectureVersion = "1.0.0"; |
| 4 | + |
| 5 | +describe('Architecture Tests', () => { |
| 6 | + beforeEach(() => { |
| 7 | + cy.intercept("/calm/namespaces", {"values": [expectedNamespace]}); |
| 8 | + cy.intercept("/calm/namespaces/finos/architectures", {"values": [expectedArchitectureId]}); |
| 9 | + cy.intercept("/calm/namespaces/finos/architectures/1/versions", {"values": [expectedArchitectureVersion]}); |
| 10 | + cy.intercept("/calm/namespaces/finos/architectures/1/versions/1.0.0", { |
| 11 | + fixture: "three-tier-calm.json" |
| 12 | + }); |
| 13 | + }) |
| 14 | + |
| 15 | + it("Displays architecture JSON successfully", () => { |
| 16 | + cy.visit("/"); |
| 17 | + cy.findByText(expectedNamespace).click(); |
| 18 | + cy.findByText(/architectures/i).click(); |
| 19 | + cy.findByText(/1/i).click(); |
| 20 | + cy.findByText(/1.0.0/i).click(); |
| 21 | + |
| 22 | + cy.findByText(/relationship descriptions/i).should("exist"); |
| 23 | + cy.findByText(/node descriptions/i).should("exist"); |
| 24 | + |
| 25 | + cy.findByRole("tab", { name: /json/i}).click(); |
| 26 | + |
| 27 | + cy.fixture('three-tier-calm').then(data => { |
| 28 | + cy.contains(/\$schema/i).should("exist"); |
| 29 | + cy.contains(data.$schema).should("exist"); |
| 30 | + cy.contains(/id/i).should("exist"); |
| 31 | + |
| 32 | + cy.contains(/nodes/i).should("exist"); |
| 33 | + |
| 34 | + Object.entries(data.nodes[0]).forEach(([key, value]) => { |
| 35 | + cy.contains(key).should("exist"); |
| 36 | + cy.contains(value as string).should("exist"); |
| 37 | + }); |
| 38 | + |
| 39 | + cy.contains(/unique-id/i).should("exist"); |
| 40 | + cy.contains(data.nodes[0]["unique-id"]).should("exist"); |
| 41 | + |
| 42 | + cy.contains(/name/i).should("exist"); |
| 43 | + cy.contains(data.nodes[0]["name"]).should("exist"); |
| 44 | + |
| 45 | + cy.contains(/description/i).should("exist"); |
| 46 | + cy.contains(data.nodes[0]["description"]).should("exist"); |
| 47 | + |
| 48 | + cy.contains(/node-type/i).should("exist"); |
| 49 | + cy.contains(data.nodes[0]["node-type"]).should("exist"); |
| 50 | + }); |
| 51 | + }) |
| 52 | +}) |
0 commit comments