0 && page > totalPages) {
- const redirectUrl = onBuildBaseUrl.call(this, {
+ const redirectUrl = this.buildBaseUrl({
search: {...search, page: metadata.totalPages}
})
return
}
- // Getting the IDs of the selected documents.
- const selection = state.selection[selectionKey] || []
-
- // Are we showing only selected documents?
- const isFilteringSelection =
- search.filter && search.filter.$selected === true
-
// Setting the page title.
setPageTitle(collection.name)
@@ -320,10 +311,7 @@ class DocumentListView extends React.Component {
// button.
const createNewHref = collection.IS_MEDIA_BUCKET
? undefined
- : onBuildBaseUrl.call(this, {
- createNew: true,
- search: null
- })
+ : this.buildBaseUrl({createNew: true, search: null})
return (
<>
@@ -352,14 +340,7 @@ class DocumentListView extends React.Component {
/>
)}
-
- {this.renderMain({
- collection,
- contentKey,
- isFilteringSelection,
- selection
- })}
-
+ {this.renderMain()}
@@ -387,165 +368,87 @@ class DocumentListView extends React.Component {
)
}
- renderMain({collection, contentKey, isFilteringSelection, selection}) {
- const {onBuildBaseUrl, route} = this.props
- const {mediaListMode} = this.state
- const {search} = route
- const pageNumber = search.page
+ renderMain() {
+ const {collection, contentKey, route, selection} = this.props
+ const {filter, order, page, sort} = route.search
- if (collection.IS_MEDIA_BUCKET) {
- const schema = {
- ...Constants.MEDIA_COLLECTION_SCHEMA,
- fields: {
- ...Constants.MEDIA_COLLECTION_SCHEMA.fields,
- url: {
- label: 'Thumbnail',
- FieldComponentList: this.renderMediaThumbnail.bind(this)
- }
- }
- }
+ const commonDocumentListProps = {
+ collection,
+ contentKey,
+ filters: filter,
+ onEmptyList: this.handleEmptyDocumentList,
+ onNetworkError: this.handleNetworkError,
+ onSelect: this.handleSelect,
+ order,
+ page,
+ selection,
+ sort
+ }
+ if (collection.IS_MEDIA_BUCKET) {
return (
(
-
- {!isFilteringSelection &&
- this.renderMediaListController({
- documents,
- onSelect,
- selectedDocuments
- })}
-
- {mediaListMode === 'grid' && (
- (
-
- )}
- onSelect={onSelect}
- selectedDocuments={selectedDocuments}
- />
- )}
-
- {mediaListMode === 'table' && (
-
- )}
-
+
)}
- onSelect={this.handleSelect.bind(this)}
- order={search.order}
- page={pageNumber}
selectAllHotKey="mod+a"
- selection={selection}
- sort={search.sort}
/>
)
}
// Filtering visible fields.
- const visibleFields =
- collection &&
- Object.keys(
- getVisibleFields({
- fields: collection.fields,
- viewType: 'list'
- })
- ).concat(Constants.DEFAULT_FIELDS)
+ const visibleFields = Object.keys(
+ getVisibleFields({
+ fields: collection.fields,
+ viewType: 'list'
+ })
+ ).concat(Constants.DEFAULT_FIELDS)
return (
(
)}
- onSelect={this.handleSelect.bind(this)}
- order={search.order}
- page={pageNumber}
- selection={selection}
- sort={search.sort}
- />
- )
- }
-
- renderMediaListController({documents, onSelect, selectedDocuments}) {
- const {mediaListMode} = this.state
-
- return (
-
- )
- }
-
- renderMediaThumbnail({document}) {
- const {state} = this.props
-
- return (
-
)
}
-
- updateMediaListMode(mediaListMode) {
- this.setState({
- mediaListMode
- })
- }
}
function mapState(state, ownProps) {
const {
+ isSingleDocument,
route: {params, search, searchString}
} = ownProps
@@ -556,12 +459,6 @@ function mapState(state, ownProps) {
return collection.slug === params.collection
})
- const isSingleDocument =
- collection &&
- collection.settings &&
- collection.settings.publish &&
- collection.settings.publish.isSingleDocument
-
const {group} = params
const contentKey = isSingleDocument
? JSON.stringify({collection: collection && collection.slug})
@@ -575,11 +472,12 @@ function mapState(state, ownProps) {
collection: collection && collection.slug,
group
})
+ const selection = state.selection[selectionKey] || []
return {
collection,
contentKey,
- isSingleDocument,
+ selection,
selectionKey,
state
}
diff --git a/app/views/ReferenceSelectView/ReferenceSelectView.jsx b/app/views/ReferenceSelectView/ReferenceSelectView.jsx
index d32d08857..796bd1e15 100644
--- a/app/views/ReferenceSelectView/ReferenceSelectView.jsx
+++ b/app/views/ReferenceSelectView/ReferenceSelectView.jsx
@@ -4,13 +4,12 @@ import {getFieldType, getVisibleFields} from 'lib/fields'
import {ArrowBack} from '@material-ui/icons'
import {Button} from '@dadi/edit-ui'
import {connectRedux} from 'lib/redux'
-import DocumentGridList from 'components/DocumentGridList/DocumentGridList'
import DocumentList from 'containers/DocumentList/DocumentList'
import DocumentListController from 'components/DocumentListController/DocumentListController'
import DocumentListToolbar from 'components/DocumentListToolbar/DocumentListToolbar'
import DocumentTableList from 'containers/DocumentTableList/DocumentTableList'
import HeroMessage from 'components/HeroMessage/HeroMessage'
-import MediaGridCard from 'containers/MediaGridCard/MediaGridCard'
+import MediaList from 'components/MediaList/MediaList'
import React from 'react'
import Style from 'lib/Style'
import styles from './ReferenceSelectView.css'
@@ -24,9 +23,12 @@ class ReferenceSelectView extends React.Component {
this.handleEmptyDocumentList = this.handleEmptyDocumentList.bind(this)
this.handleFiltersUpdate = this.handleFiltersUpdate.bind(this)
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)
+ this.sortList = ({sortBy, sortOrder}) => this.setState({sortBy, sortOrder})
+ this.updateMediaListMode = mediaListMode => this.setState({mediaListMode})
this.state = {
filter: undefined,
+ mediaListMode: 'grid',
page: 1,
sortBy: undefined,
sortOrder: undefined,
@@ -179,9 +181,16 @@ class ReferenceSelectView extends React.Component {
}}
onBuildBaseUrl={buildUrl}
onEmptyList={this.handleEmptyDocumentList}
- onRender={({documents, onSelect, selectedDocuments}) => {
+ onRender={({
+ documents,
+ hasSelection,
+ onSelect,
+ selectedDocuments
+ }) => {
return this.renderList({
documents,
+ hasSelection,
+ isFilteringSelection,
onSelect,
referencedCollection,
selectedDocuments
@@ -217,23 +226,31 @@ class ReferenceSelectView extends React.Component {
)
}
- renderList({documents, onSelect, referencedCollection, selectedDocuments}) {
- const {referenceFieldSchema} = this.props
+ renderList({
+ documents,
+ hasSelection,
+ isFilteringSelection,
+ onSelect,
+ referencedCollection,
+ selectedDocuments
+ }) {
+ const {buildUrl, referenceFieldSchema} = this.props
+ const {mediaListMode, sortBy, sortOrder} = this.state
if (referencedCollection.IS_MEDIA_BUCKET) {
return (
- (
-
- )}
+ hasSelection={hasSelection}
+ isFilteringSelection={isFilteringSelection}
+ mode={mediaListMode}
+ onBuildBaseUrl={buildUrl}
+ onListModeUpdate={this.updateMediaListMode}
onSelect={onSelect}
+ onSort={this.sortList}
+ order={sortOrder}
selectedDocuments={selectedDocuments}
+ sort={sortBy}
/>
)
}
@@ -251,8 +268,6 @@ class ReferenceSelectView extends React.Component {
_publishGroup: group
} = referencedCollection
- const {sortBy, sortOrder} = this.state
-
return (
this.setState({sortBy, sortOrder})}
+ onSort={this.sortList}
order={sortOrder}
selectedDocuments={selectedDocuments}
sort={sortBy}
diff --git a/dev-config/config.ci.json b/dev-config/config.ci.json
index 960b6a55b..29afc730a 100644
--- a/dev-config/config.ci.json
+++ b/dev-config/config.ci.json
@@ -40,6 +40,10 @@
"field-test"
],
"title": "Field Testing"
+ },
+ {
+ "collections": ["test-single-document", "test-single-document-tabs"],
+ "title": "Single Document"
}
]
}
diff --git a/dev-config/config.test.json b/dev-config/config.test.json
index aa05d8432..824b4c346 100644
--- a/dev-config/config.test.json
+++ b/dev-config/config.test.json
@@ -33,6 +33,10 @@
"no-filterable-fields"
],
"title": "Field Testing"
+ },
+ {
+ "collections": ["test-single-document", "test-single-document-tabs"],
+ "title": "Single Document"
}
]
}
diff --git a/package-lock.json b/package-lock.json
index 98de39dc6..4976c5f64 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@dadi/publish",
- "version": "3.0.0-rc5",
+ "version": "3.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -1457,9 +1457,9 @@
}
},
"@edithq/slate-md-serializer": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/@edithq/slate-md-serializer/-/slate-md-serializer-1.2.1.tgz",
- "integrity": "sha512-1aWq73DZJ/sweOoVIB6ubrDr54pHQuCW6jmWdpzk7UNvPDb0hnMtMvx0BjxUptEJ0JOKkd0oIyq0nxueE+NkyA==",
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@edithq/slate-md-serializer/-/slate-md-serializer-1.2.3.tgz",
+ "integrity": "sha512-gwmyvlRrT48nJt2vEtHBWYBFBblcasmPW/yBL0RQTHwrURMm2Kw4J0eozLHlIU5Z++dx7fHJIYDU2r6WKPDi5g==",
"dev": true,
"requires": {
"hashtag-regex": "^2.0.0"
@@ -6012,8 +6012,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"aproba": {
"version": "1.2.0",
@@ -6034,14 +6033,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -6056,20 +6053,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"core-util-is": {
"version": "1.0.2",
@@ -6186,8 +6180,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"ini": {
"version": "1.3.5",
@@ -6199,7 +6192,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -6214,7 +6206,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -6222,14 +6213,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@@ -6248,7 +6237,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -6329,8 +6317,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"object-assign": {
"version": "4.1.1",
@@ -6342,7 +6329,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"wrappy": "1"
}
@@ -6428,8 +6414,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"safer-buffer": {
"version": "2.1.2",
@@ -6465,7 +6450,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -6485,7 +6469,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@@ -6529,14 +6512,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
}
}
},
@@ -9616,9 +9597,9 @@
},
"dependencies": {
"glob": {
- "version": "7.1.4",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
- "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
+ "version": "7.1.5",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz",
+ "integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
diff --git a/package.json b/package.json
index da1835a84..f18d3ca63 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@dadi/publish",
- "version": "3.0.0",
+ "version": "3.0.1",
"description": "DADI Publish",
"main": "index.js",
"scripts": {
@@ -32,7 +32,7 @@
"@dadi/api-wrapper-core": "^4.0.0-rc2",
"@dadi/eslint-config": "^1.1.0",
"@dadi/prettier-config": "^1.1.0",
- "@edithq/slate-md-serializer": "^1.2.1",
+ "@edithq/slate-md-serializer": "^1.2.3",
"autoprefixer": "^9.6.1",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
diff --git a/test/api/workspace/collections/1.0/cloud/collection.test-single-document-tabs.json b/test/api/workspace/collections/1.0/cloud/collection.test-single-document-tabs.json
new file mode 100644
index 000000000..2339d7f7b
--- /dev/null
+++ b/test/api/workspace/collections/1.0/cloud/collection.test-single-document-tabs.json
@@ -0,0 +1,48 @@
+{
+ "fields": {
+ "title": {
+ "type": "String",
+ "label": "Title",
+ "publish": {
+ "section": "Home",
+ "placement": "main",
+ "display": {
+ "edit": true,
+ "list": true
+ }
+ }
+ },
+ "reference": {
+ "type": "Reference",
+ "label": "Reference",
+ "publish": {
+ "section": "Home",
+ "placement": "main",
+ "display": {
+ "edit": true
+ }
+ },
+ "settings": {
+ "collection": "team"
+ }
+ },
+ "titleTab2": {
+ "type": "String",
+ "label": "Title Tab 2",
+ "publish": {
+ "section": "More",
+ "placement": "main",
+ "display": {
+ "edit": true,
+ "list": true
+ }
+ }
+ }
+ },
+ "settings": {
+ "displayName": "Advanced single document",
+ "publish": {
+ "isSingleDocument": true
+ }
+ }
+}
diff --git a/test/api/workspace/collections/1.0/cloud/collection.test-single-document.json b/test/api/workspace/collections/1.0/cloud/collection.test-single-document.json
index 93fdc7621..eec009f9e 100644
--- a/test/api/workspace/collections/1.0/cloud/collection.test-single-document.json
+++ b/test/api/workspace/collections/1.0/cloud/collection.test-single-document.json
@@ -26,7 +26,7 @@
}
},
"settings": {
- "displayName": "Single-document collection",
+ "displayName": "Basic single document",
"publish": {
"isSingleDocument": true
}
diff --git a/test/functional/features/field_testing/07_misc_field_test.js b/test/functional/features/field_testing/07_misc_field_test.js
index 44cae028d..fe9a998e8 100644
--- a/test/functional/features/field_testing/07_misc_field_test.js
+++ b/test/functional/features/field_testing/07_misc_field_test.js
@@ -1,6 +1,6 @@
Feature('Misc Field Test Page - @smoke')
-BeforeSuite(async (mediaPage, fieldPage, loginPage) => {
+BeforeSuite(async (fieldPage, loginPage) => {
await loginPage.deleteUser('misc-field')
await loginPage.addUser('misc-field', '123456', [
'media:mediaStore',
@@ -13,7 +13,7 @@ BeforeSuite(async (mediaPage, fieldPage, loginPage) => {
)
})
-AfterSuite(async (I, loginPage, mediaPage) => {
+AfterSuite(async (I, loginPage) => {
await I.clearCookie('accessToken')
await loginPage.deleteUser('misc-field')
})
diff --git a/test/functional/helpers/editor_helper.js b/test/functional/helpers/editor_helper.js
index ed6459ebc..8805d0adc 100644
--- a/test/functional/helpers/editor_helper.js
+++ b/test/functional/helpers/editor_helper.js
@@ -2,10 +2,6 @@
'use strict'
-// const {
-// expect
-// } = require('chai')
-
class Editor extends Helper {
async getPage() {
return this.helpers['Puppeteer'].page
diff --git a/test/functional/pages/Article.js b/test/functional/pages/Article.js
index 9e329a32f..bf8035a8c 100644
--- a/test/functional/pages/Article.js
+++ b/test/functional/pages/Article.js
@@ -1,16 +1,11 @@
'use strict'
-const {assert, expect} = require('chai')
const moment = require('moment')
const random = require('../helpers/random')
-let I
+const I = actor()
module.exports = {
- _init() {
- I = require('../stepDefinitions/steps_file.js')()
- },
-
// insert your locators and methods here
locators: {
publishMenu: locate('a')
@@ -225,40 +220,48 @@ module.exports = {
cancelButton: locate('button[class*="Button__accent--negative"]').as(
'Cancel Button'
),
- boldButton: locate('button')
- .withText('Bold')
+ boldButton: locate('*')
+ .withAttr({'data-name': 'editor-bold-button'})
.as('Bold Button'),
- italicButton: locate('button')
- .withText('Italic')
+ italicButton: locate('*')
+ .withAttr({'data-name': 'editor-italic-button'})
.as('Italic Button'),
- linkButton: locate('button[title*="Insert link"]').as('Link Button'),
- h1Button: locate('button')
- .withText('H1')
+ linkButton: locate('*')
+ .withAttr({'data-name': 'editor-link-button'})
+ .as('Link Button'),
+ h1Button: locate('*')
+ .withAttr({'data-name': 'editor-h1-button'})
.as('Header 1 Button'),
- h2Button: locate('button')
- .withText('H2')
+ h2Button: locate('*')
+ .withAttr({'data-name': 'editor-h2-button'})
.as('Header 2 Button'),
- h3Button: locate('button')
- .withText('H3')
+ h3Button: locate('*')
+ .withAttr({'data-name': 'editor-h3-button'})
.as('Header 3 Button'),
- quoteButton: locate('button[title*="Blockquote"]').as('Blockquote Button'),
- orderedListButton: locate('button[title*="Numbered list"]').as(
- 'Numbered List Button'
- ),
- unOrderedListButton: locate('button[title*="Bulleted list"]').as(
- 'Bullet Point Button'
- ),
- codeButton: locate('button[title*="Code"]').as('Code Button'),
- imageButton: locate('button[title*="Insert asset from library"]').as(
- 'Image Button'
- ),
- fullScreenButton: locate('button[title*="Fullscreen"]').as(
- 'Full Screen Button'
- ),
- exitFullScreenButton: locate('button[title*="Exit fullscreen"]').as(
- 'Exit Full Screen Button'
- ),
- textButton: locate('button[title*="Markdown mode"]').as('Text Button'),
+ quoteButton: locate('*')
+ .withAttr({'data-name': 'editor-blockquote-button'})
+ .as('Blockquote Button'),
+ orderedListButton: locate('*')
+ .withAttr({'data-name': 'editor-ol-button'})
+ .as('Numbered List Button'),
+ unOrderedListButton: locate('*')
+ .withAttr({'data-name': 'editor-ul-button'})
+ .as('Bullet Point Button'),
+ codeButton: locate('*')
+ .withAttr({'data-name': 'editor-code-button'})
+ .as('Code Button'),
+ imageButton: locate('*')
+ .withAttr({'data-name': 'editor-image-button'})
+ .as('Image Button'),
+ fullScreenButton: locate('*')
+ .withAttr({'data-name': 'editor-fullscreen-button'})
+ .as('Full Screen Button'),
+ exitFullScreenButton: locate('*')
+ .withAttr({'data-name': 'editor-fullscreen-button'})
+ .as('Exit Full Screen Button'),
+ textButton: locate('*')
+ .withAttr({'data-name': 'editor-markdown-button'})
+ .as('Text Button'),
boldText: locate('span')
.withText('Bold')
.inside('strong')
@@ -337,6 +340,9 @@ module.exports = {
),
navMenu: locate('nav > ul > li').as('Navigation Menu'),
dogImage: locate('img[src*="dog"]').as('Dog Image'),
+ dogImageCheckbox: locate('div[data-filename*="dog"]')
+ .find('input[type="checkbox"]')
+ .as('Dog Image Checkbox'),
insertButton: locate(
'button[data-name*="save-reference-selection-button"]'
).as('Insert Items Button'),
@@ -359,24 +365,24 @@ module.exports = {
},
async validateArticlePage() {
- await I.amOnPage('/articles')
- await I.waitForVisible(this.locators.articleTitleHeading)
- await I.waitForElement(this.locators.footer)
- await I.seeElement(this.locators.createNewButton)
+ I.amOnPage('/articles')
+ I.waitForVisible(this.locators.articleTitleHeading)
+ I.waitForElement(this.locators.footer)
+ I.seeElement(this.locators.createNewButton)
const articles = await I.grabNumberOfVisibleElements(
this.locators.articleRows
)
const navItems = await I.grabTextFrom(this.locators.navMenu)
- await I.seeStringsAreEqual(
+ I.seeStringsAreEqual(
navItems.toString(),
'ARTICLES,CONTENT,TAXONOMY,WEB SERVICES,NETWORK SERVICES,MEDIA LIBRARY'
)
- await I.seeNumberOfVisibleElements(this.locators.articleRows, articles)
+ I.seeNumberOfVisibleElements(this.locators.articleRows, articles)
const range = await I.grabTextFrom(this.locators.numberOfArticles)
const number = range.substring(2, 4).trim()
- await I.seeNumbersAreEqual(articles.toString(), number)
+ I.seeNumbersAreEqual(articles.toString(), number)
},
async addArticle() {
@@ -529,10 +535,10 @@ module.exports = {
},
async editArticle() {
- await I.amOnPage('/articles')
- await I.waitForVisible(this.locators.articleTitleHeading)
- await I.waitForElement(this.locators.footer)
- await I.seeElement(this.locators.createNewButton)
+ I.amOnPage('/articles')
+ I.waitForVisible(this.locators.articleTitleHeading)
+ I.waitForElement(this.locators.footer)
+ I.seeElement(this.locators.createNewButton)
const articlesNames = await I.grabTextFrom(this.locators.numEditArticles)
@@ -564,20 +570,14 @@ module.exports = {
const authorsNamesAsc = await I.grabTextFrom(this.locators.numOfAuthors)
// Check names sorted correctly ascending alphabetically
- await I.seeStringsAreEqual(
- authorsNamesAsc.toString(),
- sortNamesAsc.toString()
- )
+ I.seeStringsAreEqual(authorsNamesAsc.toString(), sortNamesAsc.toString())
I.click(this.locators.authorNameDesc)
const authorsNamesDesc = await I.grabTextFrom(this.locators.numOfAuthors)
// Check names sorted correctly descending alphabetically
- await I.seeStringsAreEqual(
- authorsNamesDesc.toString(),
- sortNamesDesc.toString()
- )
+ I.seeStringsAreEqual(authorsNamesDesc.toString(), sortNamesDesc.toString())
I.click(this.locators.saveSelected)
I.waitForFunction(() => document.readyState === 'complete')
@@ -692,10 +692,10 @@ module.exports = {
},
async deleteArticle() {
- await I.amOnPage('/articles')
- await I.waitForVisible(this.locators.articleTitleHeading)
- await I.waitForElement(this.locators.footer)
- await I.seeElement(this.locators.createNewButton)
+ I.amOnPage('/articles')
+ I.waitForVisible(this.locators.articleTitleHeading)
+ I.waitForElement(this.locators.footer)
+ I.seeElement(this.locators.createNewButton)
const total = await I.grabTextFrom(this.locators.totalArticles)
const deleteArticles = await I.grabTextFrom(this.locators.numEditArticles)
@@ -775,103 +775,103 @@ module.exports = {
},
async richTextInput() {
- await I.amOnPage('/articles/new')
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/articles/new')
- await I.waitForVisible(this.locators.titleField)
- await I.fillField(this.locators.titleField, 'Rich Text')
- await I.scrollTo(this.locators.selectCategory)
+ I.amOnPage('/articles/new')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/articles/new')
+ I.waitForVisible(this.locators.titleField)
+ I.fillField(this.locators.titleField, 'Rich Text')
+ I.scrollTo(this.locators.selectCategory)
// Bold
- await I.fillField(this.locators.bodyField, 'Bold Text')
- await I.pressKey('ArrowLeft')
- await I.pressKey('ArrowLeft')
- await I.pressKey('ArrowLeft')
- await I.pressKey('ArrowLeft')
- await I.pressKey('ArrowLeft')
- await I.pressKey(['Shift', 'Home', 'Shift'])
- await I.emulateCommandButtonPressBold()
- await I.appendField(this.locators.bodyField, ' ')
- await I.pressKey('Enter')
+ I.fillField(this.locators.bodyField, 'Bold Text')
+ I.pressKey('ArrowLeft')
+ I.pressKey('ArrowLeft')
+ I.pressKey('ArrowLeft')
+ I.pressKey('ArrowLeft')
+ I.pressKey('ArrowLeft')
+ I.pressKey(['Shift', 'Home', 'Shift'])
+ I.emulateCommandButtonPressBold()
+ I.appendField(this.locators.bodyField, ' ')
+ I.pressKey('Enter')
// Italic
- await I.fillField(this.locators.bodyField, 'Italic Text')
- await I.pressKey('ArrowLeft')
- await I.pressKey('ArrowLeft')
- await I.pressKey('ArrowLeft')
- await I.pressKey('ArrowLeft')
- await I.pressKey('ArrowLeft')
- await I.pressKey(['Shift', 'Home', 'Shift'])
- await I.emulateCommandButtonPressItalic()
- await I.appendField(this.locators.bodyField, ' ')
- await I.pressKey('Enter')
+ I.fillField(this.locators.bodyField, 'Italic Text')
+ I.pressKey('ArrowLeft')
+ I.pressKey('ArrowLeft')
+ I.pressKey('ArrowLeft')
+ I.pressKey('ArrowLeft')
+ I.pressKey('ArrowLeft')
+ I.pressKey(['Shift', 'Home', 'Shift'])
+ I.emulateCommandButtonPressItalic()
+ I.appendField(this.locators.bodyField, ' ')
+ I.pressKey('Enter')
// H1
- await I.click(this.locators.h1Button)
- await I.fillField(this.locators.bodyField, 'Header 1')
- await I.pressKey('Enter')
+ I.click(this.locators.h1Button)
+ I.fillField(this.locators.bodyField, 'Header 1')
+ I.pressKey('Enter')
// H2
- await I.click(this.locators.h2Button)
- await I.fillField(this.locators.bodyField, 'Header 2')
- await I.pressKey('Enter')
+ I.click(this.locators.h2Button)
+ I.fillField(this.locators.bodyField, 'Header 2')
+ I.pressKey('Enter')
// H3
- await I.click(this.locators.h3Button)
- await I.fillField(this.locators.bodyField, 'Header 3')
- await I.pressKey('Enter')
+ I.click(this.locators.h3Button)
+ I.fillField(this.locators.bodyField, 'Header 3')
+ I.pressKey('Enter')
// Blockquote
- await I.fillField(this.locators.bodyField, 'Some text')
- await I.pressKey('Enter')
- await I.fillField(this.locators.bodyField, 'Blockquote')
- await I.click(this.locators.quoteButton)
- await I.pressKey('Enter')
- await I.click(this.locators.quoteButton)
+ I.fillField(this.locators.bodyField, 'Some text')
+ I.pressKey('Enter')
+ I.fillField(this.locators.bodyField, 'Blockquote')
+ I.click(this.locators.quoteButton)
+ I.pressKey('Enter')
+ I.click(this.locators.quoteButton)
// Link
- await I.fillField(this.locators.bodyField, 'Some more text')
- await I.pressKey('Enter')
- await I.fillField(this.locators.bodyField, 'Link')
- await I.pressKey(['Shift', 'Home', 'Shift'])
- await I.click(this.locators.linkButton)
- await I.waitForElement(this.locators.linkField)
- await I.fillField(this.locators.linkField, 'www.link.com')
- await I.pressKey('Enter')
- await I.appendField(this.locators.bodyField, ' ')
- await I.pressKey('Enter')
+ I.fillField(this.locators.bodyField, 'Some more text')
+ I.pressKey('Enter')
+ I.fillField(this.locators.bodyField, 'Link')
+ I.pressKey(['Shift', 'Home', 'Shift'])
+ I.click(this.locators.linkButton)
+ I.waitForElement(this.locators.linkField)
+ I.fillField(this.locators.linkField, 'www.link.com')
+ I.pressKey('Enter')
+ I.appendField(this.locators.bodyField, ' ')
+ I.pressKey('Enter')
// Ordered List
- await I.click(this.locators.orderedListButton)
- await I.fillField(this.locators.bodyField, 'Point 1')
- await I.pressKey('Enter')
- await I.fillField(this.locators.bodyField, 'Point 2')
- await I.pressKey('Enter')
- await I.click(this.locators.orderedListButton)
+ I.click(this.locators.orderedListButton)
+ I.fillField(this.locators.bodyField, 'Point 1')
+ I.pressKey('Enter')
+ I.fillField(this.locators.bodyField, 'Point 2')
+ I.pressKey('Enter')
+ I.click(this.locators.orderedListButton)
// Unordered List
- await I.click(this.locators.unOrderedListButton)
- await I.fillField(this.locators.bodyField, 'Bullet 1')
- await I.pressKey('Enter')
- await I.fillField(this.locators.bodyField, 'Bullet 2')
- await I.pressKey('Enter')
- await I.click(this.locators.unOrderedListButton)
+ I.click(this.locators.unOrderedListButton)
+ I.fillField(this.locators.bodyField, 'Bullet 1')
+ I.pressKey('Enter')
+ I.fillField(this.locators.bodyField, 'Bullet 2')
+ I.pressKey('Enter')
+ I.click(this.locators.unOrderedListButton)
// Save
- await I.click(this.locators.save)
- await I.waitForText('The document has been created', 2)
- await I.scrollTo(this.locators.selectCategory)
- await I.seeElement(this.locators.boldText)
- await I.seeElement(this.locators.italicText)
- await I.seeElement(this.locators.h1Text)
- await I.seeElement(this.locators.h2Text)
- await I.seeElement(this.locators.h3Text)
- await I.seeElement(this.locators.quoteText)
- await I.seeElement(this.locators.linkText)
- await I.seeElement(this.locators.orderedList1)
- await I.seeElement(this.locators.orderedList2)
- await I.seeElement(this.locators.unorderedList1)
- await I.seeElement(this.locators.unorderedList2)
+ I.click(this.locators.save)
+ I.waitForText('The document has been created', 2)
+ I.scrollTo(this.locators.selectCategory)
+ I.seeElement(this.locators.boldText)
+ I.seeElement(this.locators.italicText)
+ I.seeElement(this.locators.h1Text)
+ I.seeElement(this.locators.h2Text)
+ I.seeElement(this.locators.h3Text)
+ I.seeElement(this.locators.quoteText)
+ I.seeElement(this.locators.linkText)
+ I.seeElement(this.locators.orderedList1)
+ I.seeElement(this.locators.orderedList2)
+ I.seeElement(this.locators.unorderedList1)
+ I.seeElement(this.locators.unorderedList2)
// (!) TO DO: We need a better way of testing the rich editor. Currently,
// it works by typing *and* selecting text at the same time, which means
@@ -886,41 +886,41 @@ module.exports = {
// -- dm (03/07/2019)
// Text mode and Full Screen
- await I.click(this.locators.textButton)
- await I.see('**Bold** Text')
- await I.see('_Italic_ Text')
- await I.see('# Header 1')
- await I.see('## Header 2')
- await I.see('### Header 3')
- await I.see('> Blockquote')
- await I.see('(www.link.com)')
- await I.see('1. Point 1')
- await I.see('2. Point 2')
- await I.see('- Bullet 1')
- await I.see('- Bullet 2')
- await I.click(this.locators.textButton)
- await I.click(this.locators.fullScreenButton)
- await I.dontSeeElement(this.locators.titleField)
- await I.dontSeeElement(this.locators.selectCategory)
- await I.click(this.locators.exitFullScreenButton)
- await I.seeElement(this.locators.titleField)
- await I.seeElement(this.locators.selectCategory)
+ I.click(this.locators.textButton)
+ I.see('**Bold** Text')
+ I.see('_Italic_ Text')
+ I.see('# Header 1')
+ I.see('## Header 2')
+ I.see('### Header 3')
+ I.see('> Blockquote')
+ I.see('(www.link.com)')
+ I.see('1. Point 1')
+ I.see('2. Point 2')
+ I.see('- Bullet 1')
+ I.see('- Bullet 2')
+ I.click(this.locators.textButton)
+ I.click(this.locators.fullScreenButton)
+ I.dontSeeElement(this.locators.titleField)
+ I.dontSeeElement(this.locators.selectCategory)
+ I.click(this.locators.exitFullScreenButton)
+ I.seeElement(this.locators.titleField)
+ I.seeElement(this.locators.selectCategory)
},
async inlineImage() {
- await I.amOnPage('/articles/new')
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/articles/new')
- await I.waitForVisible(this.locators.titleField)
- await I.fillField(this.locators.titleField, 'Inline Image')
+ I.amOnPage('/articles/new')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/articles/new')
+ I.waitForVisible(this.locators.titleField)
+ I.fillField(this.locators.titleField, 'Inline Image')
// Inline Image
- await I.appendField(this.locators.bodyField, '')
- await I.click(this.locators.imageButton)
- await I.click(this.locators.dogImage)
- await I.click(this.locators.insertButton)
- await I.click(this.locators.save)
- await I.waitForText('The document has been created', 2)
+ I.appendField(this.locators.bodyField, '')
+ I.click(this.locators.imageButton)
+ I.click(this.locators.dogImageCheckbox)
+ I.click(this.locators.insertButton)
+ I.click(this.locators.save)
+ I.waitForText('The document has been created', 2)
// Get today's date for URL
const year = await moment(new Date()).format('YYYY')
const month = await moment(new Date()).format('MM')
@@ -935,14 +935,14 @@ module.exports = {
day +
'/dog.jpg'
- await I.seeStringContains(imageLink, expectedImageLink)
+ I.seeStringContains(imageLink, expectedImageLink)
// markdown view
I.wait(2)
- await I.scrollTo(this.locators.selectCategory)
- await I.click(this.locators.textButton)
- await I.seeElement(this.locators.markdownText)
+ I.scrollTo(this.locators.selectCategory)
+ I.click(this.locators.textButton)
+ I.seeElement(this.locators.markdownText)
const imageText = await I.grabTextFrom(this.locators.markdownText)
- await I.seeStringsAreEqual(imageText, '')
+ I.seeStringsAreEqual(imageText, '')
}
}
diff --git a/test/functional/pages/Field.js b/test/functional/pages/Field.js
index f49ea406e..c10dfaf1e 100644
--- a/test/functional/pages/Field.js
+++ b/test/functional/pages/Field.js
@@ -1,16 +1,12 @@
'use strict'
-const {assert, expect} = require('chai')
const moment = require('moment')
const random = require('../helpers/random')
+const _ = require('lodash')
-let I
+const I = actor()
module.exports = {
- _init() {
- I = require('../stepDefinitions/steps_file.js')()
- },
-
// insert your locators and methods here
locators: {
footer: locate('footer').as('Field Test Page Footer'),
@@ -106,6 +102,18 @@ module.exports = {
.find('span[class*="Label__error-message-text"]')
.withText('This field must be before Mon Jan 01 2018')
.as('A Date Before Error Message'),
+ dateYYYYMMDD: locate('div')
+ .withAttr({
+ 'data-field-name': 'dateYYYYMMDD'
+ })
+ .find('input[class*="TextInput__input"]')
+ .as('A date with no time YYYYMMDD'),
+ dateDDMMYYYY: locate('div')
+ .withAttr({
+ 'data-field-name': 'dateDDMMYYYY'
+ })
+ .find('input[class*="TextInput__input"]')
+ .as('A date with no time DDMMYYYY'),
numberReq: locate('div')
.withAttr({
'data-field-name': 'numberRequired'
@@ -358,12 +366,12 @@ module.exports = {
stringListEmptyField: locate(
'svg[class*="MuiSvgIcon-root SortableList__icon-add"]+input[value=""]'
).as('Empty Multi-Entry String Item'),
- secondElement: locate('[role="presentation"]').before(
- 'input[value="Second String"]'
- ),
- thirdElement: locate('[role="presentation"]').before(
- 'input[value="Third String"]'
- ),
+ secondElement: locate('[role="presentation"]')
+ .before('input[value="Second String"]')
+ .as('Second Element'),
+ thirdElement: locate('[role="presentation"]')
+ .before('input[value="Third String"]')
+ .as('Third Element'),
multiEntryStringText: locate('input[value*="String"]').as(
'Multi-Entry String Text'
),
@@ -451,13 +459,21 @@ module.exports = {
'Save Button'
),
totalImages: locate('.//strong[2]').as('Total Number of Images'),
- stoneJpeg: locate('img[src*="Stone"]').as('JPEG Image 1'),
- watsonJpeg: locate('img[src*="Watson"]').as('JPEG Image 2'),
- dogJpg: locate('img[src*="dog"]').as('JPG Image'),
- girlPng: locate('img[src*="girl"]').as('PNG Image'),
- pdf: locate('div[class*="MediaGridCard__filename"]')
- .withText('DADI_Publish.pdf')
- .as('PDF Document'),
+ stoneJpegCheckbox: locate('div[data-filename*="Stone"]')
+ .find('input[type="checkbox"]')
+ .as('JPEG Image 1 Checkbox'),
+ watsonJpegCheckbox: locate('div[data-filename*="Watson"]')
+ .find('input[type="checkbox"]')
+ .as('JPEG Image 2 Checkbox'),
+ dogJpgCheckbox: locate('div[data-filename*="dog"]')
+ .find('input[type="checkbox"]')
+ .as('JPG Image Checkbox'),
+ girlPngCheckbox: locate('div[data-filename*="girl"]')
+ .find('input[type="checkbox"]')
+ .as('PNG Image Checkbox'),
+ pdfCheckbox: locate('div[data-filename="DADI_Publish.pdf"]')
+ .find('input[type="checkbox"]')
+ .as('PDF Document Checkbox'),
cancelButton: locate('button[class*="Button__accent--negative"]').as(
'Cancel Button'
),
@@ -740,6 +756,48 @@ module.exports = {
colourSlider: locate('div[class*="ColorPicker__slider"]').as(
'Colour Slider'
),
+ datePickerContainer: locate('div[class*="DateTimePicker__container"]').as(
+ 'Date Picker'
+ ),
+ currentDay: locate(
+ 'button[class*="DateTimePicker__calendar-day-current"]'
+ ).as('Current Day'),
+ newCurrentDay: locate('button[class*="DateTimePicker__calendar-day"]')
+ .withText('05')
+ .as('05'),
+ hoursLauncherSelector: locate(
+ 'div[class*="DateTimePicker__time-picker"] > select'
+ ).as('Hours Selector'),
+ calBackArrow: locate('button[class*="DateTimePicker__page-icon-prev"]').as(
+ 'Back Arrow'
+ ),
+ calForwardArrow: locate(
+ 'button[class*="DateTimePicker__page-icon-next"]'
+ ).as('Forward Arrow'),
+ currentDate: locate('div[class*="DateTimePicker__head"] > p').as(
+ 'Current Month and Year'
+ ),
+ sundayCal: locate('th[class*="DateTimePicker__calendar-head"]')
+ .withText('Su')
+ .as('Sunday'),
+ mondayCal: locate('th[class*="DateTimePicker__calendar-head"]')
+ .withText('Mo')
+ .as('Monday'),
+ tuesdayCal: locate('th[class*="DateTimePicker__calendar-head"]')
+ .withText('Tu')
+ .as('Tuesday'),
+ wednesdayCal: locate('th[class*="DateTimePicker__calendar-head"]')
+ .withText('We')
+ .as('Wednesday'),
+ thursdayCal: locate('th[class*="DateTimePicker__calendar-head"]')
+ .withText('Th')
+ .as('Thursday'),
+ fridayCal: locate('th[class*="DateTimePicker__calendar-head"]')
+ .withText('Fr')
+ .as('Friday'),
+ saturdayCal: locate('th[class*="DateTimePicker__calendar-head"]')
+ .withText('Sa')
+ .as('Saturday'),
filterButton: locate('button')
.withAttr({'data-name': 'add-filter-button'})
.as('Filter Button'),
@@ -781,25 +839,25 @@ module.exports = {
},
async validateBoolean() {
- await I.amOnPage('/field-testing/field-test-boolean')
+ I.amOnPage('/field-testing/field-test-boolean')
I.wait(2)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.createNewButton)
- await I.click(this.locators.createNewButton)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/field-test-boolean/new')
- await I.seeElement(this.locators.boolReq)
- await I.seeElement(this.locators.boolReadOnly)
- await I.seeElement(this.locators.boolWithComment)
- await I.click(this.locators.boolReq)
- await I.click(this.locators.boolWithComment)
- await I.click(this.locators.saveMenu)
- await I.click(this.locators.saveGoBack)
- await I.waitForText('The document has been created', 3)
- await I.dontSeeInCurrentUrl('/new')
- await I.waitForVisible(this.locators.boolYes)
- await I.seeElement(this.locators.boolCommentYes)
- await I.seeElement(this.locators.boolNo)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeElement(this.locators.createNewButton)
+ I.click(this.locators.createNewButton)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/field-test-boolean/new')
+ I.seeElement(this.locators.boolReq)
+ I.seeElement(this.locators.boolReadOnly)
+ I.seeElement(this.locators.boolWithComment)
+ I.click(this.locators.boolReq)
+ I.click(this.locators.boolWithComment)
+ I.click(this.locators.saveMenu)
+ I.click(this.locators.saveGoBack)
+ I.waitForText('The document has been created', 3)
+ I.dontSeeInCurrentUrl('/new')
+ I.waitForVisible(this.locators.boolYes)
+ I.seeElement(this.locators.boolCommentYes)
+ I.seeElement(this.locators.boolNo)
},
async deleteAllBooleans() {
@@ -807,78 +865,151 @@ module.exports = {
},
async validateDate() {
- await I.amOnPage('/field-testing/field-test-date')
- // I.wait(2)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.createNewButton)
- await I.click(this.locators.createNewButton)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/field-test-date/new')
- await I.seeElement(this.locators.dateReq)
- await I.seeElement(this.locators.dateReadOnly)
- await I.seeElement(this.locators.dateFuture)
- await I.seeElement(this.locators.datePast)
- await I.seeElement(this.locators.dateAfter)
- await I.seeElement(this.locators.dateBefore)
- await I.click(this.locators.save)
- await I.seeElement(this.locators.dateReqError)
+ I.amOnPage('/field-testing/field-test-date')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeElement(this.locators.createNewButton)
+ I.click(this.locators.createNewButton)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/field-test-date/new')
+ I.seeElement(this.locators.dateReq)
+ I.seeElement(this.locators.dateReadOnly)
+ I.seeElement(this.locators.dateFuture)
+ I.seeElement(this.locators.datePast)
+ I.seeElement(this.locators.dateAfter)
+ I.seeElement(this.locators.dateBefore)
+ I.seeElement(this.locators.dateYYYYMMDD)
+ I.seeElement(this.locators.dateDDMMYYYY)
+ I.click(this.locators.save)
+ I.seeElement(this.locators.dateReqError)
const formattedDate = moment(new Date()).format('YYYY/MM/DD 09:00')
- await I.fillField(this.locators.dateReq, formattedDate)
- await I.pressKey('Enter')
+ I.click(this.locators.dateReadOnly)
+ I.click(this.locators.dateReq)
+ I.seeElement(this.locators.datePickerContainer)
+ I.seeElement(this.locators.calBackArrow)
+ I.seeElement(this.locators.calForwardArrow)
+ I.seeElement(this.locators.sundayCal)
+ I.seeElement(this.locators.mondayCal)
+ I.seeElement(this.locators.tuesdayCal)
+ I.seeElement(this.locators.wednesdayCal)
+ I.seeElement(this.locators.thursdayCal)
+ I.seeElement(this.locators.fridayCal)
+ I.seeElement(this.locators.saturdayCal)
+ const momentMonth = moment(new Date()).format('MMMM YYYY')
+ const currentMonth = await I.grabTextFrom(this.locators.currentDate)
+
+ I.seeStringsAreEqual(currentMonth, momentMonth)
+ I.click(this.locators.currentDay)
+ I.click(this.locators.dateReq)
+ I.selectOption(this.locators.hoursLauncherSelector, '09:00')
+ I.click(this.locators.dateYYYYMMDD)
+ I.seeElement(this.locators.datePickerContainer)
+ I.seeElement(this.locators.calBackArrow)
+ I.seeElement(this.locators.calForwardArrow)
+ I.seeElement(this.locators.sundayCal)
+ I.seeElement(this.locators.mondayCal)
+ I.seeElement(this.locators.tuesdayCal)
+ I.seeElement(this.locators.wednesdayCal)
+ I.seeElement(this.locators.thursdayCal)
+ I.seeElement(this.locators.fridayCal)
+ I.seeElement(this.locators.saturdayCal)
+ I.dontSeeElement(this.locators.hoursLauncherSelector)
+ I.click(this.locators.currentDay)
+ const noTimeDate = moment(new Date()).format('DD-MM-YYYY')
+
+ I.click(this.locators.dateDDMMYYYY)
+ I.seeElement(this.locators.datePickerContainer)
+ I.dontSeeElement(this.locators.hoursLauncherSelector)
+
+ I.fillField(this.locators.dateDDMMYYYY, noTimeDate)
let futureDateErr = moment(new Date(), 'YYYY/MM/DD').subtract(
- random(1, 7),
+ _.random(1, 7),
'days'
)
futureDateErr = futureDateErr.format('YYYY/MM/DD 09:00')
- await I.fillField(this.locators.dateFuture, futureDateErr)
- await I.pressKey('Enter')
- await I.click(this.locators.datePast)
- await I.waitForVisible(this.locators.dateFutureError)
+ I.click(this.locators.dateFuture)
+ I.fillField(this.locators.dateFuture, futureDateErr)
+ I.click(this.locators.dateReadOnly)
+ I.click(this.locators.datePast)
+ I.waitForVisible(this.locators.dateFutureError)
let pastDateErr = moment(new Date(), 'YYYY/MM/DD').add(random(1, 7), 'days')
pastDateErr = pastDateErr.format('YYYY/MM/DD 09:00')
- await I.fillField(this.locators.datePast, pastDateErr)
- await I.pressKey('Enter')
- await I.click(this.locators.dateAfter)
- await I.waitForVisible(this.locators.datePastError)
- await I.fillField(this.locators.dateAfter, '2017/12/31 09:00')
- await I.pressKey('Enter')
- await I.click(this.locators.dateBefore)
- await I.waitForVisible(this.locators.dateAfterError)
+ I.fillField(this.locators.datePast, pastDateErr)
+ I.click(this.locators.dateReadOnly)
+ I.click(this.locators.dateAfter)
+ I.waitForVisible(this.locators.datePastError)
+ I.fillField(this.locators.dateAfter, '2017/12/31 09:00')
+ I.click(this.locators.dateReadOnly)
+ I.click(this.locators.dateBefore)
+ I.waitForVisible(this.locators.dateAfterError)
const dateBefore = moment(new Date()).format('YYYY/MM/DD 09:00')
- await I.fillField(this.locators.dateBefore, dateBefore)
- await I.click(this.locators.dateReq)
- await I.waitForVisible(this.locators.dateBeforeError)
- await I.click(this.locators.save)
- await I.clearField(this.locators.dateFuture)
- let futureDate = moment(new Date(), 'YYYY/MM/DD').add(random(1, 60), 'days')
-
- futureDate = futureDate.format('YYYY/MM/DD 09:00')
- await I.fillField(this.locators.dateFuture, futureDate)
- await I.click(this.locators.dateReadOnly)
- await I.clearField(this.locators.datePast)
+ I.fillField(this.locators.dateBefore, dateBefore)
+ I.click(this.locators.dateReadOnly)
+ I.waitForVisible(this.locators.dateBeforeError)
+ I.click(this.locators.save)
+ I.clearField(this.locators.dateFuture)
+ I.seeElement(this.locators.datePickerContainer)
+ I.seeElement(this.locators.sundayCal)
+ I.seeElement(this.locators.mondayCal)
+ I.seeElement(this.locators.tuesdayCal)
+ I.seeElement(this.locators.wednesdayCal)
+ I.seeElement(this.locators.thursdayCal)
+ I.seeElement(this.locators.fridayCal)
+ I.seeElement(this.locators.saturdayCal)
+ I.click(this.locators.calForwardArrow)
+ const newCurrentMonth = await I.grabTextFrom(this.locators.currentDate)
+ const newMomentMonth = moment(new Date())
+ .add(1, 'months')
+ .format('MMMM YYYY')
+
+ I.seeStringsAreEqual(newCurrentMonth, newMomentMonth)
+ I.click(this.locators.newCurrentDay)
+ I.click(this.locators.dateReadOnly)
+ I.click(this.locators.datePast)
+ I.clearField(this.locators.datePast)
let pastDate = moment(new Date(), 'YYYY/MM/DD').subtract(
random(1, 180),
'days'
)
pastDate = pastDate.format('YYYY/MM/DD 09:00')
- await I.fillField(this.locators.datePast, pastDate)
- await I.click(this.locators.dateReadOnly)
- await I.clearField(this.locators.dateAfter)
- await I.fillField(this.locators.dateAfter, '2018/01/02 23:00')
- await I.click(this.locators.dateReadOnly)
- await I.clearField(this.locators.dateBefore)
- await I.fillField(this.locators.dateBefore, '2017/12/31 09:00')
- await I.click(this.locators.dateReadOnly)
- await I.click(this.locators.saveMenu)
- await I.click(this.locators.saveGoBack)
- await I.waitForText('The document has been created', 3)
- await I.dontSeeInCurrentUrl('/new')
- await I.waitForText(formattedDate)
+ I.fillField(this.locators.datePast, pastDate)
+ I.click(this.locators.dateReadOnly)
+ I.clearField(this.locators.dateAfter)
+ const monthPast = await I.grabTextFrom(this.locators.currentDate)
+
+ I.seeStringsAreEqual(monthPast, 'December 2017')
+ I.fillField(this.locators.dateAfter, '2018/01/02 23:00')
+ I.click(this.locators.dateReadOnly)
+ I.clearField(this.locators.dateBefore)
+ I.fillField(this.locators.dateBefore, '2017/12/31 09:00')
+ I.click(this.locators.dateReadOnly)
+ const correctYYYYMMDD = moment(new Date()).format('YYYY-MM-DD')
+ const correctDDMMYYYY = moment(new Date()).format('DD-MM-YYYY')
+ const correctedYYYYMMDD = await I.grabValueFrom(this.locators.dateYYYYMMDD)
+ const correctedDDMMYYYY = await I.grabValueFrom(this.locators.dateDDMMYYYY)
+ const futureDateEntered = await I.grabValueFrom(this.locators.dateFuture)
+ const pastDateEntered = await I.grabValueFrom(this.locators.datePast)
+ const dateAfterEntered = await I.grabValueFrom(this.locators.dateAfter)
+ const dateBeforeEntered = await I.grabValueFrom(this.locators.dateBefore)
+
+ I.seeStringsAreEqual(correctedYYYYMMDD, correctYYYYMMDD)
+ I.seeStringsAreEqual(correctedDDMMYYYY, correctDDMMYYYY)
+
+ I.click(this.locators.saveMenu)
+ I.click(this.locators.saveGoBack)
+ I.waitForText('The document has been created', 3)
+ I.dontSeeInCurrentUrl('/new')
+ I.waitForText(formattedDate)
+ I.waitForText(futureDateEntered)
+ I.waitForText(pastDateEntered)
+ I.waitForText(dateAfterEntered)
+ I.waitForText(dateBeforeEntered)
+ I.waitForText(correctedYYYYMMDD)
+ I.waitForText(correctedDDMMYYYY)
},
async deleteAllDates() {
@@ -886,57 +1017,57 @@ module.exports = {
},
async validateNumber() {
- await I.amOnPage('/field-testing/field-test-number')
+ I.amOnPage('/field-testing/field-test-number')
// I.wait(2)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.createNewButton)
- await I.click(this.locators.createNewButton)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/field-test-number/new')
- await I.seeElement(this.locators.numberReq)
- await I.seeElement(this.locators.numberNoLabel)
- await I.seeElement(this.locators.numberGT)
- await I.seeElement(this.locators.numberLT)
- await I.seeElement(this.locators.numberReadOnly)
- await I.seeElement(this.locators.numberOdd)
- await I.seeElement(this.locators.numberEven)
- await I.seeElement(this.locators.numberInt)
- await I.seeElement(this.locators.numberFloat)
- await I.click(this.locators.save)
- await I.waitForVisible(this.locators.numberReqError)
- await I.fillField(this.locators.numberGT, '10')
- await I.waitForVisible(this.locators.numberGTError)
- await I.fillField(this.locators.numberLT, '10')
- await I.waitForVisible(this.locators.numberLTError)
- await I.fillField(this.locators.numberOdd, '2')
- await I.waitForVisible(this.locators.numberOddError)
- await I.fillField(this.locators.numberEven, '1')
- await I.waitForVisible(this.locators.numberEvenError)
- await I.fillField(this.locators.numberInt, '1.01')
- await I.waitForVisible(this.locators.numberIntError)
- await I.fillField(this.locators.numberFloat, '-1')
- await I.waitForVisible(this.locators.numberFloatError)
- await I.fillField(this.locators.numberReq, '1')
- await I.appendField(this.locators.numberGT, '')
- await I.pressKey('ArrowUp')
- await I.pressKey('ArrowUp')
- await I.seeInField(this.locators.numberGT, '12')
- await I.appendField(this.locators.numberLT, '')
- await I.pressKey('ArrowDown')
- await I.seeInField(this.locators.numberLT, '9')
- await I.clearField(this.locators.numberOdd)
- await I.fillField(this.locators.numberOdd, '1')
- await I.clearField(this.locators.numberEven)
- await I.fillField(this.locators.numberEven, '2')
- await I.clearField(this.locators.numberInt)
- await I.fillField(this.locators.numberInt, '-21')
- await I.clearField(this.locators.numberFloat)
- await I.fillField(this.locators.numberFloat, '1.0123')
- await I.click(this.locators.saveMenu)
- await I.click(this.locators.saveGoBack)
- await I.waitForText('The document has been created', 3)
- await I.dontSeeInCurrentUrl('/new')
- await I.waitForText('1.0123')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeElement(this.locators.createNewButton)
+ I.click(this.locators.createNewButton)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/field-test-number/new')
+ I.seeElement(this.locators.numberReq)
+ I.seeElement(this.locators.numberNoLabel)
+ I.seeElement(this.locators.numberGT)
+ I.seeElement(this.locators.numberLT)
+ I.seeElement(this.locators.numberReadOnly)
+ I.seeElement(this.locators.numberOdd)
+ I.seeElement(this.locators.numberEven)
+ I.seeElement(this.locators.numberInt)
+ I.seeElement(this.locators.numberFloat)
+ I.click(this.locators.save)
+ I.waitForVisible(this.locators.numberReqError)
+ I.fillField(this.locators.numberGT, '10')
+ I.waitForVisible(this.locators.numberGTError)
+ I.fillField(this.locators.numberLT, '10')
+ I.waitForVisible(this.locators.numberLTError)
+ I.fillField(this.locators.numberOdd, '2')
+ I.waitForVisible(this.locators.numberOddError)
+ I.fillField(this.locators.numberEven, '1')
+ I.waitForVisible(this.locators.numberEvenError)
+ I.fillField(this.locators.numberInt, '1.01')
+ I.waitForVisible(this.locators.numberIntError)
+ I.fillField(this.locators.numberFloat, '-1')
+ I.waitForVisible(this.locators.numberFloatError)
+ I.fillField(this.locators.numberReq, '1')
+ I.appendField(this.locators.numberGT, '')
+ I.pressKey('ArrowUp')
+ I.pressKey('ArrowUp')
+ I.seeInField(this.locators.numberGT, '12')
+ I.appendField(this.locators.numberLT, '')
+ I.pressKey('ArrowDown')
+ I.seeInField(this.locators.numberLT, '9')
+ I.clearField(this.locators.numberOdd)
+ I.fillField(this.locators.numberOdd, '1')
+ I.clearField(this.locators.numberEven)
+ I.fillField(this.locators.numberEven, '2')
+ I.clearField(this.locators.numberInt)
+ I.fillField(this.locators.numberInt, '-21')
+ I.clearField(this.locators.numberFloat)
+ I.fillField(this.locators.numberFloat, '1.0123')
+ I.click(this.locators.saveMenu)
+ I.click(this.locators.saveGoBack)
+ I.waitForText('The document has been created', 3)
+ I.dontSeeInCurrentUrl('/new')
+ I.waitForText('1.0123')
},
async deleteAllNumbers() {
@@ -944,160 +1075,160 @@ module.exports = {
},
async validateString() {
- await I.amOnPage('/field-testing/field-test-string')
+ I.amOnPage('/field-testing/field-test-string')
// I.wait(2)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.createNewButton)
- await I.click(this.locators.createNewButton)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/field-test-string/new')
- await I.seeElement(this.locators.stringReq)
- await I.seeElement(this.locators.stringReadOnly)
- await I.seeElement(this.locators.stringMulti)
- await I.seeElement(this.locators.stringList)
- await I.seeElement(this.locators.stringListAdd)
- await I.seeElement(this.locators.stringHeightContent)
- await I.seeElement(this.locators.stringHeightFull)
- await I.seeElement(this.locators.stringResizable)
- await I.seeElement(this.locators.stringNoLabel)
- await I.seeElement(this.locators.stringAutoGen)
- await I.seeElement(this.locators.stringMinLength)
- await I.seeElement(this.locators.stringMaxLength)
- await I.seeElement(this.locators.stringRegex)
- await I.seeElement(this.locators.stringOptions)
- await I.seeElement(this.locators.stringOptionsMulti)
- await I.click(this.locators.save)
- await I.waitForVisible(this.locators.stringReqError)
- await I.fillField(this.locators.stringReq, 'This is a required string')
- // await I.seeAttributesOnElements(this.locators.stringMulti, {
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeElement(this.locators.createNewButton)
+ I.click(this.locators.createNewButton)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/field-test-string/new')
+ I.seeElement(this.locators.stringReq)
+ I.seeElement(this.locators.stringReadOnly)
+ I.seeElement(this.locators.stringMulti)
+ I.seeElement(this.locators.stringList)
+ I.seeElement(this.locators.stringListAdd)
+ I.seeElement(this.locators.stringHeightContent)
+ I.seeElement(this.locators.stringHeightFull)
+ I.seeElement(this.locators.stringResizable)
+ I.seeElement(this.locators.stringNoLabel)
+ I.seeElement(this.locators.stringAutoGen)
+ I.seeElement(this.locators.stringMinLength)
+ I.seeElement(this.locators.stringMaxLength)
+ I.seeElement(this.locators.stringRegex)
+ I.seeElement(this.locators.stringOptions)
+ I.seeElement(this.locators.stringOptionsMulti)
+ I.click(this.locators.save)
+ I.waitForVisible(this.locators.stringReqError)
+ I.fillField(this.locators.stringReq, 'This is a required string')
+ // I.seeAttributesOnElements(this.locators.stringMulti, {
// rows: 10
// })
- await I.fillField(this.locators.stringMulti, 'This is a')
- await I.pressKey('Enter')
- await I.appendField(this.locators.stringMulti, 'multi line string')
- // await I.seeAttributesOnElements(this.locators.stringHeightContent, {
+ I.fillField(this.locators.stringMulti, 'This is a')
+ I.pressKey('Enter')
+ I.appendField(this.locators.stringMulti, 'multi line string')
+ // I.seeAttributesOnElements(this.locators.stringHeightContent, {
// rows: 1
// })
- // await I.seeAttributesOnElements(this.locators.stringHeightFull, {
+ // I.seeAttributesOnElements(this.locators.stringHeightFull, {
// rows: 10
// })
- await I.fillField(this.locators.stringMinLength, 'minl')
- await I.waitForVisible(this.locators.stringMinLengthError)
- await I.fillField(this.locators.stringMaxLength, 'maxlen')
- await I.waitForVisible(this.locators.stringMaxLengthError)
- await I.fillField(this.locators.stringRegex, 'pwq')
- await I.waitForVisible(this.locators.stringRegexError)
- await I.appendField(this.locators.stringMinLength, 'e')
- await I.waitForInvisible(this.locators.stringMinLengthError)
- await I.appendField(this.locators.stringMaxLength, '')
- await I.pressKey('Backspace')
- await I.waitForInvisible(this.locators.stringMaxLengthError)
- await I.clearField(this.locators.stringRegex)
- await I.fillField(this.locators.stringRegex, 'pqpq')
- await I.waitForInvisible(this.locators.stringRegexError)
-
- await I.scrollTo(this.locators.stringOptions)
+ I.fillField(this.locators.stringMinLength, 'minl')
+ I.waitForVisible(this.locators.stringMinLengthError)
+ I.fillField(this.locators.stringMaxLength, 'maxlen')
+ I.waitForVisible(this.locators.stringMaxLengthError)
+ I.fillField(this.locators.stringRegex, 'pwq')
+ I.waitForVisible(this.locators.stringRegexError)
+ I.appendField(this.locators.stringMinLength, 'e')
+ I.waitForInvisible(this.locators.stringMinLengthError)
+ I.appendField(this.locators.stringMaxLength, '')
+ I.pressKey('Backspace')
+ I.waitForInvisible(this.locators.stringMaxLengthError)
+ I.clearField(this.locators.stringRegex)
+ I.fillField(this.locators.stringRegex, 'pqpq')
+ I.waitForInvisible(this.locators.stringRegexError)
+
+ I.scrollTo(this.locators.stringOptions)
const disabled = await I.grabTextFrom(this.locators.stringOptionDisabled)
- await I.seeStringsAreEqual(disabled, 'Please select String options')
- await I.selectOption(this.locators.stringOptions, 'Option three')
+ I.seeStringsAreEqual(disabled, 'Please select String options')
+ I.selectOption(this.locators.stringOptions, 'Option three')
const option = await I.grabTextFrom(this.locators.stringOptionSelected)
- await I.seeStringsAreEqual(option, 'Option three')
+ I.seeStringsAreEqual(option, 'Option three')
- await I.scrollTo(this.locators.stringOptionsMulti)
- await I.checkOption(this.locators.optionOne)
- await I.checkOption(this.locators.optionFour)
- await I.seeCheckboxIsChecked(this.locators.optionOne)
- await I.dontSeeCheckboxIsChecked(this.locators.optionTwo)
- await I.dontSeeCheckboxIsChecked(this.locators.optionThree)
- await I.seeCheckboxIsChecked(this.locators.optionFour)
+ I.scrollTo(this.locators.stringOptionsMulti)
+ I.checkOption(this.locators.optionOne)
+ I.checkOption(this.locators.optionFour)
+ I.seeCheckboxIsChecked(this.locators.optionOne)
+ I.dontSeeCheckboxIsChecked(this.locators.optionTwo)
+ I.dontSeeCheckboxIsChecked(this.locators.optionThree)
+ I.seeCheckboxIsChecked(this.locators.optionFour)
- await I.scrollTo(this.locators.stringList)
- await I.fillField(this.locators.stringList, 'First String')
- await I.fillField(this.locators.stringListEmptyField, 'Second String')
- await I.pressKey('ArrowDown')
- await I.fillField(this.locators.stringListEmptyField, 'Third String')
+ I.scrollTo(this.locators.stringList)
+ I.fillField(this.locators.stringList, 'First String')
+ I.fillField(this.locators.stringListEmptyField, 'Second String')
+ I.pressKey('ArrowDown')
+ I.fillField(this.locators.stringListEmptyField, 'Third String')
const initialNumDragElements = await I.grabNumberOfVisibleElements(
this.locators.stringListDrag
)
- await I.seeNumbersAreEqual(initialNumDragElements, 3)
+ I.seeNumbersAreEqual(initialNumDragElements, 3)
const initialNumRemoveButtons = await I.grabNumberOfVisibleElements(
this.locators.stringListRemoveButton
)
- await I.seeNumbersAreEqual(initialNumRemoveButtons, 3)
+ I.seeNumbersAreEqual(initialNumRemoveButtons, 3)
const initialNumListItems = await I.grabNumberOfVisibleElements(
this.locators.stringListItem
)
- await I.seeNumbersAreEqual(initialNumListItems, 4)
+ I.seeNumbersAreEqual(initialNumListItems, 4)
const initialNumStringListAddElements = await I.grabNumberOfVisibleElements(
this.locators.stringListAdd
)
- await I.seeNumbersAreEqual(initialNumStringListAddElements, 1)
+ I.seeNumbersAreEqual(initialNumStringListAddElements, 1)
const stringValueArray = await I.grabAttributeFrom(
this.locators.multiEntryStringText,
'value'
)
- await I.dragAndDrop(this.locators.thirdElement, this.locators.secondElement)
+ I.dragAndDrop(this.locators.thirdElement, this.locators.secondElement)
const stringValueArrayAfter = await I.grabAttributeFrom(
this.locators.multiEntryStringText,
'value'
)
- await I.seeStringsAreNotEqual(
+ I.seeStringsAreNotEqual(
stringValueArray.toString(),
stringValueArrayAfter.toString()
)
- await I.click(this.locators.mutliEntryFirstRemoveButton)
+ I.click(this.locators.mutliEntryFirstRemoveButton)
const numDragElements = await I.grabNumberOfVisibleElements(
this.locators.stringListDrag
)
- await I.seeTotalHasDecreased(numDragElements, initialNumDragElements)
+ I.seeTotalHasDecreased(numDragElements, initialNumDragElements)
const numRemoveButtons = await I.grabNumberOfVisibleElements(
this.locators.stringListRemoveButton
)
- await I.seeTotalHasDecreased(numRemoveButtons, initialNumRemoveButtons)
+ I.seeTotalHasDecreased(numRemoveButtons, initialNumRemoveButtons)
const numListItems = await I.grabNumberOfVisibleElements(
this.locators.stringListItem
)
- await I.seeTotalHasDecreased(numListItems, initialNumListItems)
+ I.seeTotalHasDecreased(numListItems, initialNumListItems)
const numStringListAddElements = await I.grabNumberOfVisibleElements(
this.locators.stringListAdd
)
- await I.seeNumbersAreEqual(
+ I.seeNumbersAreEqual(
numStringListAddElements,
initialNumStringListAddElements
)
- await I.click(this.locators.save)
- await I.waitForText('The document has been created', 2)
- await I.dontSeeInCurrentUrl('/new')
+ I.click(this.locators.save)
+ I.waitForText('The document has been created', 2)
+ I.dontSeeInCurrentUrl('/new')
const updatedSlug = await I.grabValueFrom(this.locators.stringAutoGen)
- await I.seeStringsAreEqual(updatedSlug, 'this-is-a-required-string')
- await I.see('Option three', this.locators.stringOptions)
- await I.click(this.locators.saveMenu)
- await I.click(this.locators.saveGoBack)
- await I.waitForText('This is a required string')
+ I.seeStringsAreEqual(updatedSlug, 'this-is-a-required-string')
+ I.see('Option three', this.locators.stringOptions)
+ I.click(this.locators.saveMenu)
+ I.click(this.locators.saveGoBack)
+ I.waitForText('This is a required string')
},
async deleteAllStrings() {
@@ -1105,23 +1236,23 @@ module.exports = {
},
async validateReference() {
- await I.amOnPage('/field-testing/field-test-reference')
+ I.amOnPage('/field-testing/field-test-reference')
// I.wait(2)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.createNewButton)
- await I.click(this.locators.createNewButton)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/field-test-reference/new')
- await I.seeElement(this.locators.referenceReq)
- await I.seeElement(this.locators.referenceReadOnly)
- await I.click(this.locators.referenceReq)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeElement(this.locators.createNewButton)
+ I.click(this.locators.createNewButton)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/field-test-reference/new')
+ I.seeElement(this.locators.referenceReq)
+ I.seeElement(this.locators.referenceReadOnly)
+ I.click(this.locators.referenceReq)
I.waitForFunction(() => document.readyState === 'complete')
I.waitForText('Reference')
- await I.click(this.locators.cancelButton)
- await I.seeInCurrentUrl('/field-test-reference/new')
- await I.click(this.locators.save)
- await I.see('An error has occurred. The document could not be created')
- await I.click(this.locators.referenceReq)
+ I.click(this.locators.cancelButton)
+ I.seeInCurrentUrl('/field-test-reference/new')
+ I.click(this.locators.save)
+ I.see('An error has occurred. The document could not be created')
+ I.click(this.locators.referenceReq)
I.waitForFunction(() => document.readyState === 'complete')
I.waitForText('Reference')
const numberAuthors = await I.grabNumberOfVisibleElements(
@@ -1144,15 +1275,15 @@ module.exports = {
'href'
)
- await I.click(this.locators.saveMenu)
- await I.click(this.locators.saveGoBack)
- await I.waitForText(authorsNames[2].trim())
+ I.click(this.locators.saveMenu)
+ I.click(this.locators.saveGoBack)
+ I.waitForText(authorsNames[2].trim())
const newLink = await I.grabAttributeFrom(
this.locators.referenceLink,
'href'
)
- await I.seeStringsAreEqual(link, newLink)
+ I.seeStringsAreEqual(link, newLink)
},
async deleteAllReferences() {
@@ -1160,190 +1291,178 @@ module.exports = {
},
async validateMedia() {
- await I.amOnPage('/field-testing/field-test-media')
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.createNewButton)
- await I.dontSeeElement(this.locators.mediaRowInserted)
- await I.click(this.locators.createNewButton)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/field-test-media/new')
- await I.seeElement(this.locators.mediaReqExisting)
- await I.seeElement(this.locators.mediaReqDevice)
- await I.seeElement(this.locators.mediaReqDrop)
- await I.seeElement(this.locators.mediaExisting)
- await I.seeElement(this.locators.mediaDevice)
- await I.seeElement(this.locators.mediaDrop)
- await I.seeElement(this.locators.mediaJpegExisting)
- await I.seeElement(this.locators.mediaJpegDevice)
- await I.seeElement(this.locators.mediaJpegDrop)
- await I.seeElement(this.locators.mediaPngExisting)
- await I.seeElement(this.locators.mediaPngDevice)
- await I.seeElement(this.locators.mediaPngDrop)
- await I.seeElement(this.locators.mediaJnPExisting)
- await I.seeElement(this.locators.mediaJnPDevice)
- await I.seeElement(this.locators.mediaJnPDrop)
- await I.seeElement(this.locators.mediaPdfExisting)
- await I.seeElement(this.locators.mediaPdfDevice)
- await I.seeElement(this.locators.mediaPdfDrop)
- await I.fillField(this.locators.mediaTitle, 'Media Document')
- await I.click(this.locators.mediaReqExisting)
+ I.amOnPage('/field-testing/field-test-media')
I.waitForFunction(() => document.readyState === 'complete')
- await I.click(this.locators.cancelButton)
- await I.seeInCurrentUrl('/field-test-media/new')
- await I.click(this.locators.save)
- await I.waitForText(
- 'An error has occurred. The document could not be created',
- 2
- )
- await I.click(this.locators.mediaReqExisting)
+ I.seeElement(this.locators.createNewButton)
+ I.dontSeeElement(this.locators.mediaRowInserted)
+ I.click(this.locators.createNewButton)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/field-test-media/new')
+ I.seeElement(this.locators.mediaReqExisting)
+ I.seeElement(this.locators.mediaReqDevice)
+ I.seeElement(this.locators.mediaReqDrop)
+ I.seeElement(this.locators.mediaExisting)
+ I.seeElement(this.locators.mediaDevice)
+ I.seeElement(this.locators.mediaDrop)
+ I.seeElement(this.locators.mediaJpegExisting)
+ I.seeElement(this.locators.mediaJpegDevice)
+ I.seeElement(this.locators.mediaJpegDrop)
+ I.seeElement(this.locators.mediaPngExisting)
+ I.seeElement(this.locators.mediaPngDevice)
+ I.seeElement(this.locators.mediaPngDrop)
+ I.seeElement(this.locators.mediaJnPExisting)
+ I.seeElement(this.locators.mediaJnPDevice)
+ I.seeElement(this.locators.mediaJnPDrop)
+ I.seeElement(this.locators.mediaPdfExisting)
+ I.seeElement(this.locators.mediaPdfDevice)
+ I.seeElement(this.locators.mediaPdfDrop)
+ I.fillField(this.locators.mediaTitle, 'Media Document')
+ I.click(this.locators.mediaReqExisting)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.click(this.locators.cancelButton)
+ I.seeInCurrentUrl('/field-test-media/new')
+ I.click(this.locators.save)
+ I.waitForText('An error has occurred. The document could not be created', 2)
+ I.click(this.locators.mediaReqExisting)
I.waitForFunction(() => document.readyState === 'complete')
- await I.click(this.locators.pdf)
- await I.click(this.locators.stoneJpeg)
- await I.click(this.locators.girlPng)
- await I.click(this.locators.saveSelected)
+ I.click(this.locators.pdfCheckbox)
+ I.click(this.locators.stoneJpegCheckbox)
+ I.click(this.locators.girlPngCheckbox)
+ I.click(this.locators.saveSelected)
I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.mediaReqPdf)
- await I.seeElement(this.locators.mediaReqJpeg)
- await I.seeElement(this.locators.mediaReqPng)
- await I.click(this.locators.save)
- await I.waitForText('The document has been created', 2)
- await I.dontSeeInCurrentUrl('/new')
- await I.attachFile(
+ I.seeElement(this.locators.mediaReqPdf)
+ I.seeElement(this.locators.mediaReqJpeg)
+ I.seeElement(this.locators.mediaReqPng)
+ I.click(this.locators.save)
+ I.waitForText('The document has been created', 2)
+ I.dontSeeInCurrentUrl('/new')
+ I.attachFile(
this.locators.mediafieldUpload,
'functional/images/Watson.jpeg'
)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.mediaJpegAttach)
- await I.scrollTo(this.locators.mediaPdfDrop)
- await I.attachFile(
- this.locators.mediaJpegUpload,
- 'functional/images/girl.png'
- )
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.mediaJpegUploadErr)
- await I.click(this.locators.mediaJpegExisting)
I.waitForFunction(() => document.readyState === 'complete')
- await I.see('.jpeg')
- await I.dontSee('.png')
- await I.dontSee('.pdf')
- await I.click(this.locators.dogJpg)
- await I.click(this.locators.saveSelected)
+ I.seeElement(this.locators.mediaJpegAttach)
+ I.scrollTo(this.locators.mediaPdfDrop)
+ I.attachFile(this.locators.mediaJpegUpload, 'functional/images/girl.png')
I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.mediaJpegAdded)
- await I.scrollTo(this.locators.mediaPngDrop)
- await I.attachFile(
- this.locators.mediaPngUpload,
- 'functional/images/dog.jpg'
- )
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.mediaPngUploadErr)
- await I.click(this.locators.mediaPngExisting)
+ I.seeElement(this.locators.mediaJpegUploadErr)
+ I.click(this.locators.mediaJpegExisting)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.see('.jpeg')
+ I.dontSee('.png')
+ I.dontSee('.pdf')
+ I.click(this.locators.dogJpgCheckbox)
+ I.click(this.locators.saveSelected)
I.waitForFunction(() => document.readyState === 'complete')
- await I.see('.png')
- await I.dontSee('.jpeg')
- await I.dontSee('.jpg')
- await I.dontSee('.pdf')
- await I.click(this.locators.girlPng)
- await I.click(this.locators.saveSelected)
+ I.seeElement(this.locators.mediaJpegAdded)
+ I.scrollTo(this.locators.mediaPngDrop)
+ I.attachFile(this.locators.mediaPngUpload, 'functional/images/dog.jpg')
I.waitForFunction(() => document.readyState === 'complete')
- await I.scrollTo(this.locators.mediaJnPDrop)
- await I.seeElement(this.locators.mediaPngAdded)
- await I.scrollTo(this.locators.scrollDown)
- await I.attachFile(
+ I.seeElement(this.locators.mediaPngUploadErr)
+ I.click(this.locators.mediaPngExisting)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.see('.png')
+ I.dontSee('.jpeg')
+ I.dontSee('.jpg')
+ I.dontSee('.pdf')
+ I.click(this.locators.girlPngCheckbox)
+ I.click(this.locators.saveSelected)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.scrollTo(this.locators.mediaJnPDrop)
+ I.seeElement(this.locators.mediaPngAdded)
+ I.scrollTo(this.locators.scrollDown)
+ I.attachFile(
this.locators.mediaJnPUpload,
'functional/images/DADI_Publish.pdf'
)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.mediaJnPUploadErr)
- await I.click(this.locators.mediaJnPExisting)
I.waitForFunction(() => document.readyState === 'complete')
- await I.see('.png')
- await I.see('.jpeg')
- await I.see('.jpg')
- await I.dontSee('.pdf')
- await I.click(this.locators.dogJpg)
- await I.click(this.locators.girlPng)
- await I.click(this.locators.saveSelected)
+ I.seeElement(this.locators.mediaJnPUploadErr)
+ I.click(this.locators.mediaJnPExisting)
I.waitForFunction(() => document.readyState === 'complete')
- await I.scrollTo(this.locators.mediaJnPDevice)
- await I.seeElement(this.locators.mediaJnPJpegAdded)
- await I.seeElement(this.locators.mediaJnPPngAdded)
- await I.scrollTo(this.locators.scrollDown)
- await I.attachFile(
- this.locators.mediaPdfUpload,
- 'functional/images/girl.png'
- )
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.mediaPdfUploadErr)
- await I.click(this.locators.mediaPdfExisting)
+ I.see('.png')
+ I.see('.jpeg')
+ I.see('.jpg')
+ I.dontSee('.pdf')
+ I.click(this.locators.dogJpgCheckbox)
+ I.click(this.locators.girlPngCheckbox)
+ I.click(this.locators.saveSelected)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.scrollTo(this.locators.mediaJnPDevice)
+ I.seeElement(this.locators.mediaJnPJpegAdded)
+ I.seeElement(this.locators.mediaJnPPngAdded)
+ I.scrollTo(this.locators.scrollDown)
+ I.attachFile(this.locators.mediaPdfUpload, 'functional/images/girl.png')
I.waitForFunction(() => document.readyState === 'complete')
- await I.see('.pdf')
- await I.dontSee('.jpeg')
- await I.dontSee('.jpg')
- await I.dontSee('.png')
- await I.click(this.locators.pdf)
- await I.click(this.locators.saveSelected)
+ I.seeElement(this.locators.mediaPdfUploadErr)
+ I.click(this.locators.mediaPdfExisting)
I.waitForFunction(() => document.readyState === 'complete')
- await I.scrollTo(this.locators.mediaJnPDrop)
- await I.seeElement(this.locators.mediaPdfAdded)
- await I.click(this.locators.saveMenu)
- await I.click(this.locators.saveGoBack)
+ I.see('.pdf')
+ I.dontSee('.jpeg')
+ I.dontSee('.jpg')
+ I.dontSee('.png')
+ I.click(this.locators.pdfCheckbox)
+ I.click(this.locators.saveSelected)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.scrollTo(this.locators.mediaJnPDrop)
+ I.seeElement(this.locators.mediaPdfAdded)
+ I.click(this.locators.saveMenu)
+ I.click(this.locators.saveGoBack)
I.waitForText('The document has been updated')
- await I.seeElement(this.locators.mediaRowInserted)
- await I.see('Media Document')
+ I.seeElement(this.locators.mediaRowInserted)
+ I.see('Media Document')
},
async validateMiscField() {
- await I.amOnPage('/field-testing/field-test-other')
+ I.amOnPage('/field-testing/field-test-other')
// I.wait(2)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.createNewButton)
- await I.click(this.locators.createNewButton)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/field-test-other/new')
- await I.seeElement(this.locators.colourField)
- await I.seeElement(this.locators.colourSwatch)
- await I.click(this.locators.colourField)
- await I.seeElement(this.locators.colourContainer)
- await I.seeElement(this.locators.colourPalette)
- await I.seeElement(this.locators.colourPicker)
- await I.seeElement(this.locators.colourHue)
- await I.seeElement(this.locators.colourSlider)
- await I.fillField(this.locators.colourField, '4073b1')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeElement(this.locators.createNewButton)
+ I.click(this.locators.createNewButton)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/field-test-other/new')
+ I.seeElement(this.locators.colourField)
+ I.seeElement(this.locators.colourSwatch)
+ I.click(this.locators.colourField)
+ I.seeElement(this.locators.colourContainer)
+ I.seeElement(this.locators.colourPalette)
+ I.seeElement(this.locators.colourPicker)
+ I.seeElement(this.locators.colourHue)
+ I.seeElement(this.locators.colourSlider)
+ I.fillField(this.locators.colourField, '4073b1')
const before = await I.grabValueFrom(this.locators.colourField)
- await I.dragAndDrop(this.locators.colourPicker, this.locators.colourSlider)
+ I.dragAndDrop(this.locators.colourPicker, this.locators.colourSlider)
const after = await I.grabValueFrom(this.locators.colourField)
- await I.seeStringsAreNotEqual(after, before)
- await I.click(this.locators.saveMenu)
- await I.click(this.locators.saveGoBack)
+ I.seeStringsAreNotEqual(after, before)
+ I.click(this.locators.saveMenu)
+ I.click(this.locators.saveGoBack)
I.waitForText('The document has been created')
- await I.see('094285')
+ I.see('094285')
// check filter only contains string filter field
- await I.click(this.locators.filterButton)
- await I.seeElement(this.locators.filterField)
+ I.click(this.locators.filterButton)
+ I.seeElement(this.locators.filterField)
const filterValue = await I.grabTextFrom(this.locators.filterField)
- await I.seeStringsAreEqual(filterValue, 'Normal String field')
+ I.seeStringsAreEqual(filterValue, 'Normal String field')
},
async validateNoFilter() {
- await I.amOnPage('/field-testing/no-filterable-fields')
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeElement(this.locators.createNewButton)
- await I.click(this.locators.createNewButton)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl('/no-filterable-fields/new')
- await I.click(this.locators.saveMenu)
+ I.amOnPage('/field-testing/no-filterable-fields')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeElement(this.locators.createNewButton)
+ I.click(this.locators.createNewButton)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl('/no-filterable-fields/new')
+ I.click(this.locators.saveMenu)
I.wait(2)
- await I.click(this.locators.saveGoBack)
+ I.click(this.locators.saveGoBack)
I.waitForText('The document has been created')
- await I.seeElement(this.locators.filterButtonDisabled)
+ I.seeElement(this.locators.filterButtonDisabled)
},
async validateSingleDocument() {
- await I.amOnPage('/test-single-document')
+ I.amOnPage('/single-document/test-single-document')
I.wait(2)
I.waitForFunction(() => document.readyState === 'complete')
I.seeElement(this.locators.singleTitle)
diff --git a/test/functional/pages/Login.js b/test/functional/pages/Login.js
index e25205c4b..a6e8ea4b5 100644
--- a/test/functional/pages/Login.js
+++ b/test/functional/pages/Login.js
@@ -2,8 +2,6 @@
const I = actor()
-const {assert, expect} = require('chai')
-
module.exports = {
// insert your locators and methods here
locators: {
@@ -90,16 +88,16 @@ module.exports = {
const token = x.accessToken
const value = Date.now() + 1800 * 1000
- await I.amOnPage(url)
- await I.setCookie({
+ I.amOnPage(url)
+ I.setCookie({
name: 'accessToken',
value: token
})
- await I.setCookie({
+ I.setCookie({
name: 'accessTokenExpiry',
value: value.toString()
})
- await I.resizeWindow(1200, 650)
+ I.resizeWindow(1200, 650)
},
async deleteUser(id) {
diff --git a/test/functional/pages/Media.js b/test/functional/pages/Media.js
index 6253c500f..543629c2c 100644
--- a/test/functional/pages/Media.js
+++ b/test/functional/pages/Media.js
@@ -1,14 +1,8 @@
'use strict'
-const {assert, expect} = require('chai')
-
-let I
+const I = actor()
module.exports = {
- _init() {
- I = require('../stepDefinitions/steps_file.js')()
- },
-
// insert your locators and methods here
locators: {
mediaLibraryLink: locate('a')
@@ -141,51 +135,51 @@ module.exports = {
},
async addMedia() {
- await I.amOnPage('/media')
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.waitForElement(this.locators.footer)
- await I.seeElement(this.locators.dropArea)
+ I.amOnPage('/media')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.waitForElement(this.locators.footer)
+ I.seeElement(this.locators.dropArea)
const images = await I.grabNumberOfVisibleElements(this.locators.images)
- await I.seeNumberOfVisibleElements(this.locators.images, images)
- await I.seeTotalGreaterThanZero(images)
- await I.attachFile(this.locators.fileUpload, 'functional/images/Stone.jpeg')
- await I.waitForFunction(() => document.readyState === 'complete')
+ I.seeNumberOfVisibleElements(this.locators.images, images)
+ I.seeTotalGreaterThanZero(images)
+ I.attachFile(this.locators.fileUpload, 'functional/images/Stone.jpeg')
+ I.waitForFunction(() => document.readyState === 'complete')
const newImages = await I.grabNumberOfVisibleElements(this.locators.images)
I.seeTotalHasIncreased(newImages, images)
- await I.see('Stone.jpeg')
+ I.see('Stone.jpeg')
},
async selectMedia() {
- await I.amOnPage('/media')
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.waitForElement(this.locators.footer)
- await I.seeElement(this.locators.dropArea)
- await I.see('Stone.jpeg')
+ I.amOnPage('/media')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.waitForElement(this.locators.footer)
+ I.seeElement(this.locators.dropArea)
+ I.see('Stone.jpeg')
const stoneLink = await I.grabAttributeFrom(this.locators.stoneURL, 'href')
const dogLink = await I.grabAttributeFrom(this.locators.dogURL, 'href')
const girlLink = await I.grabAttributeFrom(this.locators.girlURL, 'href')
- await I.click(this.locators.stoneImage)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl(stoneLink)
- await I.see('DETAILS')
- await I.see('METADATA')
- await I.seeElement(this.locators.editImage)
- await I.seeElement(this.locators.fileNameField)
+ I.click(this.locators.stoneImage)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl(stoneLink)
+ I.see('DETAILS')
+ I.see('METADATA')
+ I.seeElement(this.locators.editImage)
+ I.seeElement(this.locators.fileNameField)
const stoneFileNameText = await I.grabValueFrom(this.locators.fileNameField)
- await I.seeElement(this.locators.mimeField)
+ I.seeElement(this.locators.mimeField)
const stoneMimeText = await I.grabValueFrom(this.locators.mimeField)
- await I.seeElement(this.locators.heightField)
+ I.seeElement(this.locators.heightField)
const stoneHeightText = await I.grabValueFrom(this.locators.heightField)
- await I.seeElement(this.locators.widthField)
+ I.seeElement(this.locators.widthField)
const stoneWidthText = await I.grabValueFrom(this.locators.widthField)
- await I.seeElement(this.locators.urlField)
+ I.seeElement(this.locators.urlField)
const stoneUrlText = await I.grabValueFrom(this.locators.urlField)
I.seeStringsAreEqual(stoneFileNameText, 'Stone.jpeg')
@@ -193,35 +187,35 @@ module.exports = {
I.seeStringsAreEqual(stoneHeightText, '317')
I.seeStringsAreEqual(stoneWidthText, '214')
I.seeStringContains(stoneUrlText, 'Stone.jpeg')
- await I.click(this.locators.metaDataTab)
- await I.see('Alternative text')
- await I.fillField(this.locators.altTextField, 'Alt Text')
- await I.see('Caption')
- await I.fillField(this.locators.captionField, 'Stone Caption')
- await I.see('Copyright information')
- await I.fillField(this.locators.copyrightField, 'Copyright DADI')
+ I.click(this.locators.metaDataTab)
+ I.see('Alternative text')
+ I.fillField(this.locators.altTextField, 'Alt Text')
+ I.see('Caption')
+ I.fillField(this.locators.captionField, 'Stone Caption')
+ I.see('Copyright information')
+ I.fillField(this.locators.copyrightField, 'Copyright DADI')
I.click(this.locators.saveMenu)
I.click(this.locators.saveGoBack)
I.waitForText('The document has been updated successfully')
- await I.click(this.locators.dogImage)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl(dogLink)
- await I.see('DETAILS')
- await I.see('METADATA')
- await I.seeElement(this.locators.editImage)
- await I.seeElement(this.locators.fileNameField)
+ I.click(this.locators.dogImage)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl(dogLink)
+ I.see('DETAILS')
+ I.see('METADATA')
+ I.seeElement(this.locators.editImage)
+ I.seeElement(this.locators.fileNameField)
const dogFileNameText = await I.grabValueFrom(this.locators.fileNameField)
- await I.seeElement(this.locators.mimeField)
+ I.seeElement(this.locators.mimeField)
const dogMimeText = await I.grabValueFrom(this.locators.mimeField)
- await I.seeElement(this.locators.heightField)
+ I.seeElement(this.locators.heightField)
const dogHeightText = await I.grabValueFrom(this.locators.heightField)
- await I.seeElement(this.locators.widthField)
+ I.seeElement(this.locators.widthField)
const dogWidthText = await I.grabValueFrom(this.locators.widthField)
- await I.seeElement(this.locators.urlField)
+ I.seeElement(this.locators.urlField)
const dogUrlText = await I.grabValueFrom(this.locators.urlField)
I.seeStringsAreEqual(dogFileNameText, 'dog.jpg')
@@ -229,35 +223,35 @@ module.exports = {
I.seeStringsAreEqual(dogHeightText, '675')
I.seeStringsAreEqual(dogWidthText, '1200')
I.seeStringContains(dogUrlText, 'dog.jpg')
- await I.click(this.locators.metaDataTab)
- await I.see('Alternative text')
- await I.fillField(this.locators.altTextField, 'Dog Biscuit')
- await I.see('Caption')
- await I.fillField(this.locators.captionField, 'Dog wants biscuit')
- await I.see('Copyright information')
- await I.fillField(this.locators.copyrightField, 'DADI')
+ I.click(this.locators.metaDataTab)
+ I.see('Alternative text')
+ I.fillField(this.locators.altTextField, 'Dog Biscuit')
+ I.see('Caption')
+ I.fillField(this.locators.captionField, 'Dog wants biscuit')
+ I.see('Copyright information')
+ I.fillField(this.locators.copyrightField, 'DADI')
I.click(this.locators.saveMenu)
I.click(this.locators.saveGoBack)
I.waitForText('The document has been updated successfully')
- await I.click(this.locators.girlImage)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl(girlLink)
- await I.see('DETAILS')
- await I.see('METADATA')
- await I.seeElement(this.locators.editImage)
- await I.seeElement(this.locators.fileNameField)
+ I.click(this.locators.girlImage)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl(girlLink)
+ I.see('DETAILS')
+ I.see('METADATA')
+ I.seeElement(this.locators.editImage)
+ I.seeElement(this.locators.fileNameField)
const girlFileNameText = await I.grabValueFrom(this.locators.fileNameField)
- await I.seeElement(this.locators.mimeField)
+ I.seeElement(this.locators.mimeField)
const girlMimeText = await I.grabValueFrom(this.locators.mimeField)
- await I.seeElement(this.locators.heightField)
+ I.seeElement(this.locators.heightField)
const girlHeightText = await I.grabValueFrom(this.locators.heightField)
- await I.seeElement(this.locators.widthField)
+ I.seeElement(this.locators.widthField)
const girlWidthText = await I.grabValueFrom(this.locators.widthField)
- await I.seeElement(this.locators.urlField)
+ I.seeElement(this.locators.urlField)
const girlUrlText = await I.grabValueFrom(this.locators.urlField)
I.seeStringsAreEqual(girlFileNameText, 'girl.png')
@@ -265,37 +259,37 @@ module.exports = {
I.seeStringsAreEqual(girlHeightText, '2400')
I.seeStringsAreEqual(girlWidthText, '3840')
I.seeStringContains(girlUrlText, 'girl.png')
- await I.click(this.locators.metaDataTab)
- await I.see('Alternative text')
- await I.fillField(this.locators.altTextField, 'Chinese lady')
- await I.see('Caption')
- await I.fillField(this.locators.captionField, 'A Chinese lady on a path')
- await I.see('Copyright information')
- await I.fillField(this.locators.copyrightField, 'X-MEN')
+ I.click(this.locators.metaDataTab)
+ I.see('Alternative text')
+ I.fillField(this.locators.altTextField, 'Chinese lady')
+ I.see('Caption')
+ I.fillField(this.locators.captionField, 'A Chinese lady on a path')
+ I.see('Copyright information')
+ I.fillField(this.locators.copyrightField, 'X-MEN')
I.click(this.locators.saveMenu)
I.click(this.locators.saveGoBack)
I.waitForText('The document has been updated successfully')
},
async filterMedia() {
- await I.amOnPage('/media')
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.waitForElement(this.locators.footer)
- await I.seeElement(this.locators.dropArea)
+ I.amOnPage('/media')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.waitForElement(this.locators.footer)
+ I.seeElement(this.locators.dropArea)
const mediaImages = await I.grabNumberOfVisibleElements(
this.locators.images
)
- await I.seeNumberOfVisibleElements(this.locators.images, mediaImages)
- await I.seeTotalGreaterThanZero(mediaImages)
+ I.seeNumberOfVisibleElements(this.locators.images, mediaImages)
+ I.seeTotalGreaterThanZero(mediaImages)
// Text Search Box
- await I.fillField(this.locators.mediaSearchField, 'gi')
- await I.seeElement(this.locators.docFilterSuggestionsForm)
+ I.fillField(this.locators.mediaSearchField, 'gi')
+ I.seeElement(this.locators.docFilterSuggestionsForm)
const filterOptions = await I.grabNumberOfVisibleElements(
this.locators.docFilterSuggestionsOptions
)
- await I.seeNumberOfVisibleElements(
+ I.seeNumberOfVisibleElements(
this.locators.docFilterSuggestionsOptions,
filterOptions
)
@@ -304,21 +298,21 @@ module.exports = {
this.locators.images
)
- await I.seeNumberOfVisibleElements(this.locators.images, imagesFiltered)
- await I.seeElement(this.locators.filterWrapper)
+ I.seeNumberOfVisibleElements(this.locators.images, imagesFiltered)
+ I.seeElement(this.locators.filterWrapper)
const containsFilterValue = await I.grabTextFrom(this.locators.filterText)
I.seeStringsAreEqual(containsFilterValue, "Filename\ncontains\n'gi'")
I.click(this.locators.filterWrapper)
const filenameValue = await I.grabValueFrom(this.locators.filterValueString)
- await I.seeStringsAreEqual(filenameValue, 'gi')
+ I.seeStringsAreEqual(filenameValue, 'gi')
I.click(this.locators.filterRemove)
const mediaImagesReset = await I.grabNumberOfVisibleElements(
this.locators.images
)
- await I.seeNumberOfVisibleElements(this.locators.images, mediaImagesReset)
+ I.seeNumberOfVisibleElements(this.locators.images, mediaImagesReset)
// Number value retained
I.click(this.locators.filterButton)
I.selectOption(this.locators.filterField, 'Height')
@@ -329,8 +323,8 @@ module.exports = {
this.locators.images
)
- await I.seeNumberOfVisibleElements(this.locators.images, heightFiltered)
- await I.seeElement(this.locators.filterWrapper)
+ I.seeNumberOfVisibleElements(this.locators.images, heightFiltered)
+ I.seeElement(this.locators.filterWrapper)
const numberFilterValue = await I.grabTextFrom(this.locators.filterText)
I.seeStringsAreEqual(
@@ -340,7 +334,7 @@ module.exports = {
I.click(this.locators.filterWrapper)
const heightValue = await I.grabValueFrom(this.locators.filterValueNumber)
- await I.seeNumbersAreEqual(heightValue, '675')
+ I.seeNumbersAreEqual(heightValue, '675')
I.click(this.locators.filterRemove)
// Filter search summary is correct and case-sensitive
I.click(this.locators.filterButton)
@@ -352,8 +346,8 @@ module.exports = {
this.locators.images
)
- await I.seeNumberOfVisibleElements(this.locators.images, altTextFilter)
- await I.seeElement(this.locators.filterWrapper)
+ I.seeNumberOfVisibleElements(this.locators.images, altTextFilter)
+ I.seeElement(this.locators.filterWrapper)
const altTextFilterValue = await I.grabTextFrom(this.locators.filterText)
I.seeStringsAreEqual(
@@ -371,40 +365,40 @@ module.exports = {
this.locators.images
)
- await I.seeNumberOfVisibleElements(this.locators.images, captionFilter)
+ I.seeNumberOfVisibleElements(this.locators.images, captionFilter)
},
async deleteMedia() {
- await I.amOnPage('/media')
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.waitForElement(this.locators.footer)
- await I.seeElement(this.locators.dropArea)
+ I.amOnPage('/media')
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.waitForElement(this.locators.footer)
+ I.seeElement(this.locators.dropArea)
const total = await I.grabTextFrom(this.locators.totalImages)
- await I.see('Stone.jpeg')
+ I.see('Stone.jpeg')
I.click(this.locators.checkImage)
I.click(this.locators.deleteButton)
I.waitForText('Are you sure you want to delete the selected document?')
I.click(this.locators.confirmDeleteButton)
I.waitForText('The document has been deleted')
- await I.dontSee('Stone.jpeg')
+ I.dontSee('Stone.jpeg')
const newTotal = await I.grabTextFrom(this.locators.totalImages)
I.seeTotalHasDecreased(newTotal, total)
const dogLink = await I.grabAttributeFrom(this.locators.dogURL, 'href')
- await I.click(this.locators.dogImage)
- await I.waitForFunction(() => document.readyState === 'complete')
- await I.seeInCurrentUrl(dogLink)
- await I.see('DETAILS')
- await I.see('METADATA')
- await I.seeElement(this.locators.editImage)
- await I.click(this.locators.editDeleteButton)
+ I.click(this.locators.dogImage)
+ I.waitForFunction(() => document.readyState === 'complete')
+ I.seeInCurrentUrl(dogLink)
+ I.see('DETAILS')
+ I.see('METADATA')
+ I.seeElement(this.locators.editImage)
+ I.click(this.locators.editDeleteButton)
I.waitForText('Are you sure you want to delete this document?')
I.pressKey('Enter')
I.waitForText('The document has been deleted')
- await I.see('girl.png')
- await I.dontSee('dog.jpg')
+ I.see('girl.png')
+ I.dontSee('dog.jpg')
},
async insertMedia(file) {
diff --git a/test/functional/pages/Profile.js b/test/functional/pages/Profile.js
index 2e7c454e7..650d74d06 100644
--- a/test/functional/pages/Profile.js
+++ b/test/functional/pages/Profile.js
@@ -70,15 +70,15 @@ module.exports = {
},
async changePersonalDetails(first, last) {
- await I.amOnPage('/profile/personal-details')
+ I.amOnPage('/profile/personal-details')
I.seeInCurrentUrl('/profile/personal-details')
I.seeElement(this.locators.firstNameField)
I.seeElement(this.locators.lastNameField)
I.see('First name')
- await I.fillField(this.locators.firstNameField, first)
+ I.fillField(this.locators.firstNameField, first)
I.see('Last name')
- await I.fillField(this.locators.lastNameField, '')
- await I.fillField(this.locators.lastNameField, last)
+ I.fillField(this.locators.lastNameField, '')
+ I.fillField(this.locators.lastNameField, last)
I.click(this.locators.saveSettings)
I.waitForText('Your settings have been updated')
I.waitForFunction(() => document.readyState === 'complete')
@@ -89,12 +89,12 @@ module.exports = {
newPassword,
confirmNewPassword
) {
- await I.amOnPage('/profile/credentials')
+ I.amOnPage('/profile/credentials')
I.waitForFunction(() => document.readyState === 'complete')
I.seeInCurrentUrl('/profile/credentials')
- await I.fillField(this.locators.currentPasswordField, currentPassword)
- await I.fillField(this.locators.newPasswordField, newPassword)
- await I.fillField(this.locators.confirmNewPasswordField, confirmNewPassword)
+ I.fillField(this.locators.currentPasswordField, currentPassword)
+ I.fillField(this.locators.newPasswordField, newPassword)
+ I.fillField(this.locators.confirmNewPasswordField, confirmNewPassword)
I.click(this.locators.saveSettings)
I.waitForFunction(() => document.readyState === 'complete')
I.waitForText('The current password is incorrect')
@@ -104,12 +104,12 @@ module.exports = {
},
async newPasswordsNoMatch(currentPassword, newPassword, confirmNewPassword) {
- await I.amOnPage('/profile/credentials')
+ I.amOnPage('/profile/credentials')
I.waitForFunction(() => document.readyState === 'complete')
I.seeInCurrentUrl('/profile/credentials')
- await I.fillField(this.locators.currentPasswordField, currentPassword)
- await I.fillField(this.locators.newPasswordField, newPassword)
- await I.fillField(this.locators.confirmNewPasswordField, confirmNewPassword)
+ I.fillField(this.locators.currentPasswordField, currentPassword)
+ I.fillField(this.locators.newPasswordField, newPassword)
+ I.fillField(this.locators.confirmNewPasswordField, confirmNewPassword)
I.see('The passwords must match')
I.seeElement(this.locators.saveSetttingsDisabled)
},
@@ -119,12 +119,12 @@ module.exports = {
newPassword,
confirmNewPassword
) {
- await I.amOnPage('/profile/credentials')
+ I.amOnPage('/profile/credentials')
I.waitForFunction(() => document.readyState === 'complete')
I.seeInCurrentUrl('/profile/credentials')
- await I.fillField(this.locators.currentPasswordField, currentPassword)
- await I.fillField(this.locators.newPasswordField, newPassword)
- await I.fillField(this.locators.confirmNewPasswordField, confirmNewPassword)
+ I.fillField(this.locators.currentPasswordField, currentPassword)
+ I.fillField(this.locators.newPasswordField, newPassword)
+ I.fillField(this.locators.confirmNewPasswordField, confirmNewPassword)
I.click(this.locators.saveSettings)
I.waitForText('Your settings have been updated')
I.click(this.locators.accountMenuOpen)
diff --git a/test/functional/stepDefinitions/steps_file.js b/test/functional/stepDefinitions/steps_file.js
index c7bfd31ef..5f8876894 100644
--- a/test/functional/stepDefinitions/steps_file.js
+++ b/test/functional/stepDefinitions/steps_file.js
@@ -1,8 +1,6 @@
'use strict'
// in this file you can append custom step methods to 'I' object
-const {expect} = require('chai')
-
module.exports = function() {
return actor({
// Define custom steps here, use 'this' to access default methods of I.