mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-19 19:07:47 -05:00
Reconfigure comment integration tests to not sign out as much
This commit is contained in:
parent
e473e9f402
commit
6de944036c
1 changed files with 70 additions and 112 deletions
|
@ -49,126 +49,84 @@ let driver;
|
||||||
describe('comment tests', async () => {
|
describe('comment tests', async () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
driver = await buildDriver('www-integration project comments');
|
driver = await buildDriver('www-integration project comments');
|
||||||
driver.get(rootUrl);
|
await driver.get(rootUrl);
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
await clickXpath('//a[contains(@class, "user-info")]');
|
|
||||||
await clickText('Sign out');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async () => await driver.quit());
|
afterAll(async () => await driver.quit());
|
||||||
|
|
||||||
test('leave comment on project', async () => {
|
describe('leave comments', async () => {
|
||||||
await signIn(username1, password, driver);
|
beforeAll(async () => {
|
||||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
await signIn(username1, password, driver);
|
||||||
await driver.get(projectUrl);
|
await findByXpath('//span[contains(@class, "profile-name")]');
|
||||||
|
});
|
||||||
|
|
||||||
// leave the comment
|
afterAll(async () => {
|
||||||
let commentBox = await findByXpath('//textArea[@name="compose-comment"]');
|
await driver.get(rootUrl);
|
||||||
await commentBox.sendKeys(projectComment);
|
await clickXpath('//a[contains(@class, "user-info")]');
|
||||||
await findByXpath(`//textarea[contains(text(), "${projectComment}")]`);
|
await clickText('Sign out');
|
||||||
await clickXpath('//button[@class="button compose-post"]');
|
});
|
||||||
|
|
||||||
// reload the page
|
test('leave comment on project', async () => {
|
||||||
await driver.sleep(5000);
|
await driver.get(projectUrl);
|
||||||
await driver.get(projectUrl);
|
|
||||||
|
|
||||||
// find the comment
|
// leave the comment
|
||||||
let commentXpath = await `//div[@class="comment-bubble"]/span/span[contains(text(), "${buildNumber}")]`;
|
let commentBox = await findByXpath('//textArea[@name="compose-comment"]');
|
||||||
let postedComment = await findByXpath(commentXpath);
|
await commentBox.sendKeys(projectComment);
|
||||||
let commentVisible = await postedComment.isDisplayed();
|
await findByXpath(`//textarea[contains(text(), "${projectComment}")]`);
|
||||||
await expect(commentVisible).toBe(true);
|
await clickXpath('//button[@class="button compose-post"]');
|
||||||
|
|
||||||
|
// reload the page
|
||||||
|
await driver.sleep(5000);
|
||||||
|
await driver.get(projectUrl);
|
||||||
|
|
||||||
|
// find the comment
|
||||||
|
let commentXpath = await `//div[@class="comment-bubble"]/span/span[contains(text(), "${buildNumber}")]`;
|
||||||
|
let postedComment = await findByXpath(commentXpath);
|
||||||
|
let commentVisible = await postedComment.isDisplayed();
|
||||||
|
await expect(commentVisible).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('leave comment on a profile', async () => {
|
||||||
|
await driver.get(profileUrl);
|
||||||
|
|
||||||
|
// leave the comment
|
||||||
|
let commentXpath = await '//form[@id="main-post-form"]/div/textArea';
|
||||||
|
let commentArea = await findByXpath(commentXpath);
|
||||||
|
await commentArea.sendKeys(profileComment);
|
||||||
|
await clickXpath('//div[@class="button small"]/a[contains(text(), "Post")]');
|
||||||
|
|
||||||
|
// reload page
|
||||||
|
await driver.get(profileUrl);
|
||||||
|
|
||||||
|
// find the comment
|
||||||
|
let newComment = await findByXpath(`//div[@class="comment "]/div/div[contains(text(), "${buildNumber}")]`);
|
||||||
|
let commentVisible = await newComment.isDisplayed();
|
||||||
|
await expect(commentVisible).toBe(true);
|
||||||
|
|
||||||
|
// return to homepage to sign out with www
|
||||||
|
await driver.get(rootUrl);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('leave comment on studio', async () => {
|
||||||
|
await driver.get(studioUrl);
|
||||||
|
|
||||||
|
// leave the comment
|
||||||
|
let commentBox = await findByXpath('//textArea[@name="compose-comment"]');
|
||||||
|
await commentBox.sendKeys(studioComment);
|
||||||
|
await findByXpath(`//textarea[contains(text(), "${studioComment}")]`);
|
||||||
|
await clickXpath('//button[@class="button compose-post"]');
|
||||||
|
|
||||||
|
// reload the page
|
||||||
|
await driver.sleep(5000);
|
||||||
|
await driver.get(studioUrl);
|
||||||
|
|
||||||
|
// find the comment
|
||||||
|
let commentXpath = `//div[@class="comment-bubble"]/span/span[contains(text(), "${buildNumber}")]`;
|
||||||
|
let postedComment = await findByXpath(commentXpath);
|
||||||
|
let commentVisible = await postedComment.isDisplayed();
|
||||||
|
await expect(commentVisible).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('leave comment on a profile', async () => {
|
|
||||||
await signIn(username1, password, driver);
|
|
||||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
|
||||||
await driver.get(profileUrl);
|
|
||||||
|
|
||||||
// leave the comment
|
|
||||||
let commentXpath = await '//form[@id="main-post-form"]/div/textArea';
|
|
||||||
let commentArea = await findByXpath(commentXpath);
|
|
||||||
await commentArea.sendKeys(profileComment);
|
|
||||||
await clickXpath('//div[@class="button small"]/a[contains(text(), "Post")]');
|
|
||||||
|
|
||||||
// reload page
|
|
||||||
await driver.get(profileUrl);
|
|
||||||
|
|
||||||
// find the comment
|
|
||||||
let newComment = await findByXpath(`//div[@class="comment "]/div/div[contains(text(), "${buildNumber}")]`);
|
|
||||||
let commentVisible = await newComment.isDisplayed();
|
|
||||||
await expect(commentVisible).toBe(true);
|
|
||||||
|
|
||||||
// return to homepage to sign out with www
|
|
||||||
await driver.get(rootUrl);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('leave comment on studio', async () => {
|
|
||||||
await signIn(username1, password, driver);
|
|
||||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
|
||||||
await driver.get(studioUrl);
|
|
||||||
|
|
||||||
// leave the comment
|
|
||||||
let commentBox = await findByXpath('//textArea[@name="compose-comment"]');
|
|
||||||
await commentBox.sendKeys(studioComment);
|
|
||||||
await findByXpath(`//textarea[contains(text(), "${studioComment}")]`);
|
|
||||||
await clickXpath('//button[@class="button compose-post"]');
|
|
||||||
|
|
||||||
// reload the page
|
|
||||||
await driver.sleep(5000);
|
|
||||||
await driver.get(studioUrl);
|
|
||||||
|
|
||||||
// find the comment
|
|
||||||
let commentXpath = `//div[@class="comment-bubble"]/span/span[contains(text(), "${buildNumber}")]`;
|
|
||||||
let postedComment = await findByXpath(commentXpath);
|
|
||||||
let commentVisible = await postedComment.isDisplayed();
|
|
||||||
await expect(commentVisible).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
// get notifications
|
|
||||||
|
|
||||||
test('get notification badge for comments', async () => {
|
|
||||||
await signIn(username2, password, driver);
|
|
||||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
|
||||||
let messages = await findByXpath('//span[@class = "message-count show"]');
|
|
||||||
let messagesVisible = await messages.isDisplayed();
|
|
||||||
await expect(messagesVisible).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('click notifications for comments', async () => {
|
|
||||||
await signIn(username2, password, driver);
|
|
||||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
|
||||||
await clickXpath('//li[@class="link right messages"]');
|
|
||||||
let messages = await findByXpath('//ul[@class="messages-social-list"]');
|
|
||||||
let messagesVisible = await messages.isDisplayed();
|
|
||||||
await expect(messagesVisible).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('project comment visible', async () => {
|
|
||||||
await signIn(username2, password, driver);
|
|
||||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
|
||||||
await driver.get(rootUrl + '/messages');
|
|
||||||
|
|
||||||
let projectMessageXpath = '//p[@class="emoji-text mod-comment" ' +
|
|
||||||
`and contains(text(), "${projectComment}")]`;
|
|
||||||
let projectMessage = await findByXpath(projectMessageXpath);
|
|
||||||
let projectMessageVisible = await projectMessage.isDisplayed();
|
|
||||||
await expect(projectMessageVisible).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('profile comment visible', async () => {
|
|
||||||
await signIn(username2, password, driver);
|
|
||||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
|
||||||
await driver.get(rootUrl + '/messages');
|
|
||||||
|
|
||||||
let profileMessageXpath = '//p[@class="emoji-text mod-comment" ' +
|
|
||||||
`and contains(text(), "${profileComment}")]`;
|
|
||||||
let profileMessage = await findByXpath(profileMessageXpath);
|
|
||||||
let profileMessageVisible = await profileMessage.isDisplayed();
|
|
||||||
await expect(profileMessageVisible).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
// studio comments do not send a notification
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue