Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish Button test in Jest #749

Closed
wants to merge 13 commits into from
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"git add"
]
},
"jest": {
"setupFiles": ["./test/setup-jest.js"]
},
"keywords": [
"editor",
"wysiwyg",
Expand Down
16 changes: 11 additions & 5 deletions test/ui-testing/publishButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ const fs = require('fs');
beforeAll(async () => {
path = fs.realpathSync('file://../examples/index.html');
await page.goto('file://' + path, {waitUntil: 'domcontentloaded'});
await page.waitForSelector('body');
await page.addScriptTag({url: 'https://code.jquery.com/jquery-3.2.1.min.js'});
});

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

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

});

test('publish button gets enabled', () => {
// Check initially that Publish button is disabled.
expect(page.$('.ple-publish').getAttribute('disabled')).toBe(true);
// Add title.
page.$('.ple-module-title input').innerText.toBe('Title');
page.type('.ple-module-title input', 'hello');
// Check final state of Publish button.
expect(page.$('.ple-publish').getAttribute('disabled')).toBe(false);
}, timeout);
});