tests/test-html.rb
def run

    # First we need to load the data from the database
    loadData

    # Now get the list of courses from the database
    courses = loadCourseNames

    # Next extract the name of the page from the path.
    name = File.basename(@path, ".html")

    # Check to see if we have any work to do
    # TODO: Include a check to ensure each course is tested once.
    if courses.include? name

      # Load the details of the course
      course = loadCourseDetail(name)

      # Run all the layout tests
      correctTitle?(course)        # Does the page have the correct title?
      clearSelected?               # Does the page have a clear selected button?
      plannerClass?                # Does the page have a planner class?
      allYears?(course)            # Does the page contain all the years as defined in the data?
      allCounters?(course)         # Does the page have a credit counter for each year?
      allModules?(course)          # Does each module appear on the page once only.

      # Get all the module codes for the course
      modids = getAllModuleCodes(course)

      # For each modules, check that it conforms to the expected format
      for modid in modids

        # Get the module from the page
        m = @html.css("div.module##{modid}")

        # Get the module from the database
        mspec = getModuleByCode(modid)

        # Run the module tests
        moduleName?(m, mspec)          # Is the module displaying the correct name?
        moduleCode?(m, mspec)          # Is the module displaying the correct code?
        moduleCredits?(m, mspec)       # Is the module displaying the correct number of credits?
        moduleLink?(m, mspec)          # Is the more info link going to the right place?
        moduleProvides?(m, mspec)      # Is the module providing for the correct modules?
        moduleRequires?(m, mspec)      # Is the module requireing the correct modules?

      end

      return

    end

    # As long as we get to the end of the function without raising any issues
    # we assume that there wasn't any problems and the test will pass

  end
# This is actually what is called from HTMLProofer and where we
# raise all our issues from
This is actually what is called from HTMLProofer and where we
raise all our issues from
This is actually what is called from HTMLProofer and where we raise all our issues from
def run
    loadData
    courses = loadCourseNames
    name = File.basename(@path, ".html")
    if courses.include? name
      course = loadCourseDetail(name)
      correctTitle?(course)        
      clearSelected?               
      plannerClass?                
      allYears?(course)            
      allCounters?(course)         
      allModules?(course)          
      modids = getAllModuleCodes(course)
      for modid in modids
        m = @html.css("div.module##{modid}")
        mspec = getModuleByCode(modid)
        moduleName?(m, mspec)          
        moduleCode?(m, mspec)          
        moduleCredits?(m, mspec)       
        moduleLink?(m, mspec)          
        moduleProvides?(m, mspec)      
        moduleRequires?(m, mspec)      
      end
      return
    end
  end
def run loadData courses = loadCourseNames name = File . basename ( @path , ".html" ) if courses . include? name course = loadCourseDetail ( name ) correctTitle? ( course ) clearSelected? plannerClass? allYears? ( course ) allCounters? ( course ) allModules? ( course ) modids = getAllModuleCodes ( course ) for modid in modids m = @html . css ( "div.module##{modid}" ) mspec = getModuleByCode ( modid ) moduleName? ( m , mspec ) moduleCode? ( m , mspec ) moduleCredits? ( m , mspec ) moduleLink? ( m , mspec ) moduleProvides? ( m , mspec ) moduleRequires? ( m , mspec ) end return end end
This is actually what is called from HTMLProofer and where we
raise all our issues from
This is actually what is called from HTMLProofer and where we raise all our issues from
# First we need to load the data from the database # Now get the list of courses from the database # Next extract the name of the page from the path. # Check to see if we have any work to do # TODO: Include a check to ensure each course is tested once. # Load the details of the course # Run all the layout tests # Does the page have the correct title? # Does the page have a clear selected button? # Does the page have a planner class? # Does the page contain all the years as defined in the data? # Does the page have a credit counter for each year? # Does each module appear on the page once only. # Get all the module codes for the course # For each modules, check that it conforms to the expected format # Get the module from the page # Get the module from the database # Run the module tests # Is the module displaying the correct name? # Is the module displaying the correct code? # Is the module displaying the correct number of credits? # Is the more info link going to the right place? # Is the module providing for the correct modules? # Is the module requireing the correct modules? # As long as we get to the end of the function without raising any issues # we assume that there wasn't any problems and the test will pass