Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit 8a168b4

Browse files
authored
Merge pull request #80 from cisagov/cypress/fix-username-test
fix username test
2 parents 4804c37 + 88582ee commit 8a168b4

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

applications/redeye-e2e/src/integration/e2e/redteam/username-on-comments.cy.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@ describe('Username shows on comments when appropriate', () => {
77
const fileName = 'gt.redeye';
88
const normalizeText = (s) => s.replace(/\s/g, '').toLowerCase();
99

10+
function getUserName() {
11+
cy
12+
.get('[cy-test=user]')
13+
.should('be.visible')
14+
.then(($name) => {
15+
user = normalizeText($name.text());
16+
});
17+
}
18+
1019
it('Username should not appear when favoriting a comment', () => {
1120
// Upload campaign and log username
1221
cy.uploadCampaign(camp, fileName);
1322

14-
cy.get('[cy-test=user]').then(($name) => {
15-
user = normalizeText($name.text());
16-
});
23+
getUserName();
1724

1825
// Open campaign, find an existing comment, and mark it as a favorite
1926
cy.selectCampaign(camp);
@@ -34,9 +41,10 @@ describe('Username shows on comments when appropriate', () => {
3441

3542
it('Username should appear when comment is edited', () => {
3643
// Log username and open campaign
37-
cy.get('[cy-test=user]').then(($name) => {
38-
user = normalizeText($name.text());
39-
});
44+
45+
cy.get('[cy-test=appTitle]').should('be.visible');
46+
47+
getUserName();
4048

4149
cy.selectCampaign(camp);
4250

@@ -47,6 +55,7 @@ describe('Username shows on comments when appropriate', () => {
4755

4856
// Verify username shows in the comment box info
4957
cy.wait(500);
58+
5059
cy
5160
.get('[cy-test=comment-group]')
5261
.eq(0)
@@ -58,10 +67,10 @@ describe('Username shows on comments when appropriate', () => {
5867
});
5968

6069
it('Username should appear when new comment is made', () => {
70+
cy.get('[cy-test=appTitle]').should('be.visible');
71+
6172
// Log username and open campaign
62-
cy.get('[cy-test=user]').then(($name) => {
63-
user = normalizeText($name.text());
64-
});
73+
getUserName();
6574

6675
cy.selectCampaign(camp);
6776

0 commit comments

Comments
 (0)