1
+ import { expect , test } from '@playwright/test' ;
2
+
3
+ test . describe ( 'Community page, overview tab, keep in touch section' , ( ) => {
4
+ test . beforeEach ( async ( { page } ) => {
5
+ await page . goto ( '/community/' ) ;
6
+ await page . waitForSelector ( 'button.ch2-btn.ch2-btn-primary' ) ;
7
+ await page . click ( 'button.ch2-btn.ch2-btn-primary' ) ;
8
+ } ) ;
9
+
10
+ test ( 'Slack button opens the related page' , async ( { page, context } ) => {
11
+ const slackButton = page . getByRole ( 'link' , { name : 'Slack' } ) . first ( ) ;
12
+ await expect ( slackButton ) . toBeVisible ( ) ;
13
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
14
+ await slackButton . click ( ) ;
15
+ const newPage = await newPagePromise ;
16
+ await newPage . waitForLoadState ( ) ;
17
+ await expect ( newPage . url ( ) ) . toContain ( 'https://slack-chats.kotlinlang.org/' ) ;
18
+ } ) ;
19
+
20
+ test ( 'X (Twitter) button opens the related page' , async ( { page, context } ) => {
21
+ const twitterButton = page . getByRole ( 'link' , { name : 'X' } ) . first ( ) ;
22
+ await expect ( twitterButton ) . toBeVisible ( ) ;
23
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
24
+ await twitterButton . click ( ) ;
25
+ const newPage = await newPagePromise ;
26
+ await newPage . waitForLoadState ( ) ;
27
+ await expect ( newPage . url ( ) ) . toContain ( 'https://x.com/kotlin' ) ;
28
+ } ) ;
29
+
30
+ test ( 'Kotlin Blog button opens the related page' , async ( { page, context } ) => {
31
+ const blogButton = page . getByRole ( 'link' , { name : 'Kotlin Blog' } ) . first ( ) ;
32
+ await expect ( blogButton ) . toBeVisible ( ) ;
33
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
34
+ await blogButton . click ( ) ;
35
+ const newPage = await newPagePromise ;
36
+ await newPage . waitForLoadState ( ) ;
37
+ await expect ( newPage . url ( ) ) . toContain ( 'https://blog.jetbrains.com/kotlin/' ) ;
38
+ } ) ;
39
+
40
+ test ( 'Reddit button opens the related page' , async ( { page, context } ) => {
41
+ const redditButton = page . getByRole ( 'link' , { name : 'Reddit' } ) . first ( ) ;
42
+ await expect ( redditButton ) . toBeVisible ( ) ;
43
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
44
+ await redditButton . click ( ) ;
45
+ const newPage = await newPagePromise ;
46
+ await newPage . waitForLoadState ( ) ;
47
+ await expect ( newPage . url ( ) ) . toContain ( 'https://www.reddit.com/r/Kotlin/' ) ;
48
+ } ) ;
49
+
50
+ test ( 'StackOverflow button opens the related page' , async ( { page, context } ) => {
51
+ const stackOverflowButton = page . getByRole ( 'link' , { name : 'StackOverflow' } ) ;
52
+ await expect ( stackOverflowButton ) . toBeVisible ( ) ;
53
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
54
+ await stackOverflowButton . click ( ) ;
55
+ const newPage = await newPagePromise ;
56
+ await newPage . waitForLoadState ( ) ;
57
+ await expect ( newPage . url ( ) ) . toContain ( 'https://stackoverflow.com/questions/tagged/kotlin' ) ;
58
+ } ) ;
59
+
60
+ // Without click on YouTube button, because of YouTube Cookies page, but it checks that the button contains the right link.
61
+ test ( 'YouTube button opens the related page' , async ( { page } ) => {
62
+ const youtubeButton = page . getByRole ( 'link' , { name : 'YouTube' } ) . first ( ) ;
63
+ await expect ( youtubeButton ) . toBeVisible ( ) ;
64
+ const href = await youtubeButton . getAttribute ( 'href' ) ;
65
+ expect ( href ) . toBe ( 'https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw' )
66
+ } ) ;
67
+
68
+ test ( 'Talking Kotlin button opens the related page' , async ( { page, context } ) => {
69
+ const talkingKotlinButton = page . getByRole ( 'link' , { name : 'Talking Kotlin' } ) ;
70
+ await expect ( talkingKotlinButton ) . toBeVisible ( ) ;
71
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
72
+ await talkingKotlinButton . click ( ) ;
73
+ const newPage = await newPagePromise ;
74
+ await newPage . waitForLoadState ( ) ;
75
+ await expect ( newPage . url ( ) ) . toContain ( 'talkingkotlin.com/' ) ;
76
+ } ) ;
77
+
78
+ // Without click on LinkedIn button, since LinkedIn requires authorization, but it checks that the button contains the right link.
79
+ test ( 'LinkedIn button opens the related page' , async ( { page } ) => {
80
+ const linkedInButton = page . getByRole ( 'link' , { name : 'LinkedIn' } ) ;
81
+ await expect ( linkedInButton ) . toBeVisible ( ) ;
82
+ const href = await linkedInButton . getAttribute ( 'href' ) ;
83
+ expect ( href ) . toBe ( 'https://www.linkedin.com/groups/7417237/profile' ) ;
84
+ } ) ;
85
+
86
+ test ( 'Issue Tracker button opens the related page' , async ( { page, context } ) => {
87
+ const issueTrackerButton = page . getByRole ( 'link' , { name : 'Issue Tracker' } ) . first ( ) ;
88
+ await expect ( issueTrackerButton ) . toBeVisible ( ) ;
89
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
90
+ await issueTrackerButton . click ( ) ;
91
+ const newPage = await newPagePromise ;
92
+ await newPage . waitForLoadState ( ) ;
93
+ await expect ( newPage . url ( ) ) . toContain ( 'https://youtrack.jetbrains.com/issues/kt' ) ;
94
+ } ) ;
95
+ } ) ;
0 commit comments