Skip to content

Commit

Permalink
fix: review
Browse files Browse the repository at this point in the history
  • Loading branch information
CozyKourai committed Mar 28, 2019
1 parent a412e04 commit 9e70fa8
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 36 deletions.
8 changes: 4 additions & 4 deletions testcafe/runner-drive.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ async function runRunner() {
//Init data : Unzip archive with files to upload
'testcafe/tests/helpers/init-data.js',
//Tests !
// 'testcafe/tests/drive/navigation.js',
// 'testcafe/tests/drive/folder_sharing_scenario.js',
// 'testcafe/tests/drive/file_sharing_scenario.js',
// 'testcafe/tests/drive/viewer-feature.js',
'testcafe/tests/drive/navigation.js',
'testcafe/tests/drive/folder_sharing_scenario.js',
'testcafe/tests/drive/file_sharing_scenario.js',
'testcafe/tests/drive/viewer-feature.js',
'testcafe/tests/drive/public-viewer-feature.js'
])
//emulation:cdpPort=9222 is used to set the download folder in headless mode
Expand Down
9 changes: 4 additions & 5 deletions testcafe/tests/drive/file_sharing_scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ test('Drive : from Drive, go in a folder, upload a file, and share the file', as
)
if (link) {
data.sharingLink = link
console.log(`SHARING_LINK : ` + data.sharingLink)
}
console.groupEnd()
})
Expand All @@ -81,15 +80,15 @@ test(`[Desktop] Drive : Access a file public link, download the file, and check
`↳ ℹ️ [Desktop] Drive : Access a file public link, download the file, and check the 'create Cozy' link`
)
await t.navigateTo(data.sharingLink)
await publicViewerPage.waitForLoading({ isSingleShareFile: true })
await publicViewerPage.waitForLoading()

await publicDrivePage.checkActionMenuPublicDesktop('file')
await t
.setNativeDialogHandler(() => true)
.click(publicDrivePage.btnPublicDownload)
.click(publicDrivePage.btnPublicCreateCozyFile)
await publicDrivePage.checkCreateCozy()
await publicViewerPage.waitForLoading({ isSingleShareFile: true })
await publicViewerPage.waitForLoading()

console.groupEnd()
})
Expand All @@ -102,7 +101,7 @@ test(`[Mobile] Drive : Access a file public link, download the file, and check t
portraitOrientation: true
})
await t.navigateTo(data.sharingLink)
await publicViewerPage.waitForLoading({ isSingleShareFile: true })
await publicViewerPage.waitForLoading()

