-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* @format | ||
* */ | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import EditorPage from './pages/editor-page'; | ||
import { | ||
setupDriver, | ||
isLocalEnvironment, | ||
stopDriver, | ||
isAndroid, | ||
} from './helpers/utils'; | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000000; | ||
|
||
describe('Gutenberg Editor tests for List block (end)', () => { | ||
let driver; | ||
let editorPage; | ||
let allPassed = true; | ||
const listBlockName = 'List'; | ||
|
||
// Use reporter for setting status for saucelabs Job | ||
if (!isLocalEnvironment()) { | ||
const reporter = { | ||
specDone: async (result) => { | ||
allPassed = allPassed && result.status !== 'failed'; | ||
}, | ||
}; | ||
|
||
jasmine.getEnv().addReporter(reporter); | ||
} | ||
|
||
beforeAll(async () => { | ||
driver = await setupDriver(); | ||
editorPage = new EditorPage(driver); | ||
}); | ||
|
||
it( 'should handle separating and merging list items with spaces', async () => { | ||
await editorPage.addNewBlock(listBlockName); | ||
const listBlockElement = await editorPage.getBlockAtPosition(listBlockName); | ||
|
||
// Click List block on Android to force EditText focus | ||
if (isAndroid()) { | ||
await listBlockElement.click(); | ||
} | ||
|
||
// Send the first list item text | ||
await editorPage.sendTextToListBlock(listBlockElement, " "); | ||
|
||
// send an Enter | ||
await editorPage.sendTextToListBlock(listBlockElement, '\n'); | ||
|
||
// send a delete | ||
await editorPage.sendTextToListBlock(listBlockElement, '\u0008'); | ||
|
||
const expected = `<!-- wp:list --> | ||
<ul><li> </li></ul> | ||
<!-- /wp:list -->` | ||
|
||
await editorPage.verifyHtmlContent( expected ); | ||
}); | ||
|
||
afterAll(async () => { | ||
if (!isLocalEnvironment()) { | ||
driver.sauceJobStatus(allPassed); | ||
} | ||
await stopDriver(driver); | ||
}); | ||
}); |