Skip to content

Commit

Permalink
update cy-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Napolskyi committed Dec 18, 2023
1 parent 7245ac3 commit 5e4b9fb
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 33 deletions.
1 change: 1 addition & 0 deletions cypress/commands/license.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Cypress.Commands.add('changeLicence', (idLicence: string) => {
cy.get(':nth-child(3) > .mx-1').should('be.visible').click()
cy.getCy('button-switch-licence').should('be.visible').click()
cy.getCy('field-change-on-id-licence').type(`${idLicence}`)
cy.waitSec(1)
cy.getCyVisibleClick('button-confirm')
cy.api_waitPageLoad('main', idLicence)
})
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/assetDuplicateLicence/imageLicenceDuplicate.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { IMAGE_TYPES } from '../../utils/upload'
const FILE_ID: Array<string> = []
const TESTED_LICENCE_IDS = {
CMS_MAIN: 100000,
BLOG1: 200250,
BLOG2: 200251,
BLOG1: 110000,
BLOG2: 110001,
} as const

describe(`Test asset image licence duplicate function, Env: ${CY.cfg}`,
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/assetEmpty/audioEmptyAsset.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe(`Test audio empty asset, Env: ${CY.cfg}`,
cy.circleLoad()

cy.visit(`/asset/${assetID}`)
cy.circleLoad()
cy.get('.dam-image-detail__sidebar [data-cy="custom-field-title"] textarea').eq(0)
.invoke('val').then((assetTitle)=>{
cy.wrap(assetTitle).should('include', ASSET_TITLE)
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/assetEmpty/documentAssetEmpty.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe(`Test document empty asset, Env: ${CY.cfg}`,
cy.circleLoad()

cy.visit(`/asset/${assetID}`)
cy.circleLoad()
cy.get('.dam-image-detail__sidebar [data-cy="custom-field-title"] textarea').eq(0)
.invoke('val').then((assetTitle)=>{
cy.wrap(assetTitle).should('include', ASSET_TITLE)
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/assetEmpty/imageAssetEmpty.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe(`Test image empty asset, Env: ${CY.cfg}`,
cy.getCy('button-save').should('be.visible').click()

cy.getCy('button-focus').should('be.visible').click()
cy.circleLoad()
cy.waitSec(1)
cy.get('.sidebar-info__content').invoke('text').then((sidebarText) => {
cy.wrap(sidebarText).should('include', 'Náhľady')
cy.wrap(sidebarText).should('include', 'Náhľad obrázku na mobile, počítači alebo v aplikácii')
Expand All @@ -52,6 +52,7 @@ describe(`Test image empty asset, Env: ${CY.cfg}`,
cy.circleLoad()

cy.visit(`/asset/${assetID}`)
cy.circleLoad()
cy.get('.dam-image-detail__sidebar [data-cy="custom-field-title"] textarea').eq(0)
.invoke('val').then((assetTitle)=>{
cy.wrap(assetTitle).should('include', ASSET_TITLE)
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/assetEmpty/videoAssetEmpty.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe(`Test video empty asset, Env: ${CY.cfg}`,
cy.circleLoad()

cy.visit(`/asset/${assetID}`)
cy.circleLoad()
cy.get('.dam-image-detail__sidebar [data-cy="custom-field-title"] textarea').eq(0)
.invoke('val').then((assetTitle)=>{
cy.wrap(assetTitle).should('include', ASSET_TITLE)
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/assets/audioAssetToPodcast.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe(`Test add audio asset to podcast episode function, Env: ${CY.cfg}`,
cy.getCy('button-add-new-podcast-episode').should('be.visible').click()
cy.getCy('field-choose-podcast').click()
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.get('.v-list-item').should('not.contain', 'Žiadne dostupne dáta')
cy.waitSec(1)
cy.get('.v-list-item').eq(0).click()
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.getCy('field-title-podcast').clear().type(`${ASSET_TITLE}-edit`)
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/assets/audioSlots.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe(`Test audio slots function, Env: ${CY.cfg}`,
cy.visit(`/asset/${ASSET_ID}`)
cy.api_waitPageLoad('asset-edit')
cy.getCy('button-slots').click()
cy.get('button.v-btn:contains("Znovu načítať sloty assetu")').click()
cy.get('button.v-btn:contains("Znovu načítať sloty assetu")').should('be.visible').click()
cy.getCy('button-open-link').should('not.exist')
cy.get('button.v-btn:contains("Nastaviť ako verejné")').click()
cy.waitSec(1)
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/assets/imageAsset.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ describe(`Test asset image function, Env: ${CY.cfg}`,
cy.visit(`/asset/${ASSET_ID}`)
cy.api_waitPageLoad('asset-edit')
cy.getCy('button-focus').click()
cy.waitSec(1)
cy.getCy('button-rotate-right').should('be.visible').click()
cy.alertMessage(ALERT_UPDATE)
cy.getCy('button-rotate-left').should('be.visible').click()
Expand Down
4 changes: 1 addition & 3 deletions cypress/e2e/assets/videoAssetToVideoShow.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ describe(`Test add video asset to video show episode function, Env: ${CY.cfg}`,
cy.getCy('button-video-show').should('be.visible').click()
cy.getCy('button-add-new-vs-episode').should('be.visible').click()
cy.getCy('field-choose-video-show').click()
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(500)
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.waitSec(1)
cy.get('.v-list-item').first().click()
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.getCy('field-title-episode').clear().type(`${VIDEO_SHOW_TITLE}-edit`)
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/distribution/audioDistribution.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const DISTRIBUTION_DATA={

describe(`Test distribution Audio function, Env: ${CY.cfg}`,
{ tags: ['@distributionAudio', '@distribution'] }, () => {
if (CY.cfg !== 'stg' && CY.cfg !== 'dev'){
it('Tests skipped - only possible in stg/dev env', ()=>{})
return
}
it('Prepare Test Data', () => {
cy.prepareData('audio/sample.mp3', 1, ASSET_ID)
})
Expand Down
6 changes: 5 additions & 1 deletion cypress/e2e/distribution/videoDistribution.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const DISTRIBUTION_DATA={

describe(`Test distribution Video function, Env: ${CY.cfg}`,
{ tags: ['@distributionVideo', '@distribution'] }, () => {
if (CY.cfg !== 'stg' && CY.cfg !== 'dev'){
it('Tests skipped - only possible in stg/dev env', ()=>{})
return
}
it('Prepare Test Data', () => {
cy.prepareData('video/sample.mp4', 1, ASSET_ID)
})
Expand Down Expand Up @@ -61,7 +65,7 @@ describe(`Test distribution Video function, Env: ${CY.cfg}`,
cy.getCy('button-close').click()

// Check status
cy.get(':nth-child(1) > .text-body-2 > :nth-child(2) > .v-col > .v-chip > .v-chip__content', { timeout: 90000 })
cy.get(':nth-child(1) > .text-body-2 > :nth-child(2) > .v-col > .v-chip > .v-chip__content', { timeout: 120000 })
.should('include.text', 'Distribuovaný') // Artemis Distribution
cy.get(':nth-child(2) > .text-body-2 > :nth-child(2) > .v-col > .v-chip > .v-chip__content', { timeout: 20000 })
.should('include.text', 'Distribuovaný') // YouTube distribution
Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/navigation/headerNavigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ describe(`Test header navigation menu function, Env: ${CY.cfg}`,
{ tags: ['@headerNavigation', '@navigation'], 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-btn .mdi-view-grid-plus-outline').should('be.visible').click()
cy.get('.v-list-item .mdi-plus').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.get('[href="/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.get('.v-btn .mdi-view-grid-plus-outline').should('be.visible').click()
cy.get('[href="/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.get('.v-btn .mdi-view-grid-plus-outline').should('be.visible').click()
cy.getCy('button-switch-licence').click()
cy.get('.v-toolbar-title').invoke('text')
.should('contain', 'Prepnutie externého systému')
Expand Down
22 changes: 20 additions & 2 deletions cypress/e2e/settings/distributionCategory.cy.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
/// <reference types="cypress" />

import { ALERT_CREATE, ALERT_UPDATE, CY, USER_FIRST_NAME } from '../../utils/common'
import { ALERT_CREATE, ALERT_UPDATE, CY, RAND_NUM, USER_FIRST_NAME } from '../../utils/common'

describe(
`Test distribution category function, Env: ${CY.cfg}`,
{ tags: ['@distributionCategory', '@settings'], env: { visitBaseUrl: false } }, () => {
if (CY.cfg === 'local'){
//if not - create
it('Create "Podcasty" in artemis_podcast_cms', () => {
cy.visit('/distribution-category-select')
cy.cardLoad()
cy.getCy('filter-value').click()
cy.get('.v-list-item').contains('Audio').click()
cy.cardLoad()
cy.get('.v-data-table__tr').contains('td', 'artemis_podcast_cms')
.parent('.v-data-table__tr').find('[data-cy="table-edit"]').click()
cy.cardLoad()
cy.getCy('button-add-option').click()
cy.getCy('option-name').last().type('Podcasty')
cy.getCy('option-id').last().type(RAND_NUM)
cy.getCyVisibleClick('button-save')
cy.alertMessage(ALERT_UPDATE)
})
}

it('Create distribution category', () => {
cy.visit('/settings')
cy.visitSubpage('distribution-category-settings', 'distribution-category', 'Kategórie distribúcie')
Expand All @@ -15,7 +34,6 @@ describe(
cy.getCy('category-name').should('be.visible').type(USER_FIRST_NAME)
cy.getCy('distribution-category-select').eq(1).click()
cy.get('.v-overlay__content > .v-list > .v-list-item').contains('Podcasty').click()
// cy.get('body').type('{ESC}')
cy.getCy('button-close').should('be.visible')
cy.getCy('button-cancel').should('be.visible')
cy.getCyVisibleClick('button-confirm')
Expand Down
4 changes: 4 additions & 0 deletions cypress/e2e/settings/distributionCategorySelect.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ describe(
cy.getCyVisibleClick('button-save')
cy.alertMessage(ALERT_UPDATE)
cy.getCyVisibleClick('button-close')
cy.cardLoad()
cy.urlNotContains('/edit')
cy.getCy('table-detail').first().click()
cy.cardLoad()
cy.urlContains(`${ID}`)
})
it('Delete distribution category select', () => {
cy.visit(`/distribution-category-select/${ID}/edit`)
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/settings/user.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
DISTRIBUTION_SERVICE,
EXTERNAL_SYS,
CY,
ALERT_UPDATE, RAND_NUM, USER_EMAIL, USER_ROLE, PERMISSION_GROUP, ALERT_CREATE,
ALERT_UPDATE, RAND_NUM, USER_EMAIL, USER_ROLE, ALERT_CREATE,
} from '../../utils/common'
let USER_ID = ''
describe(`Test user function, Env: ${CY.cfg}`,
Expand All @@ -21,8 +21,8 @@ describe(`Test user function, Env: ${CY.cfg}`,
cy.getCyVisibleClick('user-roles')
cy.contains('.v-list-item', USER_ROLE).click()
cy.getCy('create-panel').click('top')
cy.getCy('user-permissionGroups').type(PERMISSION_GROUP)
cy.contains('.v-list-item', PERMISSION_GROUP).click()
cy.getCy('user-permissionGroups').click()
cy.get('.v-overlay .v-list-item').first().click()
cy.getCy('create-panel').click('top')
cy.getCy('button-close').should('be.visible')
cy.getCy('button-cancel').should('be.visible')
Expand Down
5 changes: 2 additions & 3 deletions cypress/e2e/settings/userPermission.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
ALERT_UPDATE,
CY, JOB_DELETE,
JOB_SYNC,
PERMISSION_GROUP,
RAND_NUM,
USER_EMAIL,
USER_ROLE
Expand All @@ -25,8 +24,8 @@ describe(
cy.getCyVisibleClick('user-roles')
cy.contains('.v-list-item', USER_ROLE).click()
cy.getCy('create-panel').click('top')
cy.getCy('user-permissionGroups').type(PERMISSION_GROUP)
cy.contains('.v-list-item', PERMISSION_GROUP).click()
cy.getCy('user-permissionGroups').click()
cy.get('.v-overlay .v-list-item').first().click()
cy.getCy('create-panel').click('top')
cy.getCy('button-close').should('be.visible')
cy.getCy('button-cancel').should('be.visible')
Expand Down
6 changes: 0 additions & 6 deletions cypress/e2e/upload/example

This file was deleted.

4 changes: 2 additions & 2 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ beforeEach(function () {
CY.loginUser,
() => {
//Setup protection cookie based on env
//cy.protectionCookie()
cy.protectionCookie()
//Login with provided user
cy.login(CY.loginUser)
cy.changeToSlovakDarkTheme()
Expand All @@ -32,5 +32,5 @@ beforeEach(function () {
}
)
cy.clipboardPermission()
cy.visitBaseUrl(CY.visitBaseUrl, 10000)
cy.visitBaseUrl(CY.visitBaseUrl, 30000)
})
1 change: 0 additions & 1 deletion cypress/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ export const ALERT_UPLOAD = 'Nahrávanie ukončené'
export const JOB_DELETE = 'Výmaz používateľových dát'
export const JOB_SYNC = 'Podcastový synchronizátor'
export const USER_ROLE = 'Super Admin'
export const PERMISSION_GROUP = 'DAM full access (redakcia)'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@vuelidate/validators": "^2.0.3",
"@vueuse/core": "10.2.1",
"@vueuse/integrations": "10.2.1",
"axios": "^1.4.0",
"axios": "^1.6.2",
"core-js": "^3.31.0",
"js-sha1": "^0.6.0",
"jwt-decode": "^3.1.2",
Expand Down

0 comments on commit 5e4b9fb

Please sign in to comment.