-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add login and logout for all tests run as admin
- Loading branch information
Showing
3 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 === '[email protected]')[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); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,12 @@ const admin = users.filter(({username}) => username === '[email protected]')[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(); | ||
// } | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 === '[email protected]')[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 | ||
|