From 0abd5f5f03d746322535ad7e81e7f5d93ce84a39 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Fri, 29 Mar 2019 22:20:09 +0200 Subject: [PATCH] test(docs-infra): add e2e test for the contributors page (#29601) Previously, if the shape of data in `contributors.json` was incorrect, there would be a runtime error (when trying to parse the data), which would result in a blank page. The likelihood for this happening is higher after #29553, where the shape of data changed. This commit adds some basic e2e tests that verify the page works as expected and there are contributors listed. PR Close #29601 --- aio/tests/e2e/app.e2e-spec.ts | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/aio/tests/e2e/app.e2e-spec.ts b/aio/tests/e2e/app.e2e-spec.ts index 40f2682482..8f686ae779 100644 --- a/aio/tests/e2e/app.e2e-spec.ts +++ b/aio/tests/e2e/app.e2e-spec.ts @@ -127,6 +127,46 @@ describe('site App', function() { }); }); + describe('contributors page', () => { + const groupButtons = element(by.css('.group-buttons')).all(by.css('.filter-button')); + const contributors = element(by.css('.contributor-group')).all(by.css('aio-contributor')); + + beforeAll(() => page.navigateTo('about')); + + it('should have the expected groups', () => { + expect(groupButtons.count()).toBe(3); + + const texts = groupButtons.map(btn => btn && btn.getText()); + expect(texts).toEqual(['ANGULAR', 'COLLABORATORS', 'GDE']); + }); + + it('should have contributors listed in each group', async () => { + const getContributorNames = + () => contributors.all(by.css('h3')).map(c => c && c.getText()); + + const names1 = getContributorNames(); + expect(contributors.count()).toBeGreaterThan(1); + + groupButtons.get(1).click(); + const names2 = getContributorNames(); + expect(contributors.count()).toBeGreaterThan(1); + expect(names2).not.toEqual(names1); + + groupButtons.get(2).click(); + const names3 = getContributorNames(); + expect(contributors.count()).toBeGreaterThan(1); + expect(names3).not.toEqual(names2); + expect(names3).not.toEqual(names1); + + groupButtons.get(0).click(); + const names4 = getContributorNames(); + expect(contributors.count()).toBeGreaterThan(1); + expect(names4).not.toEqual(names3); + expect(names4).not.toEqual(names2); + expect(names4).toEqual(names1); + }); + }); + describe('google analytics', () => { it('should call ga with initial URL', done => {