Merge pull request #6126 from BryceLTaylor/add-comment-tests

Add comment and notification integration tests
This commit is contained in:
Bryce Taylor 2021-10-04 09:47:34 -04:00 committed by GitHub
commit a83c3e5571
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 79 additions and 29 deletions

46
package-lock.json generated
View file

@ -2975,12 +2975,12 @@
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"version": "0.21.4",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
"dev": true,
"requires": {
"follow-redirects": "^1.10.0"
"follow-redirects": "^1.14.0"
}
},
"babel-cli": {
@ -4990,13 +4990,13 @@
}
},
"chromedriver": {
"version": "92.0.1",
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-92.0.1.tgz",
"integrity": "sha512-LptlDVCs1GgyFNVbRoHzzy948JDVzTgGiVPXjNj385qXKQP3hjAVBIgyvb/Hco0xSEW8fjwJfsm1eQRmu6t4pQ==",
"version": "94.0.0",
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-94.0.0.tgz",
"integrity": "sha512-x4hK7R7iOyAhdLHJEcOyGBW/oa2kno6AqpHVLd+n3G7c2Vk9XcAXMz84XhNItqykJvTc6E3z/JRIT1eHYH//Eg==",
"dev": true,
"requires": {
"@testim/chrome-version": "^1.0.7",
"axios": "^0.21.1",
"axios": "^0.21.2",
"del": "^6.0.0",
"extract-zip": "^2.0.1",
"https-proxy-agent": "^5.0.0",
@ -6598,9 +6598,9 @@
}
},
"glob": {
"version": "7.1.7",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
"integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
"integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
@ -6644,9 +6644,9 @@
"dev": true
},
"is-glob": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
"integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"requires": {
"is-extglob": "^2.1.1"
@ -8110,9 +8110,9 @@
"dev": true
},
"is-glob": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz",
"integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"requires": {
"is-extglob": "^2.1.1"
@ -8255,9 +8255,9 @@
"dev": true
},
"fastq": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.12.0.tgz",
"integrity": "sha512-VNX0QkHK3RsXVKr9KrlUv/FoTa0NdbYoHHl7uXHv2rzyHSlxjdNAKug2twd9luJxpcyNeAgf5iPPMutJO67Dfg==",
"version": "1.13.0",
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz",
"integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==",
"dev": true,
"requires": {
"reusify": "^1.0.4"
@ -8865,9 +8865,9 @@
}
},
"follow-redirects": {
"version": "1.14.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.2.tgz",
"integrity": "sha512-yLR6WaE2lbF0x4K2qE2p9PEXKLDjUjnR/xmjS3wHAYxtlsI9MLLBJUZirAHKzUZDGLxje7w/cXR49WOUo4rbsA==",
"version": "1.14.4",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz",
"integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==",
"dev": true
},
"font-atlas": {

View file

@ -76,7 +76,7 @@
"babel-preset-es2015": "6.22.0",
"babel-preset-react": "6.22.0",
"bowser": "1.9.4",
"chromedriver": "92.0.1",
"chromedriver": "94.0.0",
"classnames": "2.2.5",
"cookie": "0.4.1",
"copy-webpack-plugin": "4.6.0",

View file

@ -29,10 +29,14 @@ let profileUrl = `${rootUrl}/users/${username2}`;
let studioId = process.env.COMMENT_STUDIO_ID || 10005646;
let studioUrl = `${rootUrl}/studios/${studioId}/comments`;
// setup comments to leave
let date = new Date();
let dateString = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ` +
`${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
let buildNumber = process.env.CIRCLE_BUILD_NUM || dateString;
let projectComment = buildNumber + ' project';
let profileComment = buildNumber + ' profile';
let studioComment = buildNumber + ' studio';
if (remote) {
jest.setTimeout(60000);
@ -62,8 +66,8 @@ describe('comment tests', async () => {
// leave the comment
let commentBox = await findByXpath('//textArea[@name="compose-comment"]');
await commentBox.sendKeys(buildNumber);
await findByXpath(`//textarea[contains(text(), "${buildNumber}")]`);
await commentBox.sendKeys(projectComment);
await findByXpath(`//textarea[contains(text(), "${projectComment}")]`);
await clickXpath('//button[@class="button compose-post"]');
// reload the page
@ -85,7 +89,7 @@ describe('comment tests', async () => {
// leave the comment
let commentXpath = await '//form[@id="main-post-form"]/div/textArea';
let commentArea = await findByXpath(commentXpath);
await commentArea.sendKeys(buildNumber);
await commentArea.sendKeys(profileComment);
await clickXpath('//div[@class="button small"]/a[contains(text(), "Post")]');
// reload page
@ -107,8 +111,8 @@ describe('comment tests', async () => {
// leave the comment
let commentBox = await findByXpath('//textArea[@name="compose-comment"]');
await commentBox.sendKeys(buildNumber);
await findByXpath(`//textarea[contains(text(), "${buildNumber}")]`);
await commentBox.sendKeys(studioComment);
await findByXpath(`//textarea[contains(text(), "${studioComment}")]`);
await clickXpath('//button[@class="button compose-post"]');
// reload the page
@ -121,4 +125,50 @@ describe('comment tests', async () => {
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
});