-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enh(api): js wrapper for collectives api
Wrap all usage of the collectives api in a simple functional interface. This will allow us to change the layout of the api and only update it in a single place. Separate the API handling from the store. The api is concerned with axios and generateUrl while the store is only concerned with the current state of the app. Accept multiple arguments to `pagesUrl` and join them with `/` to build the url: Example: ```js api.pagesUrl({collectiveId: 10}, 'trash', 12) ``` results in `/apps/collectives/_api/10/_pages/trash/12` Use the api directly in the cypress commands. That way we do not require the page to be loaded. Also extract `collective-edit-mode.spec.js` from `pages.spec.js`. It requires a different beforeEach function to seed the edit mode before visiting the collective. Signed-off-by: Max <[email protected]>
- Loading branch information
1 parent
ae7c973
commit e697fe1
Showing
24 changed files
with
513 additions
and
247 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
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
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* @copyright Copyright (c) 2021 Azul <[email protected]> | ||
* | ||
* @author Azul <[email protected]> | ||
* | ||
* @license AGPL-3.0-or-later | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
describe('Collective page mode', function() { | ||
|
||
before(function() { | ||
cy.loginAs('bob') | ||
cy.deleteAndSeedCollective('Our Garden') | ||
.seedPage('Day 1', '', 'Readme.md') | ||
.seedPage('Day 2', '', 'Readme.md') | ||
}) | ||
|
||
beforeEach(function() { | ||
cy.loginAs('bob') | ||
}) | ||
|
||
describe('Changing page mode', function() { | ||
it('Opens edit mode per default', function() { | ||
cy.seedCollectivePageMode('Our Garden', 1) | ||
cy.visit('/apps/collectives/Our Garden') | ||
// make sure the page list loaded properly | ||
cy.contains('.app-content-list-item a', 'Day 1') | ||
cy.openPage('Day 2') | ||
cy.getEditor() | ||
.should('be.visible') | ||
cy.getReadOnlyEditor() | ||
.should('not.be.visible') | ||
}) | ||
|
||
it('Opens view mode per default', function() { | ||
cy.seedCollectivePageMode('Our Garden', 0) | ||
cy.visit('/apps/collectives/Our Garden') | ||
// make sure the page list loaded properly | ||
cy.contains('.app-content-list-item a', 'Day 1') | ||
cy.openPage('Day 2') | ||
cy.getReadOnlyEditor() | ||
.should('be.visible') | ||
cy.getEditor() | ||
.should('not.be.visible') | ||
}) | ||
}) | ||
}) |
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.