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 #209 from Exabyte-io/feature/SOF-7326-1
Feature/SOF-7326-1 feat: cleaned version of adding a test for JL
- Loading branch information
Showing
23 changed files
with
491 additions
and
7 deletions.
There are no files selected for viewing
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
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
60 changes: 60 additions & 0 deletions
60
tests/cypress/e2e/menu/advanced/jupyterlite-transformation-dialog.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,60 @@ | ||
Feature: User can open JupyterLite Transformation dialog and create an interface with a jupyter notebook | ||
|
||
Scenario: | ||
When I open materials designer page | ||
Then I see material designer page | ||
|
||
# Open | ||
When I open JupyterLite Transformation dialog | ||
Then I see JupyterLite Transformation dialog | ||
And I see file "Introduction.ipynb" opened | ||
|
||
# Open notebook | ||
When I click on "1.1. Interface creation with Zur and McGill Superlattice (ZSL) algorithm" link | ||
Then I see file "create_interface_with_min_strain_zsl.ipynb" opened | ||
|
||
|
||
# Change code | ||
When I set code in the cell "3" to: | ||
""" | ||
SUBSTRATE_PARAMETERS = { | ||
"MATERIAL_INDEX": 0, | ||
"MILLER_INDICES": (1, 1, 1), | ||
"THICKNESS": 1, | ||
} | ||
LAYER_PARAMETERS = { | ||
"MATERIAL_INDEX": 0, | ||
"MILLER_INDICES": (1, 1, 1), | ||
"THICKNESS": 1, | ||
} | ||
USE_CONVENTIONAL_CELL = True | ||
""" | ||
|
||
When I set code in the cell "5" to: | ||
""" | ||
INTERFACE_PARAMETERS = { | ||
"DISTANCE_Z": 3.0, # in Angstroms | ||
"MAX_AREA": 50, # in Angstroms^2 | ||
} | ||
""" | ||
Then I see code in the cell "5" is: | ||
""" | ||
INTERFACE_PARAMETERS = { | ||
"DISTANCE_Z": 3.0, # in Angstroms | ||
"MAX_AREA": 50, # in Angstroms^2 | ||
} | ||
""" | ||
|
||
# Run | ||
And I Run All Cells | ||
And I see kernel status is Idle | ||
And I submit materials | ||
Then material with following data exists in state | ||
| path | index | | ||
| si-interface.json | $INT{2} | | ||
|
||
|
||
# Reset the materials list | ||
And I delete materials with index "2" |
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,117 @@ | ||
{ | ||
"name": "Si4", | ||
"basis": { | ||
"elements": [ | ||
{ | ||
"id": 0, | ||
"value": "Si" | ||
}, | ||
{ | ||
"id": 1, | ||
"value": "Si" | ||
}, | ||
{ | ||
"id": 2, | ||
"value": "Si" | ||
}, | ||
{ | ||
"id": 3, | ||
"value": "Si" | ||
} | ||
], | ||
"coordinates": [ | ||
{ | ||
"id": 0, | ||
"value": [ | ||
0.8333333, | ||
0.5833333, | ||
0.03211513 | ||
] | ||
}, | ||
{ | ||
"id": 1, | ||
"value": [ | ||
0.5, | ||
0.25, | ||
0 | ||
] | ||
}, | ||
{ | ||
"id": 2, | ||
"value": [ | ||
0.8333333, | ||
0.5833333, | ||
0.1541721 | ||
] | ||
}, | ||
{ | ||
"id": 3, | ||
"value": [ | ||
0.5, | ||
0.25, | ||
0.1862872 | ||
] | ||
} | ||
], | ||
"units": "crystal", | ||
"cell": [ | ||
[ | ||
3.867, | ||
0, | ||
0 | ||
], | ||
[ | ||
1.9335, | ||
3.34892, | ||
0 | ||
], | ||
[ | ||
0, | ||
0, | ||
24.5787 | ||
] | ||
], | ||
"constraints": [] | ||
}, | ||
"lattice": { | ||
"a": 3.867, | ||
"b": 3.867, | ||
"c": 24.5787, | ||
"alpha": 90, | ||
"beta": 90, | ||
"gamma": 60, | ||
"units": { | ||
"length": "angstrom", | ||
"angle": "degree" | ||
}, | ||
"type": "TRI", | ||
"vectors": { | ||
"a": [ | ||
3.867, | ||
0, | ||
0 | ||
], | ||
"b": [ | ||
1.9335, | ||
3.34892, | ||
0 | ||
], | ||
"c": [ | ||
0, | ||
0, | ||
24.5787 | ||
], | ||
"alat": 1, | ||
"units": "angstrom" | ||
} | ||
}, | ||
"isNonPeriodic": false, | ||
"_id": "", | ||
"metadata": { | ||
"boundaryConditions": { | ||
"type": "pbc", | ||
"offset": 0 | ||
} | ||
}, | ||
"isUpdated": true | ||
} |
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
10 changes: 10 additions & 0 deletions
10
tests/cypress/support/step_definitions/jupyterlite/I Run All Cells.ts
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 { When } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
import MaterialDesignerPage from "../../widgets/MaterialDesignerPage"; | ||
|
||
When("I Run All Cells", () => { | ||
const { jupyterLiteSession } = new MaterialDesignerPage().designerWidget; | ||
jupyterLiteSession.waitForKernelIdleWithRestart(); | ||
jupyterLiteSession.clickMenu("Run", "Run All Cells"); | ||
jupyterLiteSession.isKernelBusy(); | ||
}); |
9 changes: 9 additions & 0 deletions
9
tests/cypress/support/step_definitions/jupyterlite/I click on link.ts
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,9 @@ | ||
import { When } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
import MaterialDesignerPage from "../../widgets/MaterialDesignerPage"; | ||
|
||
When("I click on {string} link", (link: string) => { | ||
new MaterialDesignerPage().designerWidget.jupyterLiteSession.clickLinkInNotebookByItsTextContent( | ||
link, | ||
); | ||
}); |
10 changes: 10 additions & 0 deletions
10
.../cypress/support/step_definitions/jupyterlite/I open JupyterLite Transformation dialog.ts
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 { When } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
import MaterialDesignerPage from "../../widgets/MaterialDesignerPage"; | ||
|
||
When("I open JupyterLite Transformation dialog", () => { | ||
new MaterialDesignerPage().designerWidget.headerMenu.selectMenuItemByNameAndItemNumber( | ||
"Advanced", | ||
7, | ||
); | ||
}); |
7 changes: 7 additions & 0 deletions
7
...s/cypress/support/step_definitions/jupyterlite/I see JupyterLite Transformation dialog.ts
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,7 @@ | ||
import { When } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
import MaterialDesignerPage from "../../widgets/MaterialDesignerPage"; | ||
|
||
When("I see JupyterLite Transformation dialog", () => { | ||
new MaterialDesignerPage().designerWidget.jupyterLiteTransformationDialog.waitForVisible(); | ||
}); |
15 changes: 15 additions & 0 deletions
15
tests/cypress/support/step_definitions/jupyterlite/I see code in the cell is.ts
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,15 @@ | ||
import { When } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
import MaterialDesignerPage from "../../widgets/MaterialDesignerPage"; | ||
|
||
function normalizeText(code: string) { | ||
return code.replace(/\s/g, ""); | ||
} | ||
|
||
When("I see code in the cell {string} is:", (index: string, code: string) => { | ||
new MaterialDesignerPage().designerWidget.jupyterLiteSession | ||
.getCodeFromCell(parseInt(index, 10)) | ||
.then((cellCode) => { | ||
expect(normalizeText(cellCode)).to.equal(normalizeText(code)); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
tests/cypress/support/step_definitions/jupyterlite/I see file opened.ts
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,9 @@ | ||
import { When } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
import MaterialDesignerPage from "../../widgets/MaterialDesignerPage"; | ||
|
||
When("I see file {string} opened", (filename: string) => { | ||
const { jupyterLiteSession } = new MaterialDesignerPage().designerWidget; | ||
jupyterLiteSession.waitForVisible(); | ||
jupyterLiteSession.checkFileOpened(filename); | ||
}); |
8 changes: 8 additions & 0 deletions
8
tests/cypress/support/step_definitions/jupyterlite/I see kernel status is.ts
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,8 @@ | ||
import { When } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
import MaterialDesignerPage from "../../widgets/MaterialDesignerPage"; | ||
|
||
When("I see kernel status is Idle", () => { | ||
const { jupyterLiteSession } = new MaterialDesignerPage().designerWidget; | ||
return jupyterLiteSession.isKernelIdle(); | ||
}); |
10 changes: 10 additions & 0 deletions
10
tests/cypress/support/step_definitions/jupyterlite/I set code in the cell to.ts
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 { When } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
import MaterialDesignerPage from "../../widgets/MaterialDesignerPage"; | ||
|
||
When("I set code in the cell {string} to:", (index: string, code: string) => { | ||
new MaterialDesignerPage().designerWidget.jupyterLiteSession.setCodeInCell( | ||
parseInt(index, 10), | ||
code, | ||
); | ||
}); |
9 changes: 9 additions & 0 deletions
9
tests/cypress/support/step_definitions/jupyterlite/I submit materials.ts
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,9 @@ | ||
import { When } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
import MaterialDesignerPage from "../../widgets/MaterialDesignerPage"; | ||
|
||
When("I submit materials", () => { | ||
const { jupyterLiteTransformationDialog } = new MaterialDesignerPage().designerWidget; | ||
jupyterLiteTransformationDialog.verifyMaterialsOut(1); | ||
jupyterLiteTransformationDialog.submit(); | ||
}); |
Oops, something went wrong.