-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add step definitions for reset-clone-undo-redo
- Loading branch information
1 parent
154d274
commit 8becff1
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...ber/support/step_definitions/Then material with following data does not exist in state.js
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 @@ | ||
import path from "path"; | ||
|
||
import {parseTable} from "../utils/table"; | ||
import {readFileSync} from "../utils/file"; | ||
import {retry, shallowDeepAlmostEqual} from "../utils"; | ||
|
||
export default function () { | ||
this.Then(/^material with following data does not exist in state$/, function (table) { | ||
const config = parseTable(table, this)[0]; | ||
const material = JSON.parse(readFileSync(path.resolve(__dirname, "../../fixtures", config.path))); | ||
retry(() => { | ||
const materials = exabrowser.execute(() => { | ||
return window.MDContainer.store.getState().present.materials.map(m => m.toJSON()); | ||
}).value; | ||
shallowDeepAlmostEqual(undefined, materials[config.index - 1]); | ||
}, {retries: 5}); | ||
}); | ||
}; |
10 changes: 10 additions & 0 deletions
10
tests/cucumber/support/step_definitions/When I select # option from the Edit menu.js
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,10 @@ | ||
import {materialDesignerPage} from "../widgets/material_designer_page"; | ||
|
||
export default function () { | ||
this.Then(/^I select "([^"]*)" option from the Edit menu$/, function (actionString) { | ||
const map = {"undo": 1, "redo": 2, "reset": 3}; | ||
const index = map[actionString]; | ||
if (!index) throw new Error("I click # action from the Edit menu - index is undefined"); | ||
materialDesignerPage.designerWidget.clickUndoRedoReset(index); | ||
}); | ||
}; |
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