Changeset View
Changeset View
Standalone View
Standalone View
cypress/integration/origin-visits.spec.js
/** | /** | ||||
* Copyright (C) 2019 The Software Heritage developers | * Copyright (C) 2019 The Software Heritage developers | ||||
* See the AUTHORS file at the top-level directory of this distribution | * See the AUTHORS file at the top-level directory of this distribution | ||||
* License: GNU Affero General Public License version 3, or any later version | * License: GNU Affero General Public License version 3, or any later version | ||||
* See top-level LICENSE file for more information | * See top-level LICENSE file for more information | ||||
*/ | */ | ||||
import {getTime} from '../utils'; | import {getTime} from '../utils'; | ||||
const origin = 'https://github.com/wcoder/highlightjs-line-numbers.js'; | let origin; | ||||
function checkTimeLink(element) { | function checkTimeLink(element) { | ||||
expect(element.text()).not.to.be.empty; | expect(element.text()).not.to.be.empty; | ||||
const timeStringLink = element.attr('href').split('visit/')[1].split('/')[0]; | const timeStringLink = element.attr('href').split('visit/')[1].split('/')[0]; | ||||
// time in link should be equal to that in text | // time in link should be equal to that in text | ||||
assert.deepEqual(getTime(timeStringLink), getTime(element.text())); | assert.deepEqual(getTime(timeStringLink), getTime(element.text())); | ||||
Show All 9 Lines | cy.contains('.month', date.monthName) | ||||
.eq(date.date - 1) | .eq(date.date - 1) | ||||
.trigger('mouseenter') | .trigger('mouseenter') | ||||
.get('.popover-body') | .get('.popover-body') | ||||
.should('be.visible') | .should('be.visible') | ||||
.and('contain', `${date.hours}:${date.minutes} UTC`); | .and('contain', `${date.hours}:${date.minutes} UTC`); | ||||
} | } | ||||
describe('Visits tests', function() { | describe('Visits tests', function() { | ||||
before(function() { | |||||
origin = this.origin[1]; | |||||
}); | |||||
beforeEach(function() { | beforeEach(function() { | ||||
cy.visit(this.Urls.browse_origin_visits(origin)); | cy.visit(this.Urls.browse_origin_visits(origin.url)); | ||||
}); | }); | ||||
it('should display first full visit time', function() { | it('should display first full visit time', function() { | ||||
cy.get('#swh-first-full-visit > .swh-visit-full') | cy.get('#swh-first-full-visit > .swh-visit-full') | ||||
.then(($el) => { | .then(($el) => { | ||||
checkTimeLink($el); | checkTimeLink($el); | ||||
searchInCalendar(getTime($el.text())); | searchInCalendar(getTime($el.text())); | ||||
}); | }); | ||||
Show All 27 Lines |