Skip to content

Commit

Permalink
Add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
cstns committed Jul 9, 2024
1 parent e2328b8 commit 44804fc
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions test/e2e/frontend/cypress/tests/applications/overview.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,5 +342,90 @@ describe('FlowForge - Applications', () => {
.should('not.be.disabled')
})
})

describe('can search through', () => {
it('applications', () => {
cy.intercept(
'GET',
'/api/*/teams/*/applications/status*',
{
count: 1,
applications: [
{ id: '1', instances: [], devices: [] },
{ id: '2', instances: [], devices: [] },
{ id: '3', instances: [], devices: [] }
]
}
).as('getAppStatuses')
cy.intercept('get', '/api/*/applications/*/devices*', {
meta: {},
count: 0,
devices: []
}).as('getDevices')
cy.intercept(
'GET',
'/api/*/teams/*/applications*',
{
count: 1,
applications: [
{
id: '1',
name: 'My First App',
description: 'My first empty app description',
instancesSummary: {
instances: []
},
devicesSummary: {
devices: []
}
},
{
id: '2',
name: 'My Second App',
description: 'My second empty app description',
instancesSummary: {
instances: []
},
devicesSummary: {
devices: []
}
},
{
id: '3',
name: 'My Third App',
description: 'My third empty app description',
instancesSummary: {
instances: []
},
devicesSummary: {
devices: []
}
}
]
}
).as('getApplication')

cy.home()

cy.wait('@getAppStatuses')
cy.wait('@getApplication')
cy.wait('@getDevices')

// check that we have three apps
cy.get('[data-el="applications-list"]').children().should('have.length', 3)

// check that we have three apps after searching a term common to all three
cy.get('[data-form="search"]').type('my')
cy.get('[data-el="applications-list"]').children().should('have.length', 3)

// check that we have three apps after clearing the search input
cy.get('[data-form="search"] input').clear()
cy.get('[data-el="applications-list"]').children().should('have.length', 3)

// check that we have a single app after searching a term unique to one
cy.get('[data-form="search"] input').type('second')
cy.get('[data-el="applications-list"]').children().should('have.length', 1).contains('My Second App')
})
})
})
})

0 comments on commit 44804fc

Please sign in to comment.