Skip to content

Commit

Permalink
Fix compose basic functionality tests after Corteza 2023.3.6 version …
Browse files Browse the repository at this point in the history
…upgrade
  • Loading branch information
katrinDY committed Sep 14, 2023
1 parent 6f4c279 commit 55fa58a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ describe('Test for creating a role', () => {

it('should be able to create a role with missing handle', () => {
cy.get('[data-test-id="card-role-info"]').within(() => {
cy.get('[data-test-id="input-name"]').type('Name')
cy.get('[data-test-id="input-name"]').type('No handle')
cy.get('[data-test-id="input-handle"]').clear()
cy.get('[data-test-id="button-submit"]').click()
cy.get('[data-test-id="button-submit"]').click({ force: true })
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@ describe('Test for creating a module', () => {
})

context('Test for checking if buttons in the toolbar or component should/should not be displayed', () => {
it('should be able to press the back button and be redirected to the list of modules page', () => {
cy.get('[data-test-id="button-back-without-save"]').should('exist').click()
cy.url().should('exist', composeURL + '/ns/cypress_namespace/admin/modules')
})

it('should not display federation, discovery settings, export and permissions buttons when in create module mode', () => {
cy.get('[data-test-id="button-create"]').click()
cy.get('[data-test-id="button-federation-settings"]').should('not.exist')
cy.get('[data-test-id="button-discovery-settings"]').should('not.exist')
cy.get('[data-test-id="button-export"]').should('not.exist')
Expand All @@ -52,6 +46,8 @@ describe('Test for creating a module', () => {

context('Test for creating a module', () => {
it('should be able to create a module', () => {
cy.get('a[title="Modules"]', { timeout: 10000 }).should('exist').click()
cy.get('[data-test-id="button-create"]').click()
cy.get('[data-test-id="input-module-name"]').type('Cypress module')
cy.get('[data-test-id="input-module-handle"]').type('cypress_module')
cy.get('[data-test-id="table-module-fields"] > tbody').find('tr').eq(0).within(() => {
Expand All @@ -69,25 +65,7 @@ describe('Test for creating a module', () => {
cy.get('input:eq(1)').type('Age')
cy.get('select').select('Number input')
})
cy.get('[data-test-id="button-save-and-close"]', { timeout: 1000 }).click()
})

it('should exist', () => {
cy.contains('Cypress module').should('exist')
})
})

context('Test for creating a module with same name as existing one', () => {
it('should not be able to create a module with identical name', () => {
cy.get('[data-test-id="button-create"]').click()
cy.get('[data-test-id="input-module-name"]').type('Cypress module')
cy.get('[data-test-id="input-module-handle"]').type('cypress_module')
cy.get('[data-test-id="table-module-fields"] > tbody').find('tr').eq(0).within(() => {
cy.get('input:first').type('name')
cy.get('input:eq(1)').type('Name')
})
cy.get('[data-test-id="button-save-and-close"]', { timeout: 10000 }).click()
cy.get('[data-test-id="button-back-without-save"]').click()
cy.get('[data-test-id="button-save"]', { timeout: 10000 }).click()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Test for creating a namespace', () => {
cy.get('[data-test-id="input-subtitle"]').type('Testing namespace')
cy.get('[data-test-id="input-description"]').type('This is the description of the namespace')
cy.get('[data-test-id="checkbox-enable-namespace"]').should('be.checked')
cy.get('[data-test-id="button-save"]').click()
cy.get('[data-test-id="button-save"]').click({ force: true })
})

it('should exist', () => {
Expand All @@ -71,44 +71,41 @@ describe('Test for creating a namespace', () => {
cy.get('[data-test-id="input-slug"]').should('have.value', 'cypress_namespace')
cy.get('[data-test-id="input-subtitle"]').should('have.value', 'Testing namespace')
cy.get('[data-test-id="input-description"]').should('have.value', 'This is the description of the namespace')
cy.get('[data-test-id="button-back-without-save"]', { timeout: 10000 }).click()
cy.get('[data-test-id="button-save"]').click({ force: true })
cy.get('[data-test-id="app-selector"]', { timeout: 10000 }).click({ force: true })
cy.get('[data-test-id="button-manage-namespaces"]', { timeout: 10000 }).click({ force: true })
cy.get('[data-test-id="input-search"]').type('cypress')
cy.wait("@cypress_ns")
cy.wait(100)
cy.get('tbody').contains('cypress_namespace').should('exist')
})

it('should be able to create a namespace with missing handle', () => {
cy.get('[data-test-id="button-create"]').click()
cy.get('[data-test-id="input-name"]').type('Name')
cy.wait(100)
cy.get('[data-test-id="input-name"]').type('No handle')
cy.get('[data-test-id="button-save"]').click()
})

it('should exist', () => {
cy.intercept("/api/compose/namespace/?query=Name&limit=100&incTotal=true&pageCursor=&sort=name+ASC").as("name_ns")
cy.intercept("/api/compose/namespace/?query=No+handle&limit=100&incTotal=true&pageCursor=&sort=name+ASC").as("name_ns")
cy.url().should('exist', composeURL + '/namespaces/edit')
cy.get('[data-test-id="input-name"]').should('have.value', 'Name')
cy.get('[data-test-id="input-name"]').should('have.value', 'No handle')
cy.get('[data-test-id="input-slug"]').should('have.value', '')
cy.get('[data-test-id="button-back-without-save"]', { timeout: 10000 }).click()
cy.get('[data-test-id="input-search"]').type('Name')
cy.get('[data-test-id="app-selector"]', { timeout: 10000 }).click({ force: true })
cy.get('[data-test-id="button-manage-namespaces"]', { timeout: 10000 }).click({ force: true })
cy.get('[data-test-id="input-search"]').type('No handle')
cy.wait("@name_ns")
cy.wait(100)
cy.get('tbody').contains('Name').should('exist')
cy.get('tbody').contains('No handle').should('exist')
})
})

context('Test for creating a namespace with a same handle as another one', () => {
it('should not be able to create a namespace with not unique handle', () => {
cy.visit(composeURL + '/namespaces')
cy.get('[data-test-id="button-manage-namespaces"]').click()
cy.get('[data-test-id="button-create"]').click()
cy.get('[data-test-id="button-manage-namespaces"]').click({ force: true })
cy.get('[data-test-id="button-create"]').click({ force: true })
cy.get('[data-test-id="input-name"]').type('New cypress namespace')
cy.get('[data-test-id="input-slug"]').type('cypress_namespace')
cy.get('[data-test-id="input-subtitle"]').type('Testing namespace')
cy.get('[data-test-id="input-description"]').type('This is the description of the namespace')
cy.get('[data-test-id="checkbox-enable-namespace"]').should('be.checked')
cy.get('[data-test-id="button-save"]', { timeout: 10000 }).click()
cy.get('[data-test-id="button-save"]', { timeout: 10000 }).click({ force: true })
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,23 @@ describe('Test for deleting a namespace', () => {
context('Test for deleting the created namespaces', () => {
it('should be able to delete the namespace successfully', () => {
cy.intercept("/api/compose/namespace/?query=edited&limit=100&incTotal=true&pageCursor=&sort=name+ASC").as("ns_edited")
cy.intercept("/api/compose/namespace/?query=Name&limit=100&incTotal=true&pageCursor=&sort=name+ASC").as("ns_name")
cy.intercept("/api/compose/namespace/?query=No+handle&limit=100&incTotal=true&pageCursor=&sort=name+ASC").as("ns_name")
cy.visit(composeURL + '/namespaces')
cy.get('[data-test-id="button-manage-namespaces"]').click()
cy.get('[data-test-id="input-search"]').type('edited')
cy.wait("@ns_edited")
cy.wait(1000)
cy.get('tbody').contains('edited').should('exist').click()
cy.get('[data-test-id="button-delete"]').click()
cy.get('[data-test-id="button-delete-confirm"]').click()
cy.get('[data-test-id="input-search"]').type('Edited namespace')
cy.get('[data-test-id="no-matches"]').should('exist')

cy.get('[data-test-id="input-search"]').clear().type('Name')
cy.get('[data-test-id="input-search"]').clear().type('No handle')
cy.wait("@ns_name")
cy.wait(1000)
cy.get('tbody').contains('Name').should('exist').click()
cy.get('tbody').contains('No handle').should('exist').click()
cy.get('[data-test-id="button-delete"]').click()
cy.get('[data-test-id="button-delete-confirm"]').click()
cy.get('[data-test-id="input-search"]').clear().type('Name')
cy.get('[data-test-id="input-search"]').clear().type('No handle')
cy.get('[data-test-id="no-matches"]').should('exist')
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('Test for editing a namespace', () => {
cy.get('[data-test-id="button-manage-namespaces"]').click()
cy.get('[data-test-id="input-search"]').type('cypress')
cy.wait("@ns_cypress")
cy.wait(1000)
cy.get('tbody').contains('cypress').should('exist').click()
cy.get('[data-test-id="button-export-namespace"]').should('exist')
cy.get('[data-test-id="button-permissions"]').should('exist')
Expand All @@ -32,22 +31,21 @@ describe('Test for editing a namespace', () => {
cy.visit(composeURL + '/namespaces')
cy.get('[data-test-id="button-manage-namespaces"]').click()
cy.get('[data-test-id="input-search"]').type('cypress')
cy.wait(1000)
cy.wait("@ns_cypress")
cy.get('tbody').contains('cypress').should('exist').click()
cy.get('[data-test-id="input-name"]').clear().type('Edited namespace')
cy.get('[data-test-id="input-slug"]').clear().type('edited_namespace')
cy.get('[data-test-id="input-subtitle"]').clear().type('Edited subtitle')
cy.get('[data-test-id="input-description"]').clear().type('Edited description')
cy.get('[data-test-id="button-save"]').click()
cy.get('[data-test-id="button-save-and-close"]', { timeout: 10000 }).click()
cy.get('[data-test-id="button-save"]').click({ force: true })
})

it('should be edited', () => {
cy.intercept("/api/compose/namespace/?query=edited&limit=100&incTotal=true&pageCursor=&sort=name+ASC").as("ns_edited")
cy.visit(composeURL + '/namespaces')
cy.get('[data-test-id="button-manage-namespaces"]').click()
cy.get('[data-test-id="input-search"]').type('edited')
cy.wait("@ns_edited")
cy.wait(1000)
cy.get('tbody').contains('edited').should('exist').click()
cy.get('[data-test-id="input-name"]').should('have.value', 'Edited namespace')
cy.get('[data-test-id="input-slug"]').should('have.value', 'edited_namespace')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe('Test for editing a record page', () => {
cy.visit(composeURL + '/namespaces')
cy.get('[data-test-id="input-search"]').type('cypress')
cy.get('[data-test-id="link-visit-namespace-cypress_namespace"]').click({ force: true })
cy.contains('No block').should('exist')
cy.get('[data-test-id="button-admin"]', { timeout: 10000 }).should('exist').click({ force: true })
cy.contains('Modules').should('exist')
cy.get('[data-test-id="button-public"]', { timeout: 10000 }).should('exist')
Expand Down

0 comments on commit 55fa58a

Please sign in to comment.