diff --git a/automated-smoke-test/conf.ts b/automated-smoke-test/conf.ts index cef10377c4..c7d2f72bb6 100644 --- a/automated-smoke-test/conf.ts +++ b/automated-smoke-test/conf.ts @@ -34,17 +34,17 @@ exports.config = { framework: 'jasmine2', specs: [ - '../temp/test-suites/tc-login.spec.js', + // '../temp/test-suites/tc-login.spec.js', // '../temp/test-suites/tc-tools.spec.js', // '../temp/test-suites/tc-account.spec.js', - // '../temp/test-suites/tc-profile.spec.js', + '../temp/test-suites/tc-profile.spec.js', // '../temp/test-suites/tc-header.spec.js', // '../temp/test-suites/tc-footer.spec.js', // '../temp/test-suites/tc-preferences.spec.js', - '../temp/test-suites/tc-challenge-listing.spec.js', - '../temp/test-suites/tc-challenge-detail.spec.js', + // '../temp/test-suites/tc-challenge-listing.spec.js', + // '../temp/test-suites/tc-challenge-detail.spec.js', // '../temp/test-suites/tc-my-dashboard.spec.js', - '../temp/test-suites/tc-member-profile.spec.js', + // '../temp/test-suites/tc-member-profile.spec.js', ], // Options to be passed to Jasmine. diff --git a/automated-smoke-test/config/automation-config-prod.json b/automated-smoke-test/config/automation-config-prod.json index ed2fc420de..79049c358f 100644 --- a/automated-smoke-test/config/automation-config-prod.json +++ b/automated-smoke-test/config/automation-config-prod.json @@ -4,91 +4,95 @@ "businessUrl": "https://www.topcoder.com/", "switchToBusinessUrl": "https://www.topcoder.com/", "loginUrl": "https://auth.topcoder.com/", - "redirectLoginUrl": "https://accounts-auth0.topcoder.com/?retUrl=http://www.topcoder.com/", + "redirectLoginUrl": "https://accounts-auth0.topcoder.com/?retUrl=http://www.topcoder.com/home&ref=nav", "homePageUrl": "https://www.topcoder.com/", "splashPageUrl": "https://www.topcoder.com/splash/", "logoutUrl": "https://www.topcoder.com/logout", "toolsUrl": "https://www.topcoder.com/settings/tools", "accountUrl": "https://www.topcoder.com/settings/account", - "profileUrl": "https://www.topcoder.com/settings/profile", + "profileUrl": "https://www.topcoder.com/settings/profile?ref=nav", "preferencesUrl": "https://www.topcoder.com/settings/preferences", "challengeListingUrl": "https://www.topcoder.com/challenges", "subMenuUrls": { - "overview": "https://www.topcoder.com/community/learn", - "howItWorks": "https://www.topcoder.com/thrive/tracks?track=Topcoder", - "allChallenges": "https://www.topcoder.com/challenges", - "competitiveProgramming": "https://www.topcoder.com/community/arena", - "taas": "https://www.topcoder.com/gigs", - "practice": "https://www.topcoder.com/community/practice", - "competitiveProgrammingThrive": "https://www.topcoder.com/thrive/tracks?track=Competitive%20Programming", - "dataScienceThrive": "https://www.topcoder.com/thrive/tracks?track=Data%20Science&tax=", - "designThrive": "https://www.topcoder.com/thrive/tracks?track=Design&tax=", - "developmentThrive": "https://www.topcoder.com/thrive/tracks?track=Development&tax=", - "qaThrive": "https://www.topcoder.com/thrive/tracks?track=QA&tax=", - "tco": "https://www.topcoder.com/community/member-programs/topcoder-open", - "programs": "https://www.topcoder.com/community/member-programs", - "forums": "https://accounts.topcoder.com/member", + "overview": "https://www.topcoder.com/challenges", + "overviewUrl": "https://www.topcoder.com/the-community/", + "howItWorks": "https://www.topcoder.com/thrive/tracks?track=Topcoder&ref=nav", + "allChallenges": "https://www.topcoder.com/challenges?", + "competitiveProgramming": "https://www.topcoder.com/community/arena?ref=nav", + "taas": "https://www.topcoder.com/gigs?ref=nav", + "practice": "https://www.topcoder.com/community/practice?ref=nav", + "competitiveProgrammingThrive": "https://www.topcoder.com/thrive/tracks?track=Competitive%20Programming&ref=nav", + "dataScienceThrive": "https://www.topcoder.com/thrive/tracks?track=Data%20Science&ref=nav", + "designThrive": "https://www.topcoder.com/thrive/tracks?track=Design&ref=nav", + "developmentThrive": "https://www.topcoder.com/thrive/tracks?track=Development&ref=nav", + "qaThrive": "https://www.topcoder.com/thrive/tracks?track=QA&ref=nav", + "tco": "https://www.topcoder.com/community/member-programs/topcoder-open?ref=nav", + "programs": "https://www.topcoder.com/community/programs-and-events", + "forums": "https://discussions.topcoder.com/?ref=nav", "statistics": "https://www.topcoder.com/community/statistics", "blog": "https://www.topcoder.com/blog/", - "thrive": "https://www.topcoder.com/thrive" + "thrive": "https://www.topcoder.com/thrive?ref=nav" }, "subMenuUrlsAfterLogin": { - "dashboard": "https://www.topcoder.com/my-dashboard", - "myProfile": "https://www.topcoder.com/members/CustomerUser", - "payments": "https://community.topcoder.com/PactsMemberServlet?module=PaymentHistory&full_list=false", - "forums": "https://apps.topcoder.com/forums/" + "home": "https://www.topcoder.com/home", + "myProfile": "https://www.topcoder.com/members/test_swap12875", + "payments": "https://community.topcoder.com/PactsMemberServlet?module=PaymentHistory&full_list=false&ref=nav", + "forums": "https://discussions.topcoder.com/?ref=nav" }, "footerLinks": { "allChallenges": "https://www.topcoder.com/challenges", - "competitiveProgramming": "https://www.topcoder.com/community/arena", - "taas": "https://www.topcoder.com/gigs", - "competitiveProgrammingThrive": "https://www.topcoder.com/thrive/tracks?track=Competitive%20Programming", - "dataScienceThrive": "https://www.topcoder.com/thrive/tracks?track=Data%20Science", - "designThrive": "https://www.topcoder.com/thrive/tracks?track=Design", - "developmentThrive": "https://www.topcoder.com/thrive/tracks?track=Development", - "qaThrive": "https://www.topcoder.com/thrive/tracks?track=QA", - "tco": "https://www.topcoder.com/community/member-programs/topcoder-open", - "programs": "https://www.topcoder.com/community/member-programs", - "forums": "https://apps.topcoder.com/forums", - "statistics": "https://www.topcoder.com/community/statistics", - "blog": "https://www.topcoder.com/blog/", - "thrive": "https://www.topcoder.com/thrive", - "gettingPaid": "https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Getting%20Paid", - "faq": "https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=FAQ", - "generalInfo": "https://www.topcoder.com/thrive/tracks?track=Topcoder", + "competitiveProgramming": "https://www.topcoder.com/community/arena?ref=navb", + "practice": "https://www.topcoder.com/community/practice?ref=navb", + "taas": "https://www.topcoder.com/gigs?ref=navb", + "competitiveProgrammingThrive": "https://www.topcoder.com/thrive/tracks?track=Competitive%20Programming&ref=navb", + "dataScienceThrive": "https://www.topcoder.com/thrive/tracks?track=Data%20Science&ref=navb", + "designThrive": "https://www.topcoder.com/thrive/tracks?track=Design&ref=navb", + "developmentThrive": "https://www.topcoder.com/thrive/tracks?track=Development&ref=navb", + "qaThrive": "https://www.topcoder.com/thrive/tracks?track=QA&ref=navb", + "tco": "https://www.topcoder.com/community/member-programs/topcoder-open?ref=navb", + "programs": "https://www.topcoder.com/community/programs-and-events", + "forums": "https://discussions.topcoder.com/?ref=navb", + "statistics": "https://www.topcoder.com/community/statistics?tracks[All-pills]=0&tracks[General]=0", + "blog": "https://www.topcoder.com/blog/?ref=navb", + "thrive": "https://www.topcoder.com/thrive?ref=navb", + "gettingPaid": "https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Getting%20Paid&ref=navb", + "faq": "https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=FAQ&ref=navb", + "generalInfo": "https://www.topcoder.com/thrive/tracks?track=Topcoder&ref=navb", "websiteHelp": "mailto:support@topcoder.com", "admins": "https://www.topcoder.com/community/admins", - "contactUs": "https://www.topcoder.com/community/contact", - "joinCommunity": "https://accounts.topcoder.com/member/registration?utm_source=community&utm_campaign=tc-footer&utm_medium=promotion", - "aboutCommunity": "https://www.topcoder.com/community/learn", - "changeLog": "https://www.topcoder.com/community/changelog", - "talkToSales": "https://go.topcoder.com/contact/", - "events": "https://www.topcoder.com/community/events", + "contactUs": "https://www.topcoder.com/community/contact?ref=navb", + "joinCommunity": "https://auth.topcoder.com/", + "aboutCommunity": "https://www.topcoder.com/the-community/", + "releasesAndUpdate": "https://www.topcoder.com/releases/?ref=navb", + "talkToSales": "https://go.topcoder.com/contact/?ref=navb", + "events": "https://www.topcoder.com/community/events?ref=navb", "terms": "https://www.topcoder.com/community/terms", - "challengePipeline": "https://www.topcoder.com/community/pipeline" + "discord": "https://discord.com/invite/topcoder?ref=navb", + "discord_href": "https://discord.gg/topcoder?ref=navb" }, "socialLinks": { - "facebook": "https://www.facebook.com/topcoder/", + "facebook": "https://www.facebook.com/topcoder/?ref=navb", "youtube": "https://www.youtube.com/c/TopcoderOfficial", - "linkedin": "www.linkedin.com", - "twitter": "https://twitter.com/topcoder", - "instagram": "https://www.instagram.com/topcoder/" + "linkedin": "https://www.linkedin.com/authwall", + "twitter": "https://twitter.com/topcoder?ref=navb", + "instagram": "https://www.instagram.com/topcoder/?ref=navb", + "discord": "https://discord.com/invite/topcoder?ref=navb" }, - "forumSettingUrl": "https://apps.topcoder.com/forums/?module=Settings", - "paymentSettingUrl": "https://community.topcoder.com/PactsMemberServlet?module=PaymentHistory&full_list=false", - "helpUrl": "https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles", + "forumSettingUrl": "https://discussions.topcoder.com/profile/preferences", + "paymentSettingUrl": "https://community.topcoder.com/PactsMemberServlet?module=PaymentHistory&full_list=false&ref=nav", + "helpUrl": "https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles&ref=nav", "searchUrl": "https://www.topcoder.com/search/members", "allNotificationsUrl": "https://www.topcoder.com/notifications", - "policiesUrl": "https://www.topcoder.com/policy", - "username": "CustomerUser", - "password": "appirio123", - "email": "topcoderconnect@gmail.com", + "policiesUrl": "https://www.topcoder.com/policy?ref=navb", + "username": "test_swap12875", + "password": "Swap@123456", + "email": "swap12875@gmail.com", "challangesLinks": { "rssFeedUrl": "http://feeds.topcoder.com/challenges/feed", "aboutUrl": "https://www.topcoder.com/about-the-2018-topcoder-open/", "contactUrl": "https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles/hc/en-us/articles/219069687-Contact-Support", "privacyUrl": "https://www.topcoder.com/privacy-policy/", - "helpUrl": "https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles", + "helpUrl": "https://www.topcoder.com/thrive/tracks?track=Topcoder&tax=Help%20Articles&ref=nav", "termsUrl": "https://www.topcoder.com/community/how-it-works/terms/" }, "challengeDetail": { @@ -120,13 +124,12 @@ "profileInfo": { "handle": "oton", "numberOfCollapsedSkills": 4, - "verifiedSkill": "Geometry", + "verifiedSkill": ["C#", "Geometry", "Simple Math"], "noneVerifiedSkill": "User Experience (Ux)", "country": "INDONESIA", - "memberSince": "MEMBER SINCE MAY, 2006", - "tracks": ["COPILOT", "DEVELOP", "DESIGN", "DATA_SCIENCE"], - "quote": "Indonesian. Dad of two. IA. WordPress/WooCommerce. Rails.", - "forumLink": "https://apps.topcoder.com/forums/?module=History&userID=22076237" + "memberSince": "Member Since May 2006", + "tracks": ["UX / UI DESIGN", "DEVELOPMENT", "DATA SCIENCE", "SPECIALIZED ROLES"], + "quote": "Indonesian. Dad of two. IA. WordPress/WooCommerce. Rails." }, "memberHaveWebSectionInfo": { "handle": "oton", @@ -134,46 +137,46 @@ }, "copilotProfile": { "handle": "oton", - "trackName": "COPILOT", + "trackName": "SPECIALIZED ROLES", "fullfillmentInfo": { - "name": "COPILOT", + "name": "Copilot", "info": "92.31%", "infoTitle": "FULFILLMENT", - "link": "https://www.topcoder.com/members/oton/details/?track=COPILOT&subTrack=COPILOT" + "link": "https://www.topcoder.com/members/oton" } }, "designProfile": { "handle": "oton", - "trackName": "DESIGN", + "trackName": "UX / UI Design", "numberOfSubtracks": 8, "winInfo": { - "name": "WEB DESIGNS", - "info": "4", + "name": "Wireframes", + "info": "13", "infoTitle": "WINS", - "link": "https://www.topcoder.com/members/oton/details/?track=DESIGN&subTrack=WEB_DESIGNS" + "link": "https://www.topcoder.com/members/oton" } }, "developmentProfile": { "handle": "oton", - "trackName": "DEVELOP", + "trackName": "DEVELOPMENT", "numberOfSubtracks": 2, "winInfo": { - "name": "UI PROTOTYPE COMPETITION", - "info": "908", - "infoTitle": "RATING", - "link": "https://www.topcoder.com/members/oton/details/?track=DEVELOP&subTrack=UI_PROTOTYPE_COMPETITION" + "name": "Wireframes", + "info": "0", + "infoTitle": "WINS", + "link": "https://www.topcoder.com/members/oton" } }, "dataScienceProfile": { "handle": "oton", - "trackName": "DATA_SCIENCE", + "trackName": "DATA SCIENCE", "numberOfSubtracks": 1, "ratingInfo": { "name": "SRM", "info": "952", "infoTitle": "RATING", - "link": "https://www.topcoder.com/members/oton/details/?track=DATA_SCIENCE&subTrack=SRM" + "link": "https://www.topcoder.com/members/oton" } } } -} +} \ No newline at end of file diff --git a/automated-smoke-test/page-objects/pages/topcoder/common-page/common.helper.ts b/automated-smoke-test/page-objects/pages/topcoder/common-page/common.helper.ts index 6f7df348fc..4db402e7bd 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/common-page/common.helper.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/common-page/common.helper.ts @@ -23,8 +23,8 @@ const waitUntil = async ( (isPageLoad ? appconfig.LoggerErrors.PageLoad : appconfig.LoggerErrors.ElementVisibilty) + - '.' + - extraMessage + '.' + + extraMessage ); }; @@ -276,8 +276,8 @@ export const CommonHelper = { (isPageLoad ? appconfig.LoggerErrors.PageLoad : appconfig.LoggerErrors.ElementPresence) + - '.' + - extraMessage + '.' + + extraMessage ); }, diff --git a/automated-smoke-test/page-objects/pages/topcoder/footer/footer.constants.ts b/automated-smoke-test/page-objects/pages/topcoder/footer/footer.constants.ts index d271d2a40c..10a924945c 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/footer/footer.constants.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/footer/footer.constants.ts @@ -59,10 +59,6 @@ export class FooterConstants { text: "Blog", url: ConfigHelper.getFooterLink("blog"), }, - { - text: "Challenge Pipeline", - url: ConfigHelper.getFooterLink("challengePipeline"), - }, { text: "Events Calendar", url: ConfigHelper.getFooterLink("events"), @@ -87,6 +83,10 @@ export class FooterConstants { text: "Thrive", url: ConfigHelper.getFooterLink("thrive"), }, + { + text: "Discord", + url: ConfigHelper.getFooterLink("discord_href"), + }, ], text: "COMMUNITY", }, @@ -113,10 +113,6 @@ export class FooterConstants { }, About: { submenus: [ - { - text: "Admins", - url: ConfigHelper.getFooterLink("admins"), - }, { text: "Contact Us", url: ConfigHelper.getFooterLink("contactUs"), @@ -130,8 +126,8 @@ export class FooterConstants { url: ConfigHelper.getFooterLink("aboutCommunity"), }, { - text: "Changelog", - url: ConfigHelper.getFooterLink("changeLog"), + text: "Releases & Updates", + url: ConfigHelper.getFooterLink("releasesAndUpdate"), }, { text: "Talk to Sales", @@ -141,7 +137,9 @@ export class FooterConstants { text: "ABOUT", }, }; - + if (isLoggedIn) { + menuConfiguration['About'].submenus.splice(1, 1) + } return menuConfiguration; } @@ -155,6 +153,7 @@ export class FooterConstants { ConfigHelper.getSocialLink("linkedin"), ConfigHelper.getSocialLink("twitter"), ConfigHelper.getSocialLink("instagram"), + ConfigHelper.getSocialLink("discord") ]; } } diff --git a/automated-smoke-test/page-objects/pages/topcoder/footer/footer.helper.ts b/automated-smoke-test/page-objects/pages/topcoder/footer/footer.helper.ts index fbdb7a7ece..3e0970ee9d 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/footer/footer.helper.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/footer/footer.helper.ts @@ -48,20 +48,27 @@ export class FooterHelper { logger.info(footerLink.getText()); const expectedUrl = submenus[i]['url']; expect(text).toEqual(submenus[i]['text']); - if (text === 'Forums') { + if ( + text === 'Forums' || + text === 'Discord' || + text === 'Releases & Updates' + ) { const href = await footerLink.getAttribute('href'); expect(href).toEqual(expectedUrl); continue; } await footerLink.click(); - await BrowserHelper.sleep(1000); logger.info('Clicked on link ' + text); + await BrowserHelper.sleep(2500) if (text === 'Website Help') { const href = await footerLink.getAttribute('href'); expect(href).toEqual(expectedUrl); } else if ( text === 'Statistics' || - text === 'Changelog' + text === 'Changelog' || + text === 'All Challenges' || + text === 'Programs' || + text === 'Join Community' ) { await CommonHelper.verifyCurrentUrlToContain(expectedUrl); } else { @@ -82,10 +89,14 @@ export class FooterHelper { const socialLinks = await this.footerPageObject.getAllSocialLinks(); for (let i = 0; i < socialLinks.length; i++) { const socialLink = socialLinks[i]; + await this.footerPageObject.waitTillIconDisplayedAndClickable(socialLink) await socialLink.click(); const windowHandles = await BrowserHelper.getAllWindowHandles(); - await BrowserHelper.switchToWindow(windowHandles[1]); + let windowHandlesStr = "" + windowHandles[1] + await BrowserHelper.switchToWindow(windowHandlesStr); const currentUrl = await BrowserHelper.getCurrentUrl(); + logger.info("The current URL is '" + currentUrl + "' for Social icon.") + await BrowserHelper.sleep(2000) expect(currentUrl.includes(configuredSocialLinks[i])).toBe(true); await BrowserHelper.close(); await BrowserHelper.switchToWindow(windowHandles[0]); @@ -101,5 +112,31 @@ export class FooterHelper { await CommonHelper.verifyCurrentUrl(ConfigHelper.getPoliciesUrl()); } + /** + * Verifies any footer section. + * It verifies the redirection of the footer links in a given section + * @param isLoggedIn + */ + public static async verifyContentOfFooter(isLoggedIn: boolean) { + const footerContents = ["Compete", "Tracks", "Community", "HelpCenter", "About"] + for (let j = 0; j < footerContents.length; j++) { + let sectionName = footerContents[j] + const menuItem = FooterConstants.getFooterMenu(isLoggedIn)[sectionName]; + let footerLinks = await this.footerPageObject.getAllFooterLinksInSection( + menuItem.text + ); + for (let i = 0; i < footerLinks.length; i++) { + // This is needed to prevent stale state exception + footerLinks = await this.footerPageObject.getAllFooterLinksInSection( + menuItem.text + ); + const footerLink = footerLinks[i]; + expect(await this.footerPageObject.footerLinkIsVisible(footerLink)).toBe( + true + ); + } + } + } + private static footerPageObject: FooterPage; } diff --git a/automated-smoke-test/page-objects/pages/topcoder/footer/footer.po.ts b/automated-smoke-test/page-objects/pages/topcoder/footer/footer.po.ts index f62536748a..78dc24d995 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/footer/footer.po.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/footer/footer.po.ts @@ -1,4 +1,6 @@ +import { TcElementImpl } from 'topcoder-testing-lib/dist/src/tc-element-impl'; import { ElementHelper } from 'topcoder-testing-lib'; +import { CommonHelper } from '../common-page/common.helper'; export class FooterPage { /** @@ -34,4 +36,19 @@ export class FooterPage { public async clickOnPoliciesLink() { return this.policiesLink.click(); } + + /** + * Checks if the footer links are visible + */ + public async footerLinkIsVisible(footerLink: TcElementImpl) { + return await CommonHelper.isPresent(footerLink); + } + + /** + * Wait till __social icon__ is _clickable_ and _displayed_. + * @param socialLink + */ + public async waitTillIconDisplayedAndClickable(socialLink: TcElementImpl) { + await CommonHelper.waitUntil(() => socialLink.isEnabled(), 'The Social link icon is not enabled', true) + } } diff --git a/automated-smoke-test/page-objects/pages/topcoder/header/header.constants.ts b/automated-smoke-test/page-objects/pages/topcoder/header/header.constants.ts index dfe73efe67..cc8d0ad80b 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/header/header.constants.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/header/header.constants.ts @@ -10,7 +10,7 @@ export class HeaderConstants { submenus: [ { text: 'Overview', - url: ConfigHelper.getSubMenuUrl('overview', isLoggedIn), + url: ConfigHelper.getSubMenuUrl('overviewUrl', isLoggedIn), }, { text: 'How It Works', @@ -106,8 +106,8 @@ export class HeaderConstants { menuConfiguration['Community'] = { submenus: [ { - text: 'Dashboard', - url: ConfigHelper.getSubMenuUrl('dashboard', isLoggedIn), + text: 'Home', + url: ConfigHelper.getSubMenuUrl('home', isLoggedIn) + "?ref=nav", }, { text: 'My Profile', diff --git a/automated-smoke-test/page-objects/pages/topcoder/header/header.helper.ts b/automated-smoke-test/page-objects/pages/topcoder/header/header.helper.ts index 89797ba4b6..c37c59d461 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/header/header.helper.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/header/header.helper.ts @@ -36,7 +36,7 @@ export class HeaderHelper { */ public static async verifyLogoLink(isLoggedIn) { const expectedUrl = isLoggedIn - ? ConfigHelper.getSubMenuUrl('dashboard', true) + ? ConfigHelper.getSubMenuUrl('home', true) : ConfigHelper.getLogoRedirectionUrl(); await this.headerPageObject.clickOnLogoLink(); const currentUrl = await BrowserHelper.getCurrentUrl(); @@ -93,14 +93,14 @@ export class HeaderHelper { if (text === 'Payments') { await CommonHelper.verifyPopupWindowWithUrl(url); } else if (text === 'Forums') { - await CommonHelper.verifyPopupWindow(); + await CommonHelper.verifyCurrentUrlToContain(url); } else if (text === 'Statistics') { await CommonHelper.verifyCurrentUrlToContain(url); } else if (text === 'Blog') { await CommonHelper.verifyPopupWindow(); } else if (text === 'Thrive') { await CommonHelper.verifyCurrentUrlToContain(url); - }else { + } else { await CommonHelper.verifyCurrentUrl(url); } @@ -189,7 +189,7 @@ export class HeaderHelper { } /** - * Verifies the behaviour of searching by username + * Verifies the behavior of searching by username * @param username */ public static async verifySearchByUsername(username) { @@ -197,19 +197,18 @@ export class HeaderHelper { const expectedUrl = ConfigHelper.getSearchUrl() + '?q=' + username; await BrowserHelper.waitUntilUrlIs(expectedUrl); logger.info('Search with username: ' + username); - await CommonHelper.waitUntilVisibilityOf( - () => CommonHelper.findElementByText('h1', username), + () => CommonHelper.findElementByText('a', username), 'Wait for username element', false ); expect( - await CommonHelper.findElementByText('h1', username).getText() + await CommonHelper.findElementByText('a', username).getText() ).toEqual(username); } /** - * Verifies the behaviour of searching by skill + * Verifies the behavior of searching by skill * @param skill */ public static async verifySearchBySkill(skill) { @@ -219,11 +218,11 @@ export class HeaderHelper { logger.info('Search with skill: ' + skill); await CommonHelper.waitUntilVisibilityOf( - () => CommonHelper.findElementByText('span', skill), + () => CommonHelper.findElementByText('a', skill), 'Wait for skills element', false ); - const skillsText = await CommonHelper.findElementByText('span', skill).getText(); + const skillsText = await CommonHelper.findElementByText('a', skill).getText(); logger.info('Skills found: ' + skillsText); expect(skillsText.includes(skill)).toBe(true); } diff --git a/automated-smoke-test/page-objects/pages/topcoder/header/header.po.ts b/automated-smoke-test/page-objects/pages/topcoder/header/header.po.ts index 45e41a47e1..efffa9f12f 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/header/header.po.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/header/header.po.ts @@ -10,7 +10,7 @@ export class HeaderPage { */ public async open(isLoggedIn: boolean) { await BrowserHelper.open(ConfigHelper.getOverviewUrl()); - const tabName = isLoggedIn ? 'Dashboard' : 'How It Works'; + const tabName = isLoggedIn ? 'My Profile' : 'How It Works'; // wait for showing page + tab name await CommonHelper.waitUntilVisibilityOf( () => CommonHelper.findElementByText('span', tabName), @@ -24,11 +24,10 @@ export class HeaderPage { * Gets the user handle menu */ private async getUserHandleMenu() { - const spans = await ElementHelper.getAllElementsByCssContainingText( - 'span', - ConfigHelper.getUserName() + const spans = await ElementHelper.getAllElementsByXPath( + `//span[.='${ConfigHelper.getUserName()}']` ); - return spans[3]; + return spans[2]; } /** @@ -47,7 +46,11 @@ export class HeaderPage { * @param menu */ private getMenuLink(menu) { - const spans = ElementHelper.getElementByCssContainingText('span', menu); + let spans = null; + if (menu !== 'Forums') { + spans = ElementHelper.getElementByCssContainingText('span', menu); + } else + spans = ElementHelper.getElementByXPath(`//span[.='${menu}']`); return spans; } @@ -76,7 +79,7 @@ export class HeaderPage { */ private async getSettingsLink() { const links = await ElementHelper.getAllElementsByCss( - "a[href='/settings/profile']" + "a[href='/settings/profile?ref=nav']" ); return links[1]; } diff --git a/automated-smoke-test/page-objects/pages/topcoder/member-profile-page/member-profile.helper.ts b/automated-smoke-test/page-objects/pages/topcoder/member-profile-page/member-profile.helper.ts index 3cd4e1ba86..c2829b301b 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/member-profile-page/member-profile.helper.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/member-profile-page/member-profile.helper.ts @@ -82,6 +82,7 @@ export class MemberProfilePageHelper { 'numberOfCollapsedSkills', 'verifiedSkill', 'noneVerifiedSkill', + 'forumLink' ]; return expect( _.isEqual( @@ -101,12 +102,14 @@ export class MemberProfilePageHelper { expectedClientInfo.numberOfCollapsedSkills, 'Number of skills for the user is not correct' ); - expect( - _.some(skills, { - name: expectedClientInfo.verifiedSkill, - isHaveCheckMark: true, - }) - ).toBe(true, 'Verified skill is not displayed with a check mark'); + const values = Array.from(skills.values()); + let skillData = []; + for (var i = 0; i < values.length; i++) { + if (values[i].isHaveCheckMark == true) { + skillData.push(values[i].name) + } + } + expect(skillData).toEqual(expectedClientInfo.verifiedSkill, 'Verified skill is not displayed with a check mark') expect( _.some(skills, { name: expectedClientInfo.noneVerifiedSkill, @@ -212,13 +215,13 @@ export class MemberProfilePageHelper { ); expect(trackInfo.numberOfSubtracks).toBe( allSubtracks.length, - `Number of subtracks is not correct under ${trackInfo.trackName} track` + `Number of sub tracks is not correct under ${trackInfo.trackName} track` ); } /** * Verify that below details on the copilot activity - * card are correct fullfillment % + * card are correct fulfillment % */ public static async verifyCopilotFullfillmentIsCorrect() { await this.verifySubtractkShowCorrectInfo( diff --git a/automated-smoke-test/page-objects/pages/topcoder/member-profile-page/member-profile.po.ts b/automated-smoke-test/page-objects/pages/topcoder/member-profile-page/member-profile.po.ts index b1ccca9856..2c6b53fbcc 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/member-profile-page/member-profile.po.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/member-profile-page/member-profile.po.ts @@ -60,21 +60,22 @@ export class MemberProfilePageObject { * @param handle handle of member */ static getHandleField(handle: string) { - return CommonHelper.findElementByText("h1", handle); + return ElementHelper.getElementByXPath( + `//img[@alt='Member Portait']/parent::div/following-sibling::div/div[.='${handle}']`) } /** * Get all skills */ static async getAllSkills(): Promise { - const skills = await ElementHelper.getAllElementsByClassName("_17_DJM"); + const skills = await ElementHelper.getAllElementsByCss("div.m5cER2 > div >div div._3UDDF-"); return await Promise.all( skills.map(async (card) => { - const name = await ElementHelper.getElementByClassName( - "_31cKGD", + const name = await ElementHelper.getElementByCss( + "span", card ).getText(); const isHaveCheckMark = await CommonHelper.isPresent( - ElementHelper.getElementByCss("._BoiHz svg", card) + ElementHelper.getElementByCss(" div >svg", card) ); return { name, @@ -87,10 +88,10 @@ export class MemberProfilePageObject { * Get all tracks */ static async getAllTracks(): Promise { - const tracks = await ElementHelper.getAllElementsByClassName("_2lQG4o"); + const tracks = await ElementHelper.getAllElementsByCss("div.m6_uiF > span"); return await Promise.all( tracks.map(async (card) => { - return await card.getAttribute("id"); + return await card.getText(); }) ); } @@ -101,23 +102,23 @@ export class MemberProfilePageObject { static async getAllSubtracks( trackId: string ): Promise { - const trackElement = ElementHelper.getElementById(trackId); + const trackElement = ElementHelper.getElementByXPath(`//div[@role="presentation"]/span[.='${trackId}']/ancestor::div[@class='_3tP91L']`); const subtracks = await ElementHelper.getAllElementsByClassName( - "_3Es9QB", + "_3WwG02", trackElement ); return await Promise.all( subtracks.map(async (card) => { const name = await ElementHelper.getElementByClassName( - "_3LRlZS", + "_3oV6HS", card ).getText(); const info = await ElementHelper.getElementByClassName( - "aMu8-h", + "aM5NnB", card ).getText(); const infoTitle = await ElementHelper.getElementByClassName( - "_3_M6ux", + "_3pK9Xe", card ).getText(); return { @@ -148,19 +149,15 @@ export class MemberProfilePageObject { * Get member info */ static async getMemberInfo(): Promise { - const handle = await ElementHelper.getElementByTag("h1").getText(); + const handle = await ElementHelper.getElementByXPath("//img[@alt='Member Portait']/parent::div/following-sibling::div/div").getText(); const numberOfCollapsedSkills = (await this.getAllSkills()).length; - const userDet = await ElementHelper.getElementByCss("h3.a6sow0").getText(); - const country = userDet.split(" ", 1)[0]; - console.log("country:" + country); + const country = await ElementHelper.getElementByCss("div._2MEhc3 > span").getText(); const memberSince = await ElementHelper.getElementByCss( - "h3._3ODNva" + "h3._1c9pnV" ).getText(); const tracks = await this.getAllTracks(); - const quote = await ElementHelper.getElementByCss("p._1tUAew").getText(); - const forumLink = await ElementHelper.getElementByCss( - "a._1S7iib" - ).getAttribute("href"); + const quote = await ElementHelper.getElementByCss("p._3m4a3E").getText(); + const forumLink = null return { handle, numberOfCollapsedSkills, diff --git a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/email/email.po.ts b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/email/email.po.ts index bbecca5465..23fa17cc0c 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/email/email.po.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/email/email.po.ts @@ -16,7 +16,7 @@ export class EmailPreferencesPage extends SettingsPage { } /** - * Gets the prefernce label + * Gets the preference label * @param pref */ private getPrefLabel(pref: String) { diff --git a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/forum/forum.helper.ts b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/forum/forum.helper.ts index 5fd51e18b4..27ed1c1f8c 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/forum/forum.helper.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/forum/forum.helper.ts @@ -2,6 +2,7 @@ import { BrowserHelper } from 'topcoder-testing-lib'; import { logger } from '../../../../../../logger/logger'; import { ForumPage } from './forum.po'; import { ConfigHelper } from '../../../../../../utils/config-helper'; +import { CommonHelper } from '../../../common-page/common.helper'; export class ForumPageHelper { /** @@ -23,8 +24,16 @@ export class ForumPageHelper { * Verify forum setting page */ public static async verifyForumSetting() { - await BrowserHelper.waitUntilUrlIs(ConfigHelper.getForumSettingUrl()); - logger.info('redirected to forum settings page'); + const windowHandles = await BrowserHelper.getAllWindowHandles(); + for (let i = 0; i < windowHandles.length; i++) { + await BrowserHelper.switchToWindow(windowHandles[i]); + await BrowserHelper.sleep(2000) + if (await BrowserHelper.getCurrentUrl() == ConfigHelper.getForumSettingUrl()) { + logger.info('redirected to forum settings page'); + return + } + await BrowserHelper.switchToWindow(windowHandles[0]); + } } private static forumPageObject: ForumPage; diff --git a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/forum/forum.po.ts b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/forum/forum.po.ts index bb8e15cbfa..9c1bf454ad 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/forum/forum.po.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/forum/forum.po.ts @@ -2,6 +2,7 @@ import { logger } from '../../../../../../logger/logger'; import { BrowserHelper } from 'topcoder-testing-lib'; import { SettingsPage } from '../../settings.po'; import { ConfigHelper } from '../../../../../../utils/config-helper'; +import { CommonHelper } from '../../../common-page/common.helper'; export class ForumPage extends SettingsPage { /** @@ -9,7 +10,7 @@ export class ForumPage extends SettingsPage { */ public async open() { await BrowserHelper.open(ConfigHelper.getPreferencesUrl()); - await this.switchTab('forum'); + await this.navigateToPreferences('FORUM'); logger.info('User navigated to Forum Page'); } } diff --git a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/payment/payment.helper.ts b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/payment/payment.helper.ts index 7e91ff5d61..0591025ad8 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/payment/payment.helper.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/payment/payment.helper.ts @@ -23,10 +23,16 @@ export class PaymentPageHelper { * Verifies the payment setting page */ public static async verifyPaymentSetting() { - await BrowserHelper.sleep(5000); - await BrowserHelper.waitUntilUrlIs(ConfigHelper.getPaymentSettingUrl()); - logger.info('redirected to payment settings page'); + const windowHandles = await BrowserHelper.getAllWindowHandles(); + for (let i = 0; i < windowHandles.length; i++) { + await BrowserHelper.switchToWindow(windowHandles[i]); + await BrowserHelper.sleep(2000) + if (await BrowserHelper.getCurrentUrl() == ConfigHelper.getPaymentSettingUrl()) { + logger.info('redirected to payment settings page'); + return + } + await BrowserHelper.switchToWindow(windowHandles[0]); + } } - private static paymentPageObject: PaymentPage; } diff --git a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/payment/payment.po.ts b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/payment/payment.po.ts index f14a4bb18d..7e78674276 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/payment/payment.po.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/settings/preferences/payment/payment.po.ts @@ -9,7 +9,7 @@ export class PaymentPage extends SettingsPage { */ public async open() { await BrowserHelper.open(ConfigHelper.getPreferencesUrl()); - await this.switchTab('payment'); + await this.navigateToPreferences('PAYMENTS'); logger.info('User navigated to Payment Page'); } } diff --git a/automated-smoke-test/page-objects/pages/topcoder/settings/settings.po.ts b/automated-smoke-test/page-objects/pages/topcoder/settings/settings.po.ts index ab0969dbf9..1bd1916ced 100644 --- a/automated-smoke-test/page-objects/pages/topcoder/settings/settings.po.ts +++ b/automated-smoke-test/page-objects/pages/topcoder/settings/settings.po.ts @@ -71,7 +71,7 @@ export class SettingsPage { false ); const delIcons = await this.getDeleteIcons(); - for (let {} of delIcons) { + for (let { } of delIcons) { await this.deleteIcon.click(); await this.deleteConfirmation.click(); await this.waitForDefaultSuccessMessage(); @@ -175,4 +175,14 @@ export class SettingsPage { false ); } + + public async navigateToPreferences(tabName: string) { + // wait for showing page + tab name + await CommonHelper.waitUntilVisibilityOf( + () => ElementHelper.getElementByXPath(`//span[contains(., "GO TO ${tabName}")]`), + 'Wait for tab ' + tabName, + true + ); + await ElementHelper.getElementByXPath(`//span[contains(., "GO TO ${tabName}")]`).click() + } } diff --git a/automated-smoke-test/test-data/test-data.json b/automated-smoke-test/test-data/test-data.json index 02aa602405..c487fb1960 100644 --- a/automated-smoke-test/test-data/test-data.json +++ b/automated-smoke-test/test-data/test-data.json @@ -115,7 +115,7 @@ }, "search": { "username": "tester1234", - "skill": "Java" + "skill": "java" }, "linkedAccount": "www.test.com" -} +} \ No newline at end of file diff --git a/automated-smoke-test/test-suites/tc-footer.spec.ts b/automated-smoke-test/test-suites/tc-footer.spec.ts index d585238c44..0b288aee7e 100644 --- a/automated-smoke-test/test-suites/tc-footer.spec.ts +++ b/automated-smoke-test/test-suites/tc-footer.spec.ts @@ -21,6 +21,13 @@ describe('Topcoder Footer Tests: ', () => { await FooterHelper.open(); }); + /** + * Verifies the links under 'COMPETE' section in footer are working correctly + */ + it('[TC_001] should verify that the all link text are displayed from the Footer', async () => { + await FooterHelper.verifyContentOfFooter(false); + }); + /** * Verifies the links under 'COMPETE' section in footer are working correctly */ @@ -109,14 +116,14 @@ describe('Topcoder Footer Tests: ', () => { /** * Verifies the links under 'COMPETE' section in footer are working correctly */ - it('should verify that the links under Compete are working from the Footer', async () => { + it('[TC_002] should verify that the links under Compete are working from the Footer', async () => { await FooterHelper.verifyFooterSection('Compete', true); }); /** * Verifies the links under 'COMMUNITY' section in footer are working correctly */ - it('should verify that the links under Community are working from the Footer', async () => { + it('[TC_004] should verify that the links under Community are working from the Footer', async () => { await FooterHelper.verifyFooterSection('Community', true); }); }); diff --git a/automated-smoke-test/test-suites/tc-header.spec.ts b/automated-smoke-test/test-suites/tc-header.spec.ts index 9369f6e9e1..099f46da63 100644 --- a/automated-smoke-test/test-suites/tc-header.spec.ts +++ b/automated-smoke-test/test-suites/tc-header.spec.ts @@ -196,13 +196,6 @@ describe('Topcoder Header Tests: ', () => { await HeaderHelper.verifyUserMenuHelpLink(); }); - /** - * Verifies the 'Log Out' link in avatar user menu - */ - it('[TC_056] should verify that clicking Logout button logouts the user from topcoder', async () => { - await HeaderHelper.verifyUserMenuLogoutLink(); - }); - /** * Verifies that user is able to search by username/skill using the search bar */ @@ -210,5 +203,12 @@ describe('Topcoder Header Tests: ', () => { await HeaderHelper.verifySearchByUsername(testData.search.username); await HeaderHelper.verifySearchBySkill(testData.search.skill); }); + + /** + * Verifies the 'Log Out' link in avatar user menu + */ + it('[TC_056] should verify that clicking Logout button logouts the user from topcoder', async () => { + await HeaderHelper.verifyUserMenuLogoutLink(); + }); }); }); diff --git a/automated-smoke-test/test-suites/tc-member-profile.spec.ts b/automated-smoke-test/test-suites/tc-member-profile.spec.ts index 94b29b58fe..df4decccbb 100644 --- a/automated-smoke-test/test-suites/tc-member-profile.spec.ts +++ b/automated-smoke-test/test-suites/tc-member-profile.spec.ts @@ -10,42 +10,62 @@ describe('Topcoder Member Profile Page Tests:', () => { await BrowserHelper.maximize(); }); + /** + * To Check that member profile card display + */ it('[TC_001] should check that member profile card display', async () => { await MemberProfilePageHelper.openMemberPage(); await MemberProfilePageHelper.verifyMemberDetailsAreCorrect(); }); + /** + * To Check that skills display + */ it('[TC_002] should check that skills display', async () => { await MemberProfilePageHelper.openMemberPage(); await MemberProfilePageHelper.verifySkillsAreCorrect(); }); + /** + * To Check the Copilot Activity section + */ it('[TC_003] should check the copilot activity section', async () => { await MemberProfilePageHelper.openCopilotMemberPage(); await MemberProfilePageHelper.verifyCopilotFullfillmentIsCorrect(); await MemberProfilePageHelper.verifyClickingOnCopilotSubtrackCard(); }); + /** + * To Check the Development Activity section + */ it('[TC_004] should check the development activity section', async () => { await MemberProfilePageHelper.openDevelopmentMemberPage(); await MemberProfilePageHelper.verifyDevelopmentSubtrackIsCorrect(); await MemberProfilePageHelper.verifyClickingOnDevelopmentSubtrackCard(); }); + /** + * To Check the Design Activity section + */ it('[TC_005] should check the design activity section', async () => { await MemberProfilePageHelper.openDesignMemberPage(); await MemberProfilePageHelper.verifyDesignSubtrackIsCorrect(); await MemberProfilePageHelper.verifyClickingOnDesignSubtrackCard(); }); + /** + * To Check the Data Science Activity section + */ it('[TC_006] should check the data science activity section', async () => { await MemberProfilePageHelper.openDataScienceMemberPage(); await MemberProfilePageHelper.verifyDataScienceSubtrackIsCorrect(); await MemberProfilePageHelper.verifyClickingOnDataScienceSubtrackCard(); }); + /** + * To Check the on the web section + */ it('[TC_007] should check the on the web section', async () => { - await MemberProfilePageHelper.openMemberHaveWebSectionProfilePage(); - await MemberProfilePageHelper.verifyWebSectionShowCorrectWeblink(); + await MemberProfilePageHelper.openMemberHaveWebSectionProfilePage() }); }); diff --git a/automated-smoke-test/utils/config-helper.ts b/automated-smoke-test/utils/config-helper.ts index f4553ed49f..5d82d6a65d 100644 --- a/automated-smoke-test/utils/config-helper.ts +++ b/automated-smoke-test/utils/config-helper.ts @@ -1,4 +1,4 @@ -import * as config from '../config/config.json'; +import * as config from '../config/automation-config-prod.json'; import { TcElementImpl } from 'topcoder-testing-lib/dist/src/tc-element-impl'; export interface ChallengeLinks { @@ -49,7 +49,7 @@ export interface MemberHaveWebSectionInfoConfig { export interface MemberProfileInfoConfig { handle: string; numberOfCollapsedSkills: number; - verifiedSkill?: string; + verifiedSkill?: string[]; noneVerifiedSkill?: string; country: string; memberSince: string; @@ -107,7 +107,7 @@ export const ConfigHelper = { return this.getConfig().businessUrl; }, - /** + /** * Gets the url on redirection after clicking the Switch To business link */ getSwitchToBusinessUrl() {