Skip to content

Commit

Permalink
separate ui-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
heckenmann authored and vehagn committed May 13, 2024
1 parent 4bfb2d7 commit 49ea807
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 89 deletions.
10 changes: 10 additions & 0 deletions app-src/cypress/e2e/about.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('About Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'About').click()
cy.document().its('body').should('contain', 'Docker Swarm Dashboard')
})
})
})
57 changes: 57 additions & 0 deletions app-src/cypress/e2e/dashboardh.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Dashboard horizontal Tests', () => {
it('Dashboard horizontal', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager1').click()
cy.contains('button', 'JSON')

cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager2').click()
cy.contains('button', 'JSON')

cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager3').click()
cy.contains('button', 'JSON')

cy.contains('a', 'Dashboard').click()
cy.contains('div', 'dsd_docker-swarm-dashboard').click()
cy.contains('button', 'JSON')
cy.contains('button', 'Table')
})
})

it('Filter by service name', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.contains('th > div', 'dsd_docker-swarm-dashboard')
cy.contains('th > div', 'logger')
cy.get('input[placeholder="Filter services by service name"]').type('dsd')
cy.contains('th > div', 'logger').should('not.exist')
cy.get('input[placeholder="Filter services by service name"]')
.clear()
.type('logger')
cy.contains('th > div', 'logger')
cy.contains('th > div', 'dsd_docker-swarm-dashboard').should('not.exist')
cy.get('input[placeholder="Filter services by service name"]').clear()
})
})

it('Filter by stack name', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.contains('th > div', 'dsd_docker-swarm-dashboard')
cy.contains('th > div', 'logger')
cy.contains('select', 'Service').select('Stack')
cy.get('input[placeholder="Filter services by stack name"]').type('dsd')
cy.contains('th > div', 'logger').should('not.exist')
cy.get('input[placeholder="Filter services by stack name"]')
.clear()
.type('logger')
cy.contains('th > div', 'logger').should('not.exist')
cy.contains('th > div', 'dsd_docker-swarm-dashboard').should('not.exist')
cy.get('input[placeholder="Filter services by stack name"]').clear()
})
})
})
48 changes: 48 additions & 0 deletions app-src/cypress/e2e/dashboardv.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Dashboard vertical Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('td', 'dsd_docker-swarm-dashboard').click()
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('th', 'manager1').click()
})
})

it('Filter by service name', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('td', 'dsd_docker-swarm-dashboard')
cy.contains('td', 'logger')
cy.get('input[placeholder="Filter services by service name"]').type('dsd')
cy.contains('th > div', 'logger').should('not.exist')
cy.get('input[placeholder="Filter services by service name"]')
.clear()
.type('logger')
cy.contains('td', 'logger')
cy.contains('td', 'dsd_docker-swarm-dashboard').should('not.exist')
cy.get('input[placeholder="Filter services by service name"]').clear()
})
})

it('Filter by stack name', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('td', 'dsd_docker-swarm-dashboard')
cy.contains('td', 'logger')
cy.contains('select', 'Service').select('Stack')
cy.get('input[placeholder="Filter services by stack name"]').type('dsd')
cy.contains('td', 'logger').should('not.exist')
cy.get('input[placeholder="Filter services by stack name"]')
.clear()
.type('logger')
cy.contains('td', 'logger').should('not.exist')
cy.contains('td', 'dsd_docker-swarm-dashboard').should('not.exist')
})
})
})
18 changes: 18 additions & 0 deletions app-src/cypress/e2e/nodes.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Nodes Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager1').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager2').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager3').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'worker1').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'worker2').click()
})
})
})
11 changes: 11 additions & 0 deletions app-src/cypress/e2e/ports.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Ports Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Ports').click()
cy.contains('td', '8080')
cy.contains('td', 'dsd_docker-swarm-dashboard')
})
})
})
11 changes: 11 additions & 0 deletions app-src/cypress/e2e/settings.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Settings Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Settings').click()
cy.get('input:eq(1)').click()
cy.get('input:eq(2)').click()
})
})
})
91 changes: 2 additions & 89 deletions app-src/cypress/e2e/spec.cy.js
Original file line number Diff line number Diff line change
@@ -1,93 +1,6 @@
describe('UI Tests', () => {
it('Timeline', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Timeline').click()
})
})

it('Stacks', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Stacks').click()
cy.contains('td', 'docker-swarm-dashboard')
cy.contains('h5', 'dsd').click()
})
})

it('Nodes', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager1').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager2').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'manager3').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'worker1').click()
cy.contains('a', 'Nodes').click()
cy.contains('td', 'worker2').click()
})
})

it('Tasks', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Tasks').click()
})
})

it('Ports', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Ports').click()
cy.contains('td', '8080')
cy.contains('td', 'dsd_docker-swarm-dashboard')
})
})

it('About', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'About').click()
cy.document().its('body').should('contain', 'Docker Swarm Dashboard')
})
})

it('Settings', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Settings').click()
cy.get('input:eq(1)').click()
cy.get('input:eq(2)').click()
})
})

it('Dashboard horizontal', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager1').click()
cy.contains('button', 'JSON').click()
cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager2').click()
cy.contains('button', 'JSON').click()
cy.contains('a', 'Dashboard').click()
cy.contains('button', 'manager3').click()
cy.contains('button', 'JSON').click()
cy.contains('a', 'Dashboard').click()
cy.contains('div', 'dsd_docker-swarm-dashboard').click()
cy.contains('button', 'JSON').click()
cy.contains('button', 'Table').click()
})
})

it('Dashboard vertical', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('td', 'dsd_docker-swarm-dashboard').click()
cy.contains('a', 'Dashboard').click()
cy.get('main button:eq(1)').click()
cy.contains('th', 'manager1').click()
})
})
})
describe('UI Tests', () => {})

function visitBaseUrlAndTest(fn) {
export function visitBaseUrlAndTest(fn) {
const baseUrl =
'http://localhost:3000#base="http%3A%2F%2Flocalhost%3A3001%2F"'
cy.viewport(1920, 1080)
Expand Down
11 changes: 11 additions & 0 deletions app-src/cypress/e2e/stacks.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Stacks Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Stacks').click()
cy.contains('td', 'docker-swarm-dashboard')
cy.contains('h5', 'dsd').click()
})
})
})
9 changes: 9 additions & 0 deletions app-src/cypress/e2e/tasks.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Tasks Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Tasks').click()
})
})
})
9 changes: 9 additions & 0 deletions app-src/cypress/e2e/timeline.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { visitBaseUrlAndTest } from './spec.cy'

describe('Timeline Tests', () => {
it('Load page', () => {
visitBaseUrlAndTest(() => {
cy.contains('a', 'Timeline').click()
})
})
})

0 comments on commit 49ea807

Please sign in to comment.