Skip to content

Commit

Permalink
test: use the existing fn to open the options modal
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkrulltott committed Jan 30, 2024
1 parent 505295e commit 14baf10
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
5 changes: 0 additions & 5 deletions cypress/elements/menuBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,3 @@ export const clickMenuBarFileButton = () =>

export const clickMenuBarOptionsButton = () =>
cy.getBySel(optionsButton).click()

export const openOptionsModal = (section = 'Data') => {
clickMenuBarOptionsButton()
return cy.getBySel('options-menu-list').contains(section).click()
}
30 changes: 20 additions & 10 deletions cypress/integration/options/limitValues.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ import {
deleteAO,
saveNewAO,
} from '../../elements/fileMenu/index.js'
import { openOptionsModal } from '../../elements/menuBar.js'
import { clickMenuBarOptionsButton } from '../../elements/menuBar.js'
import {
OPTIONS_TAB_LIMIT_VALUES,
changeMaxOperator,
changeMinOperator,
clickOptionsModalHideButton,
clickOptionsModalUpdateButton,
clickOptionsTab,
expectMaxOperatorToBeOption,
expectMaxValueToBeValue,
expectMinOperatorToBeOption,
Expand Down Expand Up @@ -85,7 +86,8 @@ describe('limit values', () => {
expectTableValueToBe(value, index)
)

openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('')
Expand All @@ -107,7 +109,8 @@ describe('limit values', () => {
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>=')
expectMaxOperatorToBeOption('<=')
expectMinValueToBeValue('49500')
Expand All @@ -123,7 +126,8 @@ describe('limit values', () => {
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>=')
expectMaxOperatorToBeOption('<=')
expectMinValueToBeValue('49500')
Expand All @@ -148,7 +152,8 @@ describe('limit values', () => {
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>=')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('49500')
Expand All @@ -164,7 +169,8 @@ describe('limit values', () => {
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>=')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('49500')
Expand All @@ -189,7 +195,8 @@ describe('limit values', () => {
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>')
expectMaxOperatorToBeOption('<=')
expectMinValueToBeValue('')
Expand All @@ -205,7 +212,8 @@ describe('limit values', () => {
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('>')
expectMaxOperatorToBeOption('<=')
expectMinValueToBeValue('')
Expand All @@ -230,7 +238,8 @@ describe('limit values', () => {
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('=')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('49500')
Expand All @@ -246,7 +255,8 @@ describe('limit values', () => {
)

// verify options are present when reopening modal
openOptionsModal(OPTIONS_TAB_LIMIT_VALUES)
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LIMIT_VALUES)
expectMinOperatorToBeOption('=')
expectMaxOperatorToBeOption('<')
expectMinValueToBeValue('49500')
Expand Down

0 comments on commit 14baf10

Please sign in to comment.