Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Selector } from 'testcafe';
export default Selector(complexSelector => {
function validateSelector (selector) {
if (selector !== void 0 && typeof selector !== 'string')
throw new Error('If the selector parameter is passed it should be a string, but it was ' + eval('typeof selector')); // eslint-disable-line no-eval
}
function validateVueVersion (rootInstance) {
const MAJOR_SUPPORTED_VUE_VERSION = 2;
const vueVersion = parseInt(findVueConstructor(rootInstance).version.split('.')[0], 10);
if (vueVersion < MAJOR_SUPPORTED_VUE_VERSION)
throw new Error('testcafe-vue-selectors supports Vue version 2.x and newer');
}
/*eslint-disable no-unused-vars, no-eval*/
function findVueConstructor (rootInstance) {
// NOTE: Testcafe does not support a ClientFunction containing polyfilled functions. See list in
// Change to `withProps` when implemented: https://github.com/DevExpress/testcafe-react-selectors/issues/14
.click(ReactSelector('NodeTypeItem').find('button>span>span').withText('Headline'));
subSection('Type something inside of it');
await Page.waitForIframeLoading(t);
await t
.switchToIframe('[name="neos-content-main"]')
.typeText(Selector('.test-headline h1'), headlineTitle)
.expect(Selector('.neos-contentcollection').withText(headlineTitle).exists).ok('Typed headline text exists');
subSection('Inline validation');
// We have to wait for ajax requests to be triggered, since they are debounced for 0.5s
await t.wait(600);
await changeRequestLogger.clear();
await t
.expect(Selector('.test-headline h1').exists).ok('Validation tooltip appeared')
.click('.test-headline h1')
.pressKey('ctrl+a delete')
.switchToMainWindow()
.wait(600)
.expect(ReactSelector('InlineValidationTooltips').exists).ok('Validation tooltip appeared');
await t
.expect(changeRequestLogger.count(() => true)).eql(0, 'No requests were fired with invalid state')
await t
.switchToIframe('[name="neos-content-main"]')
.typeText(Selector('.test-headline h1'), 'Some text')
.wait(600)
await t.expect(changeRequestLogger.count(() => true)).eql(1, 'Request fired when field became valid')
subSection('Create a link to node');
const linkTargetPage = 'Link target';
await t
test('testPerson', async t => {
basic.login('karpovrt', '123');
const timeStamp = ''+Math.round(+new Date()/1000);
basic.createTestUI('Вася Пупкин', timeStamp);
await t
.expect(Selector('#user-info').innerText).eql('Администратор2 .\n')
.navigateTo('http://localhost:8080/#/v-ui:TestUIRegistry')
.typeText('veda-control#comment', timeStamp)
.click('button#search-button')
.expect(Selector('.stats-top span[property="v-fs:authorized"]').innerText).eql('1')
});
'[data-test-id="suggested-senior-editors"] [data-test-id="person-pod-button"]',
),
suggestedReviewingEditorSelection: Selector(
'[data-test-id="suggested-reviewing-editors"] [data-test-id="person-pod-button"]',
),
peoplePickerOptions: Selector(
'[data-test-id="people-picker-body"] [data-test-id="person-pod-button"]',
),
peoplePickerSubmit: Selector('[data-test-id="people-picker-add"]'),
firstReviewerName: Selector('[name="suggestedReviewers.0.name"]'),
firstReviewerEmail: Selector('[name="suggestedReviewers.0.email"]'),
secondReviewerName: Selector('[name="suggestedReviewers.1.name"]'),
secondReviewerEmail: Selector('[name="suggestedReviewers.1.email"]'),
thirdReviewerName: Selector('[name="suggestedReviewers.2.name"]'),
thirdReviewerEmail: Selector('[name="suggestedReviewers.2.email"]'),
fourthReviewerName: Selector('[name="suggestedReviewers.3.name"]'),
fourthReviewerEmail: Selector('[name="suggestedReviewers.3.email"]'),
fifthReviewerName: Selector('[name="suggestedReviewers.4.name"]'),
fifthReviewerEmail: Selector('[name="suggestedReviewers.4.email"]'),
sixthReviewerName: Selector('[name="suggestedReviewers.5.name"]'),
sixthReviewerEmail: Selector('[name="suggestedReviewers.5.email"]'),
validationErrors: Selector('[data-test-id^="error-"]'),
peoplePickerInfo: Selector('[data-test-id="people-picker-info"]'),
peoplePickerModalErrorMaximum: Selector(
'[data-test-id="maximum-people-selected-error"]',
),
peoplePods: Selector('[data-test-id="person-pod"]'),
}
export default editors
constructor () {
this.advancedLink = Selector('#gfpdf-advanced-nav')
this.appearanceLink = Selector('#gfpdf-appearance-nav')
this.conditionalCheckbox = Selector('div').find('[class^="gfpdf_settings_conditional conditional_logic_listener"]')
this.templateLink = Selector('#gfpdf-custom-appearance-nav')
}
constructor () {
this.editPanel = Selector('#edit-panel');
this.ballgame = nodes.withText('Ball game');
this.football = nodes.withText('Football');
this.viewState = Selector('#rd-view');
this.editState = Selector('#rd-edit');
this.selectedNode = Selector('#selected-node');
this.newNodes = Selector('#new-nodelist').find('.new-node');
this.addInput = Selector('#btn-add-input');
this.removeInput = Selector('#btn-remove-input');
this.parentRel = Selector('#rd-parent');
this.childRel = Selector('#rd-child');
this.siblingRel = Selector('#rd-sibling');
this.addBtn = Selector('#btn-add-nodes');
this.deleteBtn = Selector('#btn-delete-nodes');
this.resetBtn = Selector('#btn-reset');
}
}
export async function createLanguageVersion(language: LanguageVersion) {
await t.click('mesh-node-language-switcher');
await t.click(Selector('gtx-dropdown-item').withText(`Create ${language} version`));
}
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Selector, ClientFunction } from 'testcafe';
export const contextDialog = Selector('#context-dialog');
export const disableToggle = Selector('#disable-toggle');
export const contextDialogPanel = Selector('.dt-context-dialog-panel');
export const backdrop = Selector('.cdk-overlay-backdrop');
export const getActiveElementText = ClientFunction(() => {
const element = document.activeElement;
if (!element) {
return '';
}
return element.textContent || '';
});
export const getActiveElementAriaLabel = ClientFunction(() => {
const element = document.activeElement;
if (!element) {
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Selector, t } from 'testcafe';
export const errorBox = Selector('.dt-filter-field-error');
export const filterField = Selector('#filter-field');
export const option = (nth: number) => Selector(`.dt-option:nth-child(${nth})`);
export const clearAll = Selector('.dt-filter-field-clear-all-button');
export const filterTags = Selector('dt-filter-field-tag');
export const input = Selector('input');
export async function clickOption(
nth: number,
testController?: TestController,
): Promise {
const controller = testController || t;
await controller.click(filterField);
await controller.click(option(nth));
}
.expect(InspectorTitleProperty.value).eql('Home')
.typeText(InspectorTitleProperty, '-1')
.click(Selector('#neos-Inspector-Apply'))
.expect(InspectorTitleProperty.value).eql('Home-1');
await waitForIframeLoading(t);
await t
.expect(InspectorTitleProperty.value).eql('Home-1');
subSection('Test unapplied changes dialog - resume');
await t
.click(InspectorTitleProperty)
.typeText(InspectorTitleProperty, '-2')
.click(Selector('[name="neos-content-main"]'))
.expect(Selector('#neos-UnappliedChangesDialog').exists).ok()
.click(Selector('#neos-UnappliedChangesDialog-resume'))
.expect(Selector('#neos-UnappliedChangesDialog').exists).notOk()
.expect(InspectorTitleProperty.value).eql('Home-1-2');
subSection('Test unapplied changes dialog - discard');
await t
.click(Selector('[name="neos-content-main"]'))
.click(Selector('#neos-UnappliedChangesDialog-discard'))
.expect(InspectorTitleProperty.value).eql('Home-1');
subSection('Test unapplied changes dialog - apply');
await t
.typeText(InspectorTitleProperty, '-3')
.click(Selector('[name="neos-content-main"]'))
.click(Selector('#neos-UnappliedChangesDialog-apply'))
.expect(InspectorTitleProperty.value).eql('Home-1-3')
.click(Selector('[name="neos-content-main"]'))
.expect(Selector('#neos-UnappliedChangesDialog').exists).notOk();