diff --git a/frontend-e2e/cypress/e2e/role_admin/sections.cy.js b/frontend-e2e/cypress/e2e/role_admin/sections.cy.js index 5c047349..3fb7c6e5 100644 --- a/frontend-e2e/cypress/e2e/role_admin/sections.cy.js +++ b/frontend-e2e/cypress/e2e/role_admin/sections.cy.js @@ -29,14 +29,23 @@ reordering of sections. Functionalities to be tested: */ import test_traditions from '../../fixtures/test_traditions.json'; +import users from '../../fixtures/users.json'; +const admin = users.filter(({username}) => username === 'admin@example.org')[0]; beforeEach(() => { cy.visit(`${Cypress.env('CY_STEMMAWEB_FRONTEND_URL')}/`); + cy.viewport(1600, 900); + test_traditions.sort( (tradition_a, tradition_b) => tradition_a.title.localeCompare( tradition_b.title ) ); + cy.loginViaUi(admin); +}); + +afterEach(() => { + cy.logoutViaUi(); }); // count sections of each (public) tradition is correct describe('Each tradition should have the right number of sections listed in the toc', () => { - it.skip('under construction', () => { // to do: user rights and db initial state. + it.skip('under construction', () => { // to do: db initial state. // TODO: number of sections currently varies in course of other test(s) // TODO: switch the lines (to filter 'Public' traditions) when user rights are implemented: // test_traditions.filter(({access}) => access === 'Public').forEach((tradition) => { @@ -46,7 +55,7 @@ describe('Each tradition should have the right number of sections listed in the // assert that the number of sections visible in the toc correponds to that in the list of traditions // TODO: add issue to scroll tradition-list, otherwise it is - // not possible to access tratition titles and sections at the + // not possible to access tradition titles and sections at the // bottom of the list. Preliminary solution here: lengthen viewport. cy.viewport(1000, 990); diff --git a/frontend-e2e/cypress/e2e/role_admin/stemwebdialog.cy.js b/frontend-e2e/cypress/e2e/role_admin/stemwebdialog.cy.js index d915e93a..8f48c084 100644 --- a/frontend-e2e/cypress/e2e/role_admin/stemwebdialog.cy.js +++ b/frontend-e2e/cypress/e2e/role_admin/stemwebdialog.cy.js @@ -49,6 +49,12 @@ const admin = users.filter(({username}) => username === 'admin@example.org')[0]; beforeEach(() => { cy.visit(`${Cypress.env('CY_STEMMAWEB_FRONTEND_URL')}/`); cy.viewport(1600, 900); + test_traditions.sort( (tradition_a, tradition_b) => tradition_a.title.localeCompare( tradition_b.title ) ); + cy.loginViaUi(admin); +}); + +afterEach(() => { + cy.logoutViaUi(); }); describe('Stemweb dialog should work properly', () => { @@ -281,24 +287,25 @@ describe('stemma editor tools and svg work properly', () => { // get the graph's svg again and assert the number of its edges to be one more than before cy.get('div#graph > svg').find('g.edge').should('have.length', countedges+1); // 21 - // save it -- needs login - // reset v at the end // cy.log('old val: ' + v); + // TODO: save it -- needs login + // TODO: reset v at the end // cy.log('old val: ' + v); }); }); }); describe('stemma editing error feedback in message console works properly', () => { it('passes', () => { // needs login - if (Cypress.env('CY_MODE') === 'headed') { // only log in if headed. dont run this test headless because it needs to be logged in // TODO: also for headless mode + // if (Cypress.env('CY_MODE') === 'headed') { // only log in if headed. dont run this test headless because it needs to be logged in // TODO: also for headless mode // TODO: when fitted also for healess mode, merge with previous test (partly duplicate) - cy.loginViaUi(admin); + // cy.loginViaUi(admin); - // To do: assert that the message console lists unexpected errors + // TODO: assert that the message console lists unexpected errors // when editing a stemma and e.g. removing [class=extant] after one of the nodes, // it should not be possible to save it, and // there should appear a message in the console panel saying "Error: BAD REQUEST; Witness [witness name here] not marked as either hypothetical or extant" // access stemma dot for editing + // TODO: test a tradition with a smaller graph / shorter dot file, for speeding up test let tradition = test_traditions.find(trad => trad.title.startsWith('Notre besoin')); cy.log('tradition.title: ' + tradition.title); // click on the tradition title within the tradition list @@ -395,10 +402,10 @@ describe('stemma editing error feedback in message console works properly', () = cy.get('#message-console-text-panel').contains(msg_err); cy.get('#message-console-text-panel').contains(msg_ok); - // Test also the CANCEL button + // TODO: Test also the CANCEL button }); - cy.logoutViaUi(); - } + // cy.logoutViaUi(); + // } }); }); diff --git a/frontend-e2e/cypress/e2e/role_admin/traditions.cy.js b/frontend-e2e/cypress/e2e/role_admin/traditions.cy.js index 34bf1048..51f7cedc 100644 --- a/frontend-e2e/cypress/e2e/role_admin/traditions.cy.js +++ b/frontend-e2e/cypress/e2e/role_admin/traditions.cy.js @@ -25,9 +25,18 @@ Cypress tests to be added: */ import test_traditions from '../../fixtures/test_traditions.json'; +import users from '../../fixtures/users.json'; +const admin = users.filter(({username}) => username === 'admin@example.org')[0]; beforeEach(() => { cy.visit(`${Cypress.env('CY_STEMMAWEB_FRONTEND_URL')}/`); + cy.viewport(1600, 900); + test_traditions.sort( (tradition_a, tradition_b) => tradition_a.title.localeCompare( tradition_b.title ) ); + cy.loginViaUi(admin); +}); + +afterEach(() => { + cy.logoutViaUi(); }); // count sections of each (public) tradition is correct