Skip to content
Open
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
28 changes: 28 additions & 0 deletions e2e/community-list-page/community-list-page.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { CommunityListPageProtractor } from './community-list-page.po';

describe('protractor CommunityListPage', () => {
let page: CommunityListPageProtractor;

beforeEach(() => {
page = new CommunityListPageProtractor();
});

it('should contain page-limited top communities (at least 1 expandable community)', () => {
page.navigateToCommunityList();
expect<any>(page.anExpandableCommunityIsPresent()).toEqual(true)
});

describe('if expanded a node and navigating away, tree state gets saved', () => {
it('if navigating back, same node is expanded', () => {
page.navigateToCommunityList();
const linkOfSecondNodeBeforeExpanding = page.getLinkOfSecondNode();
page.toggleExpandFirstExpandableCommunity();
const linkOfSecondNodeAfterExpanding = page.getLinkOfSecondNode();
page.navigateToHome();
page.navigateToCommunityList();
expect<any>(page.getLinkOfSecondNode()).toEqual(linkOfSecondNodeAfterExpanding);
page.toggleExpandFirstExpandableCommunity();
expect<any>(page.getLinkOfSecondNode()).toEqual(linkOfSecondNodeBeforeExpanding);
});
});
});
32 changes: 32 additions & 0 deletions e2e/community-list-page/community-list-page.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { browser, by, element, protractor } from 'protractor';

export class CommunityListPageProtractor {
HOMEPAGE = '/home';
COMMUNITY_LIST = '/community-list';

navigateToHome() {
return browser.get(this.HOMEPAGE);
}

navigateToCommunityList() {
browser.get(this.COMMUNITY_LIST);
const loading = element(by.css('.ds-loading'));
browser.wait(protractor.ExpectedConditions.invisibilityOf(loading), 10000);
return;

}

anExpandableCommunityIsPresent() {
console.log(element(by.css('body')));
return element(by.css('.expandable-node h5 a')).isPresent();
}

toggleExpandFirstExpandableCommunity() {
element(by.css('.expandable-node button')).click();
}

getLinkOfSecondNode() {
return element(by.css('.cdk-tree-node h5 a')).getAttribute('href');
}

}