-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.e2e.js
More file actions
42 lines (36 loc) · 1.09 KB
/
index.e2e.js
File metadata and controls
42 lines (36 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import puppeteer from 'puppeteer'
import { config, PageObjectModel } from '../helpers/e2e'
const APPLY_SELECTOR = '[type="applicationButton"]'
const SUBMIT_APPLICATION_SELECTOR = 'form button'
class LandingPage extends PageObjectModel {
async checkApplyButtonExists() {
const buttonText = await this.getTextBySelector({
selector: APPLY_SELECTOR,
})
await expect(buttonText).toBeTruthy()
}
}
describe('LandingPage', () => {
let browser
let context
let page
let landingPage
const filenamePrefix = 'landing'
beforeAll(async () => {
browser = await puppeteer.launch(config.puppeteer)
context = await browser.createIncognitoBrowserContext()
page = await context.newPage()
console.log('Host: ', config.host)
landingPage = new LandingPage(page)
})
afterAll(async () => {
await browser.close()
})
it('renders the apply button', async () => {
await landingPage.goToUrl({ url: config.host })
await landingPage.checkApplyButtonExists()
await landingPage.saveScreenshot({
filename: `${filenamePrefix}_00_landing_page_button`,
})
})
})