Skip to content

Commit

Permalink
chore: add better assertion messages
Browse files Browse the repository at this point in the history
  • Loading branch information
BeksOmega committed Mar 20, 2024
1 parent c0cc19f commit 4f371f2
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions tests/browser/test/workspace_comment_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ suite('Workspace comments', function () {
);
await foldout.click();

chai.assert.isTrue(await isCommentCollapsed(this.browser, commentId));
chai.assert.isTrue(
await isCommentCollapsed(this.browser, commentId),
'Expected the comment to be collapsed',
);
});

test('collapsing adds the css class', async function () {
Expand All @@ -70,7 +73,10 @@ suite('Workspace comments', function () {
await foldout.click();

const comment = await this.browser.$('.blocklyComment');
chai.assert.isTrue(await hasClass(comment, 'blocklyCollapsed'));
chai.assert.isTrue(
await hasClass(comment, 'blocklyCollapsed'),
'Expected the comment to have the blocklyCollapsed class',
);
});
});

Expand All @@ -90,7 +96,10 @@ suite('Workspace comments', function () {
);
await foldout.click();

chai.assert.isFalse(await isCommentCollapsed(this.browser, commentId));
chai.assert.isFalse(
await isCommentCollapsed(this.browser, commentId),
'Expected the comment to not be collapsed',
);
});

test('collapsing adds the css class', async function () {
Expand All @@ -103,7 +112,10 @@ suite('Workspace comments', function () {
await foldout.click();

const comment = await this.browser.$('.blocklyComment');
chai.assert.isFalse(await hasClass(comment, 'blocklyCollapsed'));
chai.assert.isFalse(
await hasClass(comment, 'blocklyCollapsed'),
'Expected the comment to not have the blocklyCollapsed class',
);
});
});
});
Expand Down Expand Up @@ -135,7 +147,10 @@ suite('Workspace comments', function () {
);
await deleteIcon.click();

chai.assert.isTrue(await commentIsDisposed(this.browser, commentId));
chai.assert.isTrue(
await commentIsDisposed(this.browser, commentId),
'Expected the comment model to be disposed',
);
});

test('deleting disposes of DOM elements', async function () {
Expand All @@ -147,7 +162,10 @@ suite('Workspace comments', function () {
);
await deleteIcon.click();

chai.assert.isFalse(await this.browser.$('.blocklyComment').isExisting());
chai.assert.isFalse(
await this.browser.$('.blocklyComment').isExisting(),
'Expected the comment DOM elements to not exist',
);
});
});

Expand All @@ -170,6 +188,7 @@ suite('Workspace comments', function () {
chai.assert.equal(
await getCommentText(this.browser, commentId),
'test text',
'Expected the comment model text to match the entered text',
);
});
});
Expand All @@ -192,10 +211,14 @@ suite('Workspace comments', function () {
);
await resizeHandle.dragAndDrop(delta);

chai.assert.deepEqual(await getCommentSize(this.browser, commentId), {
width: origSize.width + delta.x,
height: origSize.height + delta.y,
});
chai.assert.deepEqual(
await getCommentSize(this.browser, commentId),
{
width: origSize.width + delta.x,
height: origSize.height + delta.y,
},
'Expected the comment model size to match the resized size',
);
});
});
});

0 comments on commit 4f371f2

Please sign in to comment.