Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: update failing cypress tests #2758

Merged
merged 1 commit into from
Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/src/app/services/HeartbeatMonitorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export default function HeartbeatMonitorList(props: {
variant='contained'
onClick={() => setShowCreateDialog(true)}
startIcon={<Add />}
data-testid='create-monitor'
>
Create Heartbeat Monitor
</Button>
Expand Down
1 change: 1 addition & 0 deletions web/src/app/services/IntegrationKeyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export default function IntegrationKeyList(props: {
variant='contained'
onClick={(): void => setCreate(true)}
startIcon={<Add />}
data-testid='create-key'
>
Create Integration Key
</Button>
Expand Down
1 change: 1 addition & 0 deletions web/src/app/services/ServiceLabelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default function ServiceLabelList(props: {
variant='contained'
onClick={() => setCreate(true)}
startIcon={<Add />}
data-testid='create-label'
>
Create Label
</Button>
Expand Down
48 changes: 40 additions & 8 deletions web/src/cypress/e2e/services.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,11 @@ function testServices(screen: ScreenFormat): void {
const timeoutMinutes = (Math.trunc(Math.random() * 10) + 5).toString()
const invalidName = 'a'

cy.pageFab()
if (screen === 'mobile') {
cy.pageFab()
} else {
cy.get('button[data-testid="create-monitor"]').click()
}

cy.dialogForm({ name: invalidName, timeoutMinutes })
cy.dialogClick('Submit')
Expand Down Expand Up @@ -417,7 +421,11 @@ function testServices(screen: ScreenFormat): void {

it('should handle canceling', () => {
// cancel out of create
cy.pageFab()
if (screen === 'mobile') {
cy.pageFab()
} else {
cy.get('button[data-testid="create-monitor"]').click()
}
cy.dialogTitle('Create New Heartbeat Monitor')
cy.dialogFinish('Cancel')

Expand Down Expand Up @@ -449,7 +457,11 @@ function testServices(screen: ScreenFormat): void {
)

const createKey = (type: string, name: string): void => {
cy.pageFab()
if (screen === 'mobile') {
cy.pageFab()
} else {
cy.get('button[data-testid="create-key"]').click()
}
cy.dialogForm({ name, type })
cy.dialogFinish('Submit')
}
Expand Down Expand Up @@ -506,7 +518,11 @@ function testServices(screen: ScreenFormat): void {
)

// check that dropdown type is hidden
cy.pageFab()
if (screen === 'mobile') {
cy.pageFab()
} else {
cy.get('button[data-testid="create-key"]').click()
}
cy.get('input[name=type]').findByLabel('Email').should('not.exist')
})
})
Expand Down Expand Up @@ -570,7 +586,11 @@ function testServices(screen: ScreenFormat): void {
const key = label.key
const value = c.word({ length: 10 })

cy.pageFab()
if (screen === 'mobile') {
cy.pageFab()
} else {
cy.get('button[data-testid="create-label"]').click()
}
cy.dialogForm({ key, value })
cy.dialogFinish('Submit')
cy.get('li').should('contain', key)
Expand All @@ -584,7 +604,11 @@ function testServices(screen: ScreenFormat): void {
cy.visit(`/services/${svc.id}/labels`)
})

cy.pageFab()
if (screen === 'mobile') {
cy.pageFab()
} else {
cy.get('button[data-testid="create-label"]').click()
}
cy.dialogForm({ key, value })
cy.dialogFinish('Submit')

Expand Down Expand Up @@ -644,7 +668,11 @@ function testServices(screen: ScreenFormat): void {
const randomWord = c.word({
length: 7,
})
cy.pageFab()
if (screen === 'mobile') {
cy.pageFab()
} else {
cy.get('button[data-testid="create-label"]').click()
}
cy.get('input[name=key]').findByLabel(`Create "${randomWord}"`)

cy.updateConfig({
Expand All @@ -654,7 +682,11 @@ function testServices(screen: ScreenFormat): void {
})
cy.reload()

cy.pageFab()
if (screen === 'mobile') {
cy.pageFab()
} else {
cy.get('button[data-testid="create-label"]').click()
}
cy.get('input[name=key]').type(`Create "${randomWord}"`)
cy.get('[data-cy="select-dropdown"]').should('contain', 'No options')
})
Expand Down