Skip to content

Commit

Permalink
Anton cypress (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
stutlerxgod authored Oct 30, 2023
1 parent 6737d8f commit 77a87c8
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 85 deletions.
12 changes: 9 additions & 3 deletions cypress/commands/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,19 @@ Cypress.Commands.add('api_waitPageLoad', (pagePart: string = 'main', idLicence?:
let url = ''
switch (pagePart){
case 'main':
url = `http://core-dam.sme.localhost/api/adm/v1/asset/licence/${idLicence}/search?*`
url = `${CY.url.proto}://core-dam.${CY.url.domain}/api/adm/v1/asset/licence/${idLicence}/search?*`
break
case 'asset-edit':
url = 'http://core-dam.sme.localhost/api/adm/v1/user?*'
url = `${CY.url.proto}://core-dam.${CY.url.domain}/api/adm/v1/user?*`
break
case 'licence-unknown':
url = 'http://core-dam.sme.localhost/api/adm/v1/configuration/ext-system/*'
url = `${CY.url.proto}://core-dam.${CY.url.domain}/api/adm/v1/configuration/ext-system/*`
break
case 'keyword':
url = `${CY.url.proto}://core-dam.${CY.url.domain}/api/adm/v1/keyword/*`
break
case 'author':
url = `${CY.url.proto}://core-dam.${CY.url.domain}/api/adm/v1/author/*`
break
default:
throw new Error(`${pagePart} is unknown param`)
Expand Down
3 changes: 2 additions & 1 deletion cypress/commands/license.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Cypress.Commands.add('duplicateShouldExist', (value: boolean) => {
})

Cypress.Commands.add('changeLicence', (idLicence: string) => {
cy.getCy('button-manage-licence').should('be.visible').click()
cy.getCy('button-main').should('be.visible').click()
cy.getCy('button-switch-licence').should('be.visible').click()
cy.getCy('field-change-on-id-licence').type(`${idLicence}`)
cy.getCyVisibleClick('button-confirm')
cy.api_waitPageLoad('main', idLicence)
Expand Down
27 changes: 9 additions & 18 deletions cypress/e2e/assetDuplicateLicence/audioLicenceDuplicate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { CY } from '../../utils/common'
import { AUDIO_TYPES } from '../../utils/upload'
let idLicence = ''
const FILE_ID: Array<string> = []

const main_licence = '100000'
const cms32630_licence = '200010'
describe(`Test asset audio licence duplicate function, Env: ${CY.cfg}`,
{ tags: '@assetAudioLicence', env: { visitBaseUrl: false } }, () => {
it('Prepare Test Data', ()=> {
Expand All @@ -14,16 +14,8 @@ describe(`Test asset audio licence duplicate function, Env: ${CY.cfg}`,
})
it('Cms-sys | CMS licence', () => {
cy.visit('/asset')
cy.api_waitPageLoad('licence-unknown')
idLicence = '100000'
cy.getCy('button-manage-licence', 60000).should('be.visible')
.invoke('text')
.then((text)=>{
const actualLicence = text.trim()
if (actualLicence !== 'CMS licence'){
cy.changeLicence(idLicence)
}
})
cy.api_waitPageLoad('main', main_licence)

let idx = 0
AUDIO_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('audio', dataFormat, idx, FILE_ID)
Expand All @@ -33,9 +25,9 @@ describe(`Test asset audio licence duplicate function, Env: ${CY.cfg}`,
})
it('CMS-sys | cms32630',()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '200010' // cms32630
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', main_licence)
cy.changeLicence(cms32630_licence)

let idx = 0
AUDIO_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('audio', dataFormat, idx, FILE_ID)
Expand All @@ -48,8 +40,7 @@ describe(`Test asset audio licence duplicate function, Env: ${CY.cfg}`,
})
it('Back to main cms licence', ()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '100000'
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', cms32630_licence)
cy.changeLicence(main_licence)
})
})
27 changes: 9 additions & 18 deletions cypress/e2e/assetDuplicateLicence/documentLicenceDuplicate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { CY } from '../../utils/common'
import { DOCUMENT_TYPES } from '../../utils/upload'
let idLicence = ''
const FILE_ID: Array<string> = []

const main_licence = '100000'
const cms32630_licence = '200010'
describe(`Test asset document licence duplicate function, Env: ${CY.cfg}`,
{ tags: '@assetDocLicence', env: { visitBaseUrl: false } }, () => {
it('Prepare Test Data', ()=> {
Expand All @@ -15,16 +15,8 @@ describe(`Test asset document licence duplicate function, Env: ${CY.cfg}`,
})
it('Cms-sys | CMS licence', () => {
cy.visit('/asset')
cy.api_waitPageLoad('licence-unknown')
idLicence = '100000'
cy.getCy('button-manage-licence', 6000).should('be.visible')
.invoke('text')
.then((text)=>{
const actualLicence = text.trim()
if (actualLicence !== 'CMS licence'){
cy.changeLicence(idLicence)
}
})
cy.api_waitPageLoad('main', main_licence)

let idx = 0
DOCUMENT_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('document', dataFormat, idx, FILE_ID)
Expand All @@ -34,9 +26,9 @@ describe(`Test asset document licence duplicate function, Env: ${CY.cfg}`,
})
it('CMS-sys | cms32630',()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '200010' // cms32630
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', main_licence)
cy.changeLicence(cms32630_licence)

let idx = 0
DOCUMENT_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('document', dataFormat, idx, FILE_ID)
Expand All @@ -49,8 +41,7 @@ describe(`Test asset document licence duplicate function, Env: ${CY.cfg}`,
})
it('Back to main cms licence', ()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '100000'
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', cms32630_licence)
cy.changeLicence(main_licence)
})
})
41 changes: 17 additions & 24 deletions cypress/e2e/assetDuplicateLicence/imageLicenceDuplicate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import { CY } from '../../utils/common'
import { IMAGE_TYPES } from '../../utils/upload'
let idLicence = ''
const FILE_ID: Array<string> = []

const main_licence = '100000'
const cms32630_licence = '200010'
const slonik_licence= '100003'
const pixel_licence = '100005'
describe(`Test asset image licence duplicate function, Env: ${CY.cfg}`,
{ tags: '@assetImageLicence', env: { visitBaseUrl: false } }, () => {
it('Prepare Test Data', ()=> {
Expand All @@ -15,16 +17,8 @@ describe(`Test asset image licence duplicate function, Env: ${CY.cfg}`,
})
it('Cms-sys | CMS licence', () => {
cy.visit('/asset')
cy.api_waitPageLoad('licence-unknown')
idLicence = '100000'
cy.getCy('button-manage-licence', 6000).should('be.visible')
.invoke('text')
.then((text)=>{
const actualLicence = text.trim()
if (actualLicence !== 'CMS licence'){
cy.changeLicence('main', idLicence)
}
})
cy.api_waitPageLoad('main', main_licence)

let idx = 0
IMAGE_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('image', dataFormat, idx, FILE_ID)
Expand All @@ -34,9 +28,9 @@ describe(`Test asset image licence duplicate function, Env: ${CY.cfg}`,
})
it('CMS-sys | cms32630',()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '200010' // cms32630
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', main_licence)
cy.changeLicence(cms32630_licence)

let idx = 0
IMAGE_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('image', dataFormat, idx, FILE_ID)
Expand All @@ -46,9 +40,9 @@ describe(`Test asset image licence duplicate function, Env: ${CY.cfg}`,
})
it('Blog-sys | Slonik:PHPckar',()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '100003' // Slonik: PHPckar
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', cms32630_licence)
cy.changeLicence(slonik_licence)

let idx = 0
IMAGE_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('image', dataFormat, idx, FILE_ID)
Expand All @@ -58,9 +52,9 @@ describe(`Test asset image licence duplicate function, Env: ${CY.cfg}`,
})
it('Blog-sys | Pixel',()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '100005' // Pixel
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', slonik_licence)
cy.changeLicence(pixel_licence)

let idx = 0
IMAGE_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('image', dataFormat, idx, FILE_ID)
Expand All @@ -73,8 +67,7 @@ describe(`Test asset image licence duplicate function, Env: ${CY.cfg}`,
})
it('Back to main cms licence', ()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '100000'
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', slonik_licence)
cy.changeLicence(main_licence)
})
})
25 changes: 7 additions & 18 deletions cypress/e2e/assetDuplicateLicence/videoLicenceDuplicate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { CY } from '../../utils/common'
import { VIDEO_TYPES } from '../../utils/upload'
let idLicence = ''
const FILE_ID: Array<string> = []

const main_licence = '100000'
const cms32630_licence = '200010'
describe(`Test asset video licence duplicate function, Env: ${CY.cfg}`,
{ tags: '@assetVideoLicence', env: { visitBaseUrl: false } }, () => {
it('Prepare Test Data', ()=> {
Expand All @@ -13,16 +13,7 @@ describe(`Test asset video licence duplicate function, Env: ${CY.cfg}`,
})
it('Cms-sys | CMS licence', () => {
cy.visit('/asset')
cy.api_waitPageLoad('licence-unknown')
idLicence = '100000'
cy.getCy('button-manage-licence', 6000).should('be.visible')
.invoke('text')
.then((text)=>{
const actualLicence = text.trim()
if (actualLicence !== 'CMS licence'){
cy.changeLicence('main', idLicence)
}
})
cy.api_waitPageLoad('main', main_licence)
let idx = 0
VIDEO_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('video', dataFormat, idx, FILE_ID)
Expand All @@ -32,9 +23,8 @@ describe(`Test asset video licence duplicate function, Env: ${CY.cfg}`,
})
it('CMS-sys | cms32630',()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '200010' // cms32630
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', main_licence)
cy.changeLicence(cms32630_licence)
let idx = 0
VIDEO_TYPES.forEach((dataFormat)=>{
cy.checkDuplicate('video', dataFormat, idx, FILE_ID)
Expand All @@ -47,8 +37,7 @@ describe(`Test asset video licence duplicate function, Env: ${CY.cfg}`,
})
it('Back to main cms licence', ()=>{
cy.visit('/asset')
cy.api_waitPageLoad('main', idLicence)
idLicence = '100000'
cy.changeLicence(idLicence)
cy.api_waitPageLoad('main', cms32630_licence)
cy.changeLicence(main_licence)
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/assets/videoAsset.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe(`Test asset video function, Env: ${CY.cfg}`,
AUTHORS.forEach(author => {
cy.get('body').click()
cy.get('[data-cy="custom-field-authors"] input').type(`${author}`)
cy.contains('.v-list-item', `${author}`, { timeout: 6000 }).click()
cy.contains('.v-list-item', `${author}`, { timeout: 6000 }).click({ force: true })
})
cy.get('body').type('{esc}')
cy.getCy('button-delete').click()
Expand Down
29 changes: 29 additions & 0 deletions cypress/e2e/navigation/headerNavigation.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/// <reference types="cypress" />

import { CY } from '../../utils/common'

describe(`Test header navigation menu function, Env: ${CY.cfg}`,
{ tags: '@assetAudioLicence', env: { visitBaseUrl: true } }, () => {
it('Test Settings Navigation menu', () => {
cy.api_waitPageLoad('main')
cy.getCy('button-main').should('be.visible').click()
cy.getCy('button-main-empty-asset').should('be.visible').click()
cy.get('.v-toolbar-title').invoke('text')
.should('contain', 'Vytvoriť prázdny asset')
cy.getCy('button-close').should('be.visible').click()
cy.getCy('button-main-podcast').should('be.visible').click()
cy.urlContains('podcast')
cy.getCy('back-to-assets-settings').should('be.visible').click()
cy.getCy('button-main').should('be.visible').click()
cy.getCy('button-main-video-show').click()
cy.urlContains('video-show')
cy.getCy('back-to-assets-settings').should('be.visible').click()
cy.getCy('button-main').should('be.visible').click()
cy.getCy('button-switch-licence').click()
cy.get('.v-toolbar-title').invoke('text')
.should('contain', 'Prepnutie externého systému')
cy.getCy('button-cancel').should('be.visible').click()
cy.getCy('button-settings').click()
cy.urlContains('settings')
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/settings/groupPermission.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe(
cy.alertMessage(ALERT_CREATE)
cy.contains(`${PERMISSION_GROUP}`).click()
cy.cardLoad()
cy.getCy('copy-text', 8000)
cy.getCy('copy-text', 12000)
.invoke('text')
.then((text) => {
cy.urlContains(text)
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/settings/job.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe(`Test job function, Env: ${CY.cfg}`, { tags: '@job', env: { visitBaseUr
cy.contains('.v-list-item', JOB_SYNC)
cy.contains('.v-list-item', JOB_DELETE).click()
cy.getCy('targetUser').type(CY.credentials.admin.id)
cy.get('#switch-92').click()
cy.get('.v-input__control [id^=switch-]').click()
cy.get('.v-card-actions > .bg-primary').click()
cy.alertMessage(ALERT_CREATE)
cy.getCyVisibleClick('filter-reset')
Expand Down
1 change: 1 addition & 0 deletions src/views/coreDam/asset/components/AssetCreateButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const { assetTypeOptions } = useAssetType()
<VListItem
:title="t('coreDam.asset.meta.createEmpty')"
prepend-icon="mdi-plus"
data-cy="button-main-empty-asset"
@click.stop="onClick"
/>
<VDialog v-model="dialog">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import AssetToolbarExtSystemLicenceDialog
withDefaults(
defineProps<{
variant?: 'main' | 'settings'
dataCy?: string
}>(),
{
variant: 'main',
dataCy: undefined,
}
)
Expand Down Expand Up @@ -50,6 +52,7 @@ const openDialog = () => {
icon
size="small"
class="mx-1"
data-cy="button-main"
>
<VIcon icon="mdi-view-grid-plus-outline" />
<VMenu activator="parent">
Expand All @@ -64,13 +67,15 @@ const openDialog = () => {
:to="{ name: ROUTE.DAM.PODCAST.LIST }"
:title="t('system.mainBar.podcasts')"
prepend-icon="mdi-podcast"
data-cy="button-main-podcast"
/>
</Acl>
<Acl :permission="ACL.DAM_VIDEO_SHOW_UI">
<VListItem
:to="{ name: ROUTE.DAM.VIDEO_SHOW.LIST }"
:title="t('system.mainBar.videoShows')"
prepend-icon="mdi-video"
data-cy="button-main-video-show"
/>
</Acl>
<VDivider />
Expand Down

0 comments on commit 77a87c8

Please sign in to comment.