Skip to content

Commit

Permalink
udpate: add test for python run
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Nov 18, 2023
1 parent 4b24b26 commit 71ab7b9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: User can open Python Transformation dialog, change python code and run
Then I see PythonTransformationDialog

# Change code
When I set input with the following data:
When I set code input with the following data:
"""
print('Hello Matera!')
"""
Expand All @@ -18,12 +18,15 @@ Feature: User can open Python Transformation dialog, change python code and run

# Code persists
When I open PythonTransformationDialog
Then I see input with the following data:
Then I see code input with the following data:
"""
print('Hello Matera!')
"""

# Run
When I click the Run button
Then I see code output "Hello world"
Then I see code output with the following data:
"""
Hello Matera!
"""

2 changes: 1 addition & 1 deletion tests/cucumber/support/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const SELECTORS = {
wrapper: "#python-transformation-dialog",
dialog: 'div[role="dialog"]',
codeInput: "python-code-input",
pythonOutput: '[data-tid="python-output"]',
pythonOutput: "python-output",
runButton: `button#python-transformation-dialog-run-button`,
submitButton: `button#python-transformation-dialog-submit-button`,
cancelButton: `button#python-transformation-dialog-cancel-button`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SELECTORS } from "../selectors";
import { materialDesignerPage } from "../widgets/material_designer_page";

export default function () {
this.Then(/^I see input with the following data:$/, (docString) => {
this.Then(/^I see code input with the following data:$/, (docString) => {
const { pythonTransformationDialog } = materialDesignerPage.designerWidget;
const editorId = SELECTORS.headerMenu.pythonTransformationDialog.codeInput;
const content = pythonTransformationDialog.getCodeMirrorContent(editorId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import expect from "expect";

import { SELECTORS } from "../selectors";
import { materialDesignerPage } from "../widgets/material_designer_page";

export default function () {
this.Then(/^I see code output with the following data:$/, (docString) => {
const { pythonTransformationDialog } = materialDesignerPage.designerWidget;
const editorId = SELECTORS.headerMenu.pythonTransformationDialog.pythonOutput;
const content = pythonTransformationDialog.getCodeMirrorContent(editorId);
console.log("X:", content);
console.log("X:", docString);
expect(content.trim()).toEqual(docString);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SELECTORS } from "../selectors";
import { materialDesignerPage } from "../widgets/material_designer_page";

export default function () {
this.When(/^I set input with the following data:$/, (docString) => {
this.When(/^I set code input with the following data:$/, (docString) => {
const { pythonTransformationDialog } = materialDesignerPage.designerWidget;
const editorId = SELECTORS.headerMenu.pythonTransformationDialog.codeInput;
pythonTransformationDialog.setCodeMirrorContent(editorId, docString);
Expand Down

0 comments on commit 71ab7b9

Please sign in to comment.