Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module.exports = function(eleventyConfig) {
return {
dir: {
input: "src",
includes: "../includes"
includes: "../includes",
data: "../data"
},
templateFormats: [
"md",
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ node_modules
*.svg
*.swp
*.mp4
cypress/videos/*
cypress/screenshots/*
12 changes: 11 additions & 1 deletion cypress/e2e/homepage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,15 @@ describe('Homepage check', function() {
it('Does open', function() {
cy.visit('/')
cy.get('p:first').should('contain', 'StringBasic website is currently under construction.')
})
});
it("Check build time to be less or equal than now", () => {
cy.visit('/')
cy.get('b:first').invoke('text').then(actualDateText => {
const dayjs = require('dayjs');
const todaysDate = new Date();
const actualDate = dayjs(actualDateText, 'YYYY-MM-DD HH:mm:ss').toDate();

expect(actualDate).to.be.lte(todaysDate);
});
});
})
15 changes: 15 additions & 0 deletions data/eleventyComputed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
eleventyComputed: {
buildTime: data => {
const now = new Date();

const date = ("0" + now.getDate()).slice(-2);
const month = ("0" + (now.getMonth() + 1)).slice(-2);
const year = now.getFullYear();
const hours = now.getHours();
const minutes = now.getMinutes();
const seconds = now.getSeconds();
return year + "-" + month + "-" + date + " " + hours + ":" + minutes + ":" + seconds;
}
}
}
1 change: 1 addition & 0 deletions includes/baselayout.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ title: StringBasic
</head>
<body>
{{ content | safe }}
<b>Website build time: {{ eleventyComputed.buildTime }}</b>
</body>
</html>