Skip to content

Commit 8d6eb80

Browse files
chore(tests): use new helper function in delete tests
1 parent 6a920a8 commit 8d6eb80

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

tests/browser/test/delete_blocks_test.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,9 @@ suite('Delete blocks', function (done) {
133133
});
134134
});
135135

136-
test.only('Delete block using backspace key', async function () {
136+
test('Delete block using backspace key', async function () {
137137
const before = (await getAllBlocks(this.browser)).length;
138138
// Get first print block, click to select it, and delete it using backspace key.
139-
// const block = (await getBlockElementById(this.browser, firstBlockId)).$(
140-
// '.blocklyPath',
141-
// );
142139
const clickEl = await getClickableBlockElementById(this.browser, firstBlockId);
143140
await clickEl.click();
144141
await this.browser.keys([Key.Backspace]);
@@ -153,10 +150,8 @@ suite('Delete blocks', function (done) {
153150
test('Delete block using delete key', async function () {
154151
const before = (await getAllBlocks(this.browser)).length;
155152
// Get first print block, click to select it, and delete it using delete key.
156-
const block = (await getBlockElementById(this.browser, firstBlockId)).$(
157-
'.blocklyPath',
158-
);
159-
await block.click();
153+
const clickEl = await getClickableBlockElementById(this.browser, firstBlockId);
154+
await clickEl.click();
160155
await this.browser.keys([Key.Delete]);
161156
const after = (await getAllBlocks(this.browser)).length;
162157
chai.assert.equal(
@@ -169,8 +164,7 @@ suite('Delete blocks', function (done) {
169164
test('Delete block using context menu', async function () {
170165
const before = (await getAllBlocks(this.browser)).length;
171166
// Get first print block, click to select it, and delete it using context menu.
172-
const block = await getBlockElementById(this.browser, firstBlockId);
173-
await contextMenuSelect(this.browser, block.id, 'Delete 2 Blocks');
167+
await contextMenuSelect(this.browser, firstBlockId, 'Delete 2 Blocks');
174168
const after = (await getAllBlocks(this.browser)).length;
175169
chai.assert.equal(
176170
before - 2,
@@ -182,10 +176,8 @@ suite('Delete blocks', function (done) {
182176
test('Undo block deletion', async function () {
183177
const before = (await getAllBlocks(this.browser)).length;
184178
// Get first print block, click to select it, and delete it using backspace key.
185-
const block = (await getBlockElementById(this.browser, firstBlockId)).$(
186-
'.blocklyPath',
187-
);
188-
await block.click();
179+
const clickEl = await getClickableBlockElementById(this.browser, firstBlockId);
180+
await clickEl.click();
189181
await this.browser.keys([Key.Backspace]);
190182
await this.browser.pause(PAUSE_TIME);
191183
// Undo
@@ -201,10 +193,8 @@ suite('Delete blocks', function (done) {
201193
test('Redo block deletion', async function () {
202194
const before = (await getAllBlocks(this.browser)).length;
203195
// Get first print block, click to select it, and delete it using backspace key.
204-
const block = (await getBlockElementById(this.browser, firstBlockId)).$(
205-
'.blocklyPath',
206-
);
207-
await block.click();
196+
const clickEl = await getClickableBlockElementById(this.browser, firstBlockId);
197+
await clickEl.click();
208198
await this.browser.keys([Key.Backspace]);
209199
await this.browser.pause(PAUSE_TIME);
210200
// Undo

0 commit comments

Comments
 (0)