1
0
mirror of https://github.com/typemill/typemill.git synced 2025-07-28 09:50:37 +02:00

make tests easier

This commit is contained in:
Mysteriedev
2022-03-06 18:29:23 +01:00
parent 51ea4c71dc
commit 637cf4b77d
6 changed files with 491 additions and 618 deletions

View File

@@ -1,129 +1,51 @@
setup: false
language: en
welcome: false
title: Cypress
author: robot
copyright: CC-BY-ND
year: '2017'
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
- markdown
- headline
- ulist
- olist
- table
- quote
- notice
- image
- video
- file
- toc
- hr
- definition
- code
- shortcode
access: null
pageaccess: null
hrdelimiter: null
restrictionnotice: ''
restrictionnotice: ""
wraprestrictionnotice: null
headlineanchors: null
displayErrorDetails: null
twigcache: null
proxy: null
trustedproxies: ''
trustedproxies: ""
headersoff: null
urlschemes: ''
urlschemes: ""
svg: null
recoverpw: null
recoverfrom: ''
recoversubject: ''
recovermessage: ''
recoverfrom: ""
recoversubject: ""
recovermessage: ""
securitylog: null
oldslug: null
refreshcache: null
pingsitemap: null
images:
live:
width: '820'
logo: ''
favicon: ''
theme: cyanine
themes:
cyanine:
layoutsize: standard
blogfolder: ''
landingpage: 'on'
landingpageIntro: '1'
introTitle: ''
introMarkdown: ''
introButtonLink: 'https://typemill.net'
introButtonLabel: Typemill
introImageOpacity: ''
landingpageInfo: ''
infoMarkdown: ''
landingpageTeaser: ''
teaser1title: ''
teaser1text: ''
teaser1link: ''
teaser1label: ''
teaser2title: ''
teaser2text: ''
teaser2link: ''
teaser2label: ''
teaser3title: ''
teaser3text: ''
teaser3link: ''
teaser3label: ''
landingpageContrast: ''
contrastTitle: ''
contrastText: ''
contrastLink: ''
contrastLabel: ''
landingpageNavi: '2'
naviTitle: 'Get Started'
naviDepth: ''
landingpageNews: ''
newsHeadline: ''
newsFolder: ''
newsLabel: ''
authorPosition:
top: 'on'
authorIntro: Writer
datePosition:
bottom: 'on'
dateIntro: 'Final update'
dateFormat: m/d/Y
gitPosition:
top: 'on'
gitLink: 'https://github.com/typemill/docs'
editText: ''
printText: ''
chapnum: 'on'
expand: ''
collapse: ''
next: ''
previous: ''
footer1: ''
footer2: ''
footer3: ''
copyrightlinetext: ''
font: 'BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif'
fontheadline: 'BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif'
fontnavi: 'BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif'
brandcolorprimary: ''
fontcolorprimary: ''
newsbackground: ''
newscolor: ''
brandcolortertiary: ''
fontcolortertiary: ''
bordercolortertiary: ''
fontcolorlink: ''
brandcolorsecondary: ''
fontcolorsecondary: ''
codebackground: ''
codecolor: ''
contentnavihoverbackground: ''
contentnavihovercolor: ''
thinbordercolor: ''
live:
width: "820"
logo: ""
favicon: ""

View File

@@ -1,101 +1,93 @@
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");
});
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");
beforeEach(function() {
Cypress.Cookies.preserveOnce("typemill-session");
});
// fill out valid data
cy.get('input[name="settings[author]"]')
.clear()
.type("trendschau")
.should("have.value", "trendschau");
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 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[author]"]')
.clear()
.type("trendschau")
.should("have.value", "trendschau");
// 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[copyright]"]')
.select("CC-BY")
.should("have.value", "CC-BY");
// fill out copyright data
cy.get('select[name="settings[language]"]')
.select("German")
.should("have.value", "de");
// fill out valid data
cy.get('input[name="settings[year]"]')
.clear()
.type("2017")
.should("have.value", "2017")
.and("have.attr", "required");
// submit form
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Please correct the errors");
});
// fill out copyright data
cy.get('select[name="settings[language]"]')
.select("German")
.should("have.value", "de");
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");
// submit form
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Please correct the errors");
});
// fill out valid data
cy.get('input[name="settings[author]"]')
.clear()
.type("robot")
.should("have.value", "robot");
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");
cy.get('select[name="settings[copyright]"]')
.select("CC-BY-ND")
.should("have.value", "CC-BY-ND");
// fill out valid data
cy.get('input[name="settings[author]"]')
.clear()
.type("robot")
.should("have.value", "robot");
// fill out copyright data
cy.get('select[name="settings[language]"]')
.select("English")
.should("have.value", "en");
cy.get('select[name="settings[copyright]"]')
.select("CC-BY-ND")
.should("have.value", "CC-BY-ND");
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Settings are stored");
// fill out copyright data
cy.get('select[name="settings[language]"]')
.select("English")
.should("have.value", "en");
// fill out valid data
cy.get('input[name="settings[title]"]').should("have.value", "Cypress");
cy.get("form").submit();
cy.get("#flash-message").should("contain", "Settings are stored");
// fill out valid data
cy.get('input[name="settings[author]"]').should("have.value", "robot");
// fill out valid data
cy.get('input[name="settings[title]"]').should("have.value", "Cypress");
// 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[author]"]').should("have.value", "robot");
// fill out valid data
cy.get('input[name="settings[year]"]').should("have.value", "2017");
// 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 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

@@ -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");
});