Skip to content

Commit

Permalink
adding and deleting sections ok in local headless and headed mode
Browse files Browse the repository at this point in the history
  • Loading branch information
schiwaa committed Jan 24, 2025
1 parent 7a911d4 commit 1b91ab5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions frontend-e2e/cypress/e2e/role_admin/sections.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import users from '../../fixtures/users.json';
const admin = users.filter(({username}) => username === '[email protected]')[0];

beforeEach(() => {
cy.reseedDB();
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 ) );
Expand Down Expand Up @@ -68,17 +69,13 @@ describe('Each tradition should have the right number of sections listed in the
});

describe('Section handling works correcly in the tradition list and the section properties area', () => {
it('passes in local headed mode', () => { // under construction: relative path to sections file in headless mode
// reseed db
cy.reseedDB();

it('passes', () => {
// input string for the test section to be added
const new_section_name = 'NEW SECTION BY CY';


// relative path starting from frontend-e2e folder in local headed mode
const new_section_rel_path = './../bin/init-data/stemmarest/data/florilegium_z.csv';
// TODO: check if there is a standard cy way to refer to relative paths
// relative path to the section file which is going to be added for teesting
const new_section_rel_path = (Cypress.browser.isHeaded) ? './../bin/init-data/stemmarest/data/florilegium_z.csv' : './cypress/.initdata4headless/data/florilegium_z.csv';

// test with one tradition which has a few sections
// add and delete a section so that the final sections and their orders equal the initial ones
Expand Down Expand Up @@ -169,6 +166,7 @@ describe('Section handling works correcly in the tradition list and the section
expect($ele.text().trim()).not.contains(new_section_name);
});
*/
cy.wait(1000); // obviously necessary here before logout
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion frontend-e2e/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Cypress.Commands.add('loginViaUi', (userObj) => {
cy.contains('header a', 'Sign in').click();
cy.get('#loginEmail').wait(500).type(userObj.username, { delay: 50 });
cy.get('#loginPassword').wait(500).type(userObj.password, { delay: 50 });
cy.wait(500);
cy.get('button').contains('Sign in').wait(500).click();
cy.get('#authModal').should('not.be.visible');
cy.contains('Logged in as ' + userObj.username);
Expand All @@ -40,7 +41,6 @@ Cypress.Commands.add('loginViaUi', (userObj) => {

// Logout via user interface
Cypress.Commands.add('logoutViaUi', () => {
cy.log("Cypress.browser.isHeaded? " + Cypress.browser.isHeaded);
cy.contains('header a', 'Sign out').click();
cy.contains('header a', 'Sign in');
cy.get('header').should('not.contain', 'Sign out');
Expand Down

0 comments on commit 1b91ab5

Please sign in to comment.