Skip to content

Commit

Permalink
Add fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Napolskyi committed Jun 4, 2024
1 parent d7aab77 commit d89f9a4
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 31 deletions.
6 changes: 1 addition & 5 deletions README-TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Follow the [installation guide](README.md) to install the project and run dev se
in `cypress.config.ts`


- Some are stored in [LastPass](https://lastpass.com/) under name `Cypress Config - DAM` or use following example:
- Some are stored in [BitWarden](https://vault.bitwarden.com/#/vault?collectionId=5ec1888a-edc3-4141-8d69-b14800d2726c&itemId=2d496bd8-9b56-41f7-811a-b148007cd710) under name `Cypress Config - DAM` or use following example:
```typescript
function extendCypressConfigStg(config) {
config.baseUrl = ''
Expand All @@ -29,10 +29,6 @@ function extendCypressConfigStg(config) {
forceLoginLink: '', // admin forceLoginLink
},
}
config.env.cookie = {
name: '',
value: '',
}
config.env.url = {
domain: '',
proto: '',
Expand Down
13 changes: 0 additions & 13 deletions cypress/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ declare global {
* Clear all cookies, local storage, session storage and set protection cookie
*/
clearAll(): Chainable<any>
/**
* Setup protection cookie based on env
*/
protectionCookie(): Chainable<any>
/**
* Login to sme web
* Provide user credentials form config/cypress.config.ts env to login
Expand All @@ -31,15 +27,6 @@ declare global {
}
}

Cypress.Commands.add('protectionCookie', () => {
if (CY.cookie != undefined) {
cy.setCookie(CY.cookie.name, CY.cookie.value, {
domain: CY.url.domain,
log: false,
})
}
})

Cypress.Commands.add('login', (user: string, timeout?: number) => {
cy.visit(CY.credentials[user].forceLoginLink, { timeout: timeout })
})
Expand Down
10 changes: 5 additions & 5 deletions cypress/commands/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ declare global {
}
}

Cypress.Commands.add('waitResponse', (request: string, timeout?: number) => {
Cypress.Commands.add('waitResponse', (request: string, timeout: number = 10000) => {
cy.log(`Wait for response: ${request}`)
cy.intercept(request, {}).as('waitResponse')
cy.wait('@waitResponse', { timeout: timeout })
Expand All @@ -81,15 +81,15 @@ Cypress.Commands.add('waitSec', (sec: number) => {
cy.wait(sec * 1000)
})

Cypress.Commands.add('getCy', (selector: string, timeout?: number) => {
Cypress.Commands.add('getCy', (selector: string, timeout: number = 10000) => {
cy.get(`[data-cy='${selector}']`, { timeout: timeout })
})

Cypress.Commands.add('getCyVisibleClick', (selector: string, timeout?: number) => {
Cypress.Commands.add('getCyVisibleClick', (selector: string, timeout: number = 10000) => {
cy.get(`[data-cy='${selector}']`, { timeout: timeout }).should('be.visible').click()
})

Cypress.Commands.add('urlContains', (string: string, timeout?: number) => {
Cypress.Commands.add('urlContains', (string: string, timeout: number = 10000) => {
cy.url({ timeout: timeout }).should('contain', string)
})

Expand All @@ -103,7 +103,7 @@ Cypress.Commands.add('alertMessage', (message: string) => {
cy.get('.mdi-close').eq(0).click()
})

Cypress.Commands.add('visitBaseUrl', (value?: boolean, timeout?: number) => {
Cypress.Commands.add('visitBaseUrl', (value?: boolean, timeout: number = 10000) => {
if (value) {
cy.visit('/', { timeout: timeout })
}
Expand Down
4 changes: 2 additions & 2 deletions cypress/commands/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ Cypress.Commands.add('verifyFileType',
fileGroup = fileType.includes('txt') ? 'text' : fileGroup
expect(type).to.contain(fileGroup).and.to.contain(getFileType(fileType))})
})
Cypress.Commands.add('waitForUpload', (alertUpload: string, timeout?: number) => {
Cypress.Commands.add('waitForUpload', (alertUpload: string, timeout?: number = 10000) => {
cy.contains('[data-cy="upload-overlay-title"]', alertUpload, { timeout: timeout | 90000 })
})
Cypress.Commands.add('uploadFile', (fileName: string, action: 'select' | 'drag-drop', timeout?: number) => {
Cypress.Commands.add('uploadFile', (fileName: string, action: 'select' | 'drag-drop', timeout?: number = 10000) => {
cy.get('input[type="file"]', { timeout: timeout | 10000 })
.first()
.selectFile(
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/distribution/audioDistribution.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe(`Test distribution Audio function, Env: ${CY.cfg}`,
cy.getCy('button-add-new-podcast-episode').should('be.visible').click()
cy.getCy('field-choose-podcast').click()
cy.waitSec(2)
cy.getCy('field-choose-podcast').type(DISTRIBUTION_DATA.PODCAST)
cy.get('.v-list-item').contains(DISTRIBUTION_DATA.PODCAST).click()
cy.circleLoad()
cy.get('textarea').eq(0).type(ASSET_DESCRIPTION)
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/navigation/headerNavigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe(`Test header navigation menu function, Env: ${CY.cfg}`,
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-close').click()
cy.get('[href="/podcast"]').should('be.visible').click()
cy.urlContains('podcast')
cy.getCy('back-to-assets-settings').should('be.visible').click()
Expand All @@ -22,7 +22,7 @@ describe(`Test header navigation menu function, Env: ${CY.cfg}`,
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-cancel').click()
cy.getCy('button-settings').click()
cy.urlContains('settings')
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/settings/author.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe(`Test authors function, Env: ${CY.cfg}`,
})
it('Edit author', () => {
cy.visit('/author')
cy.getCy('filter-string', { timeout: 20000 }).first().type(`${USER_ID}{ENTER}`)
cy.getCy('filter-string', 20000).first().type(`${USER_ID}{ENTER}`)
cy.cardLoad()
cy.getCyVisibleClick('table-edit')
cy.urlContains('/edit')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/settings/userPermission.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
ALERT_UPDATE,
CY, JOB_DELETE,
JOB_SYNC,
RAND_NUM,
USER_EMAIL,
USER_ROLE
} from '../../utils/common'
let USER_ID = ''
const RAND_NUM = `${Cypress._.random(50, 100)}`
describe(
`Test permission user function, Env: ${CY.cfg}`,
{ tags: ['@userPermission', '@settings'], env: { visitBaseUrl: false } },
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ beforeEach(function () {
cy.session(
CY.loginUser,
() => {
//Setup protection cookie based on env
cy.protectionCookie()
//Login with provided user
cy.login(CY.loginUser)
cy.changeToSlovakDarkTheme()
// go to main licence
cy.changeLicence(100000)
},
{
cacheAcrossSpecs: true,
Expand Down

0 comments on commit d89f9a4

Please sign in to comment.