-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(generator): update e2e test script
ref: MANAGER-14323 Signed-off-by: Nicolas Pierre-charles <nicolas.pierre-charles.ext@corp.ovh.com>
- Loading branch information
Nicolas Pierre-charles
committed
May 14, 2024
1 parent
b988655
commit 086437f
Showing
27 changed files
with
247 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
packages/manager/core/generator/app/conditional-templates/default/home.test.ts.hbs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
packages/manager/core/generator/app/conditional-templates/listing/index.tsx.hbs
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
packages/manager/core/generator/app/conditional-templates/listing/listing.test.ts.hbs
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
packages/manager/core/generator/app/conditional-templates/onboarding/onboarding.test.ts.hbs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const isCI = process.env.CI; | ||
|
||
module.exports = { | ||
default: { | ||
paths: ['e2e/features/**/*.feature'], | ||
require: [ | ||
'../../../../playwright-helpers/bdd-setup.ts', | ||
'e2e/**/*.step.ts', | ||
], | ||
requireModule: ['ts-node/register'], | ||
format: [ | ||
'summary', | ||
isCI ? 'progress' : 'progress-bar', | ||
!isCI && ['html', 'e2e/reports/cucumber-results-report.html'], | ||
!isCI && ['usage-json', 'e2e/reports/cucumber-usage-report.json'], | ||
].filter(Boolean), | ||
formatOptions: { snippetInterface: 'async-await' }, | ||
retry: 1, | ||
}, | ||
}; |
12 changes: 12 additions & 0 deletions
12
packages/manager/core/generator/app/templates/e2e/features/error.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Feature: Error | ||
|
||
Scenario Outline: Display an error if request fails | ||
Given The service to fetch the data is <apiOk> | ||
When User navigates to Home page | ||
Then User "<sees>" the list of data | ||
Then User sees <anyError> error | ||
|
||
Examples: | ||
| apiOk | sees | anyError | | ||
| OK | sees | no | | ||
| KO | doesn't see | an | |
7 changes: 7 additions & 0 deletions
7
packages/manager/core/generator/app/templates/e2e/features/onboarding.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: Onboarding page | ||
|
||
Scenario: User wants to find informations related to {{appName}} | ||
Given User has 0 elements in the Listing page | ||
When User navigates to vRack Services Listing page | ||
Then User gets redirected to Onboarding page | ||
Then User sees 3 guides |
53 changes: 53 additions & 0 deletions
53
packages/manager/core/generator/app/templates/e2e/step-definitions/error.step.ts.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Given, When, Then } from '@cucumber/cucumber'; | ||
import { expect } from '@playwright/test'; | ||
import { ICustomWorld } from '../../../../../../playwright-helpers'; | ||
import { ConfigParams, getUrl, setupNetwork } from '../utils'; | ||
import { title } from '../../public/translations/listing/Messages_fr_FR.json'; | ||
import { | ||
manager_error_page_title, | ||
manager_error_page_action_home_label, | ||
manager_error_page_action_reload_label, | ||
} from '../../public/translations/{{appName}}/error/Messages_fr_FR.json'; | ||
|
||
Given('The service to fetch the data is {word}', function( | ||
this: ICustomWorld<ConfigParams>, | ||
apiState: 'OK' | 'KO', | ||
) { | ||
this.handlersConfig.isKo = apiState === 'KO'; | ||
}); | ||
|
||
When('User navigates to Home page', async function( | ||
this: ICustomWorld<ConfigParams>, | ||
) { | ||
await setupNetwork(this); | ||
await this.page.goto(this.testContext.initialUrl || getUrl('root'), { | ||
waitUntil: 'load', | ||
}); | ||
}); | ||
|
||
Then('User {string} the list of data', async function( | ||
this: ICustomWorld<ConfigParams>, | ||
see: 'sees' | "doesn't see", | ||
) { | ||
if (see === 'sees') { | ||
const titleElement = await this.page.getByText(title); | ||
await expect(titleElement).toBeVisible(); | ||
} | ||
}); | ||
|
||
Then('User sees {word} error', async function( | ||
this: ICustomWorld<ConfigParams>, | ||
anyError: 'an' | 'no', | ||
) { | ||
if (anyError === 'an') { | ||
await expect(this.page.getByText(manager_error_page_title)).toBeVisible(); | ||
|
||
await expect( | ||
this.page.getByText(manager_error_page_action_home_label), | ||
).toBeVisible(); | ||
|
||
await expect( | ||
this.page.getByText(manager_error_page_action_reload_label), | ||
).toBeVisible(); | ||
} | ||
}); |
Oops, something went wrong.