Skip to content

Commit

Permalink
Merge pull request #140 from anzusystems/anton-cypress
Browse files Browse the repository at this point in the history
Anton cypress
  • Loading branch information
stutlerxgod authored Oct 2, 2023
2 parents 107b2f5 + cdac3f7 commit bf037a7
Show file tree
Hide file tree
Showing 33 changed files with 272 additions and 259 deletions.
4 changes: 3 additions & 1 deletion bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ docker_env_vars

if [ -f /.dockerenv ]; then
env-config
echo "[INFO] Starting yarn install and build"
echo "[INFO] Starting yarn install"
yarn install
echo "[INFO] Starting yarn build"
yarn build
echo -e "\n\033[1;33m[INFO] Build ready:\033[0m http://$(hostname):${NGINX_PORT}\n"
exit
fi

Expand Down
11 changes: 6 additions & 5 deletions cypress/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@ Cypress.Commands.add('protectionCookie', () => {

Cypress.Commands.add('login', (user: string, password?: string, timeout?: number) => {
if (user != 'anonym') {
if ('forceLoginLink' in CY.credential[user]) {
cy.visit(CY.credential[user].forceLoginLink, { timeout: timeout })
if (CY.credentials[user].isForceLogin === true) {
cy.visit(CY.credentials[user].forceLoginLink, { timeout: timeout })
} else {
cy.visit('/')
cy.getCy('login-form').should('be.visible')
cy.getCy('username').type(CY.credential[user].name || user)
cy.getCy('password').type(CY.credential[user].password || password)
cy.getCy('login-form').should('be.visible') // central.sme.localhost
cy.getCy('username').type(CY.credentials[user].name || user)
cy.getCy('password').type(CY.credentials[user].password || password)
cy.getCyVisibleClick('button-login')
}
}

})

export {}
2 changes: 1 addition & 1 deletion cypress/commands/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Cypress.Commands.add('urlNotContains', (string: string) => {
Cypress.Commands.add('alertMessage', (message: string) => {
cy.log(`Expect alert message: ${message}`)
cy.get('.v-alert').should('be.visible').and('contain.text', `${message}`)
cy.get('.v-alert__close').click()
cy.get('.mdi-close').eq(0).click()
})

Cypress.Commands.add('visitBaseUrl', (value?: boolean, timeout?: number) => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/commands/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Cypress.Commands.add('verifyFileType', (fileID: string, fileGroup: 'image' | 'au
if (fileType.includes('mp3')) return 'mpeg'
else if (fileType.includes('mov')) return 'quicktime'
else if (fileType.includes('avi')) return 'x-msvideo'
else if (fileType.includes('m4a')) return 'mp4'
//else if (fileType.includes('m4a')) return 'mp4' // until bug is fixed
else return fileType
}

Expand Down
4 changes: 2 additions & 2 deletions cypress/config/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default defineConfig({
viewportHeight: 1080,
viewportWidth: 1920,
env: {
cfg: 'local',
cfg: 'qa', // local...
loginUser: 'admin',
failOnUncaughtException: false,
visitBaseUrl: true,
Expand All @@ -27,7 +27,7 @@ export default defineConfig({
grepIntegrationFolder: '../../',
},
e2e: {
baseUrl: 'http://admin-dam.anzusystems.localhost:8150/',
baseUrl: 'http://LoremIpsum',
specPattern: 'cypress/e2e/**/*.cy.ts',
setupNodeEvents(on, config) {
require('cypress-mochawesome-reporter/plugin')(on)
Expand Down
5 changes: 4 additions & 1 deletion cypress/e2e/navigation/logOut.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ describe(`Test Log-out function, Env: ${CY.cfg}`, () => {
cy.getCyVisibleClick('navbar-user', 10000)
cy.getCyVisibleClick('navbar-user-logout')
cy.getCyVisibleClick('button-confirm')
cy.urlContains('login', 10000)
cy.get('.v-btn')
.should('be.visible')
.invoke('text')
.should('eq', ' Log in ')
})
})
3 changes: 1 addition & 2 deletions cypress/e2e/settings/assetLicences.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ describe(
cy.getCy('button-cancel').should('be.visible')
cy.getCy('button-confirm').click()
cy.alertMessage(ALERT_CREATE)
cy.getCy('filter-submit').click() // until bug is fixed
cy.contains(`${EXTERNAL_SYS[0]}${RAND_NUM}`).click() // until bug is fixed
cy.contains(`${EXTERNAL_SYS[0]}${RAND_NUM}`).click()
cy.cardLoad()
cy.getCy('copy-text')
.invoke('text')
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/settings/author.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ describe(`Test authors function, Env: ${CY.cfg}`, { tags: '@author', env: { visi
cy.getCy('button-cancel').should('be.visible')
cy.getCyVisibleClick('button-confirm')
cy.alertMessage(ALERT_CREATE)
cy.getCy('filter-reset').click() // until bug is fixed
cy.getCy('filter-string').eq(1).type(`${USER_FIRST_NAME}{ENTER}`)
cy.contains(`${USER_FIRST_NAME}`).click() // until bug is fixed
cy.contains(`${USER_FIRST_NAME}`).click()
cy.cardLoad()
cy.getCy('copy-text')
.invoke('text')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

let CATEGOTY_ID = ''
//let CATEGORY_ID = ''
describe(
`Test distribution category function, Env: ${CY.cfg}`,
{ tags: '@distributionCategory', env: { visitBaseUrl: false } },
Expand All @@ -19,12 +19,12 @@ describe(
cy.get('.v-overlay__content > .v-list > .v-list-item').first().click()
cy.getCy('distribution-category-select').eq(2).click()
cy.get('.v-overlay__content > .v-list > .v-list-item').first().click()
cy.get('body').type('{ESC}')
cy.getCy('button-close').should('be.visible')
cy.getCy('button-cancel').should('be.visible')
cy.getCyVisibleClick('button-confirm')
cy.alertMessage(ALERT_CREATE)
cy.getCy('filter-submit').click() // until bug is fixed
cy.contains(`${USER_FIRST_NAME}`).click() // until bug is fixed
cy.contains(`${USER_FIRST_NAME}`).click()
cy.cardLoad()
cy.getCy('copy-text')
.invoke('text')
Expand All @@ -33,12 +33,13 @@ describe(
cy.getCyVisibleClick('button-close')
cy.urlNotContains(text)
cy.urlContains('/distribution-category')
CATEGOTY_ID = text
//CATEGORY_ID = text
})
})
it('Edit distribution category', () => {
cy.visit('distribution-category')
cy.getCy('filter-string').first().type(`${CATEGOTY_ID}{ENTER}`)
//cy.getCy('filter-string').first().type(`${CATEGORY_ID}{ENTER}`) //todo ctrl-v(paste) in ID-filed is not working
cy.getCy('filter-string').eq(1).type(`${USER_FIRST_NAME}{ENTER}`) //todo until bug is fixed
cy.cardLoad()
cy.getCyVisibleClick('table-edit')
cy.urlContains('/edit')
Expand All @@ -50,8 +51,10 @@ describe(
cy.contains('.v-list-item-title', /^Science$/).click()
cy.getCy('distribution-category-select').eq(2).click()
cy.contains('.v-list-item-title', /^Drama$/).click()
cy.getCyVisibleClick('button-save-close')
cy.getCy('button-close').should('be.visible')
cy.getCyVisibleClick('button-save')
cy.alertMessage(ALERT_UPDATE)
cy.getCyVisibleClick('button-close')
cy.urlNotContains('/edit')
cy.getCyVisibleClick('filter-reset')
cy.getCy('filter-string').last().type(`${USER_FIRST_NAME}-edit{ENTER}`)
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/settings/groupPermission.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ describe(
cy.getCy('button-cancel').should('be.visible')
cy.getCyVisibleClick('button-confirm')
cy.alertMessage(ALERT_CREATE)
cy.getCy('filter-submit').click() // until bug is fixed
cy.contains(`${PERMISSION_GROUP}`).click() // until bug is fixed
cy.contains(`${PERMISSION_GROUP}`).click()
cy.cardLoad()
cy.getCy('copy-text')
.invoke('text')
Expand Down
7 changes: 4 additions & 3 deletions cypress/e2e/settings/job.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ describe(`Test job function, Env: ${CY.cfg}`, { tags: '@job', env: { visitBaseUr
cy.getCyVisibleClick('job-select')
cy.contains('.v-list-item', JOB_SYNC)
cy.contains('.v-list-item', JOB_DELETE).click()
cy.getCy('targetUser').type(CY.credential.admin.id)
cy.getCy('anonymizeUser')
cy.getCy('targetUser').type(CY.credentials.admin.id)
cy.getCy('anonymizeUser').click()
cy.get('#switch-92').click()
cy.get('.v-card-actions > .bg-primary').click()
cy.alertMessage(ALERT_CREATE)
cy.getCyVisibleClick('filter-reset')
cy.cardLoad()
cy.contains('td', JOB_DELETE).click()
cy.cardLoad()
cy.get(':nth-child(2) > :nth-child(1) > .v-col').should('contain', CY.credential.admin.id)
cy.get(':nth-child(2) > :nth-child(1) > .v-col').should('contain', CY.credentials.admin.id)
cy.getCyVisibleClick('button-close')
cy.cardLoad()
cy.get('.v-table').should('be.visible')
Expand Down
3 changes: 1 addition & 2 deletions cypress/e2e/settings/keyword.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ describe(`Test keyword function, Env: ${CY.cfg}`, { tags: '@keyword', env: { vis
cy.getCy('button-cancel').should('be.visible')
cy.getCyVisibleClick('button-confirm')
cy.alertMessage(ALERT_CREATE)
cy.getCy('filter-submit').click() // until bug is fixed
cy.contains(`${USER_FIRST_NAME}`).click() // until bug is fixed
cy.contains(`${USER_FIRST_NAME}`).click()
cy.cardLoad()
cy.getCy('copy-text')
.invoke('text')
Expand Down
8 changes: 3 additions & 5 deletions cypress/e2e/settings/podcast.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ describe(`Test Podcast function, Env: ${CY.cfg}`, { tags: '@podcast', env: { vis
cy.getCy('button-cancel').should('be.visible')
cy.getCy('button-confirm').click()
cy.alertMessage(ALERT_CREATE)
cy.getCy('filter-submit').click() // until bug is fixed
cy.contains(`${PODCAST_TITLE}`).click() // until bug is fixed
cy.contains(`${PODCAST_TITLE}`).click()
cy.cardLoad()
cy.getCyVisibleClick('podcast-list')
cy.getCy('podcast-id')
Expand Down Expand Up @@ -56,7 +55,7 @@ describe(`Test Podcast function, Env: ${CY.cfg}`, { tags: '@podcast', env: { vis
// })
// cy.getCy('select-image-alt').within(() => {
// cy.get('button').click()
// cy.get('.asset-list-tiles__item').eq(1).click()
// cy.get('.asset-list-tiles__item).eq(1).click()
// cy.contains('button', 'Zvoliť').click()
// })
cy.getCyVisibleClick('button-save')
Expand All @@ -77,8 +76,7 @@ describe(`Test Podcast function, Env: ${CY.cfg}`, { tags: '@podcast', env: { vis
cy.getCy('button-cancel').should('be.visible')
cy.getCy('button-confirm').click()
cy.alertMessage(ALERT_CREATE)
cy.getCy('filter-submit').click() // until bug is fixed
cy.contains(`${EPISODE_TITLE}`).click() // until bug is fixed
cy.contains(`${EPISODE_TITLE}`).click()
cy.cardLoad()
cy.getCy('copy-text')
.invoke('text')
Expand Down
22 changes: 13 additions & 9 deletions cypress/e2e/settings/user.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ describe(`Test user function, Env: ${CY.cfg}`, { tags: '@user', env: { visitBase
it('Edit User', () => {
cy.visit('/settings')
cy.visitSubpage('user-settings', 'user', 'Používatelia')
cy.getCy('filter-string').last().type(`${CY.credential.admin.email}{ENTER}`)
cy.getCy('filter-string').last().type(`${CY.credentials.admin.email}{ENTER}`)
cy.getCyVisibleClick('filter-submit')
cy.cardLoad()
cy.contains(`${CY.credential.admin.email}`).click()
cy.contains(`${CY.credentials.admin.email}`).click()
cy.cardLoad()
cy.getCy('copy-text')
.invoke('text')
Expand All @@ -29,20 +29,22 @@ describe(`Test user function, Env: ${CY.cfg}`, { tags: '@user', env: { visitBase
cy.getCy('user-asset-licences').type(`${licence}`)
cy.contains('.v-list-item-title', `${licence}`).click()
})
cy.get('#anzu-actionbar').click()
cy.get('i[aria-label="Zatvoriť"]').click()
cy.getCy('user-admin-to-ext-systems').click()
EXTERNAL_SYS.forEach((admin) => {
cy.contains('.v-list-item-title', `${admin}`).click()
})
cy.get('#anzu-actionbar').click()
cy.get('i[aria-label="Zatvoriť"]').click()
cy.getCy('user-allowed-asset-external-providers').click()
cy.contains('.v-list-item-title', `${EXTERNAL_PROVIDER}`).click()
cy.get('#anzu-actionbar').click()
cy.get('[aria-expanded="false"]').invoke('attr', 'aria-expanded', 'true') // until aria-label,
// aria-title is added
cy.getCy('user-allowed-distribution-services').click()
DISTRIBUTION_SERVICE.forEach((service) => {
cy.contains('.v-list-item-title', `${service}`).click()
})
cy.get('#anzu-actionbar').click()
cy.get('[aria-expanded="false"]').invoke('attr', 'aria-expanded', 'true') // until aria-label,
// aria-title is added
cy.getCyVisibleClick('button-save')
cy.alertMessage(ALERT_UPDATE)
cy.getCyVisibleClick('button-close')
Expand All @@ -55,15 +57,17 @@ describe(`Test user function, Env: ${CY.cfg}`, { tags: '@user', env: { visitBase
EXTERNAL_SYS.forEach((admin) => {
cy.contains('.v-list-item-title', `${admin}`).click()
})
cy.get('#anzu-actionbar').click()
cy.get('i[aria-label="Zatvoriť"]').click()
cy.getCy('user-allowed-asset-external-providers').click()
cy.contains('.v-list-item-title', `${EXTERNAL_PROVIDER}`).click()
cy.get('#anzu-actionbar').click()
cy.get('[aria-expanded="false"]').invoke('attr', 'aria-expanded', 'true') // until aria-label,
// aria-title is added
cy.getCy('user-allowed-distribution-services').click()
DISTRIBUTION_SERVICE.forEach((service) => {
cy.contains('.v-list-item-title', `${service}`).click()
})
cy.get('#anzu-actionbar').click()
cy.get('[aria-expanded="false"]').invoke('attr', 'aria-expanded', 'true') // until aria-label,
// aria-title is added
cy.getCy('user-asset-licences').click()
USER_LICENCE.forEach((licence) => {
cy.getCy('user-asset-licences').type(`${licence}`)
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/settings/userPermission.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ describe(
cy.getCy('button-cancel').should('be.visible')
cy.getCyVisibleClick('button-confirm')
cy.alertMessage(ALERT_CREATE)
cy.getCy('filter-submit').click() // until bug is fixed
cy.contains(`${USER_EMAIL}`).click() // until bug is fixed
cy.get('[value="50"]').click()
cy.contains(`${USER_EMAIL}`).click()
cy.cardLoad()
cy.getCy('copy-text')
.invoke('text')
Expand All @@ -45,7 +45,7 @@ describe(
cy.cardLoad()
cy.getCy('user-first-name').type('test')
cy.getCy('user-last-name').type('test')
cy.getCy('enable-switch').click()
cy.get('.v-selection-control > .v-label').click()
cy.getCyVisibleClick('button-save')
cy.alertMessage(ALERT_UPDATE)
cy.getCyVisibleClick('button-close')
Expand All @@ -60,7 +60,7 @@ describe(
cy.getCyVisibleClick('table-edit')
cy.urlContains('/edit')
cy.cardLoad()
cy.getCy('enable-switch').click()
cy.get('.v-selection-control > .v-label').click()
cy.getCyVisibleClick('button-save')
cy.alertMessage(ALERT_UPDATE)
cy.getCyVisibleClick('button-close')
Expand Down
Binary file added cypress/fixtures/audio/sample.m4a
Binary file not shown.
Binary file added cypress/fixtures/audio/sample.mp3
Binary file not shown.
Binary file added cypress/fixtures/audio/sample.wav
Binary file not shown.
Binary file added cypress/fixtures/image/sample.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cypress/fixtures/image/sample.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cypress/fixtures/image/sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cypress/fixtures/image/sample.webp
Binary file not shown.
Binary file added cypress/fixtures/video/sample.3gp
Binary file not shown.
Binary file added cypress/fixtures/video/sample.avi
Binary file not shown.
Binary file added cypress/fixtures/video/sample.mov
Binary file not shown.
Binary file added cypress/fixtures/video/sample.mp4
Binary file not shown.
2 changes: 1 addition & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ beforeEach(function () {
CY.loginUser,
() => {
//Setup protection cookie based on env
cy.protectionCookie()
//cy.protectionCookie()
//Login with provided user
cy.login(CY.loginUser)
},
Expand Down
3 changes: 2 additions & 1 deletion cypress/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export const USER_PASSWORD = `pwd${RAND_NUM}`
export const USER_LICENCE = ['CMS licence']
export const EXTERNAL_SYS = ['cms', 'blog', 'tools']
export const EXTERNAL_PROVIDER = 'Unsplash'
export const DISTRIBUTION_SERVICE = ['Youtube', 'Youtube Fičí', 'JwVideo']
export const DISTRIBUTION_SERVICE = ['Youtube CMS', 'Youtube Fičí', 'JwVideo', 'Artemis Video CMS',
'Artemis Podcast CMS']
export const PERMISSION_GROUP_TITLE = `TestGroup${RAND_NUM}`
export const PODCAST_TITLE = `TestPodcast${RAND_NUM}`
export const EPISODE_TITLE = `TestEpisode${RAND_NUM}`
Expand Down
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,39 @@
"cy:open": "CYPRESS_CACHE_FOLDER='node_modules/.cache/Cypress' yarn cypress open -C cypress/config/cypress.config.ts"
},
"dependencies": {
"@anzusystems/common-admin": "^1.4.0",
"@anzusystems/common-admin": "^1.5.0",
"@mdi/font": "7.2.96",
"@vuelidate/core": "^2.0.2",
"@vuelidate/validators": "^2.0.2",
"@vueuse/core": "10.2.0",
"@vueuse/integrations": "10.2.0",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.3",
"@vueuse/core": "10.2.1",
"@vueuse/integrations": "10.2.1",
"axios": "^1.4.0",
"core-js": "^3.31.0",
"js-sha1": "^0.6.0",
"jwt-decode": "^3.1.2",
"pinia": "^2.1.4",
"sortablejs": "^1.15.0",
"universal-cookie": "^4.0.4",
"uuid": "^9.0.0",
"vue": "^3.3.4",
"vue-cropperjs": "^5.0.0",
"vue-i18n": "^9.2.2",
"vue-router": "^4.2.2",
"vuedraggable": "^4.1.0",
"vuetify": "^3.3.5"
"vuetify": "^3.3.6"
},
"devDependencies": {
"@cypress/grep": "^3.1.5",
"@intlify/unplugin-vue-i18n": "^0.11.0",
"@rushstack/eslint-patch": "^1.3.2",
"@types/node": "^18.16.18",
"@types/sortablejs": "^1.15.1",
"@types/uuid": "^9.0.2",
"@typescript-eslint/parser": "^5.60.0",
"@typescript-eslint/parser": "^5.60.1",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-prettier": "^7.1.0",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/tsconfig": "^0.1.3",
"cypress": "^12.15.0",
"cypress": "^12.16.0",
"cypress-mochawesome-reporter": "^3.5.1",
"eslint": "8.43.0",
"eslint-plugin-cypress": "^2.13.3",
Expand All @@ -64,10 +65,10 @@
"sass": "^1.63.6",
"stylelint": "^15.9.0",
"stylelint-config-recommended-vue": "^1.4.0",
"stylelint-config-standard-scss": "^9.0.0",
"stylelint-config-standard-scss": "^10.0.0",
"typescript": "^4.9.5",
"vite": "^4.3.9",
"vite-plugin-vuetify": "^1.0.2",
"vue-tsc": "1.8.1"
"vue-tsc": "1.8.3"
}
}
Loading

0 comments on commit bf037a7

Please sign in to comment.