-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from hemit-s/tests
Cucumber Tests
- Loading branch information
Showing
31 changed files
with
1,295 additions
and
159 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* @jest-environment node | ||
*/ | ||
// This is necessary so that jest and regedit works correctly in the test environment | ||
// Specifically, functions getRandomValues and setImmediate become well defined. | ||
|
||
import { loadFeature, defineFeature } from 'jest-cucumber'; | ||
import { | ||
Driver, | ||
startChromeDriver, | ||
stopChromeDriver, | ||
} from '__tests__/utils/webdriver'; | ||
import { givenAquaIsRunning, givenEnabledState } from './shared_steps/aqua'; | ||
import { givenBandCount, whenChangeBandCount } from './shared_steps/aquaSlider'; | ||
import { thenBandCount } from './shared_steps/config'; | ||
import { | ||
givenCanWriteToAquaConfig, | ||
givenEqualizerApoIsInstalled, | ||
} from './shared_steps/equalizerApo'; | ||
|
||
const chromeDriver = startChromeDriver(); | ||
|
||
const feature = loadFeature( | ||
'./src/__tests__/cucumber_tests/features/change_number_of_bands.feature' | ||
); | ||
const webdriver: { driver: Driver } = { driver: undefined }; | ||
|
||
defineFeature(feature, (test) => { | ||
test('Add a frequency band', async ({ given, when, then }) => { | ||
givenEqualizerApoIsInstalled(given); | ||
givenCanWriteToAquaConfig(given); | ||
givenAquaIsRunning(given, webdriver, chromeDriver); | ||
givenEnabledState(given, webdriver); | ||
givenBandCount(given, webdriver); | ||
|
||
whenChangeBandCount(when, webdriver); | ||
thenBandCount(then); | ||
}, 30000); | ||
|
||
test('Remove a frequency band', async ({ given, when, then }) => { | ||
givenEqualizerApoIsInstalled(given); | ||
givenCanWriteToAquaConfig(given); | ||
givenAquaIsRunning(given, webdriver, chromeDriver); | ||
givenEnabledState(given, webdriver); | ||
givenBandCount(given, webdriver); | ||
|
||
whenChangeBandCount(when, webdriver); | ||
thenBandCount(then); | ||
}, 30000); | ||
}); | ||
|
||
afterAll(() => { | ||
if (webdriver.driver) { | ||
webdriver.driver.deleteSession(); | ||
} | ||
stopChromeDriver(chromeDriver); | ||
}); |
20 changes: 20 additions & 0 deletions
20
src/__tests__/cucumber_tests/features/change_number_of_bands.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Feature: Change number of frequency bands | ||
Users want to increase or decrease the number of frequency bands | ||
|
||
Scenario: Add a frequency band | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And Aqua equalizer state is enabled | ||
And there are 10 frequency bands | ||
When I click to add a frequency band | ||
Then Aqua config file should show 11 frequency bands | ||
|
||
Scenario: Remove a frequency band | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And Aqua equalizer state is enabled | ||
And there are 10 frequency bands | ||
When I click to remove a frequency band | ||
Then Aqua config file should show 9 frequency bands |
19 changes: 19 additions & 0 deletions
19
src/__tests__/cucumber_tests/features/set_band_frequency.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: Set frequency for a band | ||
Users want to change the frequency that a band represents | ||
|
||
Scenario: Set a new frequency using the input field | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And Aqua equalizer state is enabled | ||
When I set the frequency of band 1 to 100Hz | ||
Then Aqua config file should show a frequency of 100Hz for band 1 | ||
|
||
Scenario: Set a new frequency using the arrow buttons | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And the frequency of band 1 is 32Hz | ||
And Aqua equalizer state is enabled | ||
When I click on the up arrow of band 1 2 times | ||
Then Aqua config file should show a frequency of 34Hz for band 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/__tests__/cucumber_tests/features/set_band_quality.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: Set quality of a frequency band | ||
Users want to change the quality that is applied to a certain frequency | ||
|
||
Scenario: Select a new quality using the input field | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And Aqua equalizer state is enabled | ||
When I set the quality to 1.41 for the band with frequency 125Hz | ||
Then Aqua config file should show a quality of 1.41 for the band with frequency 125Hz | ||
|
||
Scenario: Select a new quality using the arrow buttons | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And the quality for the band with frequency 125Hz is 0.5 | ||
And Aqua equalizer state is enabled | ||
When I click on the up arrow for the quality for frequency 125Hz 2 times | ||
Then Aqua config file should show a quality of 0.502 for the band with frequency 125Hz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Feature: Set whether the equalizer is enabled or disabled | ||
Users want to toggle whether the equalizer is enabled or disabled | ||
|
||
Scenario: Enable the equalizer | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And Aqua equalizer state is disabled | ||
When I toggle the equalizer state | ||
Then Aqua config file should be non-empty | ||
|
||
Scenario: Disable the equalizer | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And Aqua equalizer state is enabled | ||
When I toggle the equalizer state | ||
Then Aqua config file should be empty |
11 changes: 11 additions & 0 deletions
11
src/__tests__/cucumber_tests/features/set_filter_type.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Feature: Set filter type of a frequency band | ||
Users want to change the type of filter that is applied to a certain frequency | ||
|
||
Scenario: Select a new filter type using a mouse | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And the filter type is LPQ filter for the band with frequency 125Hz | ||
And Aqua equalizer state is enabled | ||
When I set the filter type to PK filter for the band with frequency 125Hz | ||
Then Aqua config file should show the PK filter type for the band with frequency 125Hz |
19 changes: 19 additions & 0 deletions
19
src/__tests__/cucumber_tests/features/set_preamp_gain.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Feature: Set preamplification gain | ||
Users want to change the preamplification gain | ||
|
||
Scenario: Set preamp gain using the slider | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And Aqua equalizer state is enabled | ||
When I set gain of the preamp slider to the bottom | ||
Then Aqua config should show a preamp gain of -30dB | ||
|
||
Scenario: Set preamp gain using the arrows | ||
Given EqualizerAPO is installed | ||
And Aqua can write to Aqua config | ||
And Aqua is running | ||
And the preamp gain is 0dB | ||
And Aqua equalizer state is enabled | ||
When I click on the up arrow for the preamp gain 3 times | ||
Then Aqua config should show a preamp gain of 3dB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* @jest-environment node | ||
*/ | ||
// This is necessary so that jest and regedit works correctly in the test environment | ||
// Specifically, functions getRandomValues and setImmediate become well defined. | ||
|
||
import { loadFeature, defineFeature } from 'jest-cucumber'; | ||
import { | ||
Driver, | ||
startChromeDriver, | ||
stopChromeDriver, | ||
} from '__tests__/utils/webdriver'; | ||
import { givenAquaIsRunning, givenEnabledState } from './shared_steps/aqua'; | ||
import { | ||
givenBandFrequency, | ||
whenSetBandFrequency, | ||
whenSetBandFrequencyUsingArrows, | ||
} from './shared_steps/aquaSlider'; | ||
import { thenBandFrequency } from './shared_steps/config'; | ||
import { | ||
givenCanWriteToAquaConfig, | ||
givenEqualizerApoIsInstalled, | ||
} from './shared_steps/equalizerApo'; | ||
|
||
const chromeDriver = startChromeDriver(); | ||
|
||
const feature = loadFeature( | ||
'./src/__tests__/cucumber_tests/features/set_band_frequency.feature' | ||
); | ||
const webdriver: { driver: Driver } = { driver: undefined }; | ||
|
||
defineFeature(feature, (test) => { | ||
test('Set a new frequency using the input field', async ({ | ||
given, | ||
when, | ||
then, | ||
}) => { | ||
givenEqualizerApoIsInstalled(given); | ||
givenCanWriteToAquaConfig(given); | ||
givenAquaIsRunning(given, webdriver, chromeDriver); | ||
givenEnabledState(given, webdriver); | ||
|
||
whenSetBandFrequency(when, webdriver); | ||
thenBandFrequency(then); | ||
}, 30000); | ||
|
||
test('Set a new frequency using the arrow buttons', async ({ | ||
given, | ||
when, | ||
then, | ||
}) => { | ||
givenEqualizerApoIsInstalled(given); | ||
givenCanWriteToAquaConfig(given); | ||
givenAquaIsRunning(given, webdriver, chromeDriver); | ||
givenBandFrequency(given, webdriver); | ||
givenEnabledState(given, webdriver); | ||
|
||
whenSetBandFrequencyUsingArrows(when, webdriver); | ||
thenBandFrequency(then); | ||
}, 30000); | ||
}); | ||
|
||
afterAll(() => { | ||
if (webdriver.driver) { | ||
webdriver.driver.deleteSession(); | ||
} | ||
stopChromeDriver(chromeDriver); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.