1
+ import { test , expect } from '@playwright/test' ;
2
+
3
+ test . describe ( 'Teach page' , ( ) => {
4
+ test . beforeEach ( async ( { page } ) => {
5
+ await page . goto ( '/education/' ) ;
6
+ await page . waitForSelector ( 'button.ch2-btn.ch2-btn-primary' ) ;
7
+ await page . click ( 'button.ch2-btn.ch2-btn-primary' ) ;
8
+ } ) ;
9
+
10
+ test ( 'Why teach Kotlin button in navbar opens the related page' , async ( { page } ) => {
11
+ const whyTeachKotlinButton = page . getByRole ( 'link' , { name : 'Why Teach Kotlin' } ) . first ( ) ;
12
+ await expect ( whyTeachKotlinButton ) . toBeVisible ( ) ;
13
+ await whyTeachKotlinButton . click ( ) ;
14
+ await expect ( page . url ( ) ) . toContain ( '/education/why-teach-kotlin.html' ) ;
15
+ } ) ;
16
+
17
+ test ( 'List of courses button in navbar opens the related page' , async ( { page } ) => {
18
+ const listOfCoursesButton = page . getByRole ( 'link' , { name : 'List of Courses' } ) ;
19
+ await expect ( listOfCoursesButton ) . toBeVisible ( ) ;
20
+ await listOfCoursesButton . click ( ) ;
21
+ await expect ( page . url ( ) ) . toContain ( '/education/courses.html' ) ;
22
+ } ) ;
23
+
24
+ test ( 'Join Educators button in navbar opens the related page' , async ( { page, context } ) => {
25
+ const joinEducatorsButton = page . getByRole ( 'link' , { name : 'Join Educators' } ) . first ( ) ;
26
+ await expect ( joinEducatorsButton ) . toBeVisible ( ) ;
27
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
28
+ await joinEducatorsButton . click ( ) ;
29
+ const newPage = await newPagePromise ;
30
+ await newPage . waitForLoadState ( ) ;
31
+ await expect ( newPage . url ( ) ) . toContain ( 'https://surveys.jetbrains.com/s3/kotlin-slack-signup-educators' ) ;
32
+ } ) ;
33
+
34
+ test ( 'Download all materials button opens the related page' , async ( { page, context } ) => {
35
+ const downloadMaterialsButton = page . getByRole ( 'link' , { name : 'Download all materials' } ) ;
36
+ await expect ( downloadMaterialsButton ) . toBeVisible ( ) ;
37
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
38
+ await downloadMaterialsButton . click ( ) ;
39
+ const newPage = await newPagePromise ;
40
+ await newPage . waitForLoadState ( ) ;
41
+ await expect ( newPage . url ( ) ) . toContain ( 'https://drive.google.com/drive/folders/1nN3LuyEfmBaSDZpnb4VA9kDuLakmVXH1' ) ;
42
+ } ) ;
43
+
44
+ test ( 'Join Educators button in context opens the related page' , async ( { page, context } ) => {
45
+ const joinEducatorsButton = page . getByRole ( 'link' , { name : 'Join Educators' } ) . nth ( 1 ) ;
46
+ await expect ( joinEducatorsButton ) . toBeVisible ( ) ;
47
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
48
+ await joinEducatorsButton . click ( ) ;
49
+ const newPage = await newPagePromise ;
50
+ await newPage . waitForLoadState ( ) ;
51
+ await expect ( newPage . url ( ) ) . toContain ( 'https://surveys.jetbrains.com/s3/kotlin-slack-signup-educators' ) ;
52
+ } ) ;
53
+
54
+ test ( 'Why teach Kotlin button in context opens the related page' , async ( { page } ) => {
55
+ const whyTeachKotlinButton = page . getByRole ( 'link' , { name : 'Why Teach Kotlin' } ) . nth ( 1 ) ;
56
+ await expect ( whyTeachKotlinButton ) . toBeVisible ( ) ;
57
+ await whyTeachKotlinButton . click ( ) ;
58
+ // await page.waitForTimeout(3000);
59
+ await expect ( page . url ( ) ) . toContain ( '/education/why-teach-kotlin.html' ) ;
60
+ } ) ;
61
+
62
+ test ( 'All universities button opens the related page' , async ( { page } ) => {
63
+ const allUniversitiesButton = page . getByRole ( 'link' , { name : 'All universities' } ) ;
64
+ await expect ( allUniversitiesButton ) . toBeVisible ( ) ;
65
+ await allUniversitiesButton . click ( ) ;
66
+ await expect ( page . url ( ) ) . toContain ( '/education/courses.html' ) ;
67
+ } ) ;
68
+
69
+ test ( 'Slack-channel button in context opens the related page' , async ( { page, context } ) => {
70
+ const joinEducatorsButton = page . getByRole ( 'link' , { name : 'Slack-channel' } ) ;
71
+ await expect ( joinEducatorsButton ) . toBeVisible ( ) ;
72
+ const newPagePromise = context . waitForEvent ( 'page' ) ;
73
+ await joinEducatorsButton . click ( ) ;
74
+ const newPage = await newPagePromise ;
75
+ await newPage . waitForLoadState ( ) ;
76
+ await expect ( newPage . url ( ) ) . toContain ( 'https://surveys.jetbrains.com/s3/kotlin-slack-signup-educators' ) ;
77
+ } ) ;
78
+ } ) ;
0 commit comments