From 9e6aae13b9977a6b24f7b06014a0f45cfed1a123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Mon, 17 Jul 2023 19:02:50 +0200 Subject: [PATCH] Remove dangling out of place Guillotina Cypress tests (#4980) --- cypress/tests/core/guillotina/autologin.js | 18 --- cypress/tests/core/guillotina/blocks-text.js | 88 --------------- cypress/tests/core/guillotina/content.js | 110 ------------------- cypress/tests/core/guillotina/history.js | 33 ------ cypress/tests/core/guillotina/login.js | 9 -- cypress/tests/core/guillotina/sharing.js | 32 ------ news/4980.internal | 1 + 7 files changed, 1 insertion(+), 290 deletions(-) delete mode 100644 cypress/tests/core/guillotina/autologin.js delete mode 100644 cypress/tests/core/guillotina/blocks-text.js delete mode 100644 cypress/tests/core/guillotina/content.js delete mode 100644 cypress/tests/core/guillotina/history.js delete mode 100644 cypress/tests/core/guillotina/login.js delete mode 100644 cypress/tests/core/guillotina/sharing.js create mode 100644 news/4980.internal diff --git a/cypress/tests/core/guillotina/autologin.js b/cypress/tests/core/guillotina/autologin.js deleted file mode 100644 index fce720381b..0000000000 --- a/cypress/tests/core/guillotina/autologin.js +++ /dev/null @@ -1,18 +0,0 @@ -describe('Autologin Tests', () => { - it('Autologin as an standalone test', function () { - const api_url = 'http://127.0.0.1:8081/db/web'; - const user = 'admin'; - const password = 'admin'; - - cy.request({ - method: 'POST', - url: `${api_url}/@login`, - headers: { Accept: 'application/json' }, - body: { login: user, password: password }, - }).then((response) => cy.setCookie('auth_token', response.body.token)); - - cy.visit('/'); - cy.get('#toolbar-personal').click(); - cy.get('#toolbar-logout'); - }); -}); diff --git a/cypress/tests/core/guillotina/blocks-text.js b/cypress/tests/core/guillotina/blocks-text.js deleted file mode 100644 index 334c3b3c32..0000000000 --- a/cypress/tests/core/guillotina/blocks-text.js +++ /dev/null @@ -1,88 +0,0 @@ -describe('Text Block Tests', () => { - beforeEach(() => { - // given a logged in editor and a page in edit mode - cy.autologin(); - cy.visit('/'); - cy.createContent({ - contentType: 'Document', - contentId: 'my-page', - contentTitle: 'My Page', - }); - cy.visit('/my-page'); - cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); - cy.waitForResourceToLoad('my-page'); - cy.navigate('/my-page/edit'); - }); - - it('As editor I can add a text block', () => { - // when I add a text block - cy.getSlate(true).focus().click().type('My text').contains('My text'); - cy.get('#toolbar-save').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-page'); - cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); - cy.waitForResourceToLoad('my-page'); - - // then the page view should contain the text block - cy.get('#page-document').contains('My text'); - }); - - it('As editor I can add a link to a text block', function () { - // when I create a link - cy.getSlate(true) - .focus() - .click() - .type('Colorless green ideas sleep furiously.') - .setSlateSelection('furiously'); - cy.clickSlateButton('Add link'); - cy.get('.slate-toolbar .link-form-container input').type( - 'https://google.com{enter}', - ); - cy.get('#toolbar-save').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-page'); - cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); - cy.waitForResourceToLoad('my-page'); - - // then the page view should contain a link - cy.contains('Colorless green ideas sleep furiously.'); - cy.get('#page-document p a') - .should('have.attr', 'href') - .and('include', 'https://google.com'); - }); - - it('As editor I can add a mailto link to a text block', function () { - cy.getSlateTitle().focus().click(); - - // when I create a mailto link - cy.getSlate(true) - .focus() - .click() - .type('Colorless green ideas sleep furiously.') - .setSlateSelection('furiously'); - cy.clickSlateButton('Add link'); - cy.get('.slate-toolbar .link-form-container input').type( - 'mailto:hello@example.com{enter}', - ); - cy.get('#toolbar-save').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-page'); - cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); - cy.waitForResourceToLoad('my-page'); - - // then the page view should contain a mailto link - cy.contains('Colorless green ideas sleep furiously.'); - cy.get('#page-document p a') - .should('have.attr', 'href') - .and('include', 'mailto:hello@example.com'); - }); -}); diff --git a/cypress/tests/core/guillotina/content.js b/cypress/tests/core/guillotina/content.js deleted file mode 100644 index eaa4da5c8e..0000000000 --- a/cypress/tests/core/guillotina/content.js +++ /dev/null @@ -1,110 +0,0 @@ -describe('Add Content Tests', () => { - beforeEach(() => { - // give a logged in editor and the site root - cy.autologin(); - cy.visit('/'); - cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); - cy.waitForResourceToLoad(''); - }); - it('As editor I can add a page', function () { - // when I add a page - cy.get('#toolbar-add').click(); - cy.get('#toolbar-add-document').click(); - cy.getSlateTitle().focus().click().type('My Page').contains('My Page'); - - // then I a new page has been created - cy.get('#toolbar-save').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-page'); - cy.contains('My Page'); - }); - it('As editor I can add a page with a text block', function () { - // when I add a page with a text block - cy.get('#toolbar-add').click(); - cy.get('#toolbar-add-document').click(); - cy.getSlateTitle().focus().click().type('My Page').contains('My Page'); - cy.getSlateEditorAndType('This is the text').contains('This is the text'); - cy.get('#toolbar-save').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-page'); - - // then a new page with a text block has been added - cy.contains('My Page'); - cy.contains('This is the text'); - }); - it('As editor I can add a file', function () { - // when I add a file - cy.get('#toolbar-add').click(); - cy.get('#toolbar-add-file').click(); - - cy.get('.formtabs.menu').contains('default').click(); - - cy.get('input[name="title"]') - .type('My File') - .should('have.value', 'My File'); - - // Guillotina wants the file handler instead than the base64 encoding - cy.fixture('file.pdf').then((fileContent) => { - cy.get('#field-file').attachFile( - { fileContent, fileName: 'file.pdf', mimeType: 'application/pdf' }, - { subjectType: 'input' }, - ); - }); - - cy.get('#toolbar-save').focus().click(); - - // then a new file should have been created - cy.url().should('eq', Cypress.config().baseUrl + '/my-file'); - cy.contains('My File'); - }); - - it('As editor I can add an image', function () { - // when I add an image - cy.get('#toolbar-add').click(); - cy.get('#toolbar-add-image').click(); - - cy.get('.formtabs.menu').contains('default').click(); - - cy.get('input[name="title"]') - .type('My image') - .should('have.value', 'My image'); - - // Guillotina wants the file handler instead than the base64 encoding - cy.fixture('image.png') - .then((fc) => { - return Cypress.Blob.base64StringToBlob(fc); - }) - .then((fileContent) => { - cy.get('#field-image').attachFile( - { fileContent, fileName: 'image.png', mimeType: 'image/png' }, - { subjectType: 'input' }, - ); - cy.get('#field-image-image').parent().parent().contains('image.png'); - }); - - cy.get('#toolbar-save').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-image'); - cy.contains('My image'); - }); - - describe('Actions', () => { - beforeEach(() => { - cy.autologin(); - }); - it('As editor I can add a Guillotina folder', function () { - cy.visit('/'); - cy.get('#toolbar-add').click(); - cy.get('#toolbar-add-cmsfolder').click(); - cy.getSlateTitle() - .focus() - .click() - .type('This is a guillotina folder') - .contains('This is a guillotina folder'); - - cy.get('#toolbar-save').click(); - - cy.contains('This is a guillotina folder'); - }); - }); -}); diff --git a/cypress/tests/core/guillotina/history.js b/cypress/tests/core/guillotina/history.js deleted file mode 100644 index 731131d0de..0000000000 --- a/cypress/tests/core/guillotina/history.js +++ /dev/null @@ -1,33 +0,0 @@ -describe('History Tests', () => { - beforeEach(() => { - // give a logged in editor and the site root - cy.autologin(); - cy.visit('/'); - cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); - cy.waitForResourceToLoad(''); - }); - it('As editor I can add a page and access history', function () { - // I add a page - cy.get('#toolbar-add').click(); - cy.get('#toolbar-add-document').click(); - cy.getSlateTitle().focus().click().type('My Page').contains('My Page'); - - // then a new page has been created - cy.get('#toolbar-save').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-page'); - - cy.contains('My Page'); - - // then I click on the Toolbar > More - cy.get('#toolbar-more').click(); - cy.get('.menu-more').contains('History'); - - // and then I click on History - cy.get('.menu-more a[href*="/history"]').contains('History').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-page/history'); - cy.contains('History of'); - }); -}); diff --git a/cypress/tests/core/guillotina/login.js b/cypress/tests/core/guillotina/login.js deleted file mode 100644 index dd6be74f03..0000000000 --- a/cypress/tests/core/guillotina/login.js +++ /dev/null @@ -1,9 +0,0 @@ -describe('Login Tests', () => { - it('As registered user I can login', function () { - cy.visit('/login'); - cy.get('#login').type('admin').should('have.value', 'admin'); - cy.get('#password').type('admin').should('have.value', 'admin'); - cy.get('#login-form-submit').click(); - cy.get('body').should('have.class', 'has-toolbar'); - }); -}); diff --git a/cypress/tests/core/guillotina/sharing.js b/cypress/tests/core/guillotina/sharing.js deleted file mode 100644 index 7b0dcbbdbc..0000000000 --- a/cypress/tests/core/guillotina/sharing.js +++ /dev/null @@ -1,32 +0,0 @@ -describe('Sharing Tests', () => { - beforeEach(() => { - // give a logged in editor and the site root - cy.autologin(); - cy.visit('/'); - cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); - cy.waitForResourceToLoad(''); - }); - it('As editor I can add a page and access sharing', function () { - // I add a page - cy.get('#toolbar-add').click(); - cy.get('#toolbar-add-document').click(); - cy.getSlateTitle().focus().click().type('My Page').contains('My Page'); - - // then a new page has been created - cy.get('#toolbar-save').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-page'); - cy.contains('My Page'); - - // then I click on the Toolbar > More - cy.get('#toolbar-more').click(); - cy.get('.menu-more').contains('Sharing'); - - // and then I click on History - cy.get('.menu-more a[href*="/sharing"]').contains('Sharing').click(); - cy.url().should('eq', Cypress.config().baseUrl + '/my-page/sharing'); - cy.contains('Sharing for'); - }); -}); diff --git a/news/4980.internal b/news/4980.internal new file mode 100644 index 0000000000..50a19b11ba --- /dev/null +++ b/news/4980.internal @@ -0,0 +1 @@ +Remove dangling out of place Guillotina Cypress tests @sneridagh