diff --git a/CHANGELOG.md b/CHANGELOG.md index 0545b6d76..ba387b63c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.11.12](https://github.com/surveyjs/survey-analytics/compare/v1.11.11...v1.11.12) (2024-08-20) + ### [1.11.11](https://github.com/surveyjs/survey-analytics/compare/v1.11.10...v1.11.11) (2024-08-14) ### [1.11.10](https://github.com/surveyjs/survey-analytics/compare/v1.11.9...v1.11.10) (2024-08-06) diff --git a/README.md b/README.md index 2b8a3c3fa..0a0428fac 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ The SurveyJS Dashboard library lets you build survey data dashboards and simplif - [Angular](https://surveyjs.io/Documentation/Analytics?id=get-started-angular) - [Vue](https://surveyjs.io/Documentation/Analytics?id=get-started-vue) - [React](https://surveyjs.io/Documentation/Analytics?id=get-started-react) -- [Knockout / jQuery](https://surveyjs.io/Documentation/Analytics?id=get-started-knockout-jquery) +- [HTML/CSS/JavaScript](https://surveyjs.io/dashboard/documentation/get-started-html-css-javascript) ## Resources diff --git a/docs/get-started-angular.md b/docs/get-started-angular.md index 000c3fc24..9b14ee9ea 100644 --- a/docs/get-started-angular.md +++ b/docs/get-started-angular.md @@ -15,7 +15,7 @@ This step-by-step tutorial will help you get started with SurveyJS Dashboard in As a result, you will create the following dashboard: - diff --git a/docs/get-started-html-css-javascript.md b/docs/get-started-html-css-javascript.md new file mode 100644 index 000000000..beffe6333 --- /dev/null +++ b/docs/get-started-html-css-javascript.md @@ -0,0 +1,352 @@ +--- +title: Add SurveyJS Dashboard to Your JavaScript Application | Step-by-Step Tutorial +description: Learn how to add SurveyJS Dashboard to your JavaScript application with this comprehensive step-by-step tutorial. Enhance your self-hosted surveying tool with powerful survey analytics capabilities. +--- + +# Add SurveyJS Dashboard to a JavaScript Application + +This step-by-step tutorial will help you get started with SurveyJS Dashboard in an application built with HTML, CSS, and JavaScript (without frontend frameworks). As a result, you will create a dashboard displayed below: + + + +[View Full Code on GitHub](https://github.com/surveyjs/code-examples/tree/main/get-started-analytics/html-css-js (linkStyle)) + +## Link Resources + +SurveyJS Dashboard depends on other JavaScript libraries. Reference them on your page in the following order: + +1. Survey Core +A platform-independent part of [SurveyJS Form Library](https://surveyjs.io/form-library/documentation/overview) that works with the survey model. SurveyJS Dashboard requires only this part, but if you also display the survey on the page, reference [the rest of the SurveyJS Form Library resources](/form-library/documentation/get-started-html-css-javascript#link-surveyjs-resources) as well. + +1. Plotly.js and Wordcloud +Wordcloud (optional) is used to visualize the Text, Multiple Text, and Comment question types. Plotly.js (required) is used to visualize the rest of the question types. + +1. SurveyJS Dashboard +A library that integrates Survey Core with Plotly.js and Wordcloud. + +The following code shows how to reference these libraries: + +```html + + + + + + + + + + + + + + + + + +``` + +## Load Survey Results + +You can access survey results as a JSON object within the `SurveyModel`'s `onComplete` event handler. Send the results to your server and store them with a specific survey ID. Refer to the [Handle Survey Completion](/form-library/documentation/get-started-html-css-javascript#handle-survey-completion) help topic for more information. + +To load the survey results, send the survey ID to your server and return an array of JSON objects: + +```js +const SURVEY_ID = 1; + +loadSurveyResults("https://your-web-service.com/" + SURVEY_ID) + .then((surveyResults) => { + // ... + // Configure and render the Visualization Panel here + // Refer to the help topics below + // ... + }); + +function loadSurveyResults (url) { + return new Promise((resolve, reject) => { + const request = new XMLHttpRequest(); + request.open('GET', url); + request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + request.onload = () => { + const response = request.response ? JSON.parse(request.response) : []; + resolve(response); + } + request.onerror = () => { + reject(request.statusText); + } + request.send(); + }); +} +``` + +For demonstration purposes, this tutorial uses predefined survey results. The following code shows a survey model and the structure of the survey results array: + +```js +const surveyJson = { + elements: [{ + name: "satisfaction-score", + title: "How would you describe your experience with our product?", + type: "radiogroup", + choices: [ + { value: 5, text: "Fully satisfying" }, + { value: 4, text: "Generally satisfying" }, + { value: 3, text: "Neutral" }, + { value: 2, text: "Rather unsatisfying" }, + { value: 1, text: "Not satisfying at all" } + ], + isRequired: true + }, { + name: "nps-score", + title: "On a scale of zero to ten, how likely are you to recommend our product to a friend or colleague?", + type: "rating", + rateMin: 0, + rateMax: 10, + }], + showQuestionNumbers: "off", + completedHtml: "Thank you for your feedback!", +}; + +const surveyResults = [{ + "satisfaction-score": 5, + "nps-score": 10 +}, { + "satisfaction-score": 5, + "nps-score": 9 +}, { + "satisfaction-score": 3, + "nps-score": 6 +}, { + "satisfaction-score": 3, + "nps-score": 6 +}, { + "satisfaction-score": 2, + "nps-score": 3 +}]; +``` + +## Configure the Visualization Panel + +Analytics charts are displayed in a Visualization Panel. Specify [its properties](/Documentation/Analytics?id=ivisualizationpaneloptions) in a configuration object. In this tutorial, the object enables the [`allowHideQuestions`](/Documentation/Analytics?id=ivisualizationpaneloptions#allowHideQuestions) property: + +```js +const vizPanelOptions = { + allowHideQuestions: false +} +``` + +Pass the configuration object, survey questions, and results to the `VisualizationPanel` constructor as shown in the code below to instantiate the Visualization Panel. Assign the produced instance to a constant that will be used later to render the component: + +```js +const surveyJson = { /* ... */ }; +const surveyResults = [ /* ... */ ]; +const vizPanelOptions = { /* ... */ }; + +const survey = new Survey.Model(surveyJson); + +const vizPanel = new SurveyAnalytics.VisualizationPanel( + survey.getAllQuestions(), + surveyResults, + vizPanelOptions +); +``` + +
+ View Full Code + +```html + + + + SurveyJS Dashboard + + + + + + + + + + + + + + + + + + + +``` + +```js +const surveyJson = { + elements: [{ + name: "satisfaction-score", + title: "How would you describe your experience with our product?", + type: "radiogroup", + choices: [ + { value: 5, text: "Fully satisfying" }, + { value: 4, text: "Generally satisfying" }, + { value: 3, text: "Neutral" }, + { value: 2, text: "Rather unsatisfying" }, + { value: 1, text: "Not satisfying at all" } + ], + isRequired: true + }, { + name: "nps-score", + title: "On a scale of zero to ten, how likely are you to recommend our product to a friend or colleague?", + type: "rating", + rateMin: 0, + rateMax: 10, + }], + showQuestionNumbers: "off", + completedHtml: "Thank you for your feedback!", +}; + +const survey = new Survey.Model(surveyJson); + +const surveyResults = [{ + "satisfaction-score": 5, + "nps-score": 10 +}, { + "satisfaction-score": 5, + "nps-score": 9 +}, { + "satisfaction-score": 3, + "nps-score": 6 +}, { + "satisfaction-score": 3, + "nps-score": 6 +}, { + "satisfaction-score": 2, + "nps-score": 3 +}]; + +const vizPanelOptions = { + allowHideQuestions: false +} + +const vizPanel = new SurveyAnalytics.VisualizationPanel( + survey.getAllQuestions(), + surveyResults, + vizPanelOptions +); +``` +
+ +## Render the Visualization Panel + +A Visualization Panel should be rendered in a page element. Add this element to the page markup: + +```html + +
+ +``` + +To render the Visualization Panel in the page element, call the `render(container)` method on the Visualization Panel instance you created in the previous step: + +```js +document.addEventListener("DOMContentLoaded", function() { + vizPanel.render(document.getElementById("surveyVizPanel")); +}); +``` + +
+ View Full Code + +```html + + + + SurveyJS Dashboard + + + + + + + + + + + + + + + + +
+ + +``` + +```js +const surveyJson = { + elements: [{ + name: "satisfaction-score", + title: "How would you describe your experience with our product?", + type: "radiogroup", + choices: [ + { value: 5, text: "Fully satisfying" }, + { value: 4, text: "Generally satisfying" }, + { value: 3, text: "Neutral" }, + { value: 2, text: "Rather unsatisfying" }, + { value: 1, text: "Not satisfying at all" } + ], + isRequired: true + }, { + name: "nps-score", + title: "On a scale of zero to ten, how likely are you to recommend our product to a friend or colleague?", + type: "rating", + rateMin: 0, + rateMax: 10, + }], + showQuestionNumbers: "off", + completedHtml: "Thank you for your feedback!", +}; + +const survey = new Survey.Model(surveyJson); + +const surveyResults = [{ + "satisfaction-score": 5, + "nps-score": 10 +}, { + "satisfaction-score": 5, + "nps-score": 9 +}, { + "satisfaction-score": 3, + "nps-score": 6 +}, { + "satisfaction-score": 3, + "nps-score": 6 +}, { + "satisfaction-score": 2, + "nps-score": 3 +}]; + +const vizPanelOptions = { + allowHideQuestions: false +} + +const vizPanel = new SurveyAnalytics.VisualizationPanel( + survey.getAllQuestions(), + surveyResults, + vizPanelOptions +); + +document.addEventListener("DOMContentLoaded", function() { + vizPanel.render(document.getElementById("surveyVizPanel")); +}); +``` +
+ +[View Full Code on GitHub](https://github.com/surveyjs/code-examples/tree/main/get-started-analytics/html-css-js (linkStyle)) + +## See Also + +[Dashboard Demo Examples](/dashboard/examples/ (linkStyle)) \ No newline at end of file diff --git a/docs/get-started-react.md b/docs/get-started-react.md index d5f5a4729..c1ffa99d6 100644 --- a/docs/get-started-react.md +++ b/docs/get-started-react.md @@ -15,7 +15,7 @@ This step-by-step tutorial will help you get started with SurveyJS Dashboard in As a result, you will create the following dashboard: - diff --git a/docs/get-started-vue.md b/docs/get-started-vue.md index c7f74c0fa..d4d4b2741 100644 --- a/docs/get-started-vue.md +++ b/docs/get-started-vue.md @@ -15,7 +15,7 @@ This step-by-step tutorial will help you get started with SurveyJS Dashboard in As a result, you will create the following dashboard: - diff --git a/docs/get-started.md b/docs/get-started.md index 91f9acef6..764ed8a64 100644 --- a/docs/get-started.md +++ b/docs/get-started.md @@ -10,4 +10,4 @@ Refer to one of the following tutorials to get started with SurveyJS Dashboard o - [Angular](/Documentation/Analytics?id=get-started-angular) - [Vue](/Documentation/Analytics?id=get-started-vue) - [React](/Documentation/Analytics?id=get-started-react) -- [Knockout / jQuery](/Documentation/Analytics?id=get-started-knockout-jquery) +- [HTML/CSS/JavaScript](/dashboard/documentation/get-started-html-css-javascript) diff --git a/docs/overview.md b/docs/overview.md index 8455c421a..fd151063a 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -29,7 +29,7 @@ SurveyJS Dashboard visualizes survey results and allows users to analyze them. - [Angular](/Documentation/Analytics?id=get-started-angular) - [Vue](/Documentation/Analytics?id=get-started-vue) - [React](/Documentation/Analytics?id=get-started-react) -- [Knockout / jQuery](/Documentation/Analytics?id=get-started-knockout-jquery) +- [HTML/CSS/JavaScript](/dashboard/documentation/get-started-html-css-javascript) We also include multiple [demo examples](/Examples/Analytics) that allow you to edit and copy code. diff --git a/docs/set-up-table-view-angular.md b/docs/set-up-table-view-angular.md index b3dc7bfdf..6b6aaa0b9 100644 --- a/docs/set-up-table-view-angular.md +++ b/docs/set-up-table-view-angular.md @@ -15,7 +15,7 @@ This step-by-step tutorial will help you set up a Table View for survey results As a result, you will create the following view: - diff --git a/docs/set-up-table-view-html-css-javascript.md b/docs/set-up-table-view-html-css-javascript.md new file mode 100644 index 000000000..73c347af1 --- /dev/null +++ b/docs/set-up-table-view-html-css-javascript.md @@ -0,0 +1,277 @@ +--- +title: Export Survey Results to PDF or Excel | Open-Source JS Form Builder +description: Convert your survey data to manageable table format for easy filtering and analysis. Save survey results as PDF or Excel files to visualize or share with others. View free demo for JavaScript with a step-by-step setup guide. +--- + +# Table View for Survey Results in a JavaScript Application + +This step-by-step tutorial will help you set up a Table View for survey results using SurveyJS Dashboard an application built with HTML, CSS, and JavaScript (without frontend frameworks). As a result, you will create the view displayed below: + + + +[View Full Code on GitHub](https://github.com/surveyjs/code-examples/tree/main/dashboard-table-view/html-css-js (linkStyle)) + +## Link Resources + +SurveyJS Dashboard depends on other JavaScript libraries. Reference them on your page in the following order: + +1. Survey Core +A platform-independent part of [SurveyJS Form Library](https://surveyjs.io/form-library/documentation/overview) that works with the survey model. SurveyJS Dashboard requires only this part, but if you also display the survey on the page, reference [the rest of the SurveyJS Form Library resources](/Documentation/Library?id=get-started--html-css-javascript#link-surveyjs-resources) as well. + +1. *(Optional)* jsPDF, jsPDF-AutoTable, and SheetJS +Third-party libraries that enable users to export survey results to a PDF or XLSX document. Export to CSV is supported out of the box. + +1. Tabulator +A third-party library that renders interactive tables. + +1. SurveyJS Dashboard plugin for Tabulator +A library that integrates Survey Core with Tabulator. + +The following code shows how to reference these libraries: + +```html + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +## Load Survey Results + +When a respondent completes a survey, a JSON object with their answers is passed to the `SurveyModel`'s [`onComplete`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onComplete) event handler. You should send this object to your server and store it with a specific survey ID (see [Handle Survey Completion](/form-library/documentation/get-started-html-css-javascript#handle-survey-completion)). A collection of such JSON objects is a data source for the Table View. This collection can be processed (sorted, filtered, paginated) on the server or on the client. + +### Server-Side Data Processing + +Server-side data processing enables the Table View to load survey results in small batches on demand and delegate sorting and filtering to the server. For this feature to work, the server must support these data operations. Refer to the following demo example on GitHub for information on how to configure the server and the client for this usage scenario: + +[SurveyJS Dashboard: Table View - Server-Side Data Processing Demo Example](https://github.com/surveyjs/surveyjs-dashboard-table-view-nodejs-mongodb (linkStyle)) + +> The Table View allows users to save survey results as CSV, PDF, and XLSX documents. With server-side data processing, these documents contain only currently loaded data records. To export full datasets, you need to generate the documents on the server. + +### Client-Side Data Processing + +When data is processed on the client, the Table View loads the entire dataset at startup and applies sorting and filtering in a user's browser. This demands faster web connection and higher computing power but works smoother with small datasets. + +To load survey results to the client, send the survey ID to your server and return an array of JSON objects with survey results: + +```js +const SURVEY_ID = 1; + +loadSurveyResults("https://your-web-service.com/" + SURVEY_ID) + .then((surveyResults) => { + // ... + // Configure and render the Table View here + // Refer to the help topics below + // ... + }); + +function loadSurveyResults (url) { + return new Promise((resolve, reject) => { + const request = new XMLHttpRequest(); + request.open('GET', url); + request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); + request.onload = () => { + const response = request.response ? JSON.parse(request.response) : []; + resolve(response); + } + request.onerror = () => { + reject(request.statusText); + } + request.send(); + }); +} +``` + +For demonstration purposes, this tutorial uses auto-generated survey results. The following code shows a survey model and a function that generates the survey results array: + +```js +const surveyJson = { + elements: [{ + name: "satisfaction-score", + title: "How would you describe your experience with our product?", + type: "radiogroup", + choices: [ + { value: 5, text: "Fully satisfying" }, + { value: 4, text: "Generally satisfying" }, + { value: 3, text: "Neutral" }, + { value: 2, text: "Rather unsatisfying" }, + { value: 1, text: "Not satisfying at all" } + ], + isRequired: true + }, { + name: "nps-score", + title: "On a scale of zero to ten, how likely are you to recommend our product to a friend or colleague?", + type: "rating", + rateMin: 0, + rateMax: 10, + }], + showQuestionNumbers: "off", + completedHtml: "Thank you for your feedback!", +}; + +function randomIntFromInterval(min: number, max: number): number { + return Math.floor(Math.random() * (max - min + 1) + min); +} +function generateData() { + const data = []; + for (let index = 0; index < 100; index++) { + const satisfactionScore = randomIntFromInterval(1, 5); + const npsScore = satisfactionScore > 3 ? randomIntFromInterval(7, 10) : randomIntFromInterval(1, 6); + data.push({ + "satisfaction-score": satisfactionScore, + "nps-score": npsScore + }); + } + return data; +} +``` + +## Render the Table + +The Table View is rendered by the `Tabulator` component. Pass the survey model and results to its constructor to instantiate it. Assign the produced instance to a constant that will be used later to render the component: + +```js +const surveyJson = { /* ... */ }; +function generateData() { /* ... */ } + +const survey = new Survey.Model(surveyJson); + +const surveyDataTable = new SurveyAnalyticsTabulator.Tabulator( + survey, + generateData() +); +``` + +The Table View should be rendered in a page element. Add this element to the page markup: + +```html + +
+ +``` + +To render the Table View in the page element, call the `render(container)` method on the Tabulator instance you created previously: + +```js +document.addEventListener("DOMContentLoaded", function() { + surveyDataTable.render(document.getElementById("surveyDataTable")); +}); +``` + +
+ View Full Code + +```html + + + + Table View: SurveyJS Dashboard + + + + + + + + + + + + + + + + + + + + + +
+ + +``` + +```js +const surveyJson = { + elements: [{ + name: "satisfaction-score", + title: "How would you describe your experience with our product?", + type: "radiogroup", + choices: [ + { value: 5, text: "Fully satisfying" }, + { value: 4, text: "Generally satisfying" }, + { value: 3, text: "Neutral" }, + { value: 2, text: "Rather unsatisfying" }, + { value: 1, text: "Not satisfying at all" } + ], + isRequired: true + }, { + name: "nps-score", + title: "On a scale of zero to ten, how likely are you to recommend our product to a friend or colleague?", + type: "rating", + rateMin: 0, + rateMax: 10, + }], + showQuestionNumbers: "off", + completedHtml: "Thank you for your feedback!", +}; + +const survey = new Survey.Model(surveyJson); + +function randomIntFromInterval(min, max) { + return Math.floor(Math.random() * (max - min + 1) + min); +} +function generateData() { + const data = []; + for (let index = 0; index < 100; index++) { + const satisfactionScore = randomIntFromInterval(1, 5); + const npsScore = satisfactionScore > 3 ? randomIntFromInterval(7, 10) : randomIntFromInterval(1, 6); + data.push({ + "satisfaction-score": satisfactionScore, + "nps-score": npsScore + }); + } + return data; +} + +const surveyDataTable = new SurveyAnalyticsTabulator.Tabulator( + survey, + generateData() +); + +document.addEventListener("DOMContentLoaded", function() { + surveyDataTable.render(document.getElementById("surveyDataTable")); +}); +``` + +
+ +[View Full Code on GitHub](https://github.com/surveyjs/code-examples/tree/main/dashboard-table-view/html-css-js (linkStyle)) + +## See Also + +[Dashboard Demo Examples](/dashboard/examples/ (linkStyle)) \ No newline at end of file diff --git a/docs/set-up-table-view-react.md b/docs/set-up-table-view-react.md index 26b3f7da3..0b40fc8ff 100644 --- a/docs/set-up-table-view-react.md +++ b/docs/set-up-table-view-react.md @@ -15,7 +15,7 @@ This step-by-step tutorial will help you set up a Table View for survey results As a result, you will create the following view: - diff --git a/docs/set-up-table-view-vue.md b/docs/set-up-table-view-vue.md index 5915f86a2..ff9b2b772 100644 --- a/docs/set-up-table-view-vue.md +++ b/docs/set-up-table-view-vue.md @@ -15,7 +15,7 @@ This step-by-step tutorial will help you set up a Table View for survey results As a result, you will create the following view: - diff --git a/docs/set-up-table-view.md b/docs/set-up-table-view.md index a795ce70f..972ccf4c8 100644 --- a/docs/set-up-table-view.md +++ b/docs/set-up-table-view.md @@ -10,4 +10,4 @@ Refer to one of the following tutorials to set up Table View for SurveyJS Dashbo - [Angular](/dashboard/documentation/set-up-table-view/angular) - [Vue](/dashboard/documentation/set-up-table-view/vue) - [React](/dashboard/documentation/set-up-table-view/react) -- [Knockout / jQuery](/dashboard/documentation/set-up-table-view/knockout-jquery) +- [HTML/CSS/JavaScript](/dashboard/documentation/set-up-table-view/html-css-javascript) diff --git a/docs/sidebar.json b/docs/sidebar.json index 14ceb498a..1050c4ae2 100644 --- a/docs/sidebar.json +++ b/docs/sidebar.json @@ -21,8 +21,8 @@ "Title": "React" }, { - "Name": "get-started-knockout-jquery", - "Title": "Knockout / jQuery" + "Name": "get-started-html-css-javascript", + "Title": "HTML/CSS/JavaScript" } ] }, @@ -43,8 +43,8 @@ "Title": "React" }, { - "Name": "set-up-table-view-knockout-jquery", - "Title": "Knockout / jQuery" + "Name": "set-up-table-view-html-css-javascript", + "Title": "HTML/CSS/JavaScript" } ] }, diff --git a/docs/uri.json b/docs/uri.json index 0e837ac4c..bb86bf219 100644 --- a/docs/uri.json +++ b/docs/uri.json @@ -3,6 +3,8 @@ "set-up-table-view" ], "rename": { + "get-started-knockout-jquery": "get-started-html-css-javascript", + "set-up-table-view-knockout-jquery": "set-up-table-view-html-css-javascript" }, "classRename": { } diff --git a/package-lock.json b/package-lock.json index ee91b4e61..870326494 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "survey-analytics", - "version": "1.11.11", + "version": "1.11.12", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index dc962faad..701244b32 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "lint": "eslint ./src --quiet", "pre-push-check": "npm run lint && npm run test" }, - "version": "1.11.11", + "version": "1.11.12", "name": "survey-analytics", "description": "SurveyJS analytics Library.", "main": "survey.analytics.js", diff --git a/testCafe/datatables/columnactions.js b/testCafe/datatables/columnactions.js new file mode 100644 index 000000000..055b047ff --- /dev/null +++ b/testCafe/datatables/columnactions.js @@ -0,0 +1,222 @@ +import { Selector, ClientFunction } from 'testcafe'; + +fixture `columnactions` + .page `http://localhost:8080/examples/datatables.html` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + + var json = { + elements: [ + { + type: "boolean", + name: "bool", + title: "Question 1", + }, + { + type: "boolean", + name: "bool2", + title: "Question 2", + }, + { + type: "boolean", + name: "bool3", + title: "Question 3", + }, + ], + }; + + var data = [ + { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, + ]; + + var initDatatables = ClientFunction((json, data, options) => { + window.SurveyAnalyticsDatatables.TableExtensions.findExtension( + "column", + "makepublic" + ).visibleIndex = 0; + + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables( + survey, + data, + options + ); + surveyAnalyticsDatatables.render(document.getElementById("dataTablesContainer")); + }) + + await initDatatables(json, data, { actionsColumnWidth: 100 }); + }); + +test('Check show/hide questions', async t => { + const getColumnsVisibilityArray = ClientFunction(() => { + return window.surveyAnalyticsDatatables.state.elements.map((column)=>{return column.isVisible}); + }); + + await t + .expect(Selector('#dataTablesContainer th').withText('Question 1').visible).eql(true) + .expect(getColumnsVisibilityArray()).eql([true, true, true]) + .click('#dataTablesContainer th[aria-label="Question 1"] button[title="Hide column"]') + .expect(Selector('#dataTablesContainer th').withText('Question 1').nth(3).visible).eql(false) + .expect(getColumnsVisibilityArray()).eql([false, true, true]) + .click('#dataTablesContainer .sa-table__show-column.sa-table__header-extension') + .click(Selector('#dataTablesContainer .sa-table__show-column.sa-table__header-extension option').withText('Question 1')) + .expect(Selector('#dataTablesContainer th').withText('Question 1').visible).eql(true) + .expect(getColumnsVisibilityArray()).eql([true, true, true]); +}); + +test('Check move to details', async t => { + const getColumnsLocationsArray = ClientFunction(() => { + return window.surveyAnalyticsDatatables.state.elements.map(column => column.location); + }); + + await t + .expect(Selector('#dataTablesContainer th[aria-label="Question 1"] ').visible).eql(true) + .expect(getColumnsLocationsArray()).eql([0, 0, 0]) + .click('#dataTablesContainer tbody tr:nth-child(1) button[title="Show minor columns"]') + .expect(Selector('#dataTablesContainer td').withText('Question 1').exists).eql(false) + .click('#dataTablesContainer th[aria-label="Question 1"] button[title="Move to Detail"]') + .expect(Selector('#dataTablesContainer th[aria-label="Question 1"]').visible).eql(false) + .click('#dataTablesContainer tbody tr:nth-child(1) button[title="Show minor columns"]') + .expect(Selector('#dataTablesContainer .sa-datatables__details-container td').withText('Question 1').visible).eql(true) + .expect(Selector('#dataTablesContainer td').withText('Yes').visible).eql(true) + .expect(getColumnsLocationsArray()).eql([1, 0, 0]) + .click(Selector('#dataTablesContainer button').withText('Show as Column')) + .expect(Selector('#dataTablesContainer th[aria-label="Question 1"] ').visible).eql(true) + .expect(getColumnsLocationsArray()).eql([0, 0, 0]) + .click('#dataTablesContainer tbody tr:nth-child(1) button[title="Show minor columns"]') + .expect(Selector('#dataTablesContainer .sa-datatables__details-container td').withText('Question 1').exists).eql(false); +}); + +test('Check columns drag and drop', async t => { + const getColumnNamesOrder = ClientFunction(() => { + var names = []; + document.querySelectorAll(".dataTables_scrollHead thead th").forEach((col) => { names.push(col.innerText) }) + names.splice(0, 1); + return names; + }); + + const getColumnNamesOrderInState = ClientFunction(() => { + var names = []; + window.surveyAnalyticsDatatables.state.elements.forEach((col) => { names.push(col.displayName) }) + return names; + }); + + await t + .drag('#dataTablesContainer .dataTables_scrollHead thead th[aria-label="Question 1"] button.sa-table__drag-button', 600, 0, { + offsetX: 5, + offsetY: 10, + speed: 0.01 + }) + .expect(getColumnNamesOrder()).eql(["Question 2", "Question 1", "Question 3"]) + .expect(getColumnNamesOrderInState()).eql(["Question 2", "Question 1", "Question 3"]); +}); + +test('Check public/private actions', async t => { + const getPublicitArrayInState = ClientFunction(() => { + return window.surveyAnalyticsDatatables.state.elements.map(col => col.isPublic) + }); + + await t + .click('#dataTablesContainer th[aria-label="Question 2"] button.sa-table__svg-button[title="Make column private"]') + .expect(getPublicitArrayInState()).eql([true, false, true]) + .click('#dataTablesContainer th[aria-label="Question 2"] button.sa-table__svg-button[title="Make column public"]') + .expect(getPublicitArrayInState()).eql([true, true, true]); +}); + +test('Check datatables taking into account state', async t => { + const getColumnNamesOrder = ClientFunction(() => { + var names = []; + document.querySelectorAll("#dataTablesContainer .dataTables_scrollHead thead th").forEach((col) => { names.push(col.innerText) }) + names.splice(0, 1); + return names; + }); + + var json = { + elements: [ + { + type: "boolean", + name: "bool", + title: "Question 1", + }, + { + type: "boolean", + name: "bool2", + title: "Question 2", + }, + { + type: "boolean", + name: "bool3", + title: "Question 3", + }, + { + type: "boolean", + name: "bool4", + title: "Question 4", + }, + ], + }; + + var data = [ + { + bool: true, + bool2: false, + bool3: true, + bool4: true, + }, + { + bool: true, + bool2: false, + bool3: false, + bool4: true, + + }, + { + bool: false, + bool2: true, + bool3: false, + bool4: true, + }, + ]; + + var initDatatables = ClientFunction((json, data, options) => { + window.survey = new Survey.SurveyModel(json); + window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables( + survey, + data, + options, + [ + { "name": "bool4", "displayName": "Question 4", "dataType": 0, "isVisible": true, "location": 0 }, + { "name": "bool", "displayName": "Question 1", "dataType": 0, "isVisible": false, "location": 0 }, + { "name": "bool2", "displayName": "Question 2", "dataType": 0, "isVisible": true, "location": 1 }, + { "name": "bool3", "displayName": "Question 3", "dataType": 0, "isVisible": true, "location": 0 } + ] + + ); + surveyAnalyticsDatatables.render(document.getElementById("dataTablesContainer")); + }) + + await initDatatables(json, data, { actionsColumnWidth: 100 }); + + await t + .expect(getColumnNamesOrder()).eql(["Question 4", "Question 3"]) + .expect(Selector('#dataTablesContainer thead th').withText('Question 1').visible).notOk() + .expect(Selector('#dataTablesContainer .tabulator-col').withText('Question 2').visible).notOk() + .expect(Selector('#dataTablesContainer .sa-table__show-column.sa-table__header-extension option').exists).ok() + .click('#dataTablesContainer tbody tr:nth-child(1) button[title="Show minor columns"]') + .expect(Selector('#dataTablesContainer td').withText('Question 2').visible).ok(); +}); \ No newline at end of file diff --git a/testCafe/datatables/columnactions.testcafe b/testCafe/datatables/columnactions.testcafe deleted file mode 100644 index dce95af34..000000000 --- a/testCafe/datatables/columnactions.testcafe +++ /dev/null @@ -1 +0,0 @@ -{"fixtures":[{"name":"columnactions","pageUrl":"http://localhost:8080/examples/datatables.html","tests":[{"name":"Check show/hide questions","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"0","resultVariableName":"getColumnsVisibilityArray","expression":"ClientFunction(() => {\n return window.surveyAnalyticsDatatables.state.elements.map((column)=>{return column.isVisible});\n})"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer th').withText('Question 1').visible"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer [title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('div').withText('Question 1').nth(4).visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-col').nth(1).visible"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers div').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"1","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer th').withText('Question 1').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"2","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsVisibilityArray()"},"options":{},"expected":{"type":"js-expr","value":"[true, true, true]"}},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer th[aria-label=\"Question 1\"] button[title=\"Hide column\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer th[aria-label=\"Question 1\"] button[title=\"Hide column\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"3"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer th').withText('Question 1').nth(3).visible"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer [title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('div').withText('Question 1').nth(4).visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-col').nth(1).visible"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers div').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"4","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer th').withText('Question 1').nth(3).visible"},"options":{},"expected":{"type":"js-expr","value":"false"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"5","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsVisibilityArray()"},"options":{},"expected":{"type":"js-expr","value":"[false, true, true]"}},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-table__show-column.sa-table__header-extension')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-table__show-column.sa-table__header-extension')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension')"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('select')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__show-column.sa-table__header-extension')"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions .sa-table__show-column.sa-table__header-extension')"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions select')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(1).find('div').nth(1).find('select')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":67,"offsetY":24},"options":{},"type":"click","callsite":"6"},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-table__show-column.sa-table__header-extension option').withText('Question 1')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-table__show-column.sa-table__header-extension option').withText('Question 1')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension')"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('select')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__show-column.sa-table__header-extension')"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions .sa-table__show-column.sa-table__header-extension')"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions select')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(1).find('div').nth(1).find('select')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":67,"offsetY":24},"options":{},"type":"click","callsite":"7"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer th').withText('Question 1').visible"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer [title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('div').withText('Question 1').nth(4).visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-col').nth(1).visible"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers div').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"8","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer th').withText('Question 1').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"9","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsVisibilityArray()"},"options":{},"expected":{"type":"js-expr","value":"[true, true, true]"}}]},{"name":"Check move to details","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"0","resultVariableName":"getColumnsLocationsArray","expression":"ClientFunction(() => {\n return window.surveyAnalyticsDatatables.state.elements.map(column => column.location);\n})"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"1","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer th[aria-label=\"Question 1\"] ').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"2","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsLocationsArray()"},"options":{},"expected":{"type":"js-expr","value":"[0, 0, 0]"}},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer tbody tr:nth-child(1) button[title=\"Show minor columns\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer tbody tr:nth-child(1) button[title=\"Show minor columns\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"3"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer td').withText('Question 1').exists"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').exists"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').exists"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 1').exists"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 1').exists"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').exists"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').exists"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".exists"},"callsite":"4","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer td').withText('Question 1').exists"},"options":{},"expected":{"type":"js-expr","value":"false"}},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer th[aria-label=\"Question 1\"] button[title=\"Move to Detail\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer th[aria-label=\"Question 1\"] button[title=\"Move to Detail\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"5"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"6","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer th[aria-label=\"Question 1\"]').visible"},"options":{},"expected":{"type":"js-expr","value":"false"}},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer tbody tr:nth-child(1) button[title=\"Show minor columns\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer tbody tr:nth-child(1) button[title=\"Show minor columns\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"7"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-datatables__details-container td').withText('Question 1').visible"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 1').visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').visible"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"8","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-datatables__details-container td').withText('Question 1').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer td').withText('Yes').visible"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 1').visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').visible"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"9","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer td').withText('Yes').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"10","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsLocationsArray()"},"options":{},"expected":{"type":"js-expr","value":"[1, 0, 0]"}},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer button').withText('Show as Column')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer button').withText('Show as Column')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer button').withText('Show as Column')"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__btn.sa-table__btn--gray').nth(3)"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').nth(2).find('button')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('button').withText('Show as Column')"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__btn.sa-table__btn--gray').nth(3)"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail button').withText('Show as Column')"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail .sa-table__btn.sa-table__btn--gray')"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').nth(2).find('button')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').nth(2).find('button')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":63,"offsetY":29},"options":{},"type":"click","callsite":"11"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"12","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer th[aria-label=\"Question 1\"] ').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"13","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsLocationsArray()"},"options":{},"expected":{"type":"js-expr","value":"[0, 0, 0]"}},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer tbody tr:nth-child(1) button[title=\"Show minor columns\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer tbody tr:nth-child(1) button[title=\"Show minor columns\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"14"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-datatables__details-container td').withText('Question 1').exists"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').exists"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').exists"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 1').exists"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 1').exists"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').exists"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').exists"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".exists"},"callsite":"15","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-datatables__details-container td').withText('Question 1').exists"},"options":{},"expected":{"type":"js-expr","value":"false"}}]},{"name":"Check columns drag and drop","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"0","resultVariableName":"getColumnNamesOrder","expression":"ClientFunction(() => {\n var names = [];\n document.querySelectorAll(\".dataTables_scrollHead thead th\").forEach((col) => { names.push(col.innerText) })\n names.splice(0, 1);\n return names;\n})"},{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"1","resultVariableName":"getColumnNamesOrderInState","expression":"ClientFunction(() => {\n var names = [];\n window.surveyAnalyticsDatatables.state.elements.forEach((col) => { names.push(col.displayName) })\n return names;\n})"},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer .dataTables_scrollHead thead th[aria-label=\"Question 1\"] button.sa-table__drag-button')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer .dataTables_scrollHead thead th[aria-label=\"Question 1\"] button.sa-table__drag-button')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button.sa-table__drag-button svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Question 1\"] div div div div div button svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button svg use')"},"ruleType":"$dom$"}],"useOffsets":true,"offsetX":5,"offsetY":10},"dragOffsetX":600,"dragOffsetY":0,"options":{"speed":0.01,"offsetX":5,"offsetY":10},"type":"drag","callsite":"2"},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"3","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnNamesOrder()"},"options":{},"expected":{"type":"js-expr","value":"[\"Question 2\", \"Question 1\", \"Question 3\"]"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"4","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnNamesOrderInState()"},"options":{},"expected":{"type":"js-expr","value":"[\"Question 2\", \"Question 1\", \"Question 3\"]"}}]},{"name":"Check public/private actions","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"0","resultVariableName":"getPublicitArrayInState","expression":"ClientFunction(() => {\n return window.surveyAnalyticsDatatables.state.elements.map(col => col.isPublic)\n})"},{"type":"click","studio":{},"callsite":"1","selector":{"type":"js-expr","value":"Selector('#dataTablesContainer th[aria-label=\"Question 2\"] button.sa-table__svg-button[title=\"Make column private\"]')"},"options":{}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"2","assertionType":"eql","actual":{"type":"js-expr","value":"getPublicitArrayInState()"},"options":{},"expected":{"type":"js-expr","value":"[true, false, true]"}},{"type":"click","studio":{},"callsite":"3","selector":{"type":"js-expr","value":"Selector('#dataTablesContainer th[aria-label=\"Question 2\"] button.sa-table__svg-button[title=\"Make column public\"]')"},"options":{}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"4","assertionType":"eql","actual":{"type":"js-expr","value":"getPublicitArrayInState()"},"options":{},"expected":{"type":"js-expr","value":"[true, true, true]"}}]},{"name":"Check datatables taking into account state","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"0","resultVariableName":"getColumnNamesOrder","expression":"ClientFunction(() => {\n var names = [];\n document.querySelectorAll(\"#dataTablesContainer .dataTables_scrollHead thead th\").forEach((col) => { names.push(col.innerText) })\n names.splice(0, 1);\n return names;\n})"},{"type":"execute-async-expression","studio":{},"callsite":"1","expression":"var json = {\r\n elements: [\r\n {\r\n type: \"boolean\",\r\n name: \"bool\",\r\n title: \"Question 1\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool2\",\r\n title: \"Question 2\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool3\",\r\n title: \"Question 3\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool4\",\r\n title: \"Question 4\",\r\n },\r\n ],\r\n};\r\n\r\nvar data = [\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n bool4: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n bool4: true,\r\n\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n bool4: true,\r\n },\r\n];\r\n\r\nvar initDatatables = ClientFunction((json, data, options) => {\r\n window.survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables(\r\n survey,\r\n data,\r\n options,\r\n [\r\n { \"name\": \"bool4\", \"displayName\": \"Question 4\", \"dataType\": 0, \"isVisible\": true, \"location\": 0 },\r\n { \"name\": \"bool\", \"displayName\": \"Question 1\", \"dataType\": 0, \"isVisible\": false, \"location\": 0 },\r\n { \"name\": \"bool2\", \"displayName\": \"Question 2\", \"dataType\": 0, \"isVisible\": true, \"location\": 1 },\r\n { \"name\": \"bool3\", \"displayName\": \"Question 3\", \"dataType\": 0, \"isVisible\": true, \"location\": 0 }\r\n ]\r\n\r\n );\r\n surveyAnalyticsDatatables.render(document.getElementById(\"dataTablesContainer\"));\r\n})\r\n\r\nawait initDatatables(json, data, { actionsColumnWidth: 100 });\r\n\r\n"},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"2","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnNamesOrder()"},"options":{},"expected":{"type":"js-expr","value":"[\"Question 4\", \"Question 3\"]"}},{"type":"assertion","studio":{"assertionMode":"checkElement","selectorPostfix":".visible"},"callsite":"3","assertionType":"notOk","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer thead th').withText('Question 1').visible"},"options":{}},{"type":"assertion","studio":{"assertionMode":"checkElement","selectorPostfix":".visible"},"callsite":"4","assertionType":"notOk","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer .tabulator-col').withText('Question 2').visible"},"options":{}},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-table__show-column.sa-table__header-extension option').exists"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension').exists"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('select').exists"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__show-column.sa-table__header-extension').exists"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions .sa-table__show-column.sa-table__header-extension').exists"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions select').exists"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(1).find('div').nth(1).find('select').exists"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".exists"},"callsite":"5","assertionType":"ok","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer .sa-table__show-column.sa-table__header-extension option').exists"},"options":{}},{"selector":{"type":"js-expr","value":"Selector('#dataTablesContainer tbody tr:nth-child(1) button[title=\"Show minor columns\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer tbody tr:nth-child(1) button[title=\"Show minor columns\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"6"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#dataTablesContainer td').withText('Question 2').visible"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 2').visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(43).find('div div table tr td').visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 2').visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 2').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').visible"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(43).find('div div table tr td').visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"7","assertionType":"ok","actual":{"type":"js-expr","value":"Selector('#dataTablesContainer td').withText('Question 2').visible"},"options":{}}]}],"beforeEachCommands":[{"type":"resize-window","studio":{},"callsite":"beforeEachHook_0","width":1920,"height":1080},{"type":"execute-async-expression","studio":{},"callsite":"beforeEachHook_1","expression":"var json = {\r\n elements: [\r\n {\r\n type: \"boolean\",\r\n name: \"bool\",\r\n title: \"Question 1\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool2\",\r\n title: \"Question 2\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool3\",\r\n title: \"Question 3\",\r\n },\r\n ],\r\n};\r\n\r\nvar data = [\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n },\r\n];\r\n\r\nvar initDatatables = ClientFunction((json, data, options) => {\r\n window.SurveyAnalyticsDatatables.TableExtensions.findExtension(\r\n \"column\",\r\n \"makepublic\"\r\n ).visibleIndex = 0;\r\n\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables(\r\n survey,\r\n data,\r\n options\r\n );\r\n surveyAnalyticsDatatables.render(document.getElementById(\"dataTablesContainer\"));\r\n})\r\n\r\nawait initDatatables(json, data, { actionsColumnWidth: 100 });\r\n\r\n"}]}]} diff --git a/testCafe/datatables/headeractions.js b/testCafe/datatables/headeractions.js new file mode 100644 index 000000000..0ce7c8e47 --- /dev/null +++ b/testCafe/datatables/headeractions.js @@ -0,0 +1,412 @@ +import { Selector, ClientFunction } from 'testcafe'; + +fixture `headeractions` + .page `http://localhost:8080/examples/datatables.html` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); + +test('Check pagination', async t => { + const getPaginationInState = ClientFunction(() => { + return surveyAnalyticsDatatables.state.pageSize; + }); + + var json = { + elements: [ + { + type: "boolean", + name: "bool", + title: "Question 1", + }, + { + type: "boolean", + name: "bool2", + title: "Question 2", + }, + { + type: "boolean", + name: "bool3", + title: "Question 3", + }, + ], + }; + + var data = [ + { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, + ]; + + var initDatatables = ClientFunction((json, data, options) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables( + survey, + data, + options + ); + surveyAnalyticsDatatables.render(document.getElementById("dataTablesContainer")); + }) + + await initDatatables(json, data, {actionsColumnWidth: 100}); + + await t + .expect(Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount).eql(5) + .click('.sa-table__entries select') + .click(Selector('#dataTablesContainer .sa-table__entries select option').withText('1')) + .expect(Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount).eql(1) + .expect(getPaginationInState()).eql(1) + .click('#dataTablesContainer .sa-table__entries select') + .click(Selector('#dataTablesContainer .sa-table__entries select option').withText('10')) + .expect(Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount).eql(9) + .expect(getPaginationInState()).eql(10); +}); + +test('Check change locale', async t => { + const getLocaleInState = ClientFunction(() => { + return window.surveyAnalyticsDatatables.state.locale; + }); + + var json = { + locale: "ru", + questions: [ + { + type: "dropdown", + name: "satisfaction", + title: { + default: "How satisfied are you with the Product?", + ru: "Насколько Вас устраивает наш продукт?", + }, + choices: [ + { + value: 0, + text: { + default: "Not Satisfied", + ru: "Coвсем не устраивает", + }, + }, + { + value: 1, + text: { + default: "Satisfied", + ru: "Устраивает", + }, + }, + { + value: 2, + text: { + default: "Completely satisfied", + ru: "Полностью устраивает", + }, + }, + ], + }, + ], + }; + + var data = [{ satisfaction: 0 }, { satisfaction: 1 }, { satisfaction: 2 }]; + + var initDatatables = ClientFunction((json, data, options) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables( + survey, + data, + options + ); + surveyAnalyticsDatatables.render(document.getElementById("dataTablesContainer")); + }) + + await initDatatables(json, data, { actionsColumnWidth: 100 }); + + await t + .expect(Selector('#dataTablesContainer .dataTables_scrollHead th').withText('Насколько Вас устраивает наш продукт?').innerText).eql("Насколько Вас устраивает наш продукт?") + .expect(Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Coвсем не устраивает').innerText).eql("Coвсем не устраивает") + .expect(Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Устраивает').innerText).eql("Устраивает") + .expect(Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Полностью устраивает').innerText).eql("Полностью устраивает") + .click(Selector('#dataTablesContainer .sa-table__header-extension ').withText('Сменить язык')) + .click(Selector('#dataTablesContainer .sa-table__header-extension option').withText('English')) + .expect(Selector('#dataTablesContainer .dataTables_scrollHead th').withText('How satisfied are you with the Product?').innerText).eql("How satisfied are you with the Product?") + .expect(Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Not Satisfied').innerText).eql("Not Satisfied") + .expect(Selector('#dataTablesContainer .dataTables_scrollBody td').withExactText('Satisfied').innerText).eql("Satisfied") + .expect(Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Completely satisfied').innerText).eql("Completely satisfied") + .expect(Selector('#dataTablesContainer .sa-table__header-extension').withText('Change Locale').exists).eql(true) + .expect(getLocaleInState()).eql(""); +}); + +test('Check pagination from state', async t => { + var json = { + elements: [ + { + type: "boolean", + name: "bool", + title: "Question 1", + }, + { + type: "boolean", + name: "bool2", + title: "Question 2", + }, + { + type: "boolean", + name: "bool3", + title: "Question 3", + }, + ], + }; + + var data = [ + { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, + ]; + + var initDatatables = ClientFunction((json, data, options, state) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables( + survey, + data, + options + ); + surveyAnalyticsDatatables.state = state; + surveyAnalyticsDatatables.render(document.getElementById("dataTablesContainer")); + }) + + await initDatatables(json, data, { actionsColumnWidth: 100 }, { pageSize: 10 }); + + await t + .expect(Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount).eql(9) + .expect(Selector('.sa-table__entries select').value).eql('10'); +}); + +test('Check locale from state', async t => { + var json = { + locale: "ru", + questions: [ + { + type: "dropdown", + name: "satisfaction", + title: { + default: "How satisfied are you with the Product?", + ru: "Насколько Вас устраивает наш продукт?", + }, + choices: [ + { + value: 0, + text: { + default: "Not Satisfied", + ru: "Coвсем не устраивает", + }, + }, + { + value: 1, + text: { + default: "Satisfied", + ru: "Устраивает", + }, + }, + { + value: 2, + text: { + default: "Completely satisfied", + ru: "Полностью устраивает", + }, + }, + ], + }, + ], + }; + + var data = [{ satisfaction: 0 }, { satisfaction: 1 }, { satisfaction: 2 }]; + + var initDatatables = ClientFunction((json, data, options, state) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables( + survey, + data, + options + ); + window.surveyAnalyticsDatatables.state = state; + window.surveyAnalyticsDatatables.render(document.getElementById("dataTablesContainer")); + }) + + await initDatatables(json, data, { actionsColumnWidth: 100 }, { locale: "en" }); + + await t + .expect(Selector('#dataTablesContainer thead th').withText('How satisfied are you with the Product?').innerText).eql("How satisfied are you with the Product?") + .expect(Selector('#dataTablesContainer td').withText('Not Satisfied').visible).eql(true) + .expect(Selector('#dataTablesContainer td').withExactText('Satisfied').visible).eql(true) + .expect(Selector('#dataTablesContainer td').withText('Completely satisfied').visible).eql(true); +}); + +test('Check commercial license caption', async t => { + var json = { + questions: [ + { + type: "dropdown", + name: "simplequestion", + choices: [ + 0, + ], + }, + ], + }; + + var data = []; + + var initDatatables = ClientFunction((json, data, options, state) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables( + survey, + data, + options + ); + window.surveyAnalyticsDatatables.state = state; + window.surveyAnalyticsDatatables.render(document.getElementById("dataTablesContainer")); + }) + + await initDatatables(json, data, {}); + + await t + .expect(Selector('#dataTablesContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists).ok(); + + var json = { + questions: [ + { + type: "dropdown", + name: "simplequestion", + choices: [ + 0, + ], + }, + ], + }; + + var data = []; + + var initDatatables = ClientFunction((json, data, options, state) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables( + survey, + data, + options + ); + window.surveyAnalyticsDatatables.state = state; + window.surveyAnalyticsDatatables.render(document.getElementById("dataTablesContainer")); + }) + + await initDatatables(json, data, {haveCommercialLicense: true}); + + await t + .expect(Selector('#dataTablesContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists).notOk(); + + var json = { + questions: [ + { + type: "dropdown", + name: "simplequestion", + choices: [ + 0, + ], + }, + ], + }; + + var data = []; + + var initDatatables = ClientFunction((json, data, options, state) => { + SurveyAnalyticsDatatables.DataTables.haveCommercialLicense = true; + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables( + survey, + data, + options + ); + window.surveyAnalyticsDatatables.state = state; + window.surveyAnalyticsDatatables.render(document.getElementById("dataTablesContainer")); + }) + + await initDatatables(json, data, {}); + + await t + .expect(Selector('#dataTablesContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists).notOk(); +}); \ No newline at end of file diff --git a/testCafe/datatables/headeractions.testcafe b/testCafe/datatables/headeractions.testcafe deleted file mode 100644 index 1101e00c5..000000000 --- a/testCafe/datatables/headeractions.testcafe +++ /dev/null @@ -1,2124 +0,0 @@ -{ - "fixtures": [ - { - "name": "headeractions", - "pageUrl": "http://localhost:8080/examples/datatables.html", - "tests": [ - { - "name": "Check pagination", - "commands": [ - { - "type": "execute-expression", - "studio": { - "expressionCommandType": "define-function" - }, - "callsite": "0", - "resultVariableName": "getPaginationInState", - "expression": "ClientFunction(() => {\n return surveyAnalyticsDatatables.state.pageSize;\n})" - }, - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "1", - "expression": "var json = {\r\n elements: [\r\n {\r\n type: \"boolean\",\r\n name: \"bool\",\r\n title: \"Question 1\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool2\",\r\n title: \"Question 2\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool3\",\r\n title: \"Question 3\",\r\n },\r\n ],\r\n};\r\n\r\nvar data = [\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n }, {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n }, {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n },\r\n];\r\n\r\nvar initDatatables = ClientFunction((json, data, options) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables(\r\n survey,\r\n data,\r\n options\r\n );\r\n surveyAnalyticsDatatables.render(document.getElementById(\"dataTablesContainer\"));\r\n})\r\n\r\nawait initDatatables(json, data, {actionsColumnWidth: 100});" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('html').childElementCount" - }, - "ruleType": "$tagName$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".childElementCount" - }, - "callsite": "2", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "5" - } - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('div select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('div select')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": 47, - "offsetY": 9 - }, - "options": {}, - "type": "click", - "callsite": "3" - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__entries select option').withText('1')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__entries select option').withText('1')" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer option').withText('1')" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('div select option')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('option').withText('1')" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries option').withText('1')" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select option')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('div select option')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": null, - "offsetY": null - }, - "options": {}, - "type": "click", - "callsite": "4" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('html').childElementCount" - }, - "ruleType": "$tagName$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".childElementCount" - }, - "callsite": "5", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "1" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkFunction", - "selectorPostfix": "", - "selectors": [] - }, - "callsite": "6", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "getPaginationInState()" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "1" - } - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__entries select')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__entries select')" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('div select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('div select')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": 47, - "offsetY": 9 - }, - "options": {}, - "type": "click", - "callsite": "7" - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__entries select option').withText('10')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__entries select option').withText('10')" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer option').withText('1')" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('div select option')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('option').withText('1')" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries option').withText('1')" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select option')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('div select option')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": null, - "offsetY": null - }, - "options": {}, - "type": "click", - "callsite": "8" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('html').childElementCount" - }, - "ruleType": "$tagName$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".childElementCount" - }, - "callsite": "9", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "9" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkFunction", - "selectorPostfix": "", - "selectors": [] - }, - "callsite": "10", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "getPaginationInState()" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "10" - } - } - ] - }, - { - "name": "Check change locale", - "commands": [ - { - "type": "execute-expression", - "studio": { - "expressionCommandType": "define-function" - }, - "callsite": "0", - "resultVariableName": "getLocaleInState", - "expression": "ClientFunction(() => {\n return window.surveyAnalyticsDatatables.state.locale;\n})" - }, - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "1", - "expression": "\r\nvar json = {\r\n locale: \"ru\",\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"satisfaction\",\r\n title: {\r\n default: \"How satisfied are you with the Product?\",\r\n ru: \"Насколько Вас устраивает наш продукт?\",\r\n },\r\n choices: [\r\n {\r\n value: 0,\r\n text: {\r\n default: \"Not Satisfied\",\r\n ru: \"Coвсем не устраивает\",\r\n },\r\n },\r\n {\r\n value: 1,\r\n text: {\r\n default: \"Satisfied\",\r\n ru: \"Устраивает\",\r\n },\r\n },\r\n {\r\n value: 2,\r\n text: {\r\n default: \"Completely satisfied\",\r\n ru: \"Полностью устраивает\",\r\n },\r\n },\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [{ satisfaction: 0 }, { satisfaction: 1 }, { satisfaction: 2 }];\r\n\r\nvar initDatatables = ClientFunction((json, data, options) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables(\r\n survey,\r\n data,\r\n options\r\n );\r\n surveyAnalyticsDatatables.render(document.getElementById(\"dataTablesContainer\"));\r\n})\r\n\r\nawait initDatatables(json, data, { actionsColumnWidth: 100 });\r\n\r\n" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollHead th').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).find('span').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).nth(1).find('div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Насколько Вас устраивает наш продукт?\"] span').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Насколько Вас устраивает наш продукт?\"] div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "2", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollHead th').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Насколько Вас устраивает наш продукт?\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Coвсем не устраивает').innerText" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Coвсем не устраивает').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Coвсем не устраивает\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Coвсем не устраивает').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] div').withText('Coвсем не устраивает').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Coвсем не устраивает\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "3", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Coвсем не устраивает').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Coвсем не устраивает\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Устраивает').innerText" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Устраивает').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(3).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Устраивает\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Устраивает').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(3).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] div').withText('Устраивает').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Устраивает\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "4", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Устраивает').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Устраивает\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Полностью устраивает').innerText" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Полностью устраивает').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(5).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Полностью устраивает\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Полностью устраивает').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(5).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).find('div').withText('Полностью устраивает').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).nth(1).find('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Полностью устраивает\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "5", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Полностью устраивает').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Полностью устраивает\"" - } - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__header-extension ').withText('Сменить язык')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__header-extension ').withText('Сменить язык')" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__header-extension').nth(2)" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__header-extension').nth(2)" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__header-extensions .sa-table__header-extension').nth(2)" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__header-extensions select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('select')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": 105, - "offsetY": 24 - }, - "options": {}, - "type": "click", - "callsite": "6" - }, - { - "type": "click", - "studio": {}, - "callsite": "7", - "selector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__header-extension option').withText('English')" - }, - "options": {} - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollHead th').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).find('span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).nth(1).find('div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"How satisfied are you with the Product?\"] span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"How satisfied are you with the Product?\"] div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "8", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollHead th').withText('How satisfied are you with the Product?').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"How satisfied are you with the Product?\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Not Satisfied').innerText" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Not Satisfied').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Not Satisfied\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Not Satisfied').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] div').withText('Not Satisfied').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Not Satisfied\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "9", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Not Satisfied').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Not Satisfied\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withExactText('Satisfied').innerText" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Satisfied').nth(6).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(3).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Satisfied\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Satisfied').nth(7).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(3).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] div').withText('Satisfied').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Satisfied\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "10", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withExactText('Satisfied').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Satisfied\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Completely satisfied').innerText" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Completely satisfied').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(5).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Completely satisfied\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Completely satisfied').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(5).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).find('div').withText('Completely satisfied').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).nth(1).find('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Completely satisfied\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "11", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody td').withText('Completely satisfied').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Completely satisfied\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectorPostfix": ".exists" - }, - "callsite": "13", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .sa-table__header-extension').withText('Change Locale').exists" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "true" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkFunction", - "selectorPostfix": "", - "selectors": [] - }, - "callsite": "12", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "getLocaleInState()" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"\"" - } - } - ] - }, - { - "name": "Check pagination from state", - "commands": [ - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "0", - "expression": "var json = {\r\n elements: [\r\n {\r\n type: \"boolean\",\r\n name: \"bool\",\r\n title: \"Question 1\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool2\",\r\n title: \"Question 2\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool3\",\r\n title: \"Question 3\",\r\n },\r\n ],\r\n};\r\n\r\nvar data = [\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n }, {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n }, {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n },\r\n];\r\n\r\nvar initDatatables = ClientFunction((json, data, options, state) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables(\r\n survey,\r\n data,\r\n options\r\n );\r\n surveyAnalyticsDatatables.state = state;\r\n surveyAnalyticsDatatables.render(document.getElementById(\"dataTablesContainer\"));\r\n})\r\n\r\nawait initDatatables(json, data, { actionsColumnWidth: 100 }, { pageSize: 10 });" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('html').childElementCount" - }, - "ruleType": "$tagName$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".childElementCount" - }, - "callsite": "1", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer .dataTables_scrollBody tbody').childElementCount" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "9" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectorPostfix": ".value" - }, - "callsite": "2", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select').value" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "'10'" - } - } - ] - }, - { - "name": "Check locale from state", - "commands": [ - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "0", - "expression": "\r\nvar json = {\r\n locale: \"ru\",\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"satisfaction\",\r\n title: {\r\n default: \"How satisfied are you with the Product?\",\r\n ru: \"Насколько Вас устраивает наш продукт?\",\r\n },\r\n choices: [\r\n {\r\n value: 0,\r\n text: {\r\n default: \"Not Satisfied\",\r\n ru: \"Coвсем не устраивает\",\r\n },\r\n },\r\n {\r\n value: 1,\r\n text: {\r\n default: \"Satisfied\",\r\n ru: \"Устраивает\",\r\n },\r\n },\r\n {\r\n value: 2,\r\n text: {\r\n default: \"Completely satisfied\",\r\n ru: \"Полностью устраивает\",\r\n },\r\n },\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [{ satisfaction: 0 }, { satisfaction: 1 }, { satisfaction: 2 }];\r\n\r\nvar initDatatables = ClientFunction((json, data, options, state) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables(\r\n survey,\r\n data,\r\n options\r\n );\r\n window.surveyAnalyticsDatatables.state = state;\r\n window.surveyAnalyticsDatatables.render(document.getElementById(\"dataTablesContainer\"));\r\n})\r\n\r\nawait initDatatables(json, data, { actionsColumnWidth: 100 }, { locale: \"en\" });\r\n\r\n" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer thead th').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).find('span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).nth(1).find('div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"How satisfied are you with the Product?\"] span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"How satisfied are you with the Product?\"] div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "1", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer thead th').withText('How satisfied are you with the Product?').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"How satisfied are you with the Product?\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer td').withText('Not Satisfied').visible" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Not Satisfied').nth(4).visible" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(1).visible" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Not Satisfied\"]').visible" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div div').nth(3).visible" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Not Satisfied').nth(5).visible" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(1).visible" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] div').withText('Not Satisfied').visible" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] .tabulator-cell').nth(1).visible" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Not Satisfied\"]').visible" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div div').nth(3).visible" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".visible" - }, - "callsite": "2", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer td').withText('Not Satisfied').visible" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "true" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer td').withExactText('Satisfied').visible" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Satisfied').nth(6).visible" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(3).visible" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Satisfied\"]').visible" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).visible" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Satisfied').nth(7).visible" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(3).visible" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] div').withText('Satisfied').visible" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] .tabulator-cell').nth(1).visible" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Satisfied\"]').visible" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).visible" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".visible" - }, - "callsite": "3", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer td').withExactText('Satisfied').visible" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "true" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer td').withText('Completely satisfied').visible" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Completely satisfied').nth(4).visible" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(5).visible" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Completely satisfied\"]').visible" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).visible" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Completely satisfied').nth(5).visible" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(5).visible" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).find('div').withText('Completely satisfied').visible" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).nth(1).find('.tabulator-cell').nth(1).visible" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Completely satisfied\"]').visible" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).visible" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".visible" - }, - "callsite": "4", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer td').withText('Completely satisfied').visible" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "true" - } - } - ] - }, - { - "name": "Check commercial license caption", - "commands": [ - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "0", - "expression": "\r\nvar json = {\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"simplequestion\",\r\n choices: [\r\n 0,\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [];\r\n\r\nvar initDatatables = ClientFunction((json, data, options, state) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables(\r\n survey,\r\n data,\r\n options\r\n );\r\n window.surveyAnalyticsDatatables.state = state;\r\n window.surveyAnalyticsDatatables.render(document.getElementById(\"dataTablesContainer\"));\r\n})\r\n\r\nawait initDatatables(json, data, {});\r\n\r\n" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div a span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__product').exists" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div a span span').exists" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".exists" - }, - "callsite": "1", - "assertionType": "ok", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "options": {} - }, - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "2", - "expression": "\r\nvar json = {\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"simplequestion\",\r\n choices: [\r\n 0,\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [];\r\n\r\nvar initDatatables = ClientFunction((json, data, options, state) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables(\r\n survey,\r\n data,\r\n options\r\n );\r\n window.surveyAnalyticsDatatables.state = state;\r\n window.surveyAnalyticsDatatables.render(document.getElementById(\"dataTablesContainer\"));\r\n})\r\n\r\nawait initDatatables(json, data, {haveCommercialLicense: true});" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div a span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__product').exists" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div a span span').exists" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".exists" - }, - "callsite": "3", - "assertionType": "notOk", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "options": {} - }, - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "4", - "expression": "\r\nvar json = {\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"simplequestion\",\r\n choices: [\r\n 0,\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [];\r\n\r\nvar initDatatables = ClientFunction((json, data, options, state) => {\r\n SurveyAnalyticsDatatables.DataTables.haveCommercialLicense = true;\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsDatatables = new SurveyAnalyticsDatatables.DataTables(\r\n survey,\r\n data,\r\n options\r\n );\r\n window.surveyAnalyticsDatatables.state = state;\r\n window.surveyAnalyticsDatatables.render(document.getElementById(\"dataTablesContainer\"));\r\n})\r\n\r\nawait initDatatables(json, data, {});" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div a span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__product').exists" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div a span span').exists" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".exists" - }, - "callsite": "5", - "assertionType": "notOk", - "actual": { - "type": "js-expr", - "value": "Selector('#dataTablesContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "options": {} - } - ] - } - ], - "beforeEachCommands": [ - { - "type": "resize-window", - "studio": {}, - "callsite": "beforeEachHook_0", - "width": 1920, - "height": 1080 - } - ] - } - ] -} \ No newline at end of file diff --git a/testCafe/tabulator/columnactions.js b/testCafe/tabulator/columnactions.js new file mode 100644 index 000000000..e9a36dc43 --- /dev/null +++ b/testCafe/tabulator/columnactions.js @@ -0,0 +1,222 @@ +import { Selector, ClientFunction } from 'testcafe'; + +fixture`columnactions` + .page`http://localhost:8080/examples/tabulator.html` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + + var json = { + elements: [ + { + type: "boolean", + name: "bool", + title: "Question 1", + }, + { + type: "boolean", + name: "bool2", + title: "Question 2", + }, + { + type: "boolean", + name: "bool3", + title: "Question 3", + }, + ], + }; + + var data = [ + { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, + ]; + + var initTabulator = ClientFunction((json, data, options) => { + window.SurveyAnalyticsTabulator.TableExtensions.findExtension( + "column", + "makepublic" + ).visibleIndex = 0; + + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator( + survey, + data, + options + ); + surveyAnalyticsTabulator.render(document.getElementById("tabulatorContainer")); + }) + + await initTabulator(json, data, { actionsColumnWidth: 100 }); + }); + +test('Check show/hide actions', async t => { + const getColumnsVisibilityArray = ClientFunction(() => { + return window.surveyAnalyticsTabulator.state.elements.map((column) => { return column.isVisible }); + }); + + await t + .expect(Selector('#tabulatorContainer div').withText('Question 1').visible).eql(true) + .expect(getColumnsVisibilityArray()).eql([true, true, true]) + .click('#tabulatorContainer .tabulator-col[title="Question 1"] button[title="Hide column"]') + .expect(Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible).eql(false) + .expect(getColumnsVisibilityArray()).eql([false, true, true]) + .click('#tabulatorContainer .sa-table__show-column.sa-table__header-extension') + .click(Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension option').withText('Question 1')) + .expect(Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible).eql(true) + .expect(getColumnsVisibilityArray()).eql([true, true, true]); +}); + +test('Check move to details', async t => { + const getColumnsLocationsArray = ClientFunction(() => { + return window.surveyAnalyticsTabulator.state.elements.map(column => column.location); + }); + + await t + .expect(Selector('#tabulatorContainer .tabulator-col[title="Question 1"] ').visible).eql(true) + .expect(getColumnsLocationsArray()).eql([0, 0, 0]) + .click('#tabulatorContainer .tabulator-row:nth-child(1) button[title="Show minor columns"]') + .expect(Selector('#tabulatorContainer td').withText('Question 1').exists).eql(false) + .click('#tabulatorContainer .tabulator-col[title="Question 1"] button[title="Move to Detail"]') + .expect(Selector('#tabulatorContainer .tabulator-col[title="Question 1"] ').visible).eql(false) + .click('#tabulatorContainer .tabulator-row:nth-child(1) button[title="Show minor columns"]') + .expect(Selector('#tabulatorContainer td').withText('Question 1').visible).eql(true) + .expect(Selector('#tabulatorContainer td').withText('Yes').visible).eql(true) + .expect(getColumnsLocationsArray()).eql([1, 0, 0]) + .click(Selector('#tabulatorContainer button').withText('Show as Column')) + .expect(Selector('#tabulatorContainer .tabulator-col[title="Question 1"] ').visible).eql(true) + .expect(getColumnsLocationsArray()).eql([0, 0, 0]) + .click('#tabulatorContainer .tabulator-row:nth-child(1) button[title="Show minor columns"]') + .expect(Selector('#tabulatorContainer td').withText('Question 1').exists).eql(false); +}); + +test('Check columns drag and drop', async t => { + const getColumnNamesOrder = ClientFunction(() => { + var names = []; + document.querySelectorAll(".tabulator .tabulator-col").forEach((col) => { names.push(col.innerText) }) + names.splice(0, 1); + return names; + }); + + const getColumnNamesOrderInState = ClientFunction(() => { + var names = []; + window.surveyAnalyticsTabulator.state.elements.forEach((col) => { names.push(col.displayName) }) + return names; + }); + + await t + .drag('#tabulatorContainer div.tabulator-col[title="Question 1"] button.sa-table__drag-button', 1200, 120, { + offsetX: 5, + offsetY: 10, + speed: 0.01 + }) + .expect(getColumnNamesOrder()).eql(["Question 2", "Question 1", "Question 3"]) + .expect(getColumnNamesOrderInState()).eql(["Question 2", "Question 1", "Question 3"]); +}); + +test('Check public/private actions', async t => { + const getPublicitArrayInState = ClientFunction(() => { + return window.surveyAnalyticsTabulator.state.elements.map(col => col.isPublic) + }); + + await t + .click('#tabulatorContainer .tabulator-col[title="Question 2"] button.sa-table__svg-button[title="Make column private"]') + .expect(getPublicitArrayInState()).eql([true, false, true]) + .click('#tabulatorContainer .tabulator-col[title="Question 2"] button.sa-table__svg-button[title="Make column public"]') + .expect(getPublicitArrayInState()).eql([true, true, true]); +}); + +test('Check tabulator taking into account state', async t => { + const getColumnNamesOrder = ClientFunction(() => { + var names = []; + document.querySelectorAll(".tabulator .tabulator-col").forEach((col) => { names.push(col.innerText) }) + names.splice(0, 1); + return names; + }); + + var json = { + elements: [ + { + type: "boolean", + name: "bool", + title: "Question 1", + }, + { + type: "boolean", + name: "bool2", + title: "Question 2", + }, + { + type: "boolean", + name: "bool3", + title: "Question 3", + }, + { + type: "boolean", + name: "bool4", + title: "Question 4", + }, + ], + }; + + var data = [ + { + bool: true, + bool2: false, + bool3: true, + bool4: true, + }, + { + bool: true, + bool2: false, + bool3: false, + bool4: true, + + }, + { + bool: false, + bool2: true, + bool3: false, + bool4: true, + }, + ]; + + var initTabulator = ClientFunction((json, data, options) => { + window.survey = new Survey.SurveyModel(json); + window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator( + survey, + data, + options, + [ + { "name": "bool4", "displayName": "Question 4", "dataType": 0, "isVisible": true, "location": 0 }, + { "name": "bool", "displayName": "Question 1", "dataType": 0, "isVisible": false, "location": 0 }, + { "name": "bool2", "displayName": "Question 2", "dataType": 0, "isVisible": true, "location": 1 }, + { "name": "bool3", "displayName": "Question 3", "dataType": 0, "isVisible": true, "location": 0 } + ] + + ); + surveyAnalyticsTabulator.render(document.getElementById("tabulatorContainer")); + }) + + await initTabulator(json, data, { actionsColumnWidth: 100 }); + + await t + .expect(getColumnNamesOrder()).eql(["Question 4", "Question 1", "Question 2", "Question 3"]) + .expect(Selector('#tabulatorContainer .tabulator-col').withText('Question 1').visible).notOk() + .expect(Selector('#tabulatorContainer .tabulator-col').withText('Question 2').visible).notOk() + .expect(Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension option').exists).ok() + .click('#tabulatorContainer .tabulator-row:nth-child(1) button[title="Show minor columns"]') + .expect(Selector('#tabulatorContainer td').withText('Question 2').visible).ok(); +}); \ No newline at end of file diff --git a/testCafe/tabulator/columnactions.testcafe b/testCafe/tabulator/columnactions.testcafe deleted file mode 100644 index fb3f9cfa8..000000000 --- a/testCafe/tabulator/columnactions.testcafe +++ /dev/null @@ -1 +0,0 @@ -{"fixtures":[{"name":"columnactions","pageUrl":"http://localhost:8080/examples/tabulator.html","tests":[{"name":"Check show/hide actions","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"9","resultVariableName":"getColumnsVisibilityArray","expression":"ClientFunction(() => {\n return window.surveyAnalyticsTabulator.state.elements.map((column)=>{return column.isVisible});\n})"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').visible"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer [title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('div').withText('Question 1').nth(4).visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-col').nth(1).visible"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers div').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"0","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"10","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsVisibilityArray()"},"options":{},"expected":{"type":"js-expr","value":"[true, true, true]"}},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col[title=\"Question 1\"] button[title=\"Hide column\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col[title=\"Question 1\"] button[title=\"Hide column\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"1"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer [title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('div').withText('Question 1').nth(4).visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-col').nth(1).visible"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers div').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"3","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible"},"options":{},"expected":{"type":"js-expr","value":"false"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"11","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsVisibilityArray()"},"options":{},"expected":{"type":"js-expr","value":"[false, true, true]"}},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension')"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('select')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__show-column.sa-table__header-extension')"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions .sa-table__show-column.sa-table__header-extension')"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions select')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(1).find('div').nth(1).find('select')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":67,"offsetY":24},"options":{},"type":"click","callsite":"4"},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension option').withText('Question 1')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension option').withText('Question 1')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension')"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('select')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__show-column.sa-table__header-extension')"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions .sa-table__show-column.sa-table__header-extension')"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions select')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(1).find('div').nth(1).find('select')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":67,"offsetY":24},"options":{},"type":"click","callsite":"8"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer [title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('div').withText('Question 1').nth(4).visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-col').nth(1).visible"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers div').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.tabulator-headers .tabulator-col').nth(1).visible"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Question 1\"]').nth(1).visible"},"ruleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"7","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer div').withText('Question 1').nth(3).visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"12","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsVisibilityArray()"},"options":{},"expected":{"type":"js-expr","value":"[true, true, true]"}}]},{"name":"Check move to details","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"2","resultVariableName":"getColumnsLocationsArray","expression":"ClientFunction(() => {\n return window.surveyAnalyticsTabulator.state.elements.map(column => column.location);\n})"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"3","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col[title=\"Question 1\"] ').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"4","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsLocationsArray()"},"options":{},"expected":{"type":"js-expr","value":"[0, 0, 0]"}},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-row:nth-child(1) button[title=\"Show minor columns\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-row:nth-child(1) button[title=\"Show minor columns\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"8"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').exists"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').exists"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 1').exists"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 1').exists"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').exists"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').exists"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".exists"},"callsite":"9","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').exists"},"options":{},"expected":{"type":"js-expr","value":"false"}},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col[title=\"Question 1\"] button[title=\"Move to Detail\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col[title=\"Question 1\"] button[title=\"Move to Detail\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"1"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"11","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col[title=\"Question 1\"] ').visible"},"options":{},"expected":{"type":"js-expr","value":"false"}},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-row:nth-child(1) button[title=\"Show minor columns\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-row:nth-child(1) button[title=\"Show minor columns\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"6"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 1').visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').visible"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"7","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Yes').visible"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 1').visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 1').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').visible"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"17","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Yes').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"16","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsLocationsArray()"},"options":{},"expected":{"type":"js-expr","value":"[1, 0, 0]"}},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer button').withText('Show as Column')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer button').withText('Show as Column')"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__btn.sa-table__btn--gray').nth(3)"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').nth(2).find('button')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('button').withText('Show as Column')"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__btn.sa-table__btn--gray').nth(3)"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail button').withText('Show as Column')"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail .sa-table__btn.sa-table__btn--gray')"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').nth(2).find('button')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').nth(2).find('button')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":63,"offsetY":29},"options":{},"type":"click","callsite":"10"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"12","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col[title=\"Question 1\"] ').visible"},"options":{},"expected":{"type":"js-expr","value":"true"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"13","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnsLocationsArray()"},"options":{},"expected":{"type":"js-expr","value":"[0, 0, 0]"}},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-row:nth-child(1) button[title=\"Show minor columns\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-row:nth-child(1) button[title=\"Show minor columns\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"14"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').exists"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(27).find('div div table tr td').exists"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 1').exists"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 1').exists"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').exists"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(27).find('div div table tr td').exists"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".exists"},"callsite":"15","assertionType":"eql","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 1').exists"},"options":{},"expected":{"type":"js-expr","value":"false"}}]},{"name":"Check columns drag and drop","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"3","resultVariableName":"getColumnNamesOrder","expression":"ClientFunction(() => {\n var names = [];\n document.querySelectorAll(\".tabulator .tabulator-col\").forEach((col) => { names.push(col.innerText) })\n names.splice(0, 1);\n return names;\n})"},{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"5","resultVariableName":"getColumnNamesOrderInState","expression":"ClientFunction(() => {\n var names = [];\n window.surveyAnalyticsTabulator.state.elements.forEach((col) => { names.push(col.displayName) })\n return names;\n})"},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer div.tabulator-col[title=\\'Question 1\\'] button.sa-table__drag-button')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div.tabulator-col[title=\\'Question 1\\'] button.sa-table__drag-button')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button.sa-table__drag-button svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Question 1\"] div div div div div button svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button svg use')"},"ruleType":"$dom$"}],"useOffsets":true,"offsetX":5,"offsetY":10},"dragOffsetX":1200,"dragOffsetY":120,"options":{"speed":0.01,"offsetX":5,"offsetY":10},"type":"drag","callsite":"0"},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"4","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnNamesOrder()"},"options":{},"expected":{"type":"js-expr","value":"[\"Question 2\", \"Question 1\", \"Question 3\"]"}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"6","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnNamesOrderInState()"},"options":{},"expected":{"type":"js-expr","value":"[\"Question 2\", \"Question 1\", \"Question 3\"]"}}]},{"name":"Check public/private actions","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"1","resultVariableName":"getPublicitArrayInState","expression":"ClientFunction(() => {\n return window.surveyAnalyticsTabulator.state.elements.map(col => col.isPublic)\n})"},{"type":"click","studio":{},"callsite":"5","selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col[title=\"Question 2\"] button.sa-table__svg-button[title=\"Make column private\"]')"},"options":{}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"2","assertionType":"eql","actual":{"type":"js-expr","value":"getPublicitArrayInState()"},"options":{},"expected":{"type":"js-expr","value":"[true, false, true]"}},{"type":"click","studio":{},"callsite":"6","selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col[title=\"Question 2\"] button.sa-table__svg-button[title=\"Make column public\"]')"},"options":{}},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"4","assertionType":"eql","actual":{"type":"js-expr","value":"getPublicitArrayInState()"},"options":{},"expected":{"type":"js-expr","value":"[true, true, true]"}}]},{"name":"Check tabulator taking into account state","commands":[{"type":"execute-expression","studio":{"expressionCommandType":"define-function"},"callsite":"2","resultVariableName":"getColumnNamesOrder","expression":"ClientFunction(() => {\n var names = [];\n document.querySelectorAll(\".tabulator .tabulator-col\").forEach((col) => { names.push(col.innerText) })\n names.splice(0, 1);\n return names;\n})"},{"type":"execute-async-expression","studio":{},"callsite":"1","expression":"var json = {\r\n elements: [\r\n {\r\n type: \"boolean\",\r\n name: \"bool\",\r\n title: \"Question 1\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool2\",\r\n title: \"Question 2\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool3\",\r\n title: \"Question 3\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool4\",\r\n title: \"Question 4\",\r\n },\r\n ],\r\n};\r\n\r\nvar data = [\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n bool4: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n bool4: true,\r\n\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n bool4: true,\r\n },\r\n];\r\n\r\nvar initTabulator = ClientFunction((json, data, options) => {\r\n window.survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(\r\n survey,\r\n data,\r\n options,\r\n [\r\n { \"name\": \"bool4\", \"displayName\": \"Question 4\", \"dataType\": 0, \"isVisible\": true, \"location\": 0 },\r\n { \"name\": \"bool\", \"displayName\": \"Question 1\", \"dataType\": 0, \"isVisible\": false, \"location\": 0 },\r\n { \"name\": \"bool2\", \"displayName\": \"Question 2\", \"dataType\": 0, \"isVisible\": true, \"location\": 1 },\r\n { \"name\": \"bool3\", \"displayName\": \"Question 3\", \"dataType\": 0, \"isVisible\": true, \"location\": 0 }\r\n ]\r\n\r\n );\r\n surveyAnalyticsTabulator.render(document.getElementById(\"tabulatorContainer\"));\r\n})\r\n\r\nawait initTabulator(json, data, { actionsColumnWidth: 100 });\r\n\r\n"},{"type":"assertion","studio":{"assertionMode":"checkFunction","selectorPostfix":"","selectors":[]},"callsite":"3","assertionType":"eql","actual":{"type":"js-expr","value":"getColumnNamesOrder()"},"options":{},"expected":{"type":"js-expr","value":"[\"Question 4\", \"Question 1\", \"Question 2\", \"Question 3\"]"}},{"type":"assertion","studio":{"assertionMode":"checkElement","selectorPostfix":".visible"},"callsite":"4","assertionType":"notOk","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col').withText('Question 1').visible"},"options":{}},{"type":"assertion","studio":{"assertionMode":"checkElement","selectorPostfix":".visible"},"callsite":"5","assertionType":"notOk","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-col').withText('Question 2').visible"},"options":{}},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension option').exists"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension').exists"},"ruleType":"class","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('select').exists"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__show-column.sa-table__header-extension').exists"},"ruleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions .sa-table__show-column.sa-table__header-extension').exists"},"ruleType":"class","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__header-extensions select').exists"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(1).find('div').nth(1).find('select').exists"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".exists"},"callsite":"6","assertionType":"ok","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer .sa-table__show-column.sa-table__header-extension option').exists"},"options":{}},{"selector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-row:nth-child(1) button[title=\"Show minor columns\"]')"},"studio":{"selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer .tabulator-row:nth-child(1) button[title=\"Show minor columns\"]')"},"ruleType":"$edited$"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__svg-button').nth(2).find('svg use')"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('[title=\"Hide column\"] svg use')"},"ruleType":"$dom$","ancestorRuleType":"$attr$"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div div div').nth(8).find('div div div div div button').nth(2).find('svg use')"},"ruleType":"$dom$"}],"useOffsets":false,"offsetX":6,"offsetY":11},"options":{},"type":"click","callsite":"7"},{"type":"assertion","studio":{"assertionMode":"checkElement","selectors":[{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 2').visible"},"ruleType":"$text$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('#tabulatorContainer div').nth(6).find('div').nth(43).find('div div table tr td').visible"},"ruleType":"$dom$","ancestorRuleType":"id"},{"rawSelector":{"type":"js-expr","value":"Selector('td').withText('Question 2').visible"},"ruleType":"$text$"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').withText('Question 2').visible"},"ruleType":"$text$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('.sa-table__detail td').visible"},"ruleType":"$dom$","ancestorRuleType":"class"},{"rawSelector":{"type":"js-expr","value":"Selector('div div').nth(6).find('div').nth(43).find('div div table tr td').visible"},"ruleType":"$dom$"}],"selectorType":"CSS Selector","selectorPostfix":".visible"},"callsite":"8","assertionType":"ok","actual":{"type":"js-expr","value":"Selector('#tabulatorContainer td').withText('Question 2').visible"},"options":{}}]}],"beforeEachCommands":[{"type":"resize-window","studio":{},"callsite":"beforeEachHook_6","width":1920,"height":1080},{"type":"execute-async-expression","studio":{},"callsite":"beforeEachHook_3","expression":"var json = {\r\n elements: [\r\n {\r\n type: \"boolean\",\r\n name: \"bool\",\r\n title: \"Question 1\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool2\",\r\n title: \"Question 2\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool3\",\r\n title: \"Question 3\",\r\n },\r\n ],\r\n};\r\n\r\nvar data = [\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n },\r\n];\r\n\r\nvar initTabulator = ClientFunction((json, data, options) => {\r\n window.SurveyAnalyticsTabulator.TableExtensions.findExtension(\r\n \"column\",\r\n \"makepublic\"\r\n ).visibleIndex = 0;\r\n \r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(\r\n survey,\r\n data,\r\n options\r\n );\r\n surveyAnalyticsTabulator.render(document.getElementById(\"tabulatorContainer\"));\r\n})\r\n\r\nawait initTabulator(json, data, {actionsColumnWidth: 100});\r\n\r\n"}]}]} diff --git a/testCafe/tabulator/headeractions.js b/testCafe/tabulator/headeractions.js new file mode 100644 index 000000000..d08e547e3 --- /dev/null +++ b/testCafe/tabulator/headeractions.js @@ -0,0 +1,412 @@ +import { Selector, ClientFunction } from 'testcafe'; + +fixture`headeractions` + .page`http://localhost:8080/examples/tabulator.html` + .beforeEach(async t => { + await t + .resizeWindow(1920, 1080); + }); + +test('Check pagination', async t => { + const getPaginationInState = ClientFunction(() => { + return surveyAnalyticsTabulator.state.pageSize; + }); + + var json = { + elements: [ + { + type: "boolean", + name: "bool", + title: "Question 1", + }, + { + type: "boolean", + name: "bool2", + title: "Question 2", + }, + { + type: "boolean", + name: "bool3", + title: "Question 3", + }, + ], + }; + + var data = [ + { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, + ]; + + var initTabulator = ClientFunction((json, data, options) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator( + survey, + data, + options + ); + surveyAnalyticsTabulator.render(document.getElementById("tabulatorContainer")); + }) + + await initTabulator(json, data, { actionsColumnWidth: 100 }); + + await t + .expect(Selector('#tabulatorContainer .tabulator-table').childElementCount).eql(5) + .click('.sa-table__entries select') + .click(Selector('#tabulatorContainer .sa-table__entries select option').withText('1')) + .expect(Selector('#tabulatorContainer .tabulator-table').childElementCount).eql(1) + .expect(getPaginationInState()).eql(1) + .click('.sa-table__entries select') + .click(Selector('#tabulatorContainer .sa-table__entries select option').withText('10')) + .expect(Selector('#tabulatorContainer .tabulator-table').childElementCount).eql(9) + .expect(getPaginationInState()).eql(10); +}); + +test('Check change locale', async t => { + const getLocaleInState = ClientFunction(() => { + return window.surveyAnalyticsTabulator.state.locale; + }); + + var json = { + locale: "ru", + questions: [ + { + type: "dropdown", + name: "satisfaction", + title: { + default: "How satisfied are you with the Product?", + ru: "Насколько Вас устраивает наш продукт?", + }, + choices: [ + { + value: 0, + text: { + default: "Not Satisfied", + ru: "Coвсем не устраивает", + }, + }, + { + value: 1, + text: { + default: "Satisfied", + ru: "Устраивает", + }, + }, + { + value: 2, + text: { + default: "Completely satisfied", + ru: "Полностью устраивает", + }, + }, + ], + }, + ], + }; + + var data = [{ satisfaction: 0 }, { satisfaction: 1 }, { satisfaction: 2 }]; + + var initTabulator = ClientFunction((json, data, options) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator( + survey, + data, + options + ); + surveyAnalyticsTabulator.render(document.getElementById("tabulatorContainer")); + }) + + await initTabulator(json, data, { actionsColumnWidth: 100 }); + + await t + .expect(Selector('#tabulatorContainer span').withText('Насколько Вас устраивает наш продукт?').innerText).eql("Насколько Вас устраивает наш продукт?") + .expect(Selector('#tabulatorContainer div').withText('Coвсем не устраивает').nth(4).innerText).eql("Coвсем не устраивает") + .expect(Selector('#tabulatorContainer div').withText('Устраивает').nth(4).innerText).eql("Устраивает") + .expect(Selector('#tabulatorContainer div').withText('Полностью устраивает').nth(4).innerText).eql("Полностью устраивает") + .click(Selector('#tabulatorContainer .sa-table__header-extension ').withText('Сменить язык')) + .click(Selector('#tabulatorContainer .sa-table__header-extension option').withText('English')) + .expect(Selector('#tabulatorContainer span').withText('How satisfied are you with the Product?').innerText).eql("How satisfied are you with the Product?") + .expect(Selector('#tabulatorContainer div').withText('Not Satisfied').nth(4).innerText).eql("Not Satisfied") + .expect(Selector('#tabulatorContainer div').withText('Satisfied').nth(6).innerText).eql("Satisfied") + .expect(Selector('#tabulatorContainer div').withText('Completely satisfied').nth(4).innerText).eql("Completely satisfied") + .expect(Selector('#tabulatorContainer .sa-table__header-extension').withText('Change Locale').exists).eql(true) + .expect(getLocaleInState()).eql(""); +}); + +test('Check pagination from state', async t => { + var json = { + elements: [ + { + type: "boolean", + name: "bool", + title: "Question 1", + }, + { + type: "boolean", + name: "bool2", + title: "Question 2", + }, + { + type: "boolean", + name: "bool3", + title: "Question 3", + }, + ], + }; + + var data = [ + { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, { + bool: true, + bool2: false, + bool3: true, + }, + { + bool: true, + bool2: false, + bool3: false, + }, + { + bool: false, + bool2: true, + bool3: false, + }, + ]; + + var initTabulator = ClientFunction((json, data, options, state) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator( + survey, + data, + options + ); + surveyAnalyticsTabulator.state = state; + surveyAnalyticsTabulator.render(document.getElementById("tabulatorContainer")); + }) + + await initTabulator(json, data, { actionsColumnWidth: 100 }, { pageSize: 10 }); + + await t + .expect(Selector('#tabulatorContainer .tabulator-table').childElementCount).eql(9) + .expect(Selector('.sa-table__entries select').value).eql('10'); +}); + +test('Check locale from state', async t => { + var json = { + locale: "ru", + questions: [ + { + type: "dropdown", + name: "satisfaction", + title: { + default: "How satisfied are you with the Product?", + ru: "Насколько Вас устраивает наш продукт?", + }, + choices: [ + { + value: 0, + text: { + default: "Not Satisfied", + ru: "Coвсем не устраивает", + }, + }, + { + value: 1, + text: { + default: "Satisfied", + ru: "Устраивает", + }, + }, + { + value: 2, + text: { + default: "Completely satisfied", + ru: "Полностью устраивает", + }, + }, + ], + }, + ], + }; + + var data = [{ satisfaction: 0 }, { satisfaction: 1 }, { satisfaction: 2 }]; + + var initTabulator = ClientFunction((json, data, options, state) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator( + survey, + data, + options + ); + window.surveyAnalyticsTabulator.state = state; + window.surveyAnalyticsTabulator.render(document.getElementById("tabulatorContainer")); + }) + + await initTabulator(json, data, { actionsColumnWidth: 100 }, { locale: "en" }); + + await t + .expect(Selector('#tabulatorContainer span').withText('How satisfied are you with the Product?').innerText).eql("How satisfied are you with the Product?") + .expect(Selector('#tabulatorContainer div').withText('Not Satisfied').nth(4).innerText).eql("Not Satisfied") + .expect(Selector('#tabulatorContainer div').withText('Satisfied').nth(6).innerText).eql("Satisfied") + .expect(Selector('#tabulatorContainer div').withText('Completely satisfied').nth(4).innerText).eql("Completely satisfied"); +}); + +test('Check commercial license caption', async t => { + var json = { + questions: [ + { + type: "dropdown", + name: "simplequestion", + choices: [ + 0, + ], + }, + ], + }; + + var data = []; + + var initTabulator = ClientFunction((json, data, options, state) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator( + survey, + data, + options + ); + window.surveyAnalyticsTabulator.state = state; + window.surveyAnalyticsTabulator.render(document.getElementById("tabulatorContainer")); + }) + + await initTabulator(json, data, {}); + + await t + .expect(Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists).ok(); + + var json = { + questions: [ + { + type: "dropdown", + name: "simplequestion", + choices: [ + 0, + ], + }, + ], + }; + + var data = []; + + var initTabulator = ClientFunction((json, data, options, state) => { + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator( + survey, + data, + options + ); + window.surveyAnalyticsTabulator.state = state; + window.surveyAnalyticsTabulator.render(document.getElementById("tabulatorContainer")); + }) + + await initTabulator(json, data, { haveCommercialLicense: true }); + + await t + .expect(Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists).notOk(); + + var json = { + questions: [ + { + type: "dropdown", + name: "simplequestion", + choices: [ + 0, + ], + }, + ], + }; + + var data = []; + + var initTabulator = ClientFunction((json, data, options, state) => { + SurveyAnalyticsTabulator.Tabulator.haveCommercialLicense = true; + var survey = new Survey.SurveyModel(json); + window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator( + survey, + data, + options + ); + window.surveyAnalyticsTabulator.state = state; + window.surveyAnalyticsTabulator.render(document.getElementById("tabulatorContainer")); + }) + + await initTabulator(json, data, { haveCommercialLicense: true }); + + await t + .expect(Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists).notOk(); +}); \ No newline at end of file diff --git a/testCafe/tabulator/headeractions.testcafe b/testCafe/tabulator/headeractions.testcafe deleted file mode 100644 index 36ace96f6..000000000 --- a/testCafe/tabulator/headeractions.testcafe +++ /dev/null @@ -1,2012 +0,0 @@ -{ - "fixtures": [ - { - "name": "headeractions", - "pageUrl": "http://localhost:8080/examples/tabulator.html", - "tests": [ - { - "name": "Check pagination", - "commands": [ - { - "type": "execute-expression", - "studio": { - "expressionCommandType": "define-function" - }, - "callsite": "8", - "resultVariableName": "getPaginationInState", - "expression": "ClientFunction(() => {\n return surveyAnalyticsTabulator.state.pageSize;\n})" - }, - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "5", - "expression": "var json = {\r\n elements: [\r\n {\r\n type: \"boolean\",\r\n name: \"bool\",\r\n title: \"Question 1\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool2\",\r\n title: \"Question 2\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool3\",\r\n title: \"Question 3\",\r\n },\r\n ],\r\n};\r\n\r\nvar data = [\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n }, {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n }, {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n },\r\n];\r\n\r\nvar initTabulator = ClientFunction((json, data, options) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(\r\n survey,\r\n data,\r\n options\r\n );\r\n surveyAnalyticsTabulator.render(document.getElementById(\"tabulatorContainer\"));\r\n})\r\n\r\nawait initTabulator(json, data, {actionsColumnWidth: 100});" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-table').childElementCount" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('html').childElementCount" - }, - "ruleType": "$tagName$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".childElementCount" - }, - "callsite": "9", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-table').childElementCount" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "5" - } - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('div select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('div select')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": 47, - "offsetY": 9 - }, - "options": {}, - "type": "click", - "callsite": "0" - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__entries select option').withText('1')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__entries select option').withText('1')" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer option').withText('1')" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('div select option')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('option').withText('1')" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries option').withText('1')" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select option')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('div select option')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": null, - "offsetY": null - }, - "options": {}, - "type": "click", - "callsite": "1" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-table').childElementCount" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('html').childElementCount" - }, - "ruleType": "$tagName$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".childElementCount" - }, - "callsite": "2", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-table').childElementCount" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "1" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkFunction", - "selectorPostfix": "", - "selectors": [] - }, - "callsite": "10", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "getPaginationInState()" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "1" - } - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('div select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('div select')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": 47, - "offsetY": 9 - }, - "options": {}, - "type": "click", - "callsite": "6" - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__entries select option').withText('10')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__entries select option').withText('10')" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer option').withText('1')" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('div select option')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('option').withText('1')" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries option').withText('1')" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select option')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('div select option')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": null, - "offsetY": null - }, - "options": {}, - "type": "click", - "callsite": "7" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-table').childElementCount" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('html').childElementCount" - }, - "ruleType": "$tagName$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".childElementCount" - }, - "callsite": "14", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-table').childElementCount" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "9" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkFunction", - "selectorPostfix": "", - "selectors": [] - }, - "callsite": "15", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "getPaginationInState()" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "10" - } - } - ] - }, - { - "name": "Check change locale", - "commands": [ - { - "type": "execute-expression", - "studio": { - "expressionCommandType": "define-function" - }, - "callsite": "11", - "resultVariableName": "getLocaleInState", - "expression": "ClientFunction(() => {\n return window.surveyAnalyticsTabulator.state.locale;\n})" - }, - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "0", - "expression": "\r\nvar json = {\r\n locale: \"ru\",\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"satisfaction\",\r\n title: {\r\n default: \"How satisfied are you with the Product?\",\r\n ru: \"Насколько Вас устраивает наш продукт?\",\r\n },\r\n choices: [\r\n {\r\n value: 0,\r\n text: {\r\n default: \"Not Satisfied\",\r\n ru: \"Coвсем не устраивает\",\r\n },\r\n },\r\n {\r\n value: 1,\r\n text: {\r\n default: \"Satisfied\",\r\n ru: \"Устраивает\",\r\n },\r\n },\r\n {\r\n value: 2,\r\n text: {\r\n default: \"Completely satisfied\",\r\n ru: \"Полностью устраивает\",\r\n },\r\n },\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [{ satisfaction: 0 }, { satisfaction: 1 }, { satisfaction: 2 }];\r\n\r\nvar initTabulator = ClientFunction((json, data, options) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(\r\n survey,\r\n data,\r\n options\r\n );\r\n surveyAnalyticsTabulator.render(document.getElementById(\"tabulatorContainer\"));\r\n})\r\n\r\nawait initTabulator(json, data, { actionsColumnWidth: 100 });\r\n\r\n" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).find('span').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).nth(1).find('div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Насколько Вас устраивает наш продукт?\"] span').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Насколько Вас устраивает наш продукт?\"] div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "1", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Насколько Вас устраивает наш продукт?').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Насколько Вас устраивает наш продукт?\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Coвсем не устраивает').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Coвсем не устраивает\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Coвсем не устраивает').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] div').withText('Coвсем не устраивает').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Coвсем не устраивает\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "2", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Coвсем не устраивает').nth(4).innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Coвсем не устраивает\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Устраивает').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(3).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Устраивает\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Устраивает').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(3).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] div').withText('Устраивает').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Устраивает\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "3", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Устраивает').nth(4).innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Устраивает\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Полностью устраивает').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(5).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Полностью устраивает\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Полностью устраивает').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(5).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).find('div').withText('Полностью устраивает').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).nth(1).find('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Полностью устраивает\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "4", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Полностью устраивает').nth(4).innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Полностью устраивает\"" - } - }, - { - "selector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__header-extension ').withText('Сменить язык')" - }, - "studio": { - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__header-extension ').withText('Сменить язык')" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__header-extension').nth(2)" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(1).find('div').nth(1).find('select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__header-extension').nth(2)" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__header-extensions .sa-table__header-extension').nth(2)" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-table__header-extensions select')" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(1).find('div').nth(1).find('select')" - }, - "ruleType": "$dom$" - } - ], - "useOffsets": false, - "offsetX": 105, - "offsetY": 24 - }, - "options": {}, - "type": "click", - "callsite": "5" - }, - { - "type": "click", - "studio": {}, - "callsite": "10", - "selector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__header-extension option').withText('English')" - }, - "options": {} - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).find('span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).nth(1).find('div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"How satisfied are you with the Product?\"] span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"How satisfied are you with the Product?\"] div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "6", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('How satisfied are you with the Product?').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"How satisfied are you with the Product?\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Not Satisfied').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Not Satisfied\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Not Satisfied').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] div').withText('Not Satisfied').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Not Satisfied\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "7", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Not Satisfied').nth(4).innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Not Satisfied\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Satisfied').nth(6).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(3).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Satisfied\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Satisfied').nth(7).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(3).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] div').withText('Satisfied').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Satisfied\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "8", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Satisfied').nth(6).innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Satisfied\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Completely satisfied').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(5).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Completely satisfied\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Completely satisfied').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(5).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).find('div').withText('Completely satisfied').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).nth(1).find('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Completely satisfied\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "9", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Completely satisfied').nth(4).innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Completely satisfied\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectorPostfix": ".exists" - }, - "callsite": "13", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-table__header-extension').withText('Change Locale').exists" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "true" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkFunction", - "selectorPostfix": "", - "selectors": [] - }, - "callsite": "12", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "getLocaleInState()" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"\"" - } - } - ] - }, - { - "name": "Check pagination from state", - "commands": [ - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "0", - "expression": "var json = {\r\n elements: [\r\n {\r\n type: \"boolean\",\r\n name: \"bool\",\r\n title: \"Question 1\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool2\",\r\n title: \"Question 2\",\r\n },\r\n {\r\n type: \"boolean\",\r\n name: \"bool3\",\r\n title: \"Question 3\",\r\n },\r\n ],\r\n};\r\n\r\nvar data = [\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n }, {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n }, {\r\n bool: true,\r\n bool2: false,\r\n bool3: true,\r\n },\r\n {\r\n bool: true,\r\n bool2: false,\r\n bool3: false,\r\n },\r\n {\r\n bool: false,\r\n bool2: true,\r\n bool3: false,\r\n },\r\n];\r\n\r\nvar initTabulator = ClientFunction((json, data, options, state) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(\r\n survey,\r\n data,\r\n options\r\n );\r\n surveyAnalyticsTabulator.state = state;\r\n surveyAnalyticsTabulator.render(document.getElementById(\"tabulatorContainer\"));\r\n})\r\n\r\nawait initTabulator(json, data, { actionsColumnWidth: 100 }, { pageSize: 10 });" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-table').childElementCount" - }, - "ruleType": "$edited$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('html').childElementCount" - }, - "ruleType": "$tagName$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".childElementCount" - }, - "callsite": "1", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-table').childElementCount" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "9" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectorPostfix": ".value" - }, - "callsite": "2", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('.sa-table__entries select').value" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "'10'" - } - } - ] - }, - { - "name": "Check locale from state", - "commands": [ - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "0", - "expression": "\r\nvar json = {\r\n locale: \"ru\",\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"satisfaction\",\r\n title: {\r\n default: \"How satisfied are you with the Product?\",\r\n ru: \"Насколько Вас устраивает наш продукт?\",\r\n },\r\n choices: [\r\n {\r\n value: 0,\r\n text: {\r\n default: \"Not Satisfied\",\r\n ru: \"Coвсем не устраивает\",\r\n },\r\n },\r\n {\r\n value: 1,\r\n text: {\r\n default: \"Satisfied\",\r\n ru: \"Устраивает\",\r\n },\r\n },\r\n {\r\n value: 2,\r\n text: {\r\n default: \"Completely satisfied\",\r\n ru: \"Полностью устраивает\",\r\n },\r\n },\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [{ satisfaction: 0 }, { satisfaction: 1 }, { satisfaction: 2 }];\r\n\r\nvar initTabulator = ClientFunction((json, data, options, state) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(\r\n survey,\r\n data,\r\n options\r\n );\r\n window.surveyAnalyticsTabulator.state = state;\r\n window.surveyAnalyticsTabulator.render(document.getElementById(\"tabulatorContainer\"));\r\n})\r\n\r\nawait initTabulator(json, data, { actionsColumnWidth: 100 }, { locale: \"en\" });\r\n\r\n" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).find('span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-col-title').nth(1).nth(1).find('div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"How satisfied are you with the Product?\"] span').withText('How satisfied are you with the Product?').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"How satisfied are you with the Product?\"] div div div div span').innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div div div').nth(8).find('div div div div span').innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "6", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('How satisfied are you with the Product?').innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"How satisfied are you with the Product?\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Not Satisfied').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Not Satisfied\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Not Satisfied').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] div').withText('Not Satisfied').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Not Satisfied\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "7", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Not Satisfied').nth(4).innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Not Satisfied\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Satisfied').nth(6).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(3).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Satisfied\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Satisfied').nth(7).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(3).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] div').withText('Satisfied').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-e\"] .tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Satisfied\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(7).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "8", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Satisfied').nth(6).innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Satisfied\"" - } - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Completely satisfied').nth(4).innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .tabulator-cell').nth(5).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer [title=\"Completely satisfied\"]').innerText" - }, - "ruleType": "$attr$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div').withText('Completely satisfied').nth(5).innerText" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.tabulator-cell').nth(5).innerText" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).find('div').withText('Completely satisfied').innerText" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[class^=\"tabulator-row tabulator-selectable tabulator-row-o\"]').nth(1).nth(1).find('.tabulator-cell').nth(1).innerText" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('[title=\"Completely satisfied\"]').innerText" - }, - "ruleType": "$attr$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div').nth(6).find('div').nth(19).find('div div').nth(14).find('div').nth(3).innerText" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".innerText" - }, - "callsite": "9", - "assertionType": "eql", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div').withText('Completely satisfied').nth(4).innerText" - }, - "options": {}, - "expected": { - "type": "js-expr", - "value": "\"Completely satisfied\"" - } - } - ] - }, - { - "name": "Check commercial license caption", - "commands": [ - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "3", - "expression": "\r\nvar json = {\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"simplequestion\",\r\n choices: [\r\n 0,\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [];\r\n\r\nvar initTabulator = ClientFunction((json, data, options, state) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(\r\n survey,\r\n data,\r\n options\r\n );\r\n window.surveyAnalyticsTabulator.state = state;\r\n window.surveyAnalyticsTabulator.render(document.getElementById(\"tabulatorContainer\"));\r\n})\r\n\r\nawait initTabulator(json, data, {});\r\n\r\n" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div a span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__product').exists" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div a span span').exists" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".exists" - }, - "callsite": "1", - "assertionType": "ok", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "options": {} - }, - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "2", - "expression": "var json = {\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"simplequestion\",\r\n choices: [\r\n 0,\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [];\r\n\r\nvar initTabulator = ClientFunction((json, data, options, state) => {\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(\r\n survey,\r\n data,\r\n options\r\n );\r\n window.surveyAnalyticsTabulator.state = state;\r\n window.surveyAnalyticsTabulator.render(document.getElementById(\"tabulatorContainer\"));\r\n})\r\n\r\nawait initTabulator(json, data, {haveCommercialLicense: true});" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div a span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__product').exists" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div a span span').exists" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".exists" - }, - "callsite": "5", - "assertionType": "notOk", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "options": {} - }, - { - "type": "execute-async-expression", - "studio": {}, - "callsite": "6", - "expression": "var json = {\r\n questions: [\r\n {\r\n type: \"dropdown\",\r\n name: \"simplequestion\",\r\n choices: [\r\n 0,\r\n ],\r\n },\r\n ],\r\n};\r\n\r\nvar data = [];\r\n\r\nvar initTabulator = ClientFunction((json, data, options, state) => {\r\n SurveyAnalyticsTabulator.Tabulator.haveCommercialLicense = true;\r\n var survey = new Survey.SurveyModel(json);\r\n window.surveyAnalyticsTabulator = new SurveyAnalyticsTabulator.Tabulator(\r\n survey,\r\n data,\r\n options\r\n );\r\n window.surveyAnalyticsTabulator.state = state;\r\n window.surveyAnalyticsTabulator.render(document.getElementById(\"tabulatorContainer\"));\r\n})\r\n\r\nawait initTabulator(json, data, {haveCommercialLicense: true});" - }, - { - "type": "assertion", - "studio": { - "assertionMode": "checkElement", - "selectors": [ - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer div a span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "id" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__product').exists" - }, - "ruleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "ruleType": "$text$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text .sa-commercial__product').exists" - }, - "ruleType": "class", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('.sa-commercial__text span span').exists" - }, - "ruleType": "$dom$", - "ancestorRuleType": "class" - }, - { - "rawSelector": { - "type": "js-expr", - "value": "Selector('div div a span span').exists" - }, - "ruleType": "$dom$" - } - ], - "selectorType": "CSS Selector", - "selectorPostfix": ".exists" - }, - "callsite": "7", - "assertionType": "notOk", - "actual": { - "type": "js-expr", - "value": "Selector('#tabulatorContainer span').withText('Please purchase a SurveyJS Analytics developer lic').nth(1).exists" - }, - "options": {} - } - ] - } - ], - "beforeEachCommands": [ - { - "type": "resize-window", - "studio": {}, - "callsite": "beforeEachHook_1", - "width": 1920, - "height": 1080 - } - ] - } - ] -} \ No newline at end of file