1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- export function getNextcloudHeader() {
- return cy.get('#header')
- }
- export function getNextcloudUserMenu() {
- return getNextcloudHeader().find('#user-menu')
- }
- export function getNextcloudUserMenuToggle() {
- return getNextcloudUserMenu().find('.header-menu__trigger').should('have.length', 1)
- }
- export function clearState() {
-
- cy.runOccCommand('group:list --output=json').then(($result) => {
- const groups = Object.keys(JSON.parse($result.stdout)).filter((name) => name !== 'admin')
- groups.forEach((groupID) => cy.runOccCommand(`group:delete '${groupID}'`))
- })
- cy.runOccCommand('user:list --output=json').then(($result) => {
- const users = Object.keys(JSON.parse($result.stdout)).filter((name) => name !== 'admin')
- users.forEach((userID) => cy.runOccCommand(`user:delete '${userID}'`))
- })
- }
- export function installTestApp() {
- const testAppPath = 'cypress/fixtures/testapp'
- cy.runOccCommand('-V').then((output) => {
- const version = output.stdout.match(/(\d\d+)\.\d+\.\d+/)?.[1]
- cy.wrap(version).should('not.be.undefined')
- cy.exec(`docker cp '${testAppPath}' nextcloud-cypress-tests-server:/var/www/html/apps`, { log: true })
- cy.exec(`docker exec nextcloud-cypress-tests-server sed -i -e 's|-version="[0-9]\\+|-version="${version}|g' apps/testapp/appinfo/info.xml`)
- cy.runOccCommand('app:enable --force testapp')
- })
- }
- export function uninstallTestApp() {
- cy.runOccCommand('app:remove testapp', { failOnNonZeroExit: false })
- cy.exec('docker exec nextcloud-cypress-tests-server rm -fr apps/testapp/appinfo/info.xml')
- }
|