量角器beforeAll()未运行

时间:2017-06-14 17:56:22

标签: jasmine protractor

我试图运行前一天工作的测试,并收到一条错误消息说明 - Error: Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details"

我在console.log("hi")个调用中添加了beforeAll(),并且控制台中没有输出,因此我怀疑错误是由于某种原因未调用beforeAll()。< / p>

我在我的conf文件中使用了最新的jasmine框架,并且当我不包含beforeAll()时,我的一些测试会运行,但不是全部。这个测试昨天运行正常,我今天再次运行它没有任何变化,所以我不确定问题可能是什么。还有其他人知道吗?

我将包含我的conf.js文件以及我正在运行的部分测试。

我的conf.js文件

let SpecReporter = require('jasmine-spec-reporter').SpecReporter;
exports.config = {
    framework: 'jasmine',
    directConnect: true,
    allScriptsTimeout: 50000,
    rootElement: 'html',
    untrackOutstandingTimeouts: true,

//    suites: {
      //HealthCheck: './specs/Health Check/**.js',
      //ContectCheck: './specs/Content Check/**.js',
//    },

    specs: [
      //  'specs/submitFeedback.js',
      'specs/createTeacherAndStudentOld.js',
      //  'specs/temp.js',
      //  'specs/manipTeste.js',
    ],
    capabilities: {
        browserName: 'chrome'
    },
    params: {
        screenWidth: 1920,
        screenHeight: 1080,
        siteURL: 'https://alpha.khmath.com',
        marketingSiteURL: 'https://knowledgehook.com',
        portalUsername: '',
        portalPassword: '',
        classRedemptionCode: 'testcode1',
        contentCheckCourse: 'Grade 9 Academic',
        homeWorkCourse: 'Grade 9 Applied',
        gameShowCourse: 'Grade 9 Applied',
        term: '2016-2017 Full Year',
        gameShowSiteUrl: 'https://alpha.khmath.com/play'
    },
    jasmineNodeOpts: {
        defaultTimeoutInterval: 7200000,
        print: function() {}
    },
    onPrepare: function () {

        global.helper = require('./helper.js');
        global.completeQuestionHelper = require('./pages/student/completeQuestionHelper.js');

        global.fs = require('fs');
        global.https = require('https');
        global.LoginPage = require('./pages/loginPage.js');
        global.RegistrationPage = require('./pages/registrationPage.js');

        global.TeacherGameShowPage = require('./pages/teacher/teacherGameShowPage.js');
        global.TeacherHomePage = require('./pages/teacher/teacherHomePage.js');
        global.TeacherMissionPage = require('./pages/teacher/teacherMissionPage.js');
        global.TeacherPurchasePage = require('./pages/teacher/teacherPurchasePage.js');
        global.TeacherStudentsPage = require('./pages/teacher/teacherStudentsPage.js');
        global.TeacherStudentSummaryPage = require('./pages/teacher/teacherStudentSummaryPage.js');
        global.TeacherReportPage = require('./pages/teacher/teacherReportPage.js');

        global.StudentHomePage = require('./pages/student/studentHomePage.js');
        global.StudentAllSkillsPage = require('./pages/student/studentAllSkillsPage.js');
        global.StudentSkillPage = require('./pages/student/studentSkillPage.js');
        global.StudentGameplayPage = require('./pages/student/studentGameplayPage.js');
        global.StudentMissionPage = require('./pages/student/studentMissionPage.js');
        global.StudentPortfolioPage = require('./pages/student/StudentPortfolioPage.js');

        global.GameShowStudentGameplayPage = require('./pages/gameshow/gameShowStudentGameplayPage.js');
        global.GameShowStudentRegistrationPage = require('./pages/gameshow/gameShowStudentRegistrationPage.js');
        global.GameShowTeacherGameplayPage = require('./pages/gameshow/gameShowTeacherGameplayPage.js');


        global.loginPage = new LoginPage(browser);
        global.registrationPage = new RegistrationPage(browser);

        global.teacherGameShowPage = new TeacherGameShowPage(browser);
        global.teacherHomePage = new TeacherHomePage(browser);
        global.teacherMissionPage = new TeacherMissionPage(browser);
        global.teacherPurchasePage = new TeacherPurchasePage(browser);
        global.teacherStudentsPage = new TeacherStudentsPage(browser);
        global.teacherStudentSummaryPage = new TeacherStudentSummaryPage(browser);
        global.teacherReportPage = new TeacherReportPage(browser);

        global.studentHomePage = new StudentHomePage(browser);
        global.studentAllSkillsPage = new StudentAllSkillsPage(browser);
        global.studentSkillPage = new StudentSkillPage(browser);
        global.studentGameplayPage = new StudentGameplayPage(browser);
        global.studentMissionPage = new StudentMissionPage(browser);
        global.studentPortfolioPage = new StudentPortfolioPage(browser);

        global.gameShowStudentGameplayPage = new GameShowStudentGameplayPage(browser);
        global.gameShowStudentRegistrationPage = new GameShowStudentRegistrationPage(browser);
        global.gameShowTeacherGameplayPage = new GameShowTeacherGameplayPage(browser);

        global.EC = protractor.ExpectedConditions;

        jasmine.getEnv().addReporter(new SpecReporter({
          spec: {
            displayStacktrace: true
          },
          colors: {
            enabled: false,
          },
          prefixes: {
            successful: "O ",
            failed: "X ",
          },
        }));
    },
};

我的规范文件

  beforeAll(function () {
      console.log('hi');
      helper.setBrowserParams(browser);
      browser.get(browser.params.siteURL);
    });

    it('should register a teacher and create a premium class', function () {
        //Click Register
        loginPage.registerBtn.click();

        ...

`

0 个答案:

没有答案