1
0
mirror of https://github.com/typemill/typemill.git synced 2025-01-17 05:18:19 +01:00

Merge pull request #315 from typemill/more-cy-test

Cypress: More cy test structure
This commit is contained in:
trendschau 2022-03-09 09:59:50 +01:00 committed by GitHub
commit 3a185ac3a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 921 additions and 818 deletions

3
.gitignore vendored
View File

@ -22,4 +22,5 @@ settings/users
system/vendor
plugins/demo
zips
build.php
build.php
node_modules

52
composer.lock generated
View File

@ -367,12 +367,12 @@
},
"type": "library",
"autoload": {
"psr-4": {
"FastRoute\\": "src/"
},
"files": [
"src/functions.php"
]
],
"psr-4": {
"FastRoute\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -982,16 +982,16 @@
},
{
"name": "symfony/finder",
"version": "v5.4.2",
"version": "v5.4.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "e77046c252be48c48a40816187ed527703c8f76c"
"reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/e77046c252be48c48a40816187ed527703c8f76c",
"reference": "e77046c252be48c48a40816187ed527703c8f76c",
"url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d",
"reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d",
"shasum": ""
},
"require": {
@ -1025,7 +1025,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v5.4.2"
"source": "https://github.com/symfony/finder/tree/v5.4.3"
},
"funding": [
{
@ -1041,11 +1041,11 @@
"type": "tidelift"
}
],
"time": "2021-12-15T11:06:13+00:00"
"time": "2022-01-26T16:34:36+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@ -1077,12 +1077,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -1107,7 +1107,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0"
},
"funding": [
{
@ -1127,16 +1127,16 @@
},
{
"name": "symfony/polyfill-php80",
"version": "v1.24.0",
"version": "v1.25.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9"
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9",
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c",
"shasum": ""
},
"require": {
@ -1153,12 +1153,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"classmap": [
"Resources/stubs"
]
@ -1190,7 +1190,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0"
},
"funding": [
{
@ -1206,7 +1206,7 @@
"type": "tidelift"
}
],
"time": "2021-09-13T13:58:33+00:00"
"time": "2022-03-04T08:16:47+00:00"
},
{
"name": "symfony/yaml",
@ -1411,5 +1411,5 @@
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.0.0"
"plugin-api-version": "2.2.0"
}

3
cypress.json Normal file
View File

@ -0,0 +1,3 @@
{
"baseUrl": "http://localhost/EDIT_YOUR_LOCAL_BASE_URL_HERE"
}

View File

@ -0,0 +1,51 @@
setup: false
language: en
welcome: false
title: TYPEMILL
author: Unknown
copyright: ©
year: "2022"
langattr: en
editor: visual
formats:
- markdown
- headline
- ulist
- olist
- table
- quote
- notice
- image
- video
- file
- toc
- hr
- definition
- code
- shortcode
access: null
pageaccess: null
hrdelimiter: null
restrictionnotice: ""
wraprestrictionnotice: null
headlineanchors: null
displayErrorDetails: null
twigcache: null
proxy: null
trustedproxies: ""
headersoff: null
urlschemes: ""
svg: null
recoverpw: null
recoverfrom: ""
recoversubject: ""
recovermessage: ""
securitylog: null
oldslug: null
refreshcache: null
pingsitemap: null
images:
live:
width: "820"
logo: ""
favicon: ""

View File

@ -0,0 +1,9 @@
username: trendschau
email: trendschau@gmail.com
userrole: administrator
password: $2y$10$SMeVwJeo/5vyjeI68uFi.OJZhSR.3KQTVb5zcKF5D65eZ8CDpX29.
lastlogin: 1646578390
image: ''
description: ''
firstname: Sebastian
lastname: Schürmanns

View File

