-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1058 from adobe/testShowContainers
Show containers even when renderDecisions is false
- Loading branch information
Showing
6 changed files
with
203 additions
and
2 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
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,47 @@ | ||
/* | ||
Copyright 2023 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
import { t, Selector } from "testcafe"; | ||
import createFixture from "../../helpers/createFixture"; | ||
import { | ||
compose, | ||
orgMainConfigMain, | ||
debugEnabled | ||
} from "../../helpers/constants/configParts"; | ||
import { TEST_PAGE as TEST_PAGE_URL } from "../../helpers/constants/url"; | ||
import createAlloyProxy from "../../helpers/createAlloyProxy"; | ||
import addHtmlToHeader from "../../helpers/dom/addHtmlToHeader"; | ||
|
||
const config = compose(orgMainConfigMain, debugEnabled); | ||
|
||
createFixture({ | ||
title: | ||
"C14299419: Prehiding style is removed when no personalization payload is returned", | ||
url: `${TEST_PAGE_URL}?test=C14299419` | ||
}); | ||
|
||
test.meta({ | ||
ID: "C14299419", | ||
SEVERITY: "P0", | ||
TEST_RUN: "Regression" | ||
}); | ||
|
||
test("Test C14299419: Prehiding style is removed when no personalization payload is returned", async () => { | ||
await addHtmlToHeader( | ||
`<style id="alloy-prehiding">body { visibility: hidden; }</style` | ||
); | ||
|
||
const alloy = createAlloyProxy(); | ||
await alloy.configure(config); | ||
await alloy.sendEvent({ renderDecisions: true }); | ||
|
||
await t.expect(Selector("#alloy-prehiding").exists).notOk(); | ||
}); |
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,46 @@ | ||
/* | ||
Copyright 2023 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
import { t, Selector } from "testcafe"; | ||
import createFixture from "../../helpers/createFixture"; | ||
import { | ||
compose, | ||
orgMainConfigMain, | ||
debugEnabled | ||
} from "../../helpers/constants/configParts"; | ||
import { TEST_PAGE as TEST_PAGE_URL } from "../../helpers/constants/url"; | ||
import createAlloyProxy from "../../helpers/createAlloyProxy"; | ||
import addHtmlToHeader from "../../helpers/dom/addHtmlToHeader"; | ||
|
||
const config = compose(orgMainConfigMain, debugEnabled); | ||
|
||
createFixture({ | ||
title: "C14299420: Prehiding style is removed when renderDecisions is false", | ||
url: `${TEST_PAGE_URL}?test=C14299420` | ||
}); | ||
|
||
test.meta({ | ||
ID: "C14299420", | ||
SEVERITY: "P0", | ||
TEST_RUN: "Regression" | ||
}); | ||
|
||
test("Test C14299420: Prehiding style is removed when renderDecisions is false", async () => { | ||
await addHtmlToHeader( | ||
`<style id="alloy-prehiding">body { visibility: hidden; }</style` | ||
); | ||
|
||
const alloy = createAlloyProxy(); | ||
await alloy.configure(config); | ||
await alloy.sendEvent({ renderDecisions: false }); | ||
|
||
await t.expect(Selector("#alloy-prehiding").exists).notOk(); | ||
}); |
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,59 @@ | ||
/* | ||
Copyright 2023 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
import { t, Selector } from "testcafe"; | ||
import createFixture from "../../helpers/createFixture"; | ||
import { | ||
compose, | ||
orgMainConfigMain, | ||
debugEnabled | ||
} from "../../helpers/constants/configParts"; | ||
import { TEST_PAGE as TEST_PAGE_URL } from "../../helpers/constants/url"; | ||
import createAlloyProxy from "../../helpers/createAlloyProxy"; | ||
import addHtmlToHeader from "../../helpers/dom/addHtmlToHeader"; | ||
import addHtmlToBody from "../../helpers/dom/addHtmlToBody"; | ||
import createConsoleLogger from "../../helpers/consoleLogger"; | ||
|
||
const config = compose(orgMainConfigMain, debugEnabled); | ||
|
||
createFixture({ | ||
title: | ||
"C14299421: Prehiding style is removed when there is a problem rendering", | ||
url: `${TEST_PAGE_URL}?test=C14299421` | ||
}); | ||
|
||
test.meta({ | ||
ID: "C14299421", | ||
SEVERITY: "P0", | ||
TEST_RUN: "Regression" | ||
}); | ||
|
||
test("Test C14299421: Prehiding style is removed when there is a problem rendering", async () => { | ||
const logger = await createConsoleLogger(); | ||
|
||
// remove the heading so there is an error when trying to apply the personalization which is attached to the h1 | ||
await t.eval(() => { | ||
window.document.body.children[0].remove(); | ||
}); | ||
await addHtmlToBody(`<div>Test C14299421 with missing heading</div>`); | ||
await addHtmlToHeader( | ||
`<style id="alloy-prehiding">body { visibility: hidden; }</style` | ||
); | ||
|
||
const alloy = createAlloyProxy(); | ||
await alloy.configure(config); | ||
await alloy.sendEvent({ renderDecisions: true }); | ||
|
||
await t.expect(Selector("#alloy-prehiding").exists).notOk(); | ||
// wait for the rendering to timeout | ||
await new Promise(resolve => setTimeout(resolve, 5000)); | ||
await logger.warn.expectMessageMatching(/Failed to execute action/); | ||
}); |
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,47 @@ | ||
/* | ||
Copyright 2023 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
import { t, Selector } from "testcafe"; | ||
import createFixture from "../../helpers/createFixture"; | ||
import { | ||
compose, | ||
orgMainConfigMain, | ||
debugEnabled | ||
} from "../../helpers/constants/configParts"; | ||
import { TEST_PAGE as TEST_PAGE_URL } from "../../helpers/constants/url"; | ||
import createAlloyProxy from "../../helpers/createAlloyProxy"; | ||
import addHtmlToHeader from "../../helpers/dom/addHtmlToHeader"; | ||
|
||
const config = compose(orgMainConfigMain, debugEnabled); | ||
|
||
createFixture({ | ||
title: | ||
"C14299422: Prehiding style is removed when there is a personalization payload", | ||
url: `${TEST_PAGE_URL}?test=C14299421` | ||
}); | ||
|
||
test.meta({ | ||
ID: "C14299422", | ||
SEVERITY: "P0", | ||
TEST_RUN: "Regression" | ||
}); | ||
|
||
test("Test C14299422: Prehiding style is removed when there is a personalization payload", async () => { | ||
await addHtmlToHeader( | ||
`<style id="alloy-prehiding">body { visibility: hidden; }</style` | ||
); | ||
|
||
const alloy = createAlloyProxy(); | ||
await alloy.configure(config); | ||
await alloy.sendEvent({ renderDecisions: true }); | ||
|
||
await t.expect(Selector("#alloy-prehiding").exists).notOk(); | ||
}); |