@centreon/js-config 23.10.27 → 23.10.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/e2e/commands.ts +1 -23
- package/cypress/e2e/plugins.ts +17 -0
- package/package.json +1 -1
- package/tsconfig/index.json +1 -0
package/cypress/e2e/commands.ts
CHANGED
|
@@ -225,29 +225,7 @@ interface StartContainerProps {
|
|
|
225
225
|
Cypress.Commands.add(
|
|
226
226
|
'startContainer',
|
|
227
227
|
({ name, image, portBindings }: StartContainerProps): Cypress.Chainable => {
|
|
228
|
-
return cy
|
|
229
|
-
.exec('docker image list --format "{{.Repository}}:{{.Tag}}"')
|
|
230
|
-
.then(({ stdout }) => {
|
|
231
|
-
if (
|
|
232
|
-
stdout.match(
|
|
233
|
-
new RegExp(
|
|
234
|
-
`^${image.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}`,
|
|
235
|
-
'm'
|
|
236
|
-
)
|
|
237
|
-
)
|
|
238
|
-
) {
|
|
239
|
-
cy.log(`Local docker image found : ${image}`);
|
|
240
|
-
|
|
241
|
-
return cy.wrap(image);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
cy.log(`Pulling remote docker image : ${image}`);
|
|
245
|
-
|
|
246
|
-
return cy.exec(`docker pull ${image}`).then(() => cy.wrap(image));
|
|
247
|
-
})
|
|
248
|
-
.then((imageName) =>
|
|
249
|
-
cy.task('startContainer', { image: imageName, name, portBindings })
|
|
250
|
-
);
|
|
228
|
+
return cy.task('startContainer', { image, name, portBindings });
|
|
251
229
|
}
|
|
252
230
|
);
|
|
253
231
|
|
package/cypress/e2e/plugins.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
4
4
|
/* eslint-disable no-param-reassign */
|
|
5
5
|
|
|
6
|
+
import { execSync } from 'child_process';
|
|
7
|
+
|
|
6
8
|
import Docker from 'dockerode';
|
|
7
9
|
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
|
|
8
10
|
import webpackPreprocessor from '@cypress/webpack-preprocessor';
|
|
@@ -91,6 +93,21 @@ export default async (on, config): Promise<void> => {
|
|
|
91
93
|
name,
|
|
92
94
|
portBindings = []
|
|
93
95
|
}: StartContainerProps) => {
|
|
96
|
+
const imageList = execSync(
|
|
97
|
+
'docker image list --format "{{.Repository}}:{{.Tag}}"'
|
|
98
|
+
).toString('utf8');
|
|
99
|
+
|
|
100
|
+
if (
|
|
101
|
+
!imageList.match(
|
|
102
|
+
new RegExp(
|
|
103
|
+
`^${image.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')}`,
|
|
104
|
+
'm'
|
|
105
|
+
)
|
|
106
|
+
)
|
|
107
|
+
) {
|
|
108
|
+
execSync(`docker pull ${image}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
94
111
|
const webContainers = await docker.listContainers({
|
|
95
112
|
all: true,
|
|
96
113
|
filters: { name: [name] }
|
package/package.json
CHANGED