@ -1,40 +1,43 @@
describe("Typemill Setup with Signup", function() {
it("validates form input", function() {
// reset users and settings
cy.task("resetSetup");
// visit setup form
cy.visit("/setup");
// cy.visit('/setup',{ onBeforeLoad: (_contentWindow) => { Object.defineProperty(navigator, 'language', { value: 'fr-FR' }) } })
cy.url().should("include", "/setup");
describe("Typemill Setup with Signup", function () {
before(function () {
// reset users and settings
cy.task("resetSetup");
});
// add data and check attributes
cy.get('input[name="username"]')
.type("?1")
.should("have.value", "?1")
.and("have.attr", "required");
it("validates form input", function () {
// visit setup form
cy.visit("/setup");
// cy.visit('/setup',{ onBeforeLoad: (_contentWindow) => { Object.defineProperty(navigator, 'language', { value: 'fr-FR' }) } })
cy.url().should("include", "/setup");
cy.get('input[name="email"]')
.type("trendschau.net")
.should("have.value", "trendschau.net")
.and("have.attr", "required");
// add data and check attributes
cy.get('input[name="username"]')
.type("?1")
.should("have.value", "?1")
.and("have.attr", "required");
cy.get('input[name="password"]')
.type("pass")
.should("have.value", "pass")
.and("have.attr", "required");
cy.get('input[name="email"]')
.type("trendschau.net")
.should("have.value", "trendschau.net")
.and("have.attr", "required");
// submit and get validation errors
cy.get("form").submit();
cy.get("#flash-message").should(
"contain",
"Please check your input and try again"
);
cy.get(".error").should("contain", "invalid characters");
cy.get(".error").should("contain", "e-mail is invalid");
cy.get(".error").should("contain", "Length between 5 - 20");
});
cy.get('input[name="password"]')
.type("pass")
.should("have.value", "pass")
.and("have.attr", "required");
/*
// submit and get validation errors
cy.get("form").submit();
cy.get("#flash-message").should(
"contain",
"Please check your input and try again"
);
cy.get(".error").should("contain", "invalid characters");
cy.get(".error").should("contain", "e-mail is invalid");
cy.get(".error").should("contain", "Length between 5 - 20");
});
/*
it('fails without CSRF-token', function ()
{
cy.request({
@ -52,111 +55,111 @@ describe("Typemill Setup with Signup", function() {
.should('include', 'The form has a timeout')
})
*/
it("fails without CSRF-token", function() {
cy.visit("/setup");
it("fails without CSRF-token", function () {
cy.visit("/setup");
// enter correct data
cy.get('input[name="username"]').clear().type("trendschau");
cy.get('input[name="email"]').clear().type("trendschau@gmail.com");
cy.get('input[name="password"]').clear().type("password");
cy.get("#csrf_value").then((elem) => {
elem.val("wrongvalue");
});
// submit and get validation errors
cy.get("form").submit();
cy.get("#flash-message").should("contain", "form has a timeout");
// enter correct data
cy.get('input[name="username"]').clear().type("trendschau");
cy.get('input[name="email"]').clear().type("trendschau@gmail.com");
cy.get('input[name="password"]').clear().type("password");
cy.get("#csrf_value").then((elem) => {
elem.val("wrongvalue");
});
it("submits valid form data and visit welcome and settings page", function() {
cy.visit("/setup");
// submit and get validation errors
cy.get("form").submit();
cy.get("#flash-message").should("contain", "form has a timeout");
});
// enter correct data
cy.get('input[name="username"]').clear().type("trendschau");
cy.get('input[name="email"]').clear().type("trendschau@gmail.com");
cy.get('input[name="password"]').clear().type("password");
it("submits valid form data and visit welcome and settings page", function () {
cy.visit("/setup");
// submits valid form
cy.get("form").submit();
cy.url().should("include", "/welcome");
cy.getCookie("typemill-session").should("exist");
Cypress.Cookies.preserveOnce("typemill-session");
// enter correct data
cy.get('input[name="username"]').clear().type("trendschau");
cy.get('input[name="email"]').clear().type("trendschau@gmail.com");
cy.get('input[name="password"]').clear().type("password");
// clicks link on welcome page to settings page
// cy.get('.button').should('contain', 'Configure your website')
cy.get(".button").click();
cy.url().should("include", "/tm/settings");
});
// submits valid form
cy.get("form").submit();
cy.url().should("include", "/welcome");
cy.getCookie("typemill-session").should("exist");
Cypress.Cookies.preserveOnce("typemill-session");
it("creates default settings data", function() {
cy.get('input[name="settings[title]"]')
.should("have.value", "TYPEMILL")
.and("have.attr", "required");
cy.get('input[name="settings[author]"]');
cy.get('select[name="settings[copyright]"]');
cy.get('input[name="settings[year]"]').should("have.attr", "required");
cy.get('select[name="settings[language]"]');
// cy.get('select[name="settings[langattr]"]')
cy.get('input[name="settings[sitemap]"]')
.should("have.value", `${Cypress.config().baseUrl}/cache/sitemap.xml`)
.and("have.attr", "readonly");
cy.get('input[name="settings[logo]"]');
cy.get('input[name="settings[deletelogo]"]');
cy.get('input[name="settings[favicon]"]');
cy.get('input[name="settings[deletefav]"]');
cy.get('input[name="settings[headlineanchors]"]');
cy.get('input[name="settings[editor]"]');
// clicks link on welcome page to settings page
// cy.get('.button').should('contain', 'Configure your website')
cy.get(".button").click();
cy.url().should("include", "/tm/settings");
});
cy.get('select[name="settings[language]"]')
.select("en")
.should("have.value", "en");
it("creates default settings data", function () {
cy.get('input[name="settings[title]"]')
.should("have.value", "TYPEMILL")
.and("have.attr", "required");
cy.get('input[name="settings[author]"]');
cy.get('select[name="settings[copyright]"]');
cy.get('input[name="settings[year]"]').should("have.attr", "required");
cy.get('select[name="settings[language]"]');
// cy.get('select[name="settings[langattr]"]')
cy.get('input[name="settings[sitemap]"]')
.should("have.value", `${Cypress.config().baseUrl}/cache/sitemap.xml`)
.and("have.attr", "readonly");
cy.get('input[name="settings[logo]"]');
cy.get('input[name="settings[deletelogo]"]');
cy.get('input[name="settings[favicon]"]');
cy.get('input[name="settings[deletefav]"]');
cy.get('input[name="settings[headlineanchors]"]');
cy.get('input[name="settings[editor]"]');
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Settings are stored");
cy.get('select[name="settings[language]"]')
.select("en")
.should("have.value", "en");
Cypress.Cookies.preserveOnce("typemill-session");
});
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Settings are stored");
it("creates default user data", function() {
cy.visit("/tm/user/trendschau");
cy.url().should("include", "/tm/user/trendschau");
cy.get('input[name="user[username]"]').should("have.value", "trendschau");
cy.get('input[name="user[firstname]"]')
.clear()
.type("Sebastian")
.should("have.value", "Sebastian");
cy.get('input[name="user[lastname]"]')
.clear()
.type("Schürmanns")
.should("have.value", "Schürmanns");
cy.get('input[name="user[email]"]').should(
"have.value",
"trendschau@gmail.com"
);
cy.get('select[name="user[userrole]"]').should(
"have.value",
"administrator"
);
cy.get('input[name="user[password]"]').should("have.value", "");
cy.get('input[name="user[newpassword]"]').should("have.value", "");
Cypress.Cookies.preserveOnce("typemill-session");
});
cy.get("#userform").submit();
cy.get("#flash-message").should("contain", "Saved all changes");
});
it("creates default user data", function () {
cy.visit("/tm/user/trendschau");
cy.url().should("include", "/tm/user/trendschau");
cy.get('input[name="user[username]"]').should("have.value", "trendschau");
cy.get('input[name="user[firstname]"]')
.clear()
.type("Sebastian")
.should("have.value", "Sebastian");
cy.get('input[name="user[lastname]"]')
.clear()
.type("Schürmanns")
.should("have.value", "Schürmanns");
cy.get('input[name="user[email]"]').should(
"have.value",
"trendschau@gmail.com"
);
cy.get('select[name="user[userrole]"]').should(
"have.value",
"administrator"
);
cy.get('input[name="user[password]"]').should("have.value", "");
cy.get('input[name="user[newpassword]"]').should("have.value", "");
it("logouts out", function() {
// visits logout link
cy.visit("/tm/logout");
cy.url().should("include", "/tm/login");
cy.get("#userform").submit();
cy.get("#flash-message").should("contain", "Saved all changes");
});
// tries to open setup form again and gets redirected to login
cy.visit("/setup");
cy.url().should("include", "/login");
});
it("logouts out", function () {
// visits logout link
cy.visit("/tm/logout");
cy.url().should("include", "/tm/login");
it("redirects when tries to setup again", function() {
// tries to open setup form again and gets redirected to login
cy.visit("/setup");
cy.url().should("include", "/login");
});
});
// tries to open setup form again and gets redirected to login
cy.visit("/setup");
cy.url().should("include", "/login");
});
it("redirects when tries to setup again", function () {
// tries to open setup form again and gets redirected to login
cy.visit("/setup");
cy.url().should("include", "/login");
});
});

View File

@ -1,152 +1,155 @@
describe("Typemill Initial Frontend", function() {
it("has startpage with navigation", function() {
/* visit homepage */
cy.visit("/");
describe("Typemill Initial Frontend", function () {
before(function () {
cy.task("prepopulateSetup");
});
it("has startpage with navigation", function () {
/* visit homepage */
cy.visit("/");
/* has startpage with headline */
cy.get("h1").contains("Typemill");
/* has startpage with headline */
cy.get("h1").contains("Typemill");
/* has start and setup button */
cy.get("nav")
.find("a")
.should(($a) => {
expect($a).to.have.length(11);
expect($a[0].href).to.match(/welcome/);
expect($a[1].href).to.match(/welcome\/setup-your-website/);
expect($a[2].href).to.match(/welcome\/manage-access/);
expect($a[3].href).to.match(/welcome\/write-content/);
expect($a[4].href).to.match(/welcome\/get-help/);
expect($a[5].href).to.match(/welcome\/markdown-test/);
expect($a[6].href).to.match(/cyanine-theme/);
expect($a[7].href).to.match(/cyanine-theme\/landingpage/);
expect($a[8].href).to.match(/cyanine-theme\/colors-and-fonts/);
expect($a[9].href).to.match(/cyanine-theme\/footer/);
expect($a[10].href).to.match(/cyanine-theme\/content-elements/);
});
/* has start and setup button */
cy.get("nav")
.find("a")
.should(($a) => {
expect($a).to.have.length(11);
expect($a[0].href).to.match(/welcome/);
expect($a[1].href).to.match(/welcome\/setup-your-website/);
expect($a[2].href).to.match(/welcome\/manage-access/);
expect($a[3].href).to.match(/welcome\/write-content/);
expect($a[4].href).to.match(/welcome\/get-help/);
expect($a[5].href).to.match(/welcome\/markdown-test/);
expect($a[6].href).to.match(/cyanine-theme/);
expect($a[7].href).to.match(/cyanine-theme\/landingpage/);
expect($a[8].href).to.match(/cyanine-theme\/colors-and-fonts/);
expect($a[9].href).to.match(/cyanine-theme\/footer/);
expect($a[10].href).to.match(/cyanine-theme\/content-elements/);
});
});
it("has error page", function () {
cy.request({
url: "/error",
failOnStatusCode: false,
}).then((resp) => {
/* should return 404 not found */
expect(resp.status).to.eq(404);
});
it("has error page", function() {
cy.request({
url: "/error",
failOnStatusCode: false,
}).then((resp) => {
/* should return 404 not found */
expect(resp.status).to.eq(404);
});
cy.visit("/error", { failOnStatusCode: false });
cy.url().should("include", "/error");
cy.visit("/error", { failOnStatusCode: false });
cy.url().should("include", "/error");
cy.get("h1").contains("Not Found");
});
cy.get("h1").contains("Not Found");
it("has no access to cache files", function () {
cy.request({
url: "/cache/structure.txt",
failOnStatusCode: false,
}).then((resp) => {
// redirect status code is 302
expect(resp.status).to.eq(403);
});
});
it("has no access to dashboard", function () {
cy.visit("/tm/settings");
cy.url().should("include", "/tm/login");
});
it("has proper markdown test page", function () {
cy.visit("/welcome/markdown-test");
cy.url().should("include", "/welcome/markdown-test");
/* has navigation element */
cy.get("nav").should("exist");
/* check if toc exists */
cy.get(".TOC").within(($toc) => {
/* check if a certain link in toc exists */
cy.get("a").eq(2).should("have.attr", "href", "#h-headlines");
});
it("has no access to cache files", function() {
cy.request({
url: "/cache/structure.txt",
failOnStatusCode: false,
}).then((resp) => {
// redirect status code is 302
expect(resp.status).to.eq(403);
});
/* check if corresponding anchor exists */
cy.get("#h-headlines").should("exist");
/* soft linebreaks */
cy.get("br").should("exist");
/* emphasis */
cy.get("em").should("exist");
/* strong */
cy.get("strong").should("exist");
/* ordered list */
cy.get("ol").should("exist");
/* linebreak */
cy.get("hr").should("exist");
/* links exists? hard to test, any idea? We need to wrap it in a div... */
/* images */
cy.get("img").eq(0).should("have.attr", "alt", "alt");
cy.get("img")
.eq(0)
.should("have.attr", "src")
.should("include", "media/files/markdown.png");
cy.get("figure")
.eq(2)
.should("have.id", "myid")
.and("have.class", "otherclass");
cy.get("img")
.eq(2)
.should("have.attr", "alt", "alt-text")
.and("have.attr", "title", "my title")
.and("have.attr", "width", "150px");
/* blockquote */
cy.get("blockquote").should("exist");
/* has navigation element */
cy.get(".notice1").should("exist");
cy.get(".notice2").should("exist");
cy.get(".notice3").should("exist");
/* footnote */
cy.get("sup").eq(0).should("have.id", "fnref1:1");
cy.get("sup")
.eq(0)
.within(($sup) => {
cy.get("a")
.eq(0)
.should("have.attr", "href", "#fn%3A1")
.and("have.class", "footnote-ref");
});
/* abbreviation */
cy.get("abbr").should("exist");
/* definition list */
cy.get("dl").should("exist");
/* table */
cy.get("table").should("exist");
/* code */
cy.get("pre").should("exist");
cy.get("code").should("exist");
/* math */
cy.get(".math").should("exist");
/* footnote end */
cy.get(".footnotes").within(($footnotes) => {
cy.get("li").eq(0).should("have.id", "fn:1");
cy.get("a")
.eq(0)
.should("have.class", "footnote-backref")
.and("have.attr", "href", "#fnref1%3A1")
.and("have.attr", "rev", "footnote");
});
it("has no access to dashboard", function() {
cy.visit("/tm/settings");
cy.url().should("include", "/tm/login");
});
it("has proper markdown test page", function() {
cy.visit("/welcome/markdown-test");
cy.url().should("include", "/welcome/markdown-test");
/* has navigation element */
cy.get("nav").should("exist");
/* check if toc exists */
cy.get(".TOC").within(($toc) => {
/* check if a certain link in toc exists */
cy.get("a").eq(2).should("have.attr", "href", "#h-headlines");
});
/* check if corresponding anchor exists */
cy.get("#h-headlines").should("exist");
/* soft linebreaks */
cy.get("br").should("exist");
/* emphasis */
cy.get("em").should("exist");
/* strong */
cy.get("strong").should("exist");
/* ordered list */
cy.get("ol").should("exist");
/* linebreak */
cy.get("hr").should("exist");
/* links exists? hard to test, any idea? We need to wrap it in a div... */
/* images */
cy.get("img").eq(0).should("have.attr", "alt", "alt");
cy.get("img")
.eq(0)
.should("have.attr", "src")
.should("include", "media/files/markdown.png");
cy.get("figure")
.eq(2)
.should("have.id", "myid")
.and("have.class", "otherclass");
cy.get("img")
.eq(2)
.should("have.attr", "alt", "alt-text")
.and("have.attr", "title", "my title")
.and("have.attr", "width", "150px");
/* blockquote */
cy.get("blockquote").should("exist");
/* has navigation element */
cy.get(".notice1").should("exist");
cy.get(".notice2").should("exist");
cy.get(".notice3").should("exist");
/* footnote */
cy.get("sup").eq(0).should("have.id", "fnref1:1");
cy.get("sup")
.eq(0)
.within(($sup) => {
cy.get("a")
.eq(0)
.should("have.attr", "href", "#fn%3A1")
.and("have.class", "footnote-ref");
});
/* abbreviation */
cy.get("abbr").should("exist");
/* definition list */
cy.get("dl").should("exist");
/* table */
cy.get("table").should("exist");
/* code */
cy.get("pre").should("exist");
cy.get("code").should("exist");
/* math */
cy.get(".math").should("exist");
/* footnote end */
cy.get(".footnotes").within(($footnotes) => {
cy.get("li").eq(0).should("have.id", "fn:1");
cy.get("a")
.eq(0)
.should("have.class", "footnote-backref")
.and("have.attr", "href", "#fnref1%3A1")
.and("have.attr", "rev", "footnote");
});
});
});
});
});

View File

@ -1,101 +1,97 @@
describe("Typemill System Settings", function() {
before(function() {
cy.visit("/tm/login");
cy.url().should("include", "/tm/login");
describe("Typemill System Settings", function () {
before(function () {
cy.loginTypemill();
cy.get('input[name="username"]').type("trendschau");
cy.get('input[name="password"]').type("password");
cy.visit("/tm/settings");
cy.url().should("include", "/tm/settings");
});
cy.get("form").submit();
cy.url().should("include", "/tm/content");
cy.getCookie("typemill-session").should("exist");
beforeEach(function () {
Cypress.Cookies.preserveOnce("typemill-session");
});
cy.visit("/tm/settings");
cy.url().should("include", "/tm/settings");
});
after(function () {
cy.logoutTypemill();
});
beforeEach(function() {
Cypress.Cookies.preserveOnce("typemill-session");
});
it("validates the form", function () {
// fill out valid data
cy.get('input[name="settings[title]"]')
.clear()
.type("Cypress<?")
.should("have.value", "Cypress<?")
.and("have.attr", "required");
it("validates the form", function() {
// fill out valid data
cy.get('input[name="settings[title]"]')
.clear()
.type("Cypress<?")
.should("have.value", "Cypress<?")
.and("have.attr", "required");
// fill out valid data
cy.get('input[name="settings[author]"]')
.clear()
.type("trendschau")
.should("have.value", "trendschau");
// fill out valid data
cy.get('input[name="settings[author]"]')
.clear()
.type("trendschau")
.should("have.value", "trendschau");
// fill out copyright data
cy.get('select[name="settings[copyright]"]')
.select("CC-BY")
.should("have.value", "CC-BY");
// fill out copyright data
cy.get('select[name="settings[copyright]"]')
.select("CC-BY")
.should("have.value", "CC-BY");
// fill out valid data
cy.get('input[name="settings[year]"]')
.clear()
.type("2017")
.should("have.value", "2017")
.and("have.attr", "required");
// fill out valid data
cy.get('input[name="settings[year]"]')
.clear()
.type("2017")
.should("have.value", "2017")
.and("have.attr", "required");
// fill out copyright data
cy.get('select[name="settings[language]"]')
.select("German")
.should("have.value", "de");
// fill out copyright data
cy.get('select[name="settings[language]"]')
.select("German")
.should("have.value", "de");
// submit form
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Please correct the errors");
});
// submit form
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Please correct the errors");
});
it("changes default values", function () {
// fill out valid data
cy.get('input[name="settings[title]"]')
.clear()
.type("Cypress")
.should("have.value", "Cypress")
.and("have.attr", "required");
it("changes default values", function() {
// fill out valid data
cy.get('input[name="settings[title]"]')
.clear()
.type("Cypress")
.should("have.value", "Cypress")
.and("have.attr", "required");
// fill out valid data
cy.get('input[name="settings[author]"]')
.clear()
.type("robot")
.should("have.value", "robot");
// fill out valid data
cy.get('input[name="settings[author]"]')
.clear()
.type("robot")
.should("have.value", "robot");
cy.get('select[name="settings[copyright]"]')
.select("CC-BY-ND")
.should("have.value", "CC-BY-ND");
cy.get('select[name="settings[copyright]"]')
.select("CC-BY-ND")
.should("have.value", "CC-BY-ND");
// fill out copyright data
cy.get('select[name="settings[language]"]')
.select("English")
.should("have.value", "en");
// fill out copyright data
cy.get('select[name="settings[language]"]')
.select("English")
.should("have.value", "en");
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Settings are stored");
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Settings are stored");
// fill out valid data
cy.get('input[name="settings[title]"]').should("have.value", "Cypress");
// fill out valid data
cy.get('input[name="settings[title]"]').should("have.value", "Cypress");
// fill out valid data
cy.get('input[name="settings[author]"]').should("have.value", "robot");
// fill out valid data
cy.get('input[name="settings[author]"]').should("have.value", "robot");
// fill out copyright data
cy.get('select[name="settings[copyright]"]').should(
"have.value",
"CC-BY-ND"
);
// fill out copyright data
cy.get('select[name="settings[copyright]"]').should(
"have.value",
"CC-BY-ND"
);
// fill out valid data
cy.get('input[name="settings[year]"]').should("have.value", "2017");
// fill out valid data
cy.get('input[name="settings[year]"]').should("have.value", "2017");
// fill out copyright data
cy.get('select[name="settings[language]"]').should("have.value", "en");
});
});
// fill out copyright data
cy.get('select[name="settings[language]"]').should("have.value", "en");
});
});

View File

@ -1,149 +1,141 @@
describe("Typemill Theme Settings", function() {
before(function() {
cy.clearCookies();
});
describe("Typemill Theme Settings", function () {
before(function () {
cy.clearCookies();
});
beforeEach(function() {
cy.visit("/tm/login");
cy.url().should("include", "/tm/login");
beforeEach(function () {
cy.loginTypemill();
cy.get('input[name="username"]').type("trendschau");
cy.get('input[name="password"]').type("password");
cy.visit("/tm/themes");
cy.url().should("include", "/tm/themes");
});
cy.get("form").submit();
cy.url().should("include", "/tm/content");
cy.getCookie("typemill-session").should("exist");
afterEach(function () {
cy.logoutTypemill();
});
cy.visit("/tm/themes");
cy.url().should("include", "/tm/themes");
});
it("changes default values", function () {
// open the form
cy.get("#cyanine-toggle").should("contain", "Settings").click();
afterEach(function() {
cy.visit("/tm/logout");
});
// fill out valid data
cy.get('input[name="cyanine[introButtonLink]"]')
.clear()
.type("https://typemill.net")
.should("have.value", "https://typemill.net");
it("changes default values", function() {
// open the form
cy.get("#cyanine-toggle").should("contain", "Settings").click();
// fill out valid data
cy.get('input[name="cyanine[introButtonLabel]"]')
.clear()
.type("Typemill")
.should("have.value", "Typemill");
// fill out valid data
cy.get('input[name="cyanine[introButtonLink]"]')
.clear()
.type("https://typemill.net")
.should("have.value", "https://typemill.net");
// fill out valid data
cy.get('input[name="cyanine[chapnum]"]')
.should("not.be.checked")
.and("not.be.visible")
.check({ force: true })
.should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[introButtonLabel]"]')
.clear()
.type("Typemill")
.should("have.value", "Typemill");
// fill out valid data
cy.get('input[name="cyanine[authorPosition][top]"]')
.should("not.be.checked")
.and("not.be.visible")
.check({ force: true })
.should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[chapnum]"]')
.should("not.be.checked")
.and("not.be.visible")
.check({ force: true })
.should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[authorIntro]"]')
.clear()
.type("Writer")
.should("have.value", "Writer");
// fill out valid data
cy.get('input[name="cyanine[authorPosition][top]"]')
.should("not.be.checked")
.and("not.be.visible")
.check({ force: true })
.should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[datePosition][bottom]"]')
.should("not.be.checked")
.and("not.be.visible")
.check({ force: true })
.should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[authorIntro]"]')
.clear()
.type("Writer")
.should("have.value", "Writer");
// fill out valid data
cy.get('input[name="cyanine[dateIntro]"]')
.clear()
.type("Final update")
.should("have.value", "Final update");
// fill out valid data
cy.get('input[name="cyanine[datePosition][bottom]"]')
.should("not.be.checked")
.and("not.be.visible")
.check({ force: true })
.should("be.checked");
cy.get('select[name="cyanine[dateFormat]"]')
.should("have.value", "m/d/Y")
.select("m/d/Y")
.should("have.value", "m/d/Y");
// fill out valid data
cy.get('input[name="cyanine[dateIntro]"]')
.clear()
.type("Final update")
.should("have.value", "Final update");
cy.get('input[name="cyanine[gitPosition][top]"]')
.should("not.be.checked")
.and("not.be.visible")
.check({ force: true })
.should("be.checked");
cy.get('select[name="cyanine[dateFormat]"]')
.should("have.value", "m/d/Y")
.select("m/d/Y")
.should("have.value", "m/d/Y");
cy.get('input[name="cyanine[gitLink]"]')
.clear()
.type("https://github.com/typemill/docs")
.should("have.value", "https://github.com/typemill/docs");
cy.get('input[name="cyanine[gitPosition][top]"]')
.should("not.be.checked")
.and("not.be.visible")
.check({ force: true })
.should("be.checked");
cy.get("#theme-cyanine").submit();
cy.get("#flash-message").should("contain", "Settings are stored");
cy.get('input[name="cyanine[gitLink]"]')
.clear()
.type("https://github.com/typemill/docs")
.should("have.value", "https://github.com/typemill/docs");
// fill out valid data
cy.get('input[name="cyanine[introButtonLink]"]').should(
"have.value",
"https://typemill.net"
);
cy.get("#theme-cyanine").submit();
cy.get("#flash-message").should("contain", "Settings are stored");
// fill out valid data
cy.get('input[name="cyanine[introButtonLabel]"]').should(
"have.value",
"Typemill"
);
// fill out valid data
cy.get('input[name="cyanine[introButtonLink]"]').should(
"have.value",
"https://typemill.net"
);
// fill out valid data
cy.get('input[name="cyanine[chapnum]"]').should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[introButtonLabel]"]').should(
"have.value",
"Typemill"
);
// fill out valid data
cy.get('input[name="cyanine[authorPosition][top]"]').should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[chapnum]"]').should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[authorIntro]"]').should("have.value", "Writer");
// fill out valid data
cy.get('input[name="cyanine[authorPosition][top]"]').should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[datePosition][bottom]"]').should("be.checked");
// fill out valid data
cy.get('input[name="cyanine[authorIntro]"]').should("have.value", "Writer");
// fill out valid data
cy.get('input[name="cyanine[dateIntro]"]').should(
"have.value",
"Final update"
);
// fill out valid data
cy.get('input[name="cyanine[datePosition][bottom]"]').should("be.checked");
cy.get('select[name="cyanine[dateFormat]"]').should("have.value", "m/d/Y");
// fill out valid data
cy.get('input[name="cyanine[dateIntro]"]').should(
"have.value",
"Final update"
);
cy.get('input[name="cyanine[gitPosition][top]"]').should("be.checked");
cy.get('select[name="cyanine[dateFormat]"]').should("have.value", "m/d/Y");
cy.get('input[name="cyanine[gitLink]"]').should(
"have.value",
"https://github.com/typemill/docs"
);
});
cy.get('input[name="cyanine[gitPosition][top]"]').should("be.checked");
it("validates input", function () {
// open the form
cy.get("#cyanine-toggle").should("contain", "Settings").click();
cy.get('input[name="cyanine[gitLink]"]').should(
"have.value",
"https://github.com/typemill/docs"
);
});
// fill out invalid data
cy.get('input[name="cyanine[introButtonLabel]"]')
.should("have.value", "Typemill")
.clear()
.type("Kapitel<?")
.should("have.value", "Kapitel<?");
it("validates input", function() {
// open the form
cy.get("#cyanine-toggle").should("contain", "Settings").click();
// submit form
cy.get("#theme-cyanine").submit();
// fill out invalid data
cy.get('input[name="cyanine[introButtonLabel]"]')
.should("have.value", "Typemill")
.clear()
.type("Kapitel<?")
.should("have.value", "Kapitel<?");
// submit form
cy.get("#theme-cyanine").submit();
cy.get("#flash-message").should("contain", "Please correct the errors");
});
});
cy.get("#flash-message").should("contain", "Please correct the errors");
});
});

View File

@ -1,308 +0,0 @@
describe('Blox Editor', function()
{
before(function ()
{
cy.visit('/tm/login')
cy.url().should('include','/tm/login')
cy.get('input[name="username"]').type('trendschau')
cy.get('input[name="password"]').type('password')
cy.get('form').submit()
cy.url().should('include','/tm/content')
cy.getCookie('typemill-session').should('exist')
cy.visit('/tm/content/visual')
cy.url().should('include','/tm\/content\/visual')
})
beforeEach(function ()
{
Cypress.Cookies.preserveOnce('typemill-session')
})
it('creates new page', function()
{
// click on add element
cy.get('.addNaviItem > a').eq(0).click()
/* Check dublicates cannot be made */
/* Check new page can be created */
cy.get('.addNaviForm').within(($naviform) =>{
/* add Testpage into input */
cy.get('input')
.clear()
.type('Testpage')
.should('have.value', 'Testpage')
cy.get('.b-left').click()
})
/* get Navilist */
cy.get('.navi-list')
.should('contain', 'Testpage')
.eq(2).find('a').should(($a) => {
expect($a).to.have.length(6)
expect($a[5].href).to.include('/welcome\/testpage')
})
})
it('edits default content', function()
{
cy.visit('/tm/content/visual/welcome/testpage')
cy.url().should('include','/tm\/content\/visual\/welcome\/testpage')
cy.get('#blox').within(($blox) => {
/* Change Title */
cy.get('#blox-0').click()
cy.get("input")
.clear()
.type("This is my Testpage")
cy.get(".edit").click()
cy.get('#blox-0').should("contain", "This is my Testpage")
/* Change Text */
cy.get('#blox-1').click()
cy.get("textarea")
.clear()
.type("This is the new paragraph for the first line with some text.")
cy.get(".edit").click()
cy.get('#blox-1').should("contain", "new paragraph")
})
})
it('edits paragraph', function()
{
cy.get('#blox').within(($blox) => {
/* Get Format Bar */
cy.get('.format-bar').within(($formats) => {
/* Edit Table */
cy.get("button").eq(0).click()
cy.get("textarea")
.type("This is a second paragraph.")
/* save table */
cy.get(".edit").click()
cy.get(".cancel").click()
})
cy.get('#blox-2').should("contain", "second paragraph")
})
})
it('edits headline', function()
{
cy.get('#blox').within(($blox) => {
/* Get Format Bar */
cy.get('.format-bar').within(($formats) => {
/* Edit Table */
cy.get("button").eq(1).click()
cy.get("input")
.type("Second Level Headline")
/* save block */
cy.get(".edit").click()
/* close new standard textarea */
cy.get(".cancel").click()
})
cy.get('#blox-3').should("contain", "Second Level Headline")
})
})
it('edits unordered list', function()
{
cy.get('#blox').within(($blox) => {
/* Get Format Bar */
cy.get('.format-bar').within(($formats) => {
/* Edit Table */
cy.get("button").eq(2).click()
cy.get("textarea")
.type("first list item{enter}second list item")
/* save block */
cy.get(".edit").click()
/* close new standard textarea */
cy.get(".cancel").click()
})
cy.get('#blox-4').within(($block) => {
cy.get("li").should(($lis) => {
expect($lis).to.have.length(2)
expect($lis.eq(0)).to.contain('first list item')
})
})
})
})
it('edits ordered list', function()
{
cy.get('#blox').within(($blox) => {
/* Get Format Bar */
cy.get('.format-bar').within(($formats) => {
/* Edit Table */
cy.get("button").eq(3).click()
cy.get("textarea")
.type("first ordered item{enter}second ordered item")
/* save block */
cy.get(".edit").click()
/* close new standard textarea */
cy.get(".cancel").click()
})
cy.get('#blox-5').within(($block) => {
cy.get("li").should(($lis) => {
expect($lis).to.have.length(2)
expect($lis.eq(0)).to.contain('first ordered item')
})
})
})
})
it('edits table', function()
{
cy.get('#blox').within(($blox) => {
/* Get Format Bar */
cy.get('.format-bar').within(($formats) => {
/* Edit Table */
cy.get("button").eq(4).click()
cy.get("table").within(($table) => {
/* edit table head */
cy.get("tr").eq(1).within(($row) => {
cy.get("th").eq(1).click()
.clear()
.type("first Headline")
cy.get("th").eq(2).click()
.clear()
.type("Second Headline")
})
/* edit first content row */
cy.get("tr").eq(2).within(($row) => {
cy.get("td").eq(1).click()
.clear()
.type("Some")
cy.get("td").eq(2).click()
.clear()
.type("More")
})
/* edit second content row */
cy.get("tr").eq(3).within(($row) => {
cy.get("td").eq(1).click()
.clear()
.type("Beautiful")
cy.get("td").eq(2).click()
.clear()
.type("Content")
})
/* add new column on the right */
cy.get("tr").eq(0).within(($row) => {
cy.get("td").eq(2).click()
cy.get(".actionline").eq(0).click()
})
})
cy.get("table").within(($table) => {
/* edit second new column head */
cy.get("tr").eq(1).within(($row) => {
cy.get("th").eq(3).click()
.clear()
.type("New Head")
})
/* edit second new column head */
cy.get("tr").eq(2).within(($row) => {
cy.get("td").eq(3).click()
.clear()
.type("With")
})
/* edit second new column head */
cy.get("tr").eq(3).within(($row) => {
cy.get("td").eq(3).click()
.clear()
.type("new Content")
})
})
/* save table */
cy.get(".edit").click()
})
cy.get('#blox-6').should("contain", "Beautiful").click()
cy.get('.editactive').within(($activeblock) => {
cy.get('.component').should("contain", "Beautiful")
})
})
})
it('Publishes new page', function()
{
cy.visit('/tm/content/visual/welcome/testpage')
cy.url().should('include','/tm\/content\/visual\/welcome\/testpage')
cy.get('#publish').click().wait(500)
cy.visit('/welcome/testpage')
cy.url().should('include','/welcome/testpage')
cy.get('.cy-nav')
.should('contain', 'Testpage')
})
it('has sitemap xml', function ()
{
cy.request({
url: '/cache/sitemap.xml',
})
.then((resp) => {
/* should return xml-format */
expect(resp.headers).to.have.property('content-type','application/xml')
})
})
it('Deletes new page', function()
{
cy.visit('/tm/content/visual/welcome/testpage')
cy.url().should('include','/tm\/content\/visual\/welcome\/testpage')
cy.get('.danger').click()
cy.get('#modalWindow').within(($modal) => {
cy.get('button').click()
})
cy.visit('/tm/content/visual/welcome')
cy.get('.navi-list')
.not('contain', 'Testpage')
.eq(2).find('a').should(($a) => {
expect($a).to.have.length(5)
})
})
})

View File

@ -0,0 +1,259 @@
describe("Blox Editor", function () {
before(function () {
cy.loginTypemill();
cy.visit("/tm/content/visual");
cy.url().should("include", "/tm/content/visual");
});
beforeEach(function () {
Cypress.Cookies.preserveOnce("typemill-session");
});
it("creates new page", function () {
// click on add element
cy.get(".addNaviItem > a").eq(0).click();
/* Check dublicates cannot be made */
/* Check new page can be created */
cy.get(".addNaviForm").within((naviform) => {
/* add Testpage into input */
cy.get("input").clear().type("Testpage").should("have.value", "Testpage");
cy.get(".b-left").click();
});
/* get Navilist */
cy.get(".navi-list")
.should("contain", "Testpage")
.eq(2)
.find("a")
.should((a) => {
expect(a).to.have.length(6);
expect(a[5].href).to.include("/welcome/testpage");
});
});
it("edits default content", function () {
cy.visit("/tm/content/visual/welcome/testpage");
cy.url().should("include", "/tm/content/visual/welcome/testpage");
cy.get("#blox").within((blox) => {
/* Change Title */
cy.get("#blox-0").click();
cy.get("input").clear().type("This is my Testpage");
cy.get(".edit").click();
cy.get("#blox-0").should("contain", "This is my Testpage");
/* Change Text */
cy.get("#blox-1").click();
cy.get("textarea")
.clear()
.type("This is the new paragraph for the first line with some text.");
cy.get(".edit").click();
cy.get("#blox-1").should("contain", "new paragraph");
});
});
it("edits paragraph", function () {
cy.get("#blox").within((blox) => {
/* Get Format Bar */
cy.get(".format-bar").within((formats) => {
/* Edit Table */
cy.get("button").eq(0).click();
cy.get("textarea").type("This is a second paragraph.");
/* save table */
cy.get(".edit").click();
cy.get(".cancel").click();
});
cy.get("#blox-2").should("contain", "second paragraph");
});
});
it("edits headline", function () {
cy.get("#blox").within((blox) => {
/* Get Format Bar */
cy.get(".format-bar").within((formats) => {
/* Edit Table */
cy.get("button").eq(1).click();
cy.get("input").type("Second Level Headline");
/* save block */
cy.get(".edit").click();
/* close new standard textarea */
cy.get(".cancel").click();
});
cy.get("#blox-3").should("contain", "Second Level Headline");
});
});
it("edits unordered list", function () {
cy.get("#blox").within((blox) => {
/* Get Format Bar */
cy.get(".format-bar").within((formats) => {
/* Edit Table */
cy.get("button").eq(2).click();
cy.get("textarea").type("first list item{enter}second list item");
/* save block */
cy.get(".edit").click();
/* close new standard textarea */
cy.get(".cancel").click();
});
cy.get("#blox-4").within((block) => {
cy.get("li").should((lis) => {
expect(lis).to.have.length(2);
expect(lis.eq(0)).to.contain("first list item");
});
});
});
});
it("edits ordered list", function () {
cy.get("#blox").within((blox) => {
/* Get Format Bar */
cy.get(".format-bar").within((formats) => {
/* Edit Table */
cy.get("button").eq(3).click();
cy.get("textarea").type("first ordered item{enter}second ordered item");
/* save block */
cy.get(".edit").click();
/* close new standard textarea */
cy.get(".cancel").click();
});
cy.get("#blox-5").within((block) => {
cy.get("li").should((lis) => {
expect(lis).to.have.length(2);
expect(lis.eq(0)).to.contain("first ordered item");
});
});
});
});
it("edits table", function () {
cy.get("#blox").within((blox) => {
/* Get Format Bar */
cy.get(".format-bar").within((formats) => {
/* Edit Table */
cy.get("button").eq(4).click();
cy.get("table").within((table) => {
/* edit table head */
cy.get("tr")
.eq(1)
.within((row) => {
cy.get("th").eq(1).click().clear().type("first Headline");
cy.get("th").eq(2).click().clear().type("Second Headline");
});
/* edit first content row */
cy.get("tr")
.eq(2)
.within((row) => {
cy.get("td").eq(1).click().clear().type("Some");
cy.get("td").eq(2).click().clear().type("More");
});
/* edit second content row */
cy.get("tr")
.eq(3)
.within((row) => {
cy.get("td").eq(1).click().clear().type("Beautiful");
cy.get("td").eq(2).click().clear().type("Content");
});
/* add new column on the right */
cy.get("tr")
.eq(0)
.within((row) => {
cy.get("td").eq(2).click();
cy.get(".actionline").eq(0).click();
});
});
cy.get("table").within((table) => {
/* edit second new column head */
cy.get("tr")
.eq(1)
.within((row) => {
cy.get("th").eq(3).click().clear().type("New Head");
});
/* edit second new column head */
cy.get("tr")
.eq(2)
.within((row) => {
cy.get("td").eq(3).click().clear().type("With");
});
/* edit second new column head */
cy.get("tr")
.eq(3)
.within((row) => {
cy.get("td").eq(3).click().clear().type("new Content");
});
});
/* save table */
cy.get(".edit").click();
});
cy.get("#blox-6").should("contain", "Beautiful").click();
cy.get(".editactive").within((activeblock) => {
cy.get(".component").should("contain", "Beautiful");
});
});
});
it("Publishes new page", function () {
cy.visit("/tm/content/visual/welcome/testpage");
cy.url().should("include", "/tm/content/visual/welcome/testpage");
cy.get("#publish").click().wait(500);
cy.visit("/welcome/testpage");
cy.url().should("include", "/welcome/testpage");
cy.get(".cy-nav").should("contain", "Testpage");
});
it("has sitemap xml", function () {
cy.request({
url: "/cache/sitemap.xml",
}).then((resp) => {
/* should return xml-format */
expect(resp.headers).to.have.property("content-type", "application/xml");
});
});
it("Deletes new page", function () {
cy.visit("/tm/content/visual/welcome/testpage");
cy.url().should("include", "/tm/content/visual/welcome/testpage");
cy.get(".danger").click();
cy.get("#modalWindow").within((modal) => {
cy.get("button").click();
});
cy.visit("/tm/content/visual/welcome");
cy.get(".navi-list")
.not("contain", "Testpage")
.eq(2)
.find("a")
.should((a) => {
expect(a).to.have.length(5);
});
});
});

View File

@ -1,4 +1,4 @@
const fs = require("fs");
const fs = require("fs-extra");
/// <reference types="cypress" />
// ***********************************************************
@ -19,16 +19,30 @@ const fs = require("fs");
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
on("task", {
resetSetup() {
fs.rmSync("settings/users", { recursive: true, force: true });
fs.rmSync("settings/settings.yaml");
fs.copyFileSync(
"cypress/fixtures/01_setup/default-settings.yaml",
"settings/settings.yaml"
);
on("task", {
resetSetup() {
const users = "settings/users";
const settings = "settings/settings.yaml";
// of course files need to exist in order to perform a delete
if (fs.existsSync(settings) && fs.existsSync(users)) {
fs.rmSync(users, { recursive: true, force: true });
fs.rmSync(settings);
fs.copyFileSync(
"cypress/fixtures/01_setup/default-settings.yaml",
"settings/settings.yaml"
);
}
return null;
},
});
};
return null;
},
prepopulateSetup() {
const settings = "settings";
const settingsFixture =
"cypress/fixtures/01_setup/prepulate_settings_seed/settings";
// of course files need to exist in order to perform a delete
fs.copySync(settingsFixture, settings);
return null;
},
});
};

View File

@ -23,3 +23,19 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
Cypress.Commands.add("loginTypemill", () => {
cy.visit("/tm/login");
cy.url().should("include", "/tm/login");
cy.get('input[name="username"]').type("trendschau");
cy.get('input[name="password"]').type("password");
cy.get("form").submit();
cy.url().should("include", "/tm/content");
cy.getCookie("typemill-session").should("exist");
});
Cypress.Commands.add("logoutTypemill", () => {
cy.visit("/tm/logout");
});

41
package-lock.json generated Normal file
View File

@ -0,0 +1,41 @@
{
"name": "typemill",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"fs-extra": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
"integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
"dev": true,
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
}
},
"graceful-fs": {
"version": "4.2.9",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz",
"integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==",
"dev": true
},
"jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
}
},
"universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==",
"dev": true
}
}
}

23
package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "typemill",
"version": "1.0.0",
"description": "TYPEMILL is a lightweight flat file cms for micro-publishers. You can use it for documentations, manuals, special interest websites, and any other information-driven web-project. You can also enhance Typemill with plugins and generate professional e-books in pdf-format with it. The website http://typemill.net runs with Typemill.",
"main": "index.js",
"scripts": {
"e2e": "cypress open --project .",
"install-and-e2e": "npm i && composer update && cypress open --project ."
},
"repository": {
"type": "git",
"url": "git+https://github.com/typemill/typemill.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/typemill/typemill/issues"
},
"homepage": "https://github.com/typemill/typemill#readme",
"devDependencies": {
"fs-extra": "^10.0.1"
}
}