Skip to content
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

e2e: Increase S4L startup time #3575

Merged
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
7 changes: 2 additions & 5 deletions tests/e2e/tutorials/isolve-gpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const templateName = "isolve-gpu";

async function runTutorial() {
const tutorial = new tutorialBase.TutorialBase(url, templateName, user, pass, newUser, enableDemoMode);
let studyId
let studyId;
try {
await tutorial.start();
const studyData = await tutorial.openTemplate(1000);
Expand All @@ -42,10 +42,7 @@ async function runTutorial() {
console.log('Tutorial error: ' + err);
}
finally {
await tutorial.toDashboard()
await tutorial.removeStudy(studyId);
await tutorial.logOut();
await tutorial.close();
await tutorial.leave(studyId);
}

if (tutorial.getTutorialFailed()) {
Expand Down
7 changes: 2 additions & 5 deletions tests/e2e/tutorials/isolve-mpi.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const templateName = "isolve-mpi";

async function runTutorial() {
const tutorial = new tutorialBase.TutorialBase(url, templateName, user, pass, newUser, enableDemoMode);
let studyId
let studyId;
try {
await tutorial.start();
const studyData = await tutorial.openTemplate(1000);
Expand Down Expand Up @@ -50,10 +50,7 @@ async function runTutorial() {
console.log('Tutorial error: ' + err);
}
finally {
await tutorial.toDashboard()
await tutorial.removeStudy(studyId);
await tutorial.logOut();
await tutorial.close();
await tutorial.leave(studyId);
}

if (tutorial.getTutorialFailed()) {
Expand Down
7 changes: 2 additions & 5 deletions tests/e2e/tutorials/jupyterlabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const templateName = "JupyterLabs";

async function runTutorial() {
const tutorial = new tutorialBase.TutorialBase(url, templateName, user, pass, newUser, enableDemoMode);
let studyId
let studyId;
try {
await tutorial.start();
const studyData = await tutorial.openTemplate(1000);
Expand Down Expand Up @@ -80,10 +80,7 @@ async function runTutorial() {
console.log('Tutorial error: ' + err);
}
finally {
await tutorial.toDashboard()
await tutorial.removeStudy(studyId);
await tutorial.logOut();
await tutorial.close();
await tutorial.leave(studyId);
}

if (tutorial.getTutorialFailed()) {
Expand Down
7 changes: 2 additions & 5 deletions tests/e2e/tutorials/mattward.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const templateName = "Mattward";

async function runTutorial() {
const tutorial = new tutorialBase.TutorialBase(url, templateName, user, pass, newUser, enableDemoMode);
let studyId
let studyId;
try {
await tutorial.start();
const studyData = await tutorial.openTemplate(1000);
Expand Down Expand Up @@ -48,10 +48,7 @@ async function runTutorial() {
console.log('Tutorial error: ' + err);
}
finally {
await tutorial.toDashboard()
await tutorial.removeStudy(studyId);
await tutorial.logOut();
await tutorial.close();
await tutorial.leave(studyId);
}

if (tutorial.getTutorialFailed()) {
Expand Down
25 changes: 3 additions & 22 deletions tests/e2e/tutorials/sim4life-light.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// node ti-plan.js [url] [user] [password] [timeout] [--demo]
// node sim4life-light.js [url] [user] [password] [timeout] [--demo]

const utils = require('../utils/utils');
const tutorialBase = require('./tutorialBase');
Expand Down Expand Up @@ -44,34 +44,15 @@ async function runTutorial() {
false
);

await tutorial.waitFor(15000, 'Wait for some time');

// do some basic interaction
const s4lIframe = await tutorial.getIframe(s4lNodeId);
const modelTree = await s4lIframe.$('.model-tree');
const modelItems = await modelTree.$$('.MuiTreeItem-label');
const nLabels = modelItems.length;
if (nLabels > 1) {
modelItems[0].click();
await tutorial.waitFor(2000, 'Model clicked');
await tutorial.takeScreenshot('ModelClicked');
modelItems[1].click();
await tutorial.waitFor(2000, 'Grid clicked');
await tutorial.takeScreenshot('GridlClicked');
}
await tutorial.testS4L(s4lNodeId);
}
catch (err) {
tutorial.setTutorialFailed(true);
console.log('Tutorial error: ' + err);
throw "Tutorial Failed";
}
finally {
if (studyId) {
await tutorial.toDashboard()
await tutorial.removeStudy(studyId);
}
await tutorial.logOut();
await tutorial.close();
await tutorial.leave(studyId);
}

if (tutorial.getTutorialFailed()) {
Expand Down
29 changes: 6 additions & 23 deletions tests/e2e/tutorials/sim4life.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// node sim4life.js [url] [user] [password] [--demo]
// node sim4life.js [url] [user] [password] [timeout] [--demo]

const utils = require('../utils/utils');
const tutorialBase = require('./tutorialBase');
Expand All @@ -15,13 +15,13 @@ const {

const serviceName = "sim4life-dy";


async function runTutorial() {
const tutorial = new tutorialBase.TutorialBase(url, serviceName, user, pass, newUser, enableDemoMode);
let studyId

let studyId;
try {
await tutorial.start();

// start sim4life-dy service
const studyData = await tutorial.openService(1000);
studyId = studyData["data"]["uuid"];

Expand All @@ -35,31 +35,14 @@ async function runTutorial() {
false
);

await tutorial.waitFor(15000, 'Wait for some time');

// do some basic interaction
const s4lIframe = await tutorial.getIframe(s4lNodeId);
const modelTree = await s4lIframe.$('.model-tree');
const modelItems = await modelTree.$$('.MuiTreeItem-label');
const nLabels = modelItems.length;
if (nLabels > 1) {
modelItems[0].click();
await tutorial.waitFor(2000, 'Model clicked');
await tutorial.takeScreenshot('ModelClicked');
modelItems[1].click();
await tutorial.waitFor(2000, 'Grid clicked');
await tutorial.takeScreenshot('GridlClicked');
}
await tutorial.testS4L(s4lNodeId);
}
catch (err) {
await tutorial.setTutorialFailed(true);
console.log('Tutorial error: ' + err);
}
finally {
await tutorial.toDashboard()
await tutorial.removeStudy(studyId);
await tutorial.logOut();
await tutorial.close();
await tutorial.leave(studyId);
}

if (tutorial.getTutorialFailed()) {
Expand Down
7 changes: 2 additions & 5 deletions tests/e2e/tutorials/sleepers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const templateName = "Sleepers";

async function runTutorial() {
const tutorial = new tutorialBase.TutorialBase(url, templateName, user, pass, newUser, enableDemoMode);
let studyId
let studyId;
try {
await tutorial.start();
const studyData = await tutorial.openTemplate(1000);
Expand All @@ -39,10 +39,7 @@ async function runTutorial() {
console.log('Tutorial error: ' + err);
}
finally {
await tutorial.toDashboard()
await tutorial.removeStudy(studyId);
await tutorial.logOut();
await tutorial.close();
await tutorial.leave(studyId);
}

if (tutorial.getTutorialFailed()) {
Expand Down
7 changes: 1 addition & 6 deletions tests/e2e/tutorials/ti-plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,7 @@ async function runTutorial() {
throw "Tutorial Failed";
}
finally {
if (studyId) {
await tutorial.toDashboard()
await tutorial.removeStudy(studyId, 20000);
}
await tutorial.logOut();
await tutorial.close();
await tutorial.leave(studyId);
}

if (tutorial.getTutorialFailed()) {
Expand Down
43 changes: 28 additions & 15 deletions tests/e2e/tutorials/tutorialBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,15 @@ class TutorialBase {
}
}

async leave(studyId) {
if (studyId) {
await this.toDashboard()
await this.removeStudy(studyId);
}
await this.logOut();
await this.close();
}

async toDashboard() {
await this.takeScreenshot("toDashboard_before");
this.__responsesQueue.addResponseListener("projects");
Expand All @@ -548,20 +557,6 @@ class TutorialBase {
await this.takeScreenshot("toDashboard_after");
}

async closeStudy() {
await this.takeScreenshot("closeStudy_before");
this.__responsesQueue.addResponseListener(":close");
try {
await auto.toDashboard(this.__page);
await this.__responsesQueue.waitUntilResponse(":close");
}
catch (err) {
console.error("Failed closing study", err);
throw (err);
}
await this.takeScreenshot("closeStudy_after");
}

async removeStudy(studyId, waitFor = 5000) {
await this.waitFor(waitFor, 'Wait to be unlocked');
await this.takeScreenshot("deleteFirstStudy_before");
Expand All @@ -572,7 +567,7 @@ class TutorialBase {
for (i = 0; i < nTries; i++) {
const cardUnlocked = await auto.deleteFirstStudy(this.__page, this.__templateName);
if (cardUnlocked) {
console.log("Study Card unlocked in " + (waitFor + intervalWait*i) + "s");
console.log("Study Card unlocked in " + ((waitFor + intervalWait*i)/1000) + "s");
break;
}
console.log(studyId, "study card still locked");
Expand Down Expand Up @@ -607,6 +602,24 @@ class TutorialBase {
await this.takeScreenshot('waitFor_finished')
}

async testS4L(s4lNodeId) {
await this.waitFor(20000, 'Wait for the splash screen to disappear');

// do some basic interaction
const s4lIframe = await this.getIframe(s4lNodeId);
const modelTree = await s4lIframe.$('.model-tree');
const modelItems = await modelTree.$$('.MuiTreeItem-label');
const nLabels = modelItems.length;
if (nLabels > 1) {
modelItems[0].click();
await this.waitFor(2000, 'Model clicked');
await this.takeScreenshot('ModelClicked');
modelItems[1].click();
await this.waitFor(2000, 'Grid clicked');
await this.takeScreenshot('GridlClicked');
}
}

async takeScreenshot(screenshotTitle) {
// Generates an URL that points to the backend logs at this time
const snapshotUrl = utils.getGrayLogSnapshotUrl(this.__url, 30);
Expand Down