await publicDrivePage.checkActionMenuPublicMobile('file')
await t
Expand All @@ -111,7 +110,7 @@ test(`[Mobile] Drive : Access a file public link, download the file, and check t
.click(publicDrivePage.btnPublicMoreMenuFile) //need to re-open the more menu
.click(publicDrivePage.btnPublicMobileCreateCozy)
await publicDrivePage.checkCreateCozy()
await publicViewerPage.waitForLoading({ isSingleShareFile: true })
await publicViewerPage.waitForLoading()

await t.maximizeWindow() //Back to desktop
console.groupEnd()
Expand Down
2 changes: 1 addition & 1 deletion testcafe/tests/drive/folder_sharing_scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test('Drive : from Drive, go in a folder, upload a file, and share the folder',
)
if (link) {
data.sharingLink = link
console.log(`data.sharingLink : ` + data.sharingLink)

}
console.groupEnd()
})
Expand Down
4 changes: 2 additions & 2 deletions testcafe/tests/drive/navigation.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { driveUser } from '../helpers/roles'
import { TESTCAFE_DRIVE_URL, isExistingAndVisibile } from '../helpers/utils'

import PrivateprivateDrivePage from '../pages/drive/drive-model-private'
import PrivateDrivePage from '../pages/drive/drive-model-private'

const privateDrivePage = new PrivateprivateDrivePage()
const privateDrivePage = new PrivateDrivePage()

fixture`DRIVE - NAV`.page`${TESTCAFE_DRIVE_URL}/`.beforeEach(async t => {
console.group(`\n↳ ℹ️ Loggin & Initialization`)
Expand Down
14 changes: 6 additions & 8 deletions testcafe/tests/drive/public-viewer-feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const TEST_DELETE_FOLDER = `3-1 Delete Folder`
fixture`${FIXTURE_INIT}`.page`${TESTCAFE_DRIVE_URL}/`
.before(async ctx => {
await initVR(ctx, SLUG, FIXTURE_INIT)
console.log(`ctx.isVR ${ctx.isVR}`)
})
.beforeEach(async t => {
console.group(`\n↳ ℹ️ Loggin & Initialization`)
Expand Down Expand Up @@ -104,7 +103,6 @@ test(`${TEST_UPLOAD_AND_SHARE}`, async t => {
)
if (link) {
data.sharingLink = link
console.log(`data.sharingLink : ` + data.sharingLink)
}
console.groupEnd()
})
Expand Down Expand Up @@ -167,7 +165,7 @@ test(`${TEST_PUBLIC_VIEWER_ZIP}`, async t => {
await publicViewerPage.checkCommonViewerDownload(data.FILE_ZIP)
t.ctx.fileDownloaded = data.FILE_ZIP

await publicViewerPage.checkPublicViewer_vr(
await publicViewerPage.checkPublicViewer(
`${FEATURE_PREFIX}/${TEST_PUBLIC_VIEWER_ZIP}-1`,
data.FILE_ZIP
)
Expand All @@ -187,7 +185,7 @@ test(`${TEST_PUBLIC_VIEWER_ZIP}`, async t => {
})
t.ctx.fileDownloaded = data.FILE_PPTX

await publicViewerPage.checkPublicViewer_vr(
await publicViewerPage.checkPublicViewer(
`${FEATURE_PREFIX}/${TEST_PUBLIC_VIEWER_PPTX}-1`,
data.FILE_PPTX
)
Expand All @@ -203,7 +201,7 @@ test(`${TEST_PUBLIC_VIEWER_IMG}`, async t => {
await publicViewerPage.checkCommonViewerDownload(data.FILE_IMG)
t.ctx.fileDownloaded = data.FILE_IMG

await publicViewerPage.checkPublicViewer_vr(
await publicViewerPage.checkPublicViewer(
`${FEATURE_PREFIX}/${TEST_PUBLIC_VIEWER_IMG}-1`,
data.FILE_IMG,
'img'
Expand All @@ -227,7 +225,7 @@ test(`${TEST_PUBLIC_VIEWER_AUDIO}`, async t => {
width: 100,
y: 623
})
await publicViewerPage.checkPublicViewer_vr(
await publicViewerPage.checkPublicViewer(
`${FEATURE_PREFIX}/${TEST_PUBLIC_VIEWER_AUDIO}-1`,
data.FILE_AUDIO,
'audio',
Expand All @@ -253,7 +251,7 @@ test(`${TEST_PUBLIC_VIEWER_VIDEO}`, async t => {
await publicViewerPage.checkCommonViewerDownload(data.FILE_VIDEO)
t.ctx.fileDownloaded = data.FILE_VIDEO

await publicViewerPage.checkPublicViewer_vr(
await publicViewerPage.checkPublicViewer(
`${FEATURE_PREFIX}/${TEST_PUBLIC_VIEWER_VIDEO}-1`,
data.FILE_VIDEO,
'video'
Expand All @@ -270,7 +268,7 @@ test(`${TEST_PUBLIC_VIEWER_TXT}`, async t => {
await publicViewerPage.checkCommonViewerDownload(data.FILE_TXT)
t.ctx.fileDownloaded = data.FILE_TXT

await publicViewerPage.checkPublicViewer_vr(
await publicViewerPage.checkPublicViewer(
`${FEATURE_PREFIX}/${TEST_PUBLIC_VIEWER_TXT}-1`,
data.FILE_TXT,
'txt'
Expand Down
11 changes: 4 additions & 7 deletions testcafe/tests/pages/drive-viewer/drive-viewer-model-public.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import { t } from 'testcafe'
import PRECISION from '../../helpers/visualreview-utils'
import { PRECISION } from '../../helpers/visualreview-utils'
import PublicDriveVRPage from '../drive/drive-model-public'
import ViewerPage from './drive-viewer-model'

const publicDrivePage = new PublicDriveVRPage()

export default class PublicViewerPage extends ViewerPage {
constructor() {
super()
}

// perform checks commons to all viewer : navigation / toolbar download btn / closing viewer
//@param {String} screenshotPath : path for screenshots taken in this test
//@param {string} filename : file to check
//@param {string} type : file type to check for Specific viewer
async checkPublicViewer_vr(screenshotPath, fileName, type, hasMask = false) {
async checkPublicViewer(screenshotPath, fileName, type, hasMask = false) {
const index = await publicDrivePage.getElementIndex(fileName)
console.log(`↳ 📁 ${fileName} with index : ${index}`)
await this.openViewerForFile(fileName)
Expand Down Expand Up @@ -43,14 +39,15 @@ export default class PublicViewerPage extends ViewerPage {
})
await t.fixtureCtx.vr.takeScreenshotAndUpload(screenshotPath, hasMask)
//precision back to default
console.log('PRécision : ' + PRECISION)
t.fixtureCtx.vr.options.compareSettings = {
precision: PRECISION //precision goes from 0 to 255
}
}

//@param {String} screenshotPath : path for screenshots taken in this test
//@param {string} filename : file to check
async checkMobilePublicViewer_vr(screenshotsPath, fileName, hasMask = false) {
async checkMobilePublicViewer(screenshotsPath, fileName, hasMask = false) {
await t.resizeWindowToFitDevice('iPhone 6', {
portraitOrientation: true
})
Expand Down
8 changes: 3 additions & 5 deletions testcafe/tests/pages/drive-viewer/drive-viewer-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ export default class Page {
this.btnPdfViewerDownload = this.pdfViewer.find('#download')
}

//@param { bool } isSingleShaereFile : set to true only when checking viewer on a single shared file
async waitForLoading({ isSingleShareFile } = {}) {
//@param { bool } isSingleShareFile : set to true only when checking viewer on a single shared file
async waitForLoading() {
await t.expect(this.spinner.exists).notOk('Spinner still spinning')
await isExistingAndVisibile(this.viewerWrapper, 'Viewer Wrapper')
await isExistingAndVisibile(this.viewerControls, 'Viewer Controls')
if (!isSingleShareFile)
await isExistingAndVisibile(this.viewerToolbar, 'Viewer Toolbar')
console.log('Viewer Ok')
}

Expand Down Expand Up @@ -109,7 +107,7 @@ export default class Page {
//@param {String} screenshotPath : path for screenshots taken in this test
//@param {string} fileStartName : file to open to start the navigation testing
//@param {number} numberOfNavigation : the number of file we want to go through during the test.
async checkViewerNavigation_vr(
async checkViewerNavigation(
screenshotPath,
fileStartName,
numberOfNavigation
Expand Down
4 changes: 0 additions & 4 deletions testcafe/tests/pages/drive/drive-model-private.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import {
import DrivePage from './drive-model'

export default class PrivateDrivePage extends DrivePage {
constructor() {
super()
}

//@param {Selector} btn : button to tests
//@param {text} path : redirection path
//@param {text} title : text for console.log
Expand Down

0 comments on commit 9e70fa8

Please sign in to comment.