Skip to content

Commit

Permalink
test(): fixed karma and protractor tests for terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
Izak88 committed Nov 8, 2017
1 parent 858cb14 commit 5f602b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
20 changes: 11 additions & 9 deletions e2e/080_job.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ describe('Job Details', () => {
}))
.then((): any => element(by.css('.restart-job')).click())
.then((): any => browser.wait(() => {
return element.all(by.css('.terminal .command')).count().then(cnt => cnt === 0);
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.terminal .command')).count().then(cnt => cnt === 1);
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.terminal .output')).count().then(cnt => cnt === 1);
return element(by.css('app-terminal')).isPresent().then(dis => dis);
}))
.then(() => browser.switchTo().frame( element( by.tagName( 'iframe' )).getWebElement()))
.then(() => element.all(by.css('x-row')).count())
.then(cnt => expect(cnt).to.be.greaterThan(0))
.then(() => browser.driver.switchToParentFrame())
.then((): any => browser.wait(() => {
return element.all(by.css(`[name="btn-stop"]`)).first().isPresent();
})
Expand Down Expand Up @@ -63,11 +61,15 @@ describe('Job Details', () => {
})))
.then(() => browser.get('/job/5'))
.then((): any => browser.wait(() => {
return element.all(by.css('.terminal .command')).count().then(cnt => cnt === 3);
return element(by.css('app-terminal')).isPresent().then(dis => dis);
}))
.then(() => browser.switchTo().frame( element( by.tagName( 'iframe' )).getWebElement()))
.then(() => element.all(by.css('x-row')).count())
.then(cnt => expect(cnt).to.be.greaterThan(0))
.then((): any => browser.wait(() => {
return element.all(by.css('.terminal .output')).count().then(cnt => cnt === 3);
return element.all(by.css('x-row')).count().then(cnt => cnt > 10);
}))
.then(() => browser.driver.switchToParentFrame())
.then((): any => browser.wait(() => {
return element.all(by.css(`[name="btn-stop"]`)).first().isPresent();
})
Expand Down
14 changes: 2 additions & 12 deletions src/app/components/app-terminal/app-terminal.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,8 @@ describe('Terminal Component', () => {
.createComponent(AppTerminalComponent);
});

it('should expect noData to be undefined', () => {
expect(fixture.componentInstance.noData).toBeUndefined();
});

it('should expect noData to be true', () => {
fixture.detectChanges();
expect(fixture.componentInstance.noData).toBe(true);
});

it('should expect duration to convert into human readable string', () => {
it('should expect hterm to be defined', () => {
fixture.detectChanges();
const duration = fixture.componentInstance.getDuration(2142412421421);
expect(duration).toBe('26d, 9h, 36min, 54sec, 21ms');
expect(fixture.componentInstance.hterm).toBeDefined();
});
});

0 comments on commit 5f602b8

Please sign in to comment.