<reponame>Shivkant-Chauhan/prototype---dockerizing-oppia<filename>core/tests/webdriverio_desktop/classroomPage.js<gh_stars>0// Copyright 2022 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 End-to-end tests for the classroom page.
 */

var general = require('../webdriverio_utils/general.js');
var users = require('../webdriverio_utils/users.js');
var workflow = require('../webdriverio_utils/workflow.js');

var ClassroomPage = require('../webdriverio_utils/ClassroomPage.js');
var LibraryPage = require('../webdriverio_utils/LibraryPage.js');

describe('Classroom page functionality', function() {
  var classroomPage = null;
  var libraryPage = null;

  beforeAll(async function() {
    classroomPage = new ClassroomPage.ClassroomPage();
    libraryPage = new LibraryPage.LibraryPage();

    await users.createAndLoginCurriculumAdminUser(
      'ychag@example.com', 'creatorClassroomPage');
    await users.logout();
  });

  beforeEach(async function() {
    await users.login('ychag@example.com');
  });

  it('should search for explorations from classroom page', async function() {
    await workflow.createAndPublishExploration(
      'Exploration Title',
      'Algorithms',
      'This is the objective.',
      'English',
      true);
    await classroomPage.get('math');
    await libraryPage.findExploration('Title');
    await libraryPage.expectExplorationToBeVisible('Exploration Title');

    await libraryPage.selectLanguages(['English']);
    await libraryPage.expectCurrentLanguageSelectionToBe(['English']);

    await libraryPage.selectCategories(['Algorithms']);
    await libraryPage.expectCurrentCategorySelectionToBe(['Algorithms']);
  });

  afterEach(async function() {
    await general.checkForConsoleErrors([]);
    await users.logout();
  });
});
