Skip to content

Commit c3828e5

Browse files
chore: (cy.prompt) fix prompt driver tests during contributor workflows (#32667)
* chore: (cy.prompt) fix prompt driver tests during contributor workflows * chore: (cy.prompt) fix prompt driver tests during contributor workflows * Update packages/driver/cypress/e2e/commands/prompt/prompt.cy.ts * rework test
1 parent 33df568 commit c3828e5

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

packages/driver/cypress.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export const baseConfig: Cypress.ConfigOptions = {
66
projectId: 'ypt4pf',
77
experimentalMemoryManagement: true,
88
experimentalWebKitSupport: true,
9+
env: {
10+
CI: process.env.CI,
11+
},
912
hosts: {
1013
'foobar.com': '127.0.0.1',
1114
'*.foobar.com': '127.0.0.1',

packages/driver/cypress/e2e/commands/prompt/prompt.cy.ts

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,31 @@ describe('src/cy/commands/prompt', () => {
33
Cypress.testingType = 'e2e'
44
})
55

6-
it('executes the prompt command', () => {
7-
// TODO: (cy.prompt) We will look into supporting other browsers
8-
// as this is rolled out. We will add error messages for other browsers
9-
// and add tests if necessary
10-
if (Cypress.isBrowser('webkit') || Cypress.isBrowser('firefox')) {
11-
return
6+
// TODO: (cy.prompt) We will look into supporting other browsers
7+
// as this is rolled out. We will add error messages for other browsers
8+
// and add tests if necessary
9+
if (!Cypress.isBrowser('webkit') && !Cypress.isBrowser('firefox')) {
10+
const contributorPr = Cypress.env('CI') && !Cypress.env('RECORD_KEY') && Cypress.config('isTextTerminal')
11+
12+
if (contributorPr) {
13+
it('executes the prompt command - contributor PR', (done) => {
14+
cy.on('fail', (err) => {
15+
expect(err.message).to.include('Record key not provided')
16+
17+
done()
18+
})
19+
20+
cy.visit('http://www.foobar.com:3500/fixtures/prompt.html')
21+
cy.prompt(['Click the "click me" button'])
22+
})
23+
} else {
24+
it('executes the prompt command - normal PR', () => {
25+
cy.visit('http://www.foobar.com:3500/fixtures/prompt.html')
26+
cy.prompt(['Click the "click me" button'])
27+
cy.get('#log').should('contain', 'clicked')
28+
})
1229
}
13-
14-
cy.visit('http://www.foobar.com:3500/fixtures/prompt.html')
15-
16-
// TODO: add more tests when cy.prompt is built out, but for now this just
17-
// verifies that the command executes without throwing an error
18-
cy.prompt(['Click the "click me" button'])
19-
20-
cy.get('#log').should('contain', 'clicked')
21-
})
30+
}
2231

2332
it('fails when testingType is component', (done) => {
2433
cy.on('fail', (err) => {

0 commit comments

Comments
 (0)