Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions test/ui-testing/publishButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ beforeAll(async () => {

describe('Publish button', () => {

test('something we are testing described here', () => {

test('Publish button is enabled', async () => {
// Check initially that Publish button is disabled.
expect(await page.evaluate(() => document.querySelector('.ple-publish').disabled)).toBe(true);
// Add title.
await page.evaluate(() => {
document.querySelector('.ple-module-title input').value = 'A title';
document.querySelector('.ple-module-title input').dispatchEvent(new KeyboardEvent('keydown', { "code": "9" })); // random key
});
// Check final state of Publish button.
expect(await page.evaluate(() => document.querySelector('.ple-publish').disabled)).toBe(false);
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jywarren I noticed you didn't add the timeout variable here. Is this part of the new change or is it something you missed out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I was able to set it globally on the first few lines and so didn't need to set it per-test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting, actually on checking, I am not setting the timeout. I think that means we could remove that line, actually.

For reference, I'm stuck on a related issue (going past the timeout limit in this case) in this test publiclab/image-sequencer#2026

https://github.com/publiclab/image-sequencer/blob/58eb3ef6b1caba88aaf217d93ec085a14765d8aa/test/ui-2/test/OverlayInput.test.js#L1-L12

That actually is globally setting timeout. But here I think i just removed it and for the purposes of our test it wasn't needed. I think the default timeout is 5 or 10 seconds? So i guess that's enough for this.


});