Skip to content

Latest commit

 

History

History
127 lines (99 loc) · 3.76 KB

File metadata and controls

127 lines (99 loc) · 3.76 KB

find-one

Migrates from using findElementWithAssert( to findOne(.

Note: only findElementWithAssert(...).get(0) and findElementWithAssert(...)[0] forms are able to be migrated at the moment.

Usage

npx ember-page-object-codemod find-one path/of/files/ or/some**/*glob.js

# or

yarn global add ember-page-object-codemod
ember-page-object-codemod find-one path/of/files/ or/some**/*glob.js

Input / Output


default-import

Input (default-import.input.js):

import po, { findElementWithAssert } from 'ember-cli-page-object';

function test() {
    return po.create();
}

Output (default-import.output.js):

import po from 'ember-cli-page-object';

function test() {
    return po.create();
}

find-element-with-assert-0

Input (find-element-with-assert-0.input.js):

import { findElementWithAssert } from 'ember-cli-page-object';

function testOne(po) {
    return findElementWithAssert(po)[0];
}

Output (find-element-with-assert-0.output.js):

import { findOne } from "ember-cli-page-object/extend";

function testOne(po) {
    return findOne(po);
}

find-element-with-assert-get-0

Input (find-element-with-assert-get-0.input.js):

import { findElementWithAssert } from 'ember-cli-page-object/extend';

function testOne(po) {
    return findElementWithAssert(po).get(0);
}

Output (find-element-with-assert-get-0.output.js):

import { findOne } from 'ember-cli-page-object/extend';

function testOne(po) {
    return findOne(po);
}

find-element-with-assert

Input (find-element-with-assert.input.js):

import { findElementWithAssert } from 'ember-cli-page-object';

function testOne(po) {
    return findElementWithAssert(po);
}

Output (find-element-with-assert.output.js):

import { findElementWithAssert } from 'ember-cli-page-object';

function testOne(po) {
    return findElementWithAssert(po);
}

member-find-element-with-assert-0

Input (member-find-element-with-assert-0.input.js):

import { findElementWithAssert } from 'ember-cli-page-object/extend';

function testOne(po) {
    return po.findElementWithAssert(po)[0];
}

Output (member-find-element-with-assert-0.output.js):

function testOne(po) {
    return po.findElementWithAssert(po)[0];
}