Skip to content

Commit

Permalink
Fix part of oppia#17712 Add more acceptance tests for logged in users (
Browse files Browse the repository at this point in the history
…oppia#19991)

* Footer navigation logged-in user tests progress

* Click all buttons on get started page done

* logged in users get started page test refactoring

* click all about oppia footer buttons test working

* Lint fixes

* Lint fixes

* Lint fixes

* null-safety

* Add /usr/bin/google-chrome-stable as possible CHROME_BIN path

* click all about oppia footer buttons changes

* Fix some flakiness for logged in user acceptance tests

* Remove extra space

* Matcher changes for logged-in-users-utils

* Swap ` with \' on non-format string

* Swaping a .toContain to a .toBe

* Rename of some logged in user tests and restructuring of the click all likns on get started page spec
  • Loading branch information
agallop authored Apr 1, 2024
1 parent f605163 commit ceaafdb
Show file tree
Hide file tree
Showing 10 changed files with 398 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,12 @@ jobs:
suite:
- blog-admin-tests/assign-roles-to-users-and-change-tag-properties
- blog-editor-tests/try-to-publish-a-duplicate-blog-post-and-get-blocked
- logged-in-user-tests/click-all-buttons-on-about-page
- logged-in-user-tests/click-all-buttons-on-about-foundation-page
- logged-in-user-tests/click-all-buttons-on-thanks-for-donating-page
- logged-in-user-tests/click-all-buttons-on-navbar
- logged-in-user-tests/click-all-buttons-in-about-page
- logged-in-user-tests/click-all-buttons-in-about-foundation-page
- logged-in-user-tests/click-all-buttons-in-thanks-for-donating-page
- logged-in-user-tests/click-all-links-in-about-oppia-footer
- logged-in-user-tests/click-all-links-on-get-started-page
- practice-question-admin-tests/add-and-remove-contribution-rights
- translation-admin-tests/add-translation-rights
- translation-admin-tests/remove-translation-rights
Expand Down
14 changes: 11 additions & 3 deletions core/templates/base-components/oppia-footer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,26 @@ <h2>{{ 'I18N_FOOTER_NEWSLETTER_HEADING' | translate }}</h2>
<ul>
<li>
<a href="/about"
class="e2e-test-footer-about-link"
[smartRouterLink]="'/' + PAGES_REGISTERED_WITH_FRONTEND.ABOUT.ROUTE">
{{ 'I18N_FOOTER_ABOUT' | translate }}
</a>
</li>
<li>
<a href="/about-foundation">
<a href="/about-foundation"
class="e2e-test-footer-about-foundation-link">
{{ 'I18N_FOOTER_OPPIA_FOUNDATION' | translate }}
</a>
</li>
<li>
<a [href]="getOppiaBlogUrl()">
<a [href]="getOppiaBlogUrl()"
class="e2e-test-footer-blog-link">
{{ 'I18N_TOPNAV_BLOG' | translate }}
</a>
</li>
<li>
<a href="https://groups.google.com/forum/?place=forum/oppia#!forum/oppia">
<a href="https://groups.google.com/g/oppia"
class="e2e-test-footer-forum-link">
{{ 'I18N_FOOTER_FORUM' | translate }}
</a>
</li>
Expand All @@ -69,24 +73,28 @@ <h2>{{ 'I18N_FOOTER_NEWSLETTER_HEADING' | translate }}</h2>
</li>
<li>
<a href="/creator-guidelines"
class="e2e-test-creator-guidelines-link"
[smartRouterLink]="'/' + PAGES_REGISTERED_WITH_FRONTEND.PLAYBOOK.ROUTE">
{{ 'I18N_PLAYBOOK_HEADING' | translate }}
</a>
</li>
<li>
<a href="/teach"
class="e2e-test-teach-link"
[smartRouterLink]="'/' + PAGES_REGISTERED_WITH_FRONTEND.TEACH.ROUTE">
{{ 'I18N_FOOTER_TEACH_PAGE' | translate }}
</a>
</li>
<li>
<a href="/community-library"
class="e2e-test-community-library-link"
[smartRouterLink]="'/' + PAGES_REGISTERED_WITH_FRONTEND.LIBRARY_INDEX.ROUTE">
{{ 'I18N_FOOTER_BROWSE_LIBRARY' | translate }}
</a>
</li>
<li>
<a href="/contact"
class="e2e-test-contact-link"
[smartRouterLink]="'/' + PAGES_REGISTERED_WITH_FRONTEND.CONTACT.ROUTE">
{{ 'I18N_FOOTER_CONTACT_US' | translate }}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ export default {
CreatorDashboard: 'http://localhost:8181/creator-dashboard',
CreatorDashboardCreateMode:
'http://localhost:8181/creator-dashboard?mode=create',
CreatingAnExploration: 'https://oppia.github.io/#/CreatingAnExploration',
Donate: 'http://localhost:8181/donate',
DonateWithThanksModal: 'http://localhost:8181/donate?thanks=',
EmbeddingAnExploration: 'https://oppia.github.io/#/EmbeddingAnExploration',
ExternalLink61MillionChildren:
'https://uis.unesco.org/en/news/world-poverty-could-be-cut-half-if-all-adults-completed-secondary-education',
ExternalLinkEvenThoseWhoAreInSchool:
Expand All @@ -45,13 +47,17 @@ export default {
'https://uis.unesco.org/en/news/new-report-how-measure-equity-education',
DesktopExternalLinkWatchAVideo:
'https://www.facebook.com/oppiaorg/videos/189487953721583/',
MobileExternalLinkWatchAVideo:
'https://m.facebook.com/oppiaorg/videos/189487953721583/',
Electromagnetism: 'https://www.oppia.org/collection/wqCTKpKA0LBe',
GetStarted: 'http://localhost:8181/get-started',
Home: 'http://localhost:8181/',
Logout: 'http://localhost:8181/logout',
MathClassroom: 'http://localhost:8181/learn/math',
MobileExternalLinkWatchAVideo:
'https://m.facebook.com/oppiaorg/videos/189487953721583/',
Partnerships: 'http://localhost:8181/partnerships',
ProgrammingWithCarla: 'https://www.oppia.org/collection/inDXV0w8-p1C',
Volunteer: 'http://localhost:8181/volunteer',
WelcomeToOppia: 'https://www.oppia.org/explore/0',
},
Dashboard: {
MainDashboard: '.e2e-test-splash-page',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright 2024 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @fileoverview Acceptance Test for checking if logged-in users can
* navigate using all the links under the "About Oppia" footer section.
*/

import {UserFactory} from '../../puppeteer-testing-utilities/user-factory';
import {LoggedInUser} from '../../user-utilities/logged-in-users-utils';
import testConstants from '../../puppeteer-testing-utilities/test-constants';

const DEFAULT_SPEC_TIMEOUT = testConstants.DEFAULT_SPEC_TIMEOUT;

describe('Logged-in User', function () {
let testUser: LoggedInUser;

beforeAll(async function () {
testUser = await UserFactory.createNewUser(
'testuser',
'[email protected]'
);
}, DEFAULT_SPEC_TIMEOUT);

beforeEach(async function () {
// Navigate to a page that has the oppia footer.
await testUser.goto(testConstants.URLs.Volunteer);
});

it(
'should open About page via the footer',
async function () {
await testUser.navigateToAboutPageViaFooter();
},
DEFAULT_SPEC_TIMEOUT
);

it(
'should open "About Foundation" page via the footer',
async function () {
await testUser.navigateToAboutFoundationPageViaFooter();
},
DEFAULT_SPEC_TIMEOUT
);

it(
'should open "Blog" page via the footer',
async function () {
await testUser.navigateToBlogPageViaFooter();
},
DEFAULT_SPEC_TIMEOUT
);

it(
'should open "Forum" page via the footer',
async function () {
await testUser.navigateToForumPageViaFooter();
},
DEFAULT_SPEC_TIMEOUT
);

afterAll(async function () {
await UserFactory.closeAllBrowsers();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Copyright 2024 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @fileoverview Acceptance Test for checking if logged-in users
* can open all the links on the "Get Started" page.
*/

import {UserFactory} from '../../puppeteer-testing-utilities/user-factory';
import {LoggedInUser} from '../../user-utilities/logged-in-users-utils';
import testConstants from '../../puppeteer-testing-utilities/test-constants';

const DEFAULT_SPEC_TIMEOUT = testConstants.DEFAULT_SPEC_TIMEOUT;

describe('Logged-in Users', function () {
let testUser: LoggedInUser;

beforeAll(async function () {
testUser = await UserFactory.createNewUser(
'testuser',
'[email protected]'
);
}, DEFAULT_SPEC_TIMEOUT);

it(
'should be able to navigate to the Get Started page using the footer',
async function () {
await testUser.navigateToAboutFoundationPage();
await testUser.navigateToGetStartedPageViaFooter();
},
DEFAULT_SPEC_TIMEOUT
);

describe('on the Get Started page', function () {
beforeEach(async function () {
await testUser.navigateToGetStartedPage();
}, DEFAULT_SPEC_TIMEOUT);

it(
'should be able to use the "create one here" link',
async function () {
await testUser.clickCreateOneHereLinkInGetStartedPage();
},
DEFAULT_SPEC_TIMEOUT
);

it(
'should be able to use the "Welcome to Oppia" link',
async function () {
await testUser.clickWelcomeToOppiaLinkInGetStartedPage();
},
DEFAULT_SPEC_TIMEOUT
);

it(
'should be able to use the "Get Electrified!" link',
async function () {
await testUser.clickGetElectrifiedLinkInGetStartedPage();
},
DEFAULT_SPEC_TIMEOUT
);

it(
'should be able to use the "Programming with Carla" link',
async function () {
await testUser.clickProgrammingWithCarlaLinkInGetStartedPage();
},
DEFAULT_SPEC_TIMEOUT
);

it(
'should be able to use "in our user documentation" link',
async function () {
await testUser.clickInOurUserDocumentationLinkInGetStartedPage();
},
DEFAULT_SPEC_TIMEOUT
);

it(
'should be able to use the "embed it in your own web page" link',
async function () {
await testUser.clickEmbedItInYourOwnWebPageLinkInGetStartedPage();
},
DEFAULT_SPEC_TIMEOUT
);

it(
'should be able to use the "discover more ways to get involved" link',
async function () {
await testUser.clickDiscoverMoreWaysToGetInvolvedLinkInGetStartedPage();
},
DEFAULT_SPEC_TIMEOUT
);

afterAll(async function () {
await UserFactory.closeAllBrowsers();
});
});
});
Loading

0 comments on commit ceaafdb

Please sign in to comment.