Skip to content

Commit

Permalink
enable protractor export test (hyperledger-archives#1923)
Browse files Browse the repository at this point in the history
  • Loading branch information
nklincoln authored and Simon Stone committed Aug 19, 2017
1 parent 852eab6 commit f31329d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 33 deletions.
10 changes: 7 additions & 3 deletions packages/composer-playground/e2e/component/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export class Editor {
return OperationsHelper.click(element(by.id('editor_import')));
}

// RETRIEVE ACTIONS
// Wait for editor files to load
static waitForProjectFilesToLoad() {
return OperationsHelper.retriveMatchingElementsByCSS('.side-bar-nav', '.flex-container', 0);
}

// Retrieve Editor Side Navigation FileNames
static retrieveNavigatorFileNames() {
// Due to scroll bar, need to scroll element into view in order to inspect text
Expand All @@ -54,9 +58,9 @@ export class Editor {
return OperationsHelper.retriveMatchingElementsByCSS('.side-bar-nav', '.flex-container', 0);
}

// Retrieve Editor Deployed Package Name, visible only when readme is selected
// Retrieve Editor Deployed Package Name from navlogo section
static retrieveDeployedPackageName() {
return OperationsHelper.retriveTextFromElement(element(by.id('editor_deployedPackageName')));
return OperationsHelper.retriveTextFromElement(element(by.id('network-name')));
}

// Retrieve current 'active' file from navigator
Expand Down
59 changes: 30 additions & 29 deletions packages/composer-playground/e2e/specs/editor-define.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,37 @@ describe('Editor Define', (() => {

describe('Export BND button', (() => {

xit('should export BNA named as the package name', (() => {

Editor.retrieveDeployedPackageName()
.then((packageName) => {
let filename = './e2e/downloads/' + packageName + '.bna';
if (fs.existsSync(filename)) {
// Make sure the browser doesn't have to rename the download.
fs.unlinkSync(filename);
}
return filename;
})
.then((filename) => {
Editor.clickExportBND();
return waitForFileToExist(filename)
.then(() => { return retrieveZipContentList(filename); });
})
.then((contents) => {
// -should have known contents
let expectedContents = [ 'package.json',
'README.md',
'permissions.acl',
'models/',
'models/sample.cto',
'lib/',
'lib/sample.js' ];
expect(contents).to.be.an('array').lengthOf(7);
expect(contents).to.deep.equal(expectedContents);
});
it('should export BNA named as the package name', (() => {
Editor.waitForProjectFilesToLoad();

Editor.retrieveDeployedPackageName()
.then((packageName) => {
let filename = './e2e/downloads/' + packageName + '.bna';
if (fs.existsSync(filename)) {
// Make sure the browser doesn't have to rename the download.
fs.unlinkSync(filename);
}
return filename;
})
.then((filename) => {
Editor.clickExportBND();
return waitForFileToExist(filename)
.then(() => { return retrieveZipContentList(filename); });
})
.then((contents) => {
// -should have known contents
let expectedContents = [ 'package.json',
'README.md',
'permissions.acl',
'models/',
'models/sample.cto',
'lib/',
'lib/sample.js' ];
expect(contents).to.be.an('array').lengthOf(7);
expect(contents).to.deep.equal(expectedContents);
});
}));
}));
}));

describe('Import BND button', (() => {

Expand Down
2 changes: 1 addition & 1 deletion packages/composer-playground/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<nav class="indexnav">
<div class="navcontent">
<div class="navlogo">
<p><b>{{ composerBanner[0] }}</b> {{ composerBanner[1] }}</p>
<p><b>{{ composerBanner[0] }}</b></p>&nbsp;<p id="network-name">{{ composerBanner[1] }}</p>
<div class="tooltiptext">{{ composerBanner[0] }} {{ composerBanner[1] }}</div>
</div>
<div class="navmain" [ngClass]="{'rightonly' : !showHeaderLinks && !usingLocally }">
Expand Down

0 comments on commit f31329d

Please sign in to comment.