-
Notifications
You must be signed in to change notification settings - Fork 27
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 upgrade #2352
e2e upgrade #2352
Changes from 8 commits
0d0c1aa
2e41616
b27f950
e564e4a
71dffe3
2c531bb
873a321
afc9030
d59b177
a613ef1
0a1e412
a8e7224
bc7642f
28e9b01
f0321af
e916094
e3e8ced
14f77e8
e0848b9
06e9b07
256e997
ede6329
8c67625
4413e43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,19 +16,18 @@ const templateName = "Mattward"; | |
|
||
async function runTutorial() { | ||
const tutorial = new tutorialBase.TutorialBase(url, templateName, user, pass, newUser, enableDemoMode); | ||
|
||
let studyId | ||
try { | ||
tutorial.startScreenshooter(); | ||
await tutorial.start(); | ||
const studyData = await tutorial.openTemplate(1000); | ||
const studyId = studyData["data"]["uuid"]; | ||
studyId = studyData["data"]["uuid"]; | ||
console.log("Study ID:", studyId); | ||
|
||
const workbenchData = utils.extractWorkbenchData(studyData["data"]); | ||
await tutorial.waitForServices(workbenchData["studyId"], [workbenchData["nodeIds"][0]]); | ||
|
||
// Wait for the output files to be pushed | ||
await tutorial.waitFor(30000); | ||
await tutorial.waitFor(30000, 'Wait for the output files to be pushed'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice, probably then we can remove the duplicated comments. |
||
|
||
// This study opens in fullscreen mode | ||
await tutorial.restoreIFrame(); | ||
|
@@ -42,19 +41,18 @@ async function runTutorial() { | |
"t_plot.csv", | ||
"tst_plot.csv" | ||
]; | ||
await tutorial.checkNodeResults(0, outFiles); | ||
|
||
await tutorial.toDashboard(); | ||
|
||
await tutorial.removeStudy(studyId); | ||
await tutorial.openNodeFiles(0) | ||
await tutorial.checkResults2(outFiles); | ||
} | ||
catch(err) { | ||
tutorial.setTutorialFailed(true); | ||
console.log('Tutorial error: ' + err); | ||
} | ||
finally { | ||
await tutorial.toDashboard(); | ||
await tutorial.removeStudy2(studyId); | ||
await tutorial.logOut(); | ||
tutorial.stopScreenshooter(); | ||
await tutorial.close(); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,6 +332,28 @@ class TutorialBase { | |
await this.takeScreenshot("checkNodeResults_after"); | ||
} | ||
|
||
async checkResults2(fileNames) { | ||
try { | ||
await this.takeScreenshot("checkResults_before"); | ||
const files = await this.__page.$$eval('[osparc-test-id="FolderViewerItem"]', | ||
elements => elements.map(el => el.textContent.trim())); | ||
assert(files.length === fileNames.length, 'Number of files is incorrect') | ||
sanderegg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
console.log('Number of files is correct') | ||
assert( | ||
fileNames.every(fileName => files.some(file => file.includes(fileName))), | ||
'File names are incorrect' | ||
) | ||
console.log('File names are correct') | ||
} | ||
catch (err) { | ||
throw(err) | ||
} | ||
finally { | ||
await utils.waitAndClick(this.__page, '[osparc-test-id="nodeDataManagerCloseBtn"]'); | ||
await this.takeScreenshot("checkResults_after"); | ||
} | ||
} | ||
|
||
async toDashboard() { | ||
await this.takeScreenshot("toDashboard_before"); | ||
this.__responsesQueue.addResponseListener("projects"); | ||
|
@@ -383,6 +405,17 @@ class TutorialBase { | |
await this.takeScreenshot("deleteFirstStudy_after"); | ||
} | ||
|
||
async removeStudy2(studyId) { | ||
console.log(`Removing study ${studyId}`) | ||
const resp = await this.__page.evaluate(async function(studyId) { | ||
return await osparc.data.Resources.fetch('studies', 'delete', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool |
||
url: { | ||
projectId: studyId | ||
} | ||
}, studyId); | ||
}, studyId); | ||
} | ||
|
||
async logOut() { | ||
await auto.logOut(this.__page); | ||
} | ||
|
@@ -392,8 +425,10 @@ class TutorialBase { | |
await this.__browser.close(); | ||
} | ||
|
||
async waitFor(waitFor) { | ||
async waitFor(waitFor, reason) { | ||
console.log(`Waiting for ${waitFor}ms. Reason: ${reason}`) | ||
await utils.sleep(waitFor); | ||
await this.takeScreenshot('waitFor_finished') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice |
||
} | ||
|
||
async takeScreenshot(screenshotTitle) { | ||
|
@@ -403,10 +438,6 @@ class TutorialBase { | |
console.log("Backend Snapshot: ", snapshotUrl) | ||
} | ||
|
||
if (this.__demo) { | ||
return; | ||
} | ||
|
||
let title = this.__templateName; | ||
if (screenshotTitle) { | ||
title += '_' + screenshotTitle; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,12 +9,13 @@ async function getBrowser(demo) { | |
headless: false, | ||
devTools: true, | ||
defaultViewport: null, // Defaults to an 800x600 viewport. null disables the default viewport. | ||
slowMo: 80 // Slows down Puppeteer operations by the specified amount of milliseconds. | ||
slowMo: 80, // Slows down Puppeteer operations by the specified amount of milliseconds. | ||
}; | ||
Object.assign(options, visibleOptions); | ||
} | ||
else { | ||
const woSandbox = { | ||
defaultViewport: null, | ||
args: [ | ||
'--no-sandbox', | ||
'--disable-setuid-sandbox', | ||
|
@@ -82,11 +83,9 @@ function listenToEvents(page) { | |
async function getPage(browser) { | ||
const page = await browser.newPage(); | ||
page.setCacheEnabled(false); | ||
// NOTE: activate to see what happens in puppeteer evaluate function | ||
// page.on('console', consoleObj => console.log(consoleObj.text())); | ||
await page.setViewport({ | ||
width: 1920, | ||
height: 1080 | ||
width: 1680, | ||
height: 950 | ||
Comment on lines
+87
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this done? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was too big for my laptop screen to check it in demo mode |
||
}); | ||
listenToEvents(page); | ||
return page; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the purpose of
removeStudy2
. Why don't you rename it and move the call to thecatch
section? (and keep the original way toremoveStudy
)Also,
removeStudy2
doesn't need to gotoDashboard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree with @odeimaiz, then we could detect when the remove study fails and still remove the studies