diff --git a/test/app.test.mjs b/test/app.test.mjs index 192e3e08..fddc0541 100644 --- a/test/app.test.mjs +++ b/test/app.test.mjs @@ -1,19 +1,21 @@ /* eslint-disable no-unused-expressions */ import faker from 'faker' -import { expect } from 'chai' - +import chai, { util, expect } from 'chai' +import chailint from 'chai-lint' import { core } from '@kalisio/kdk/test.client.js' import { createDocument, deleteDocumentItem, deleteDocumentCard } from './document.mjs' const suite = 'app' -describe(suite, () => { +describe(`suite:${suite}`, () => { let runner let page let user before(async () => { + chailint(chai, util) + runner = new core.Runner(suite, { appName: 'kapp', browser: { @@ -35,26 +37,27 @@ describe(suite, () => { await core.register(page, user) }) - it('check-profile', async () => { - await core.manageAccount(page, 'profile') - await core.manageAccount(page, 'security') - await core.manageAccount(page, 'danger-zone') + it('update profile', async () => { + await core.updateAccountProfile(page, 'My new name', runner.getDataPath('avatar.png')) + user.name = 'My new name' + await core.clickOpener(page, 'left') + expect(await runner.captureAndMatch('profile')).beTrue() }) it('check-collections', async () => { - await core.clickLeftPaneAction(page, 'collection', 1000) + await core.clickPaneAction(page, 'left', 'collection', 1000) const nbDocuments = await core.countItems(page, 'collection/KItem') const doc1 = { name: faker.name.findName() } await createDocument(page, doc1) expect((nbDocuments + 1) === await core.countItems(page, 'collection/KItem')).to.true - await core.clickTopPaneAction(page, 'grid', 1000) + await core.clickAction(page, 'grid', 1000) const doc2 = { name: faker.name.findName() } await createDocument(page, doc2) expect((nbDocuments + 2) === await core.countItems(page, 'collection/KCard')).to.true - await core.clickTopPaneAction(page, 'list', 1000) + await core.clickAction(page, 'list', 1000) await deleteDocumentItem(page, doc1) expect((nbDocuments + 1) === await core.countItems(page, 'collection/KItem')).to.true - await core.clickTopPaneAction(page, 'grid', 1000) + await core.clickAction(page, 'grid', 1000) await deleteDocumentCard(page, doc2) expect(nbDocuments === await core.countItems(page, 'collection/KCard')).to.true }) diff --git a/test/data/app/avatar.png b/test/data/app/avatar.png new file mode 100644 index 00000000..30ac4702 Binary files /dev/null and b/test/data/app/avatar.png differ diff --git a/test/data/app/screenrefs/profile.png b/test/data/app/screenrefs/profile.png new file mode 100644 index 00000000..3e337244 Binary files /dev/null and b/test/data/app/screenrefs/profile.png differ diff --git a/test/data/misc/screenrefs/misc.png b/test/data/misc/screenrefs/misc.png index de954f8d..7229c042 100644 Binary files a/test/data/misc/screenrefs/misc.png and b/test/data/misc/screenrefs/misc.png differ diff --git a/test/layout.test.mjs b/test/layout.test.mjs index 21393275..d62a777d 100644 --- a/test/layout.test.mjs +++ b/test/layout.test.mjs @@ -1,17 +1,20 @@ /* eslint-disable no-unused-expressions */ -import { expect } from 'chai' +import chai, { util, expect } from 'chai' +import chailint from 'chai-lint' import { core } from '@kalisio/kdk/test.client.js' const suite = 'layout' -describe(suite, () => { +describe(`suite:${suite}`, () => { let runner let page let user const placements = ['left', 'top', 'right', 'bottom'] before(async () => { + chailint(chai, util) + runner = new core.Runner(suite, { appName: 'kapp', browser: { @@ -32,47 +35,47 @@ describe(suite, () => { }) it('check-header-footer', async () => { - expect(await core.isHeaderVisible(page)).be.true - expect(await core.isFooterVisible(page)).be.false + expect(await core.isHeaderVisible(page)).beTrue() + expect(await core.isFooterVisible(page)).beFalse() await core.clickAction(page, 'toggle-header') - expect(await core.isHeaderVisible(page)).be.false + expect(await core.isHeaderVisible(page)).beFalse() await core.clickAction(page, 'toggle-footer') - expect(await core.isFooterVisible(page)).be.true + expect(await core.isFooterVisible(page)).beTrue() }) it('check-panes', async () => { await core.clickPaneAction(page, 'top', 'panes') - expect(await core.isPaneVisible(page, 'top')).be.true - expect(await core.isPaneVisible(page, 'right')).be.false - expect(await core.isPaneVisible(page, 'bottom')).be.false - expect(await core.isPaneVisible(page, 'left')).be.false + expect(await core.isPaneVisible(page, 'top')).beTrue() + expect(await core.isPaneVisible(page, 'right')).beFalse() + expect(await core.isPaneVisible(page, 'bottom')).beFalse() + expect(await core.isPaneVisible(page, 'left')).beFalse() await core.clickAction(page, 'toggle-top-pane') - expect(await core.isPaneVisible(page, 'top')).be.false + expect(await core.isPaneVisible(page, 'top')).beFalse() await core.clickAction(page, 'toggle-right-pane') - expect(await core.isPaneVisible(page, 'right')).be.true + expect(await core.isPaneVisible(page, 'right')).beTrue() await core.clickAction(page, 'toggle-bottom-pane') - expect(await core.isPaneVisible(page, 'bottom')).be.true + expect(await core.isPaneVisible(page, 'bottom')).beTrue() await core.clickAction(page, 'toggle-left-pane') - expect(await core.isPaneVisible(page, 'left')).be.true + expect(await core.isPaneVisible(page, 'left')).beTrue() }) it('check-windows', async () => { await core.clickPaneAction(page, 'top', 'windows') for (const placement of placements) { - expect(await core.isWindowVisible(page, placement)).be.false + expect(await core.isWindowVisible(page, placement)).beFalse() } for (const placement of placements) { await core.clickAction(page, `toggle-${placement}-window`) - expect(await core.isWindowVisible(page, placement)).be.true + expect(await core.isWindowVisible(page, placement)).beTrue() const isFloating = await core.isWindowFloating(page, placement) if (isFloating) await core.pinWindow(page, placement) - expect(await core.isWindowPinned(page, placement)).be.true + expect(await core.isWindowPinned(page, placement)).beTrue() await core.maximizeWindow(page, placement) - expect(await core.isWindowMaximized(page, placement)).be.true + expect(await core.isWindowMaximized(page, placement)).beTrue() await core.restoreWindow(page, placement) - expect(await core.isWindowPinned(page, placement)).be.true + expect(await core.isWindowPinned(page, placement)).beTrue() await core.closeWindow(page, placement) - expect(await core.isWindowVisible(page, placement)).be.false + expect(await core.isWindowVisible(page, placement)).beFalse() } }) diff --git a/test/misc.test.mjs b/test/misc.test.mjs index a20ce476..54da8d8e 100644 --- a/test/misc.test.mjs +++ b/test/misc.test.mjs @@ -1,13 +1,17 @@ +import chai, { util, expect } from 'chai' +import chailint from 'chai-lint' import { core } from '@kalisio/kdk/test.client.js' const suite = 'misc' -describe(suite, () => { +describe(`suite:${suite}`, () => { let runner let page let user before(async () => { + chailint(chai, util) + runner = new core.Runner(suite, { appName: 'kapp', browser: { diff --git a/test/webpush.test.mjs b/test/webpush.test.mjs index aa3477ca..cb5bf32c 100644 --- a/test/webpush.test.mjs +++ b/test/webpush.test.mjs @@ -5,7 +5,7 @@ import { type, clickAction } from '@kalisio/kdk/test/client/core/utils.js'; const suite = 'webpush' -describe(suite, () => { +describe(`suite:${suite}`, () => { let runner let page let user diff --git a/yarn.lock b/yarn.lock index aa653479..ebd84c67 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5111,6 +5111,11 @@ eslint@^8.10.0, eslint@^8.41.0: strip-ansi "^6.0.1" text-table "^0.2.0" +esm@^3.2.25: + version "3.2.25" + resolved "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" + integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA== + espree@^9.3.1, espree@^9.6.0, espree@^9.6.1: version "9.6.1" resolved "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f"