Skip to content

e2e: Check number of output files #1343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tests/e2e/tutorials/mattward.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ async function runTutorial () {
await tutorial.waitFor(60000);

await tutorial.openNodeFiles(0);
await tutorial.checkResults();
const outFiles = [
"CAP_plot.csv",
"CV_plot.csv",
"Lpred_plot.csv",
"V_pred_plot.csv",
"input.csv",
"t_plot.csv",
"tst_plot.csv"
];
await tutorial.checkResults(outFiles.length);

await tutorial.removeStudy();
await tutorial.logOut();
await tutorial.close();
Expand Down
7 changes: 6 additions & 1 deletion tests/e2e/tutorials/sleepers.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ async function runTutorial () {

await tutorial.runPipeline(25000);
await tutorial.openNodeFiles(0);
await tutorial.checkResults();
const outFiles = [
"logs.zip",
"out_1"
];
await tutorial.checkResults(outFiles.length);

await tutorial.removeStudy();
await tutorial.logOut();
await tutorial.close();
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/tutorials/tutorialBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ class TutorialBase {
await utils.takeScreenshot("openNodeRetrieveAndRestart_after");
}

async checkResults() {
async checkResults(expecedNFiles = 1) {
await utils.takeScreenshot(this.__page, this.__templateName + "_checkResults_before");
try {
await auto.checkDataProducedByNode(this.__page);
await auto.checkDataProducedByNode(this.__page, expecedNFiles);
}
catch(err) {
console.error("Failed checking Data Produced By Node", err);
Expand Down
9 changes: 5 additions & 4 deletions tests/e2e/utils/auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ async function openNodeFiles(page) {
await page.click('[osparc-test-id="nodeViewFilesBtn"]')
}

async function checkDataProducedByNode(page) {
console.log("checking Data produced by Node");
async function checkDataProducedByNode(page, nFiles = 1) {
console.log("checking Data produced by Node. Expecting", nFiles, "file(s)");
const tries = 3;
let children = [];
for (let i=0; i<tries && children.length === 0; i++) {
Expand All @@ -328,8 +328,9 @@ async function checkDataProducedByNode(page) {
children = await utils.getFileTreeItemIDs(page, "NodeFiles");
console.log(i+1, 'try: ', children);
}
if (children.length < 4) { // 4 = location + study + node + file
throw("file items not found");
const nFolders = 3;
if (children.length < (nFolders+nFiles)) { // 4 = location + study + node + file
throw("Expected files not found");
}

const lastChildId = '[osparc-test-id="' + children.pop() + '"]';
Expand